summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2020-09-17 16:31:17 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2020-09-17 16:31:17 -0400
commite00f2c1f9310e7423be3a094aa77b1e84b1a0a80 (patch)
tree6baf06361ea4c09538a825e6ca6f57aa351ff85c
parent33d48a40a5625db0967bed780654fce8b1abbd5c (diff)
downloadsdl_android-e00f2c1f9310e7423be3a094aa77b1e84b1a0a80.tar.gz
Run the Reformat Code tool on the project
-rw-r--r--android/sdl_android/bintray.gradle2
-rw-r--r--android/sdl_android/src/androidTest/AndroidManifest.xml18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/AddCommand.json32
-rw-r--r--android/sdl_android/src/androidTest/assets/json/AddSubMenu.json32
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Alert.json116
-rw-r--r--android/sdl_android/src/androidTest/assets/json/AlertManeuver.json58
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ButtonPress.json20
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CancelInteraction.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ChangeRegistration.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CloseApplication.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CreateInteractionChoiceSet.json62
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CreateWindow.json26
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteCommand.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteFile.json22
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteInteractionChoiceSet.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteSubMenu.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteWindow.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DiagnosticMessage.json24
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DialNumber.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/EndAudioPassThru.json12
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetAppServiceData.json20
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetDTCs.json30
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetFile.json22
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json56
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json22
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetSystemCapability.json22
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetVehicleData.json310
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetWayPoints.json23
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ListFiles.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformAudioPassThru.json38
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformInteraction.json86
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PublishAppService.json45
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PutFile.json34
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ReadDID.json34
-rw-r--r--android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json234
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json18
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ResetGlobalProperties.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json54
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SendHapticData.json29
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SendLocation.json32
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetAppIcon.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json128
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetGlobalProperties.json78
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json84
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json34
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Show.json82
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ShowConstantTBT.json80
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Slider.json30
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Speak.json24
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeButton.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json322
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json12
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SystemRequest.json22
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnregisterAppInterface.json12
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeButton.json16
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json322
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json12
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UpdateTurnList.json66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/ManagerUtilityTests.java339
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java720
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/audio/AudioStreamManagerTest.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java1909
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java1733
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java268
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java282
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java643
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java482
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java242
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java374
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java332
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesModeTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java163
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java1152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java274
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java808
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java123
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Config.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java515
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Logger.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/NullValues.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SampleRpc.java137
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlUnitTestContants.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java2162
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java4515
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java777
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/json/rpc/JsonFileReader.java77
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java196
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataControlFrameTypeTests.java294
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameTypeTests.java208
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/MessageTypeTests.java97
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/SessionTypeTests.java224
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java80
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java182
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java238
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java166
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java162
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java170
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java46
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java166
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DynamicUpdateCapabilitiesTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java145
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java136
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java78
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java222
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java170
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java234
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java210
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java228
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java132
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java86
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java84
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java294
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java242
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java288
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java138
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java64
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java158
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java78
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java170
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java96
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java64
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java180
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java326
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java224
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java128
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AmbientLightStatusTests.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java186
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java188
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingIndicatorTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingStateTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioTypeTests.java84
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/BitsPerSampleTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonEventModeTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java470
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonPressModeTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CarModeStatusTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java128
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CompassDirectionTests.java138
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ComponentVolumeStatusTests.java122
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DeviceLevelStatusTests.java126
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DimensionTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayModeTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayTypeTests.java166
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DistanceUnitTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DriverDistractionStateTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ECallConfirmationStatusTests.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ElectronicParkBrakeStatusTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/EmergencyEventTypeTests.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FileTypeTests.java140
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelCutoffStatusTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelTypeTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java138
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiLevelTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiZoneCapabilitiesTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStableStatusTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStatusTests.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java186
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageTypeTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/InteractionModeTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/JingleTests.java128
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardEventTests.java114
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardLayoutTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeypressModeTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java390
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LayoutModeTests.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightNameTests.java460
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightStatusTests.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LockScreenStatusTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageCushionTests.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageModeTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageZoneTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaClockFormatTests.java130
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java134
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java142
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeQualificationStatusTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeStatusTests.java146
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java246
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrerecordedSpeechTests.java112
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrimaryAudioSourceTests.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrndlTests.java218
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java96
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java252
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java370
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SamplingRateTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java304
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SeatMemoryActionTypeTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SoftButtonTypeTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SpeechCapabilitiesTests.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/StaticIconNameTests.java1524
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SupportedSeatTests.java92
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemActionTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java224
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemContextTests.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TPMSTests.java142
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TbtStateTests.java154
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextAlignmentTests.java98
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java312
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TransmissionTypeTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TriggerSourceTests.java102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TurnSignalTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/UpdateModeTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataEventStatusTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataNotificationStatusTests.java112
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataResultCodeTests.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataStatusTests.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java366
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java104
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java119
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingStateTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VrCapabilitiesTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WarningLightStatusTests.java112
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WiperStatusTests.java200
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java28
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java34
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java36
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java42
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateFileTest.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateSubMenuTest.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java915
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java146
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java166
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java168
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java77
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java88
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java182
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java91
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java226
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java146
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java278
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java220
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java246
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java316
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java178
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java241
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java172
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java382
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java142
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java204
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java124
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java180
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java192
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java290
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java326
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java268
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java344
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java221
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java156
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java150
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java310
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubtleAlertTests.java19
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java198
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java176
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java61
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java153
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java347
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java138
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java76
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java54
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java96
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java60
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java86
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java192
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java128
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java1090
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java84
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java156
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java168
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java160
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java454
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java64
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java60
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java84
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java234
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java58
-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/ShowConstantTbtResponseTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java670
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java674
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java188
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java86
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java35
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java43
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java960
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java1688
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java234
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java80
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java218
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java126
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java63
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexBluetoothTransportTest.java127
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java150
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java120
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/WiFiSocketFactoryTest.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java148
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java152
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java40
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java68
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java45
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java268
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java75
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java1000
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java1081
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java227
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java44
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java21
-rw-r--r--android/sdl_android/src/main/AndroidManifest.xml3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java422
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java9
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java57
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java11
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java21
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderListener.java59
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java50
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java29
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java59
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java216
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java51
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java78
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java280
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java655
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java452
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java12
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java12
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java29
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java12
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java12
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/HapticInterfaceManager.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java1411
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java33
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java100
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitorListener.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java6
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java412
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java27
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java96
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java212
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBaseTransport.java39
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java625
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java768
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransportConfig.java474
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java84
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java1573
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java1055
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java7083
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java274
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportConfig.java152
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java37
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java30
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java179
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java38
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java62
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java128
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java202
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java10
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java8
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java285
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java327
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java73
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java49
-rw-r--r--android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml12
-rw-r--r--android/sdl_android/src/main/res/xml/accessory_filter.xml2
-rw-r--r--android/sdl_android/src/test/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/exception/SdlException.java146
-rw-r--r--base/src/main/java/com/smartdevicelink/exception/SdlExceptionCause.java52
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSubManager.java123
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/CompletionListener.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/ISdl.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/StreamingStateMachine.java123
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/audio/BaseAudioStreamManager.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java802
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/FileManagerConfig.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/MultipleFileCompletionListener.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java1124
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java156
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/OnSystemCapabilityListener.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/OnPermissionChangeListener.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/PermissionElement.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/PermissionFilter.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java1228
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java12
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java999
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java43
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java151
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalInterface.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java198
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCell.java56
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java96
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetSelectionListener.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java114
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardCharacterSetCompletionListener.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardListener.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java426
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java612
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java510
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java2344
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java535
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesMode.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java601
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java100
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuSelectionListener.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/RunScore.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/SubCellCommandList.java82
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java163
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java196
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java662
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java220
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java38
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/ISdlServiceListener.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/ISecondaryTransportListener.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java293
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java196
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java395
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java273
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java87
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FrameType.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java44
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/MessageType.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/SessionType.java60
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java240
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCRequest.java71
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java254
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java650
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java302
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java74
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java281
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java74
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java38
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java476
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuver.java58
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java27
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java167
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java152
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java145
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java367
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java174
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java167
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java274
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlData.java174
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java51
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java156
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java127
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java148
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java74
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DTC.java46
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DateTime.java222
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java101
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java89
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java53
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java81
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java102
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java21
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java56
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java123
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DriverDistractionCapability.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DynamicUpdateCapabilities.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java115
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java140
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java34
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java290
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GearStatus.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java67
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java107
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java25
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java200
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java183
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java24
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java112
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java242
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java259
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java28
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java205
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java57
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java202
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlData.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Headers.java118
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Image.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java53
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java44
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightCapabilities.java186
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java142
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlData.java82
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightState.java186
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ListFiles.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java34
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LocationDetails.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MassageCushionFirmness.java111
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MassageModeData.java111
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java490
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java124
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java164
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java284
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java34
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java33
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java263
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java295
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java43
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OasisAddress.java225
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java60
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java39
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnRCStatus.java87
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java238
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java39
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnUpdateSubMenu.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java251
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java162
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java334
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java480
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java56
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java21
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java25
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java82
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java299
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java87
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RGBColor.java27
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java117
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java87
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java60
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java135
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java125
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java797
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java549
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java258
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java104
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java203
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java107
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java111
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java595
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlData.java569
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatMemoryAction.java141
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java110
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java13
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java83
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java162
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java326
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java427
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java107
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java787
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java157
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java90
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SisData.java184
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java273
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java55
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java102
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java129
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java107
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/StationIDNumber.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java104
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java809
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java272
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPoints.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java24
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateColorScheme.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java142
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Turn.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java106
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java80
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java807
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java292
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPoints.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java60
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnList.java70
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java29
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java90
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleType.java81
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java206
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java168
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java531
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java195
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java170
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java24
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowState.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowStatus.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java94
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java190
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java35
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingIndicator.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java114
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioType.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java103
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java97
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java556
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CompassDirection.java134
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ComponentVolumeStatus.java118
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeviceLevelStatus.java118
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayMode.java24
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DistanceUnit.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DriverDistractionState.java62
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ElectronicParkBrakeStatus.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java94
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FileType.java76
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelType.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java21
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStableStatus.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java118
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java161
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageType.java62
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java145
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java39
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java186
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightName.java246
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightStatus.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageCushion.java28
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageMode.java24
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageZone.java34
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java207
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java173
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java88
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PRNDL.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java111
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java43
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java277
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java55
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrimaryAudioSource.java74
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java121
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java249
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java125
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java112
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlInterfaceAvailability.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SeatMemoryActionType.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java110
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java91
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java1813
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SupportedSeat.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemAction.java103
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java787
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java140
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TBTState.java84
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TPMS.java82
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextAlignment.java74
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java132
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java103
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TransmissionType.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java99
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TurnSignal.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java116
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataEventStatus.java92
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java103
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java150
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java84
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingState.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VrCapabilities.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WarningLightStatus.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WayPointType.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java236
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java56
-rw-r--r--base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/security/ISecurityInitializedListener.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java87
-rw-r--r--base/src/main/java/com/smartdevicelink/session/ISdlSessionListener.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/IStreamListener.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/audio/IAudioStreamListener.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/IVideoStreamListener.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java879
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java129
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/DiagLevel.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/ISTListener.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/Mime.java166
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java149
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/SdlTraceBase.java774
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/enums/DetailLevel.java34
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/enums/InterfaceActivityDirection.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/enums/Mod.java36
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/BaseTransportConfig.java33
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/SdlPsm.java484
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/SiphonServer.java736
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/TransportConstants.java501
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/TransportManagerBase.java47
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/enums/TransportType.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/util/BitConverter.java283
-rw-r--r--base/src/main/java/com/smartdevicelink/util/ByteEnumer.java115
-rw-r--r--base/src/main/java/com/smartdevicelink/util/CompareUtils.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/util/CorrelationIdGenerator.java38
-rw-r--r--base/src/main/java/com/smartdevicelink/util/DebugTool.java665
-rw-r--r--base/src/main/java/com/smartdevicelink/util/FileUtls.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/util/IConsole.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/util/NativeLogTool.java196
-rw-r--r--base/src/main/java/com/smartdevicelink/util/SdlDataTypeConverter.java96
-rw-r--r--base/src/main/java/com/smartdevicelink/util/Version.java38
-rw-r--r--javaSE/javaSE/bintray.gradle4
-rw-r--r--javaSE/javaSE/build.gradle4
-rw-r--r--javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java24
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java58
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java55
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java165
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java49
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java78
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java12
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java14
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SoftButtonManager.java4
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java3
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java33
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java14
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java12
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java3
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java4
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java2
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/trace/SdlTrace.java12
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransport.java29
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransportConfig.java4
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportCallback.java5
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportInterface.java4
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java60
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java40
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java8
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLConfig.java24
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java69
-rw-r--r--javaSE/javaSE/src/main/java/org/json/JSON.java2
-rw-r--r--javaSE/javaSE/src/main/java/org/json/JSONArray.java57
-rw-r--r--javaSE/javaSE/src/main/java/org/json/JSONObject.java153
-rw-r--r--javaSE/javaSE/src/main/java/org/json/JSONStringer.java13
-rw-r--r--javaSE/javaSE/src/main/java/org/json/JSONTokener.java17
-rw-r--r--javaSE/javaSE/src/test/java/com/smartdevicelink/test/TestValues.java10
1102 files changed, 78813 insertions, 76629 deletions
diff --git a/android/sdl_android/bintray.gradle b/android/sdl_android/bintray.gradle
index 734b77755..ed286eabd 100644
--- a/android/sdl_android/bintray.gradle
+++ b/android/sdl_android/bintray.gradle
@@ -66,7 +66,7 @@ bintray {
version {
name = libVersion // Change to release version
desc = libDescription
- released = new Date() // Will be the current date & time
+ released = new Date() // Will be the current date & time
vcsTag = libVersion // Should match git tag
}
}
diff --git a/android/sdl_android/src/androidTest/AndroidManifest.xml b/android/sdl_android/src/androidTest/AndroidManifest.xml
index 28ba9d76e..203bf840b 100644
--- a/android/sdl_android/src/androidTest/AndroidManifest.xml
+++ b/android/sdl_android/src/androidTest/AndroidManifest.xml
@@ -1,17 +1,19 @@
-<manifest package="com.smartdevicelink" xmlns:android="http://schemas.android.com/apk/res/android">
- <uses-sdk android:minSdkVersion="16"/>
- <uses-permission android:name="android.permission.BLUETOOTH" />
+<manifest package="com.smartdevicelink"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <uses-sdk android:minSdkVersion="16" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Required to pair Bluetooth devices -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to check if WiFi is enabled -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
+
<instrumentation
- android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.smartdevicelink.test" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-
+ android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.smartdevicelink.test" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
<application android:debuggable="true">
<uses-library android:name="android.test.runner" />
</application>
diff --git a/android/sdl_android/src/androidTest/assets/json/AddCommand.json b/android/sdl_android/src/androidTest/assets/json/AddCommand.json
index c6567e966..c8dfe5267 100644
--- a/android/sdl_android/src/androidTest/assets/json/AddCommand.json
+++ b/android/sdl_android/src/androidTest/assets/json/AddCommand.json
@@ -1,27 +1,27 @@
{
- "request":{
- "name":"AddCommand",
- "correlationID":105,
- "parameters":{
- "cmdID":1098,
- "vrCommands":[
+ "request": {
+ "name": "AddCommand",
+ "correlationID": 105,
+ "parameters": {
+ "cmdID": 1098,
+ "vrCommands": [
"vr1",
"vr2",
"vr3"
],
- "cmdIcon":{
- "value":"cmdImage1.png",
- "imageType":"DYNAMIC"
+ "cmdIcon": {
+ "value": "cmdImage1.png",
+ "imageType": "DYNAMIC"
},
- "menuParams":{
- "parentID":194,
- "position":1,
- "menuName":"My Command"
+ "menuParams": {
+ "parentID": 194,
+ "position": 1,
+ "menuName": "My Command"
}
}
},
- "response":{
- "name":"AddCommandResponse",
- "correlationID":106
+ "response": {
+ "name": "AddCommandResponse",
+ "correlationID": 106
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/AddSubMenu.json b/android/sdl_android/src/androidTest/assets/json/AddSubMenu.json
index 37cc46adb..9b5cbd11b 100644
--- a/android/sdl_android/src/androidTest/assets/json/AddSubMenu.json
+++ b/android/sdl_android/src/androidTest/assets/json/AddSubMenu.json
@@ -1,19 +1,19 @@
{
- "request":{
- "name":"AddSubMenu",
- "correlationID":107,
- "parameters":{
- "menuID":765,
- "position":2,
- "menuName":"Menu Name",
- "menuIcon":{
- "value":"cmdImage1.png",
- "imageType":"DYNAMIC"
- }
+ "request": {
+ "name": "AddSubMenu",
+ "correlationID": 107,
+ "parameters": {
+ "menuID": 765,
+ "position": 2,
+ "menuName": "Menu Name",
+ "menuIcon": {
+ "value": "cmdImage1.png",
+ "imageType": "DYNAMIC"
+ }
}
- },
- "response":{
- "name":"AddSubMenuResponse",
- "correlationID":108
- }
+ },
+ "response": {
+ "name": "AddSubMenuResponse",
+ "correlationID": 108
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/Alert.json b/android/sdl_android/src/androidTest/assets/json/Alert.json
index 75ff2ca50..70b1fcbe9 100644
--- a/android/sdl_android/src/androidTest/assets/json/Alert.json
+++ b/android/sdl_android/src/androidTest/assets/json/Alert.json
@@ -1,60 +1,60 @@
{
- "request":{
- "name":"Alert",
- "correlationID":109,
- "parameters":{
- "playTone":true,
- "duration":500,
- "alertText1":"Line 1",
- "alertText2":"Line 2",
- "alertText3":"Line 3",
- "progressIndicator":true,
- "cancelID":45,
- "alertIcon":{
- "value":"alertIconImage1.png",
- "imageType":"DYNAMIC"
- },
- "ttsChunks":[
- {
- "text":"Phrase 1",
- "type":"TEXT"
- },
- {
- "text":"Phrase 2",
- "type":"TEXT"
- }
- ],
- "softButtons":[
- {
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
- }
- },
- {
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
- }
- }
- ]
- }
- },
- "response":{
- "name":"AlertResponse",
- "correlationID":110,
- "parameters":{
- "tryAgainTime":400
- }
- }
+ "request": {
+ "name": "Alert",
+ "correlationID": 109,
+ "parameters": {
+ "playTone": true,
+ "duration": 500,
+ "alertText1": "Line 1",
+ "alertText2": "Line 2",
+ "alertText3": "Line 3",
+ "progressIndicator": true,
+ "cancelID": 45,
+ "alertIcon": {
+ "value": "alertIconImage1.png",
+ "imageType": "DYNAMIC"
+ },
+ "ttsChunks": [
+ {
+ "text": "Phrase 1",
+ "type": "TEXT"
+ },
+ {
+ "text": "Phrase 2",
+ "type": "TEXT"
+ }
+ ],
+ "softButtons": [
+ {
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
+ }
+ },
+ {
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
+ }
+ }
+ ]
+ }
+ },
+ "response": {
+ "name": "AlertResponse",
+ "correlationID": 110,
+ "parameters": {
+ "tryAgainTime": 400
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/AlertManeuver.json b/android/sdl_android/src/androidTest/assets/json/AlertManeuver.json
index 4099f80b0..1c07ae98b 100644
--- a/android/sdl_android/src/androidTest/assets/json/AlertManeuver.json
+++ b/android/sdl_android/src/androidTest/assets/json/AlertManeuver.json
@@ -1,46 +1,46 @@
{
- "request":{
- "name":"AlertManeuver",
- "correlationID":194,
- "parameters":{
- "ttsChunks":[
+ "request": {
+ "name": "AlertManeuver",
+ "correlationID": 194,
+ "parameters": {
+ "ttsChunks": [
{
- "text":"Phrase 1",
- "type":"TEXT"
+ "text": "Phrase 1",
+ "type": "TEXT"
},
{
- "text":"Phrase 2",
- "type":"TEXT"
+ "text": "Phrase 2",
+ "type": "TEXT"
}
],
- "softButtons":[
+ "softButtons": [
{
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
]
}
},
- "response":{
- "name":"AlertManeuverResponse",
- "correlationID":195
+ "response": {
+ "name": "AlertManeuverResponse",
+ "correlationID": 195
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ButtonPress.json b/android/sdl_android/src/androidTest/assets/json/ButtonPress.json
index e74e857be..dcbecfa08 100644
--- a/android/sdl_android/src/androidTest/assets/json/ButtonPress.json
+++ b/android/sdl_android/src/androidTest/assets/json/ButtonPress.json
@@ -1,15 +1,15 @@
{
- "request":{
- "name":"ButtonPress",
- "correlationID":215,
- "parameters":{
- "buttonName":"OK",
- "buttonPressMode":"LONG",
- "moduleType":"CLIMATE"
+ "request": {
+ "name": "ButtonPress",
+ "correlationID": 215,
+ "parameters": {
+ "buttonName": "OK",
+ "buttonPressMode": "LONG",
+ "moduleType": "CLIMATE"
}
},
- "response":{
- "name":"ButtonPressResponse",
- "correlationID":216
+ "response": {
+ "name": "ButtonPressResponse",
+ "correlationID": 216
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
index dc420ad8f..db7c641f2 100644
--- a/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
@@ -1,14 +1,14 @@
{
- "request":{
- "name":"CancelInteraction",
- "correlationID":554,
- "parameters":{
- "cancelID":6052,
- "functionID":12
+ "request": {
+ "name": "CancelInteraction",
+ "correlationID": 554,
+ "parameters": {
+ "cancelID": 6052,
+ "functionID": 12
}
},
- "response":{
- "name":"CancelInteractionResponse",
- "correlationID":554
+ "response": {
+ "name": "CancelInteractionResponse",
+ "correlationID": 554
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ChangeRegistration.json b/android/sdl_android/src/androidTest/assets/json/ChangeRegistration.json
index ceb93ccd3..fa08a6fea 100644
--- a/android/sdl_android/src/androidTest/assets/json/ChangeRegistration.json
+++ b/android/sdl_android/src/androidTest/assets/json/ChangeRegistration.json
@@ -1,14 +1,14 @@
{
- "request":{
- "name":"ChangeRegistration",
- "correlationID":111,
- "parameters":{
- "language":"ES-ES",
- "hmiDisplayLanguage":"EN-US"
+ "request": {
+ "name": "ChangeRegistration",
+ "correlationID": 111,
+ "parameters": {
+ "language": "ES-ES",
+ "hmiDisplayLanguage": "EN-US"
}
},
- "response":{
- "name":"ChangeRegistrationResponse",
- "correlationID":112
+ "response": {
+ "name": "ChangeRegistrationResponse",
+ "correlationID": 112
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CloseApplication.json b/android/sdl_android/src/androidTest/assets/json/CloseApplication.json
index d58666311..5424240ce 100644
--- a/android/sdl_android/src/androidTest/assets/json/CloseApplication.json
+++ b/android/sdl_android/src/androidTest/assets/json/CloseApplication.json
@@ -1,11 +1,11 @@
{
- "request":{
- "name":"CloseApplication",
- "correlationID":131
+ "request": {
+ "name": "CloseApplication",
+ "correlationID": 131
},
- "response":{
- "name":"CloseApplicationResponse",
- "correlationID":131,
- "parameters":{}
+ "response": {
+ "name": "CloseApplicationResponse",
+ "correlationID": 131,
+ "parameters": {}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CreateInteractionChoiceSet.json b/android/sdl_android/src/androidTest/assets/json/CreateInteractionChoiceSet.json
index 6f01500db..9dbcac3d1 100644
--- a/android/sdl_android/src/androidTest/assets/json/CreateInteractionChoiceSet.json
+++ b/android/sdl_android/src/androidTest/assets/json/CreateInteractionChoiceSet.json
@@ -1,19 +1,19 @@
{
- "request":{
- "name":"CreateInteractionChoiceSet",
- "correlationID":113,
- "parameters":{
- "interactionChoiceSetID":56,
- "choiceSet":[
+ "request": {
+ "name": "CreateInteractionChoiceSet",
+ "correlationID": 113,
+ "parameters": {
+ "interactionChoiceSetID": 56,
+ "choiceSet": [
{
- "secondaryText":"Secondary Text",
- "tertiaryText":"Tertiary Text",
- "secondaryImage":{
- "value":"lessImportantImage.png",
- "imageType":"STATIC"
+ "secondaryText": "Secondary Text",
+ "tertiaryText": "Tertiary Text",
+ "secondaryImage": {
+ "value": "lessImportantImage.png",
+ "imageType": "STATIC"
},
- "menuName":"Menu Name",
- "vrCommands":[
+ "menuName": "Menu Name",
+ "vrCommands": [
"vr1",
"vr2",
"vr3",
@@ -22,21 +22,21 @@
"vr6",
"vr7"
],
- "choiceID":1,
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "choiceID": 1,
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
},
{
- "secondaryText":"Secondary Text 2",
- "tertiaryText":"Tertiary Text 2",
- "secondaryImage":{
- "value":"evenLessImportantImage.png",
- "imageType":"STATIC"
+ "secondaryText": "Secondary Text 2",
+ "tertiaryText": "Tertiary Text 2",
+ "secondaryImage": {
+ "value": "evenLessImportantImage.png",
+ "imageType": "STATIC"
},
- "menuName":"Menu Name 2",
- "vrCommands":[
+ "menuName": "Menu Name 2",
+ "vrCommands": [
"vr1",
"vr2",
"vr3",
@@ -45,17 +45,17 @@
"vr6",
"vr7"
],
- "choiceID":2,
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "choiceID": 2,
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
]
}
},
- "response":{
- "name":"CreateInteractionChoiceSetResponse",
- "correlationID":114
+ "response": {
+ "name": "CreateInteractionChoiceSetResponse",
+ "correlationID": 114
}
} \ 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
index 6322b5250..fc0ac9093 100644
--- a/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
+++ b/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
@@ -1,17 +1,17 @@
{
- "request":{
- "name":"CreateWindow",
- "correlationID":107,
- "parameters":{
- "windowID":765,
- "windowName":"Window Name",
- "type": "MAIN",
- "associatedServiceType":"Service Type",
- "duplicateUpdatesFromWindowID":766
- }
+ "request": {
+ "name": "CreateWindow",
+ "correlationID": 107,
+ "parameters": {
+ "windowID": 765,
+ "windowName": "Window Name",
+ "type": "MAIN",
+ "associatedServiceType": "Service Type",
+ "duplicateUpdatesFromWindowID": 766
+ }
},
- "response":{
- "name":"CreateWindowResponse",
- "correlationID":108
+ "response": {
+ "name": "CreateWindowResponse",
+ "correlationID": 108
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteCommand.json b/android/sdl_android/src/androidTest/assets/json/DeleteCommand.json
index cba061a03..922e58f0b 100644
--- a/android/sdl_android/src/androidTest/assets/json/DeleteCommand.json
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteCommand.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"DeleteCommand",
- "correlationID":115,
- "parameters":{
- "cmdID":34
- }
+ "request": {
+ "name": "DeleteCommand",
+ "correlationID": 115,
+ "parameters": {
+ "cmdID": 34
+ }
},
- "response":{
- "name":"DeleteCommandResponse",
- "correlationID":116
+ "response": {
+ "name": "DeleteCommandResponse",
+ "correlationID": 116
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteFile.json b/android/sdl_android/src/androidTest/assets/json/DeleteFile.json
index ed3ff0cdc..712f505e3 100644
--- a/android/sdl_android/src/androidTest/assets/json/DeleteFile.json
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteFile.json
@@ -1,16 +1,16 @@
{
- "request":{
- "name":"DeleteFile",
- "correlationID":117,
- "parameters":{
- "syncFileName":"fileName.file"
- }
+ "request": {
+ "name": "DeleteFile",
+ "correlationID": 117,
+ "parameters": {
+ "syncFileName": "fileName.file"
+ }
},
- "response":{
- "name":"DeleteFileResponse",
- "correlationID":118,
- "parameters":{
- "spaceAvailable":2345678
+ "response": {
+ "name": "DeleteFileResponse",
+ "correlationID": 118,
+ "parameters": {
+ "spaceAvailable": 2345678
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteInteractionChoiceSet.json b/android/sdl_android/src/androidTest/assets/json/DeleteInteractionChoiceSet.json
index 60f9a6c61..68bd3405f 100644
--- a/android/sdl_android/src/androidTest/assets/json/DeleteInteractionChoiceSet.json
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteInteractionChoiceSet.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"DeleteInteractionChoiceSet",
- "correlationID":119,
- "parameters":{
- "interactionChoiceSetID":56
+ "request": {
+ "name": "DeleteInteractionChoiceSet",
+ "correlationID": 119,
+ "parameters": {
+ "interactionChoiceSetID": 56
}
},
- "response":{
- "name":"DeleteInteractionChoiceSetResponse",
- "correlationID":120
+ "response": {
+ "name": "DeleteInteractionChoiceSetResponse",
+ "correlationID": 120
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteSubMenu.json b/android/sdl_android/src/androidTest/assets/json/DeleteSubMenu.json
index c31eb189d..7cebf113d 100644
--- a/android/sdl_android/src/androidTest/assets/json/DeleteSubMenu.json
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteSubMenu.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"DeleteSubMenu",
- "correlationID":121,
- "parameters":{
- "menuID":765
+ "request": {
+ "name": "DeleteSubMenu",
+ "correlationID": 121,
+ "parameters": {
+ "menuID": 765
}
},
- "response":{
- "name":"AddCommandResponse",
- "correlationID":122
+ "response": {
+ "name": "AddCommandResponse",
+ "correlationID": 122
}
} \ 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
index 69b9013b1..9c0733593 100644
--- a/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"DeleteWindow",
- "correlationID":109,
- "parameters":{
- "windowID":765
- }
+ "request": {
+ "name": "DeleteWindow",
+ "correlationID": 109,
+ "parameters": {
+ "windowID": 765
+ }
},
- "response":{
- "name":"DeleteWindowResponse",
- "correlationID":110
+ "response": {
+ "name": "DeleteWindowResponse",
+ "correlationID": 110
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DiagnosticMessage.json b/android/sdl_android/src/androidTest/assets/json/DiagnosticMessage.json
index ff5e4a92d..d20eb021e 100644
--- a/android/sdl_android/src/androidTest/assets/json/DiagnosticMessage.json
+++ b/android/sdl_android/src/androidTest/assets/json/DiagnosticMessage.json
@@ -1,11 +1,11 @@
{
- "request":{
- "name":"DiagnosticMessage",
- "correlationID":123,
- "parameters":{
- "targetID":46,
- "messageLength":231,
- "messageData":[
+ "request": {
+ "name": "DiagnosticMessage",
+ "correlationID": 123,
+ "parameters": {
+ "targetID": 46,
+ "messageLength": 231,
+ "messageData": [
33245,
23456,
234,
@@ -16,11 +16,11 @@
]
}
},
- "response":{
- "name":"DiagnosticMessageResponse",
- "correlationID":124,
- "parameters":{
- "messageDataResult":[
+ "response": {
+ "name": "DiagnosticMessageResponse",
+ "correlationID": 124,
+ "parameters": {
+ "messageDataResult": [
33245,
23456,
234,
diff --git a/android/sdl_android/src/androidTest/assets/json/DialNumber.json b/android/sdl_android/src/androidTest/assets/json/DialNumber.json
index cb79aad84..34ad2501a 100644
--- a/android/sdl_android/src/androidTest/assets/json/DialNumber.json
+++ b/android/sdl_android/src/androidTest/assets/json/DialNumber.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"DialNumber",
- "correlationID":194,
- "parameters":{
- "wayPointType":"DESTINATION"
+ "request": {
+ "name": "DialNumber",
+ "correlationID": 194,
+ "parameters": {
+ "wayPointType": "DESTINATION"
}
},
- "response":{
- "name":"DialNumberResponse",
- "correlationID":195
+ "response": {
+ "name": "DialNumberResponse",
+ "correlationID": 195
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/EndAudioPassThru.json b/android/sdl_android/src/androidTest/assets/json/EndAudioPassThru.json
index ed6554bc3..a92933d47 100644
--- a/android/sdl_android/src/androidTest/assets/json/EndAudioPassThru.json
+++ b/android/sdl_android/src/androidTest/assets/json/EndAudioPassThru.json
@@ -1,10 +1,10 @@
{
- "request":{
- "name":"EndAudioPassThru",
- "correlationID":125
+ "request": {
+ "name": "EndAudioPassThru",
+ "correlationID": 125
},
- "response":{
- "name":"EndAudioPassThruResponse",
- "correlationID":126
+ "response": {
+ "name": "EndAudioPassThruResponse",
+ "correlationID": 126
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetAppServiceData.json b/android/sdl_android/src/androidTest/assets/json/GetAppServiceData.json
index 6e4e9a2e2..62a3c8b1e 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetAppServiceData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetAppServiceData.json
@@ -1,16 +1,16 @@
{
- "request":{
- "name":"GetAppServiceData",
- "correlationID":53,
- "parameters":{
- "subscribe":true,
- "serviceType":"MEDIA"
+ "request": {
+ "name": "GetAppServiceData",
+ "correlationID": 53,
+ "parameters": {
+ "subscribe": true,
+ "serviceType": "MEDIA"
}
},
- "response":{
- "name":"GetAppServiceDataResponse",
- "correlationID":53,
- "parameters":{
+ "response": {
+ "name": "GetAppServiceDataResponse",
+ "correlationID": 53,
+ "parameters": {
"serviceData": {
"serviceId": "test",
"serviceType": "MEDIA"
diff --git a/android/sdl_android/src/androidTest/assets/json/GetDTCs.json b/android/sdl_android/src/androidTest/assets/json/GetDTCs.json
index 7a0f0e51d..8f6f0c2de 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetDTCs.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetDTCs.json
@@ -1,21 +1,21 @@
{
- "request":{
- "name":"GetDTCs",
- "correlationID":127,
- "parameters":{
- "dtcMask":4356,
- "ecuName":4567
+ "request": {
+ "name": "GetDTCs",
+ "correlationID": 127,
+ "parameters": {
+ "dtcMask": 4356,
+ "ecuName": 4567
}
},
- "response":{
- "name":"GetDTCsResponse",
- "correlationID":128,
- "parameters":{
- "dtc":[
- "item1",
- "item2",
- "item3"
- ]
+ "response": {
+ "name": "GetDTCsResponse",
+ "correlationID": 128,
+ "parameters": {
+ "dtc": [
+ "item1",
+ "item2",
+ "item3"
+ ]
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetFile.json b/android/sdl_android/src/androidTest/assets/json/GetFile.json
index 422bb4ee6..e985bef38 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetFile.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetFile.json
@@ -1,20 +1,20 @@
{
- "request":{
- "name":"GetFile",
- "correlationID":1,
- "parameters":{
- "fileName":"test",
+ "request": {
+ "name": "GetFile",
+ "correlationID": 1,
+ "parameters": {
+ "fileName": "test",
"appServiceId": "test",
- "fileType":"GRAPHIC_JPEG",
+ "fileType": "GRAPHIC_JPEG",
"offset": 100,
"length": 100
}
},
- "response":{
- "name":"GetFileResponse",
- "correlationID":1,
- "parameters":{
- "fileType":"GRAPHIC_JPEG",
+ "response": {
+ "name": "GetFileResponse",
+ "correlationID": 1,
+ "parameters": {
+ "fileType": "GRAPHIC_JPEG",
"offset": 100,
"length": 100,
"crc": 1234
diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json
index 7000d2918..0c5ca2d45 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json
@@ -1,36 +1,36 @@
{
- "request":{
- "name":"GetInteriorVehicleData",
- "correlationID":101,
- "parameters":{
- "subscribe":true,
- "moduleType":"CLIMATE"
+ "request": {
+ "name": "GetInteriorVehicleData",
+ "correlationID": 101,
+ "parameters": {
+ "subscribe": true,
+ "moduleType": "CLIMATE"
}
},
- "response":{
- "name":"GetInteriorVehicleDataResponse",
- "correlationID":102,
- "parameters":{
- "isSubscribed":true,
- "moduleData":{
- "moduleType":"CLIMATE",
- "climateControlData":{
- "circulateAirEnable":true,
- "ventilationMode":"UPPER",
- "acEnable":true,
- "currentTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "response": {
+ "name": "GetInteriorVehicleDataResponse",
+ "correlationID": 102,
+ "parameters": {
+ "isSubscribed": true,
+ "moduleData": {
+ "moduleType": "CLIMATE",
+ "climateControlData": {
+ "circulateAirEnable": true,
+ "ventilationMode": "UPPER",
+ "acEnable": true,
+ "currentTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "acMaxEnable":true,
- "desiredTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "acMaxEnable": true,
+ "desiredTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "dualModeEnable":true,
- "autoModeEnable":true,
- "fanSpeed":100,
- "defrostZone":"FRONT"
+ "dualModeEnable": true,
+ "autoModeEnable": true,
+ "fanSpeed": 100,
+ "defrostZone": "FRONT"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
index 5ab1c6c41..786df251d 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
@@ -1,20 +1,20 @@
{
- "request":{
- "name":"GetInteriorVehicleDataConsent",
- "correlationID":168,
- "parameters":{
- "moduleType":"CLIMATE",
- "moduleIds":[
+ "request": {
+ "name": "GetInteriorVehicleDataConsent",
+ "correlationID": 168,
+ "parameters": {
+ "moduleType": "CLIMATE",
+ "moduleIds": [
"A0A",
"R0A"
]
}
},
- "response":{
- "name":"GetInteriorVehicleDataConsent",
- "correlationID":169,
- "parameters":{
- "allowed":[
+ "response": {
+ "name": "GetInteriorVehicleDataConsent",
+ "correlationID": 169,
+ "parameters": {
+ "allowed": [
true,
true
]
diff --git a/android/sdl_android/src/androidTest/assets/json/GetSystemCapability.json b/android/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
index 5869df406..deb152354 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
@@ -1,18 +1,18 @@
{
- "request":{
- "name":"GetSystemCapability",
- "correlationID":203,
- "parameters":{
- "systemCapabilityType":"NAVIGATION",
+ "request": {
+ "name": "GetSystemCapability",
+ "correlationID": 203,
+ "parameters": {
+ "systemCapabilityType": "NAVIGATION",
"subscribe": true
}
},
- "response":{
- "name":"GetSystemCapabilityResponse",
- "correlationID":204,
- "parameters":{
- "systemCapability":{
- "systemCapabilityType":"NAVIGATION"
+ "response": {
+ "name": "GetSystemCapabilityResponse",
+ "correlationID": 204,
+ "parameters": {
+ "systemCapability": {
+ "systemCapabilityType": "NAVIGATION"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
index 085cfedce..b31a0e4db 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
@@ -1,183 +1,183 @@
{
- "request":{
- "name":"GetVehicleData",
- "correlationID":129,
- "parameters":{
- "speed":true,
- "rpm":true,
- "externalTemperature":false,
- "fuelLevel":true,
- "vin":true,
- "prndl":true,
- "tirePressure":true,
- "engineTorque":false,
- "engineOilLife":true,
- "odometer":true,
- "gps":false,
- "fuelLevel_State":true,
- "instantFuelConsumption":false,
- "beltStatus":true,
- "bodyInformation":false,
- "deviceStatus":true,
- "driverBraking":true,
- "wiperStatus":false,
- "headLampStatus":true,
- "accPedalPosition":true,
- "steeringWheelAngle":true,
- "eCallInfo":false,
- "airbagStatus":true,
- "emergencyEvent":false,
- "clusterModeStatus":true,
- "myKey":true,
- "fuelRange":true,
- "turnSignal":true,
- "electronicParkBrakeStatus":true,
+ "request": {
+ "name": "GetVehicleData",
+ "correlationID": 129,
+ "parameters": {
+ "speed": true,
+ "rpm": true,
+ "externalTemperature": false,
+ "fuelLevel": true,
+ "vin": true,
+ "prndl": true,
+ "tirePressure": true,
+ "engineTorque": false,
+ "engineOilLife": true,
+ "odometer": true,
+ "gps": false,
+ "fuelLevel_State": true,
+ "instantFuelConsumption": false,
+ "beltStatus": true,
+ "bodyInformation": false,
+ "deviceStatus": true,
+ "driverBraking": true,
+ "wiperStatus": false,
+ "headLampStatus": true,
+ "accPedalPosition": true,
+ "steeringWheelAngle": true,
+ "eCallInfo": false,
+ "airbagStatus": true,
+ "emergencyEvent": false,
+ "clusterModeStatus": true,
+ "myKey": true,
+ "fuelRange": true,
+ "turnSignal": true,
+ "electronicParkBrakeStatus": true,
"gearStatus": true,
- "oemCustomVehicleDataName":true,
+ "oemCustomVehicleDataName": true,
"windowStatus": true,
"stabilityControlsStatus": true
}
},
- "response":{
- "name":"GetVehicleDataResponse",
- "correlationID":130,
- "parameters":{
- "speed":35.6,
- "rpm":2500,
- "externalTemperature":140.1,
- "fuelLevel":3.7,
- "vin":"FIUE4WHR3984579THIRU",
- "prndl":"SECOND",
- "tirePressure":{
- "pressureTellTale":"ON",
- "leftFront":"NORMAL",
- "rightFront":"FAULT",
- "leftRear":"LOW",
- "innerLeftRear":"NORMAL",
- "innerRightRear":"LOW",
- "rightRear":"ALERT"
+ "response": {
+ "name": "GetVehicleDataResponse",
+ "correlationID": 130,
+ "parameters": {
+ "speed": 35.6,
+ "rpm": 2500,
+ "externalTemperature": 140.1,
+ "fuelLevel": 3.7,
+ "vin": "FIUE4WHR3984579THIRU",
+ "prndl": "SECOND",
+ "tirePressure": {
+ "pressureTellTale": "ON",
+ "leftFront": "NORMAL",
+ "rightFront": "FAULT",
+ "leftRear": "LOW",
+ "innerLeftRear": "NORMAL",
+ "innerRightRear": "LOW",
+ "rightRear": "ALERT"
},
- "engineTorque":518.3,
- "engineOilLife":19.3,
- "odometer":140000,
- "gps":{
- "longitudeDegrees":104.2,
- "latitudeDegrees":56.3,
- "utcYear":2015,
- "utcMonth":7,
- "utcDay":14,
- "utcHours":11,
- "utcMinutes":38,
- "utcSeconds":12,
- "compassDirection":"NORTHWEST",
- "pdop":4.1,
- "vdop":2.4,
- "hdop":5.5,
- "actual":true,
- "satellites":3,
- "dimension":"_2D",
- "altitude":768.5,
- "heading":315.0,
- "speed":30.5
+ "engineTorque": 518.3,
+ "engineOilLife": 19.3,
+ "odometer": 140000,
+ "gps": {
+ "longitudeDegrees": 104.2,
+ "latitudeDegrees": 56.3,
+ "utcYear": 2015,
+ "utcMonth": 7,
+ "utcDay": 14,
+ "utcHours": 11,
+ "utcMinutes": 38,
+ "utcSeconds": 12,
+ "compassDirection": "NORTHWEST",
+ "pdop": 4.1,
+ "vdop": 2.4,
+ "hdop": 5.5,
+ "actual": true,
+ "satellites": 3,
+ "dimension": "_2D",
+ "altitude": 768.5,
+ "heading": 315.0,
+ "speed": 30.5
},
- "fuelLevel_State":"ALERT",
- "turnSignal":"OFF",
- "instantFuelConsumption":2.76,
- "beltStatus":{
- "driverBeltDeployed":"NO",
- "passengerBeltDeployed":"YES",
- "passengerBuckleBelted":"NO",
- "driverBuckleBelted":"NO",
- "leftRow2BuckleBelted":"NO_EVENT",
- "passengerChildDetected":"NO",
- "rightRow2BuckleBelted":"NO_EVENT",
- "middleRow2BuckleBelted":"YES",
- "middleRow3BuckleBelted":"NO_EVENT",
- "leftRow3BuckleBelted":"NO",
- "rightRow3BuckleBelted":"NO_EVENT",
- "rearInflatableBelted":"NO",
- "rightRearInflatableBelted":"NO_EVENT",
- "middleRow1BeltDeployed":"NO",
- "middleRow1BuckleBelted":"YES"
+ "fuelLevel_State": "ALERT",
+ "turnSignal": "OFF",
+ "instantFuelConsumption": 2.76,
+ "beltStatus": {
+ "driverBeltDeployed": "NO",
+ "passengerBeltDeployed": "YES",
+ "passengerBuckleBelted": "NO",
+ "driverBuckleBelted": "NO",
+ "leftRow2BuckleBelted": "NO_EVENT",
+ "passengerChildDetected": "NO",
+ "rightRow2BuckleBelted": "NO_EVENT",
+ "middleRow2BuckleBelted": "YES",
+ "middleRow3BuckleBelted": "NO_EVENT",
+ "leftRow3BuckleBelted": "NO",
+ "rightRow3BuckleBelted": "NO_EVENT",
+ "rearInflatableBelted": "NO",
+ "rightRearInflatableBelted": "NO_EVENT",
+ "middleRow1BeltDeployed": "NO",
+ "middleRow1BuckleBelted": "YES"
},
- "bodyInformation":{
- "parkBrakeActive":false,
- "ignitionStableStatus":"IGNITION_SWITCH_NOT_STABLE",
- "ignitionStatus":"ACCESSORY",
- "driverDoorAjar":true,
- "passengerDoorAjar":true,
- "rearLeftDoorAjar":false,
- "rearRightDoorAjar":true
+ "bodyInformation": {
+ "parkBrakeActive": false,
+ "ignitionStableStatus": "IGNITION_SWITCH_NOT_STABLE",
+ "ignitionStatus": "ACCESSORY",
+ "driverDoorAjar": true,
+ "passengerDoorAjar": true,
+ "rearLeftDoorAjar": false,
+ "rearRightDoorAjar": true
},
- "deviceStatus":{
- "voiceRecOn":true,
- "btIconOn":true,
- "callActive":true,
- "phoneRoaming":false,
- "textMsgAvailable":false,
- "battLevelStatus":"TWO_LEVEL_BARS",
- "stereoAudioOutputMuted":false,
- "monoAudioOutputMuted":true,
- "signalLevelStatus":"ONE_LEVEL_BARS",
- "primaryAudioSource":"BLUETOOTH_STEREO_BTST",
- "eCallEventActive":false
+ "deviceStatus": {
+ "voiceRecOn": true,
+ "btIconOn": true,
+ "callActive": true,
+ "phoneRoaming": false,
+ "textMsgAvailable": false,
+ "battLevelStatus": "TWO_LEVEL_BARS",
+ "stereoAudioOutputMuted": false,
+ "monoAudioOutputMuted": true,
+ "signalLevelStatus": "ONE_LEVEL_BARS",
+ "primaryAudioSource": "BLUETOOTH_STEREO_BTST",
+ "eCallEventActive": false
},
- "driverBraking":"NO",
- "wiperStatus":"COURTESYWIPE",
- "headLampStatus":{
- "ambientLightSensorStatus":"TWILIGHT_3",
- "highBeamsOn":true,
- "lowBeamsOn":false
+ "driverBraking": "NO",
+ "wiperStatus": "COURTESYWIPE",
+ "headLampStatus": {
+ "ambientLightSensorStatus": "TWILIGHT_3",
+ "highBeamsOn": true,
+ "lowBeamsOn": false
},
- "accPedalPosition":28.29,
- "steeringWheelAngle":70.5,
- "eCallInfo":{
- "eCallNotificationStatus":"NOT_SUPPORTED",
- "auxECallNotificationStatus":"NOT_USED",
- "eCallConfirmationStatus":"ECALL_CONFIGURED_OFF"
+ "accPedalPosition": 28.29,
+ "steeringWheelAngle": 70.5,
+ "eCallInfo": {
+ "eCallNotificationStatus": "NOT_SUPPORTED",
+ "auxECallNotificationStatus": "NOT_USED",
+ "eCallConfirmationStatus": "ECALL_CONFIGURED_OFF"
},
- "airbagStatus":{
- "driverAirbagDeployed":"NO",
- "driverSideAirbagDeployed":"NO",
- "driverCurtainAirbagDeployed":"YES",
- "driverKneeAirbagDeployed":"NO",
- "passengerAirbagDeployed":"NO",
- "passengerSideAirbagDeployed":"NO",
- "passengerCurtainAirbagDeployed":"YES",
- "passengerKneeAirbagDeployed":"NO"
+ "airbagStatus": {
+ "driverAirbagDeployed": "NO",
+ "driverSideAirbagDeployed": "NO",
+ "driverCurtainAirbagDeployed": "YES",
+ "driverKneeAirbagDeployed": "NO",
+ "passengerAirbagDeployed": "NO",
+ "passengerSideAirbagDeployed": "NO",
+ "passengerCurtainAirbagDeployed": "YES",
+ "passengerKneeAirbagDeployed": "NO"
},
- "emergencyEvent":{
- "emergencyEventType":"FRONTAL",
- "fuelCutoffStatus":"TERMINATE_FUEL",
- "rolloverEvent":"YES",
- "maximumChangeVelocity":5,
- "multipleEvents":"NO"
+ "emergencyEvent": {
+ "emergencyEventType": "FRONTAL",
+ "fuelCutoffStatus": "TERMINATE_FUEL",
+ "rolloverEvent": "YES",
+ "maximumChangeVelocity": 5,
+ "multipleEvents": "NO"
},
- "clusterModeStatus":{
- "powerModeActive":true,
- "powerModeQualificationStatus":"POWER_MODE_EVALUATION_IN_PROGRESS",
- "carModeStatus":"TRANSPORT",
- "powerModeStatus":"POST_ACCESORY_0"
+ "clusterModeStatus": {
+ "powerModeActive": true,
+ "powerModeQualificationStatus": "POWER_MODE_EVALUATION_IN_PROGRESS",
+ "carModeStatus": "TRANSPORT",
+ "powerModeStatus": "POST_ACCESORY_0"
},
- "myKey":{
- "e911Override":"NO_DATA_EXISTS"
+ "myKey": {
+ "e911Override": "NO_DATA_EXISTS"
},
- "electronicParkBrakeStatus":"CLOSED",
- "fuelRange":[
+ "electronicParkBrakeStatus": "CLOSED",
+ "fuelRange": [
{
- "type":"GASOLINE",
- "range":100.0
+ "type": "GASOLINE",
+ "range": 100.0
},
{
- "type":"DIESEL",
- "range":10.0
+ "type": "DIESEL",
+ "range": 10.0
}
],
"stabilityControlsStatus": {
"escSystem": "ON",
"trailerSwayControl": "OFF"
},
- "oemCustomVehicleDataName":"oemCustomVehicleDataState",
+ "oemCustomVehicleDataName": "oemCustomVehicleDataState",
"gearStatus": {
"userSelectedGear": "PARK",
"transmissionType": "ELECTRIC_VARIABLE",
@@ -185,7 +185,7 @@
},
"windowStatus": [
{
- "location": {
+ "location": {
"row": 2,
"col": 3
},
diff --git a/android/sdl_android/src/androidTest/assets/json/GetWayPoints.json b/android/sdl_android/src/androidTest/assets/json/GetWayPoints.json
index 8d06a9dd6..f9878976d 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetWayPoints.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetWayPoints.json
@@ -1,17 +1,18 @@
{
- "request":{
- "name":"GetWayPoints",
- "correlationID":196,
- "parameters":{
- "wayPointType":"DESTINATION"
+ "request": {
+ "name": "GetWayPoints",
+ "correlationID": 196,
+ "parameters": {
+ "wayPointType": "DESTINATION"
}
},
- "response":{
- "name":"GetWayPointsResponse",
- "correlationID":197,
- "parameters":{
- "wayPoints":[
- {}, {}
+ "response": {
+ "name": "GetWayPointsResponse",
+ "correlationID": 197,
+ "parameters": {
+ "wayPoints": [
+ {},
+ {}
]
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/ListFiles.json b/android/sdl_android/src/androidTest/assets/json/ListFiles.json
index d34d64ff0..92f6378ed 100644
--- a/android/sdl_android/src/androidTest/assets/json/ListFiles.json
+++ b/android/sdl_android/src/androidTest/assets/json/ListFiles.json
@@ -1,18 +1,18 @@
{
- "request":{
- "name":"ListFiles",
- "correlationID":131
+ "request": {
+ "name": "ListFiles",
+ "correlationID": 131
},
- "response":{
- "name":"ListFilesResponse",
- "correlationID":132,
- "parameters":{
- "filenames":[
+ "response": {
+ "name": "ListFilesResponse",
+ "correlationID": 132,
+ "parameters": {
+ "filenames": [
"file1",
"file2",
"file3"
],
- "spaceAvailable":1947255
+ "spaceAvailable": 1947255
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json b/android/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json
index e16bc880f..fbd1f6159 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformAppServiceInteraction.json
@@ -1,18 +1,18 @@
{
- "request":{
- "name":"PerformAppServiceInteraction",
- "correlationID":55,
- "parameters":{
+ "request": {
+ "name": "PerformAppServiceInteraction",
+ "correlationID": 55,
+ "parameters": {
"serviceUri": "test",
"appServiceId": "test",
"originApp": "test",
"requestServiceActive": true
}
},
- "response":{
- "name":"PerformAppServiceInteractionResponse",
- "correlationID":55,
- "parameters":{
+ "response": {
+ "name": "PerformAppServiceInteractionResponse",
+ "correlationID": 55,
+ "parameters": {
"serviceSpecificResult": "test"
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/PerformAudioPassThru.json b/android/sdl_android/src/androidTest/assets/json/PerformAudioPassThru.json
index 60e88b694..3711de408 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformAudioPassThru.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformAudioPassThru.json
@@ -1,29 +1,29 @@
{
- "request":{
- "name":"PerformAudioPassThru",
- "correlationID":133,
- "parameters":{
- "maxDuration":5,
- "audioPassThruDisplayText1":"Text 1",
- "audioPassThruDisplayText2":"Text 2",
- "muteAudio":true,
- "samplingRate":"8KHZ",
- "audioType":"PCM",
- "initialPrompt":[
+ "request": {
+ "name": "PerformAudioPassThru",
+ "correlationID": 133,
+ "parameters": {
+ "maxDuration": 5,
+ "audioPassThruDisplayText1": "Text 1",
+ "audioPassThruDisplayText2": "Text 2",
+ "muteAudio": true,
+ "samplingRate": "8KHZ",
+ "audioType": "PCM",
+ "initialPrompt": [
{
- "text":"TEXT",
- "type":"Hello"
+ "text": "TEXT",
+ "type": "Hello"
},
{
- "text":"TEXT",
- "type":"Goodbye"
+ "text": "TEXT",
+ "type": "Goodbye"
}
],
- "bitsPerSample":"8_BIT"
+ "bitsPerSample": "8_BIT"
}
},
- "response":{
- "name":"PerformAudioPassThruResponse",
- "correlationID":134
+ "response": {
+ "name": "PerformAudioPassThruResponse",
+ "correlationID": 134
}
} \ 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 583a72b1c..333ae65b7 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
@@ -1,76 +1,76 @@
{
- "request":{
- "name":"PerformInteraction",
- "correlationID":135,
- "parameters":{
- "initialText":"Initial Text",
- "interactionMode":"VR_ONLY",
- "interactionChoiceSetIDList":[
+ "request": {
+ "name": "PerformInteraction",
+ "correlationID": 135,
+ "parameters": {
+ "initialText": "Initial Text",
+ "interactionMode": "VR_ONLY",
+ "interactionChoiceSetIDList": [
442,
2352,
4623,
8954
],
- "interactionLayout":"ICON_ONLY",
- "initialPrompt":[
+ "interactionLayout": "ICON_ONLY",
+ "initialPrompt": [
{
- "text":"TEXT",
- "type":"Hello"
+ "text": "TEXT",
+ "type": "Hello"
},
{
- "text":"TEXT",
- "type":"Goodbye"
+ "text": "TEXT",
+ "type": "Goodbye"
}
],
- "helpPrompt":[
+ "helpPrompt": [
{
- "text":"TEXT",
- "type":"Hello2"
+ "text": "TEXT",
+ "type": "Hello2"
},
{
- "text":"TEXT",
- "type":"Goodbye2"
+ "text": "TEXT",
+ "type": "Goodbye2"
}
],
- "timeoutPrompt":[
+ "timeoutPrompt": [
{
- "text":"TEXT",
- "type":"Hello3"
+ "text": "TEXT",
+ "type": "Hello3"
},
{
- "text":"TEXT",
- "type":"Goodbye3"
+ "text": "TEXT",
+ "type": "Goodbye3"
}
],
- "timeout":0,
- "cancelID":45,
- "vrHelp":[
+ "timeout": 0,
+ "cancelID": 45,
+ "vrHelp": [
{
- "position":7,
- "text":"Voice Recognition Text",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "position": 7,
+ "text": "Voice Recognition Text",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
},
{
- "position":3,
- "text":"Voice Recognition Text 2",
- "image":{
- "value":"image2.png",
- "imageType":"STATIC"
+ "position": 3,
+ "text": "Voice Recognition Text 2",
+ "image": {
+ "value": "image2.png",
+ "imageType": "STATIC"
}
}
]
}
},
- "response":{
- "name":"PerformInteractionResponse",
- "correlationID":136,
- "parameters":{
- "manualTextEntry":"Text Entry",
- "triggerSource":"MENU",
- "choiceID":45
+ "response": {
+ "name": "PerformInteractionResponse",
+ "correlationID": 136,
+ "parameters": {
+ "manualTextEntry": "Text Entry",
+ "triggerSource": "MENU",
+ "choiceID": 45
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/PublishAppService.json b/android/sdl_android/src/androidTest/assets/json/PublishAppService.json
index 1a6edf9db..8d16dfb66 100644
--- a/android/sdl_android/src/androidTest/assets/json/PublishAppService.json
+++ b/android/sdl_android/src/androidTest/assets/json/PublishAppService.json
@@ -1,25 +1,29 @@
{
- "request":{
- "name":"PublishAppService",
- "correlationID":52,
- "parameters":{
- "appServiceManifest":{
- "allowAppConsumers":true,
+ "request": {
+ "name": "PublishAppService",
+ "correlationID": 52,
+ "parameters": {
+ "appServiceManifest": {
+ "allowAppConsumers": true,
"serviceIcon": "test",
- "rpcSpecVersion":{
- "majorVersion":5,
- "minorVersion":1,
- "patchVersion":0},
- "serviceName":"Mobile_MEDIA",
- "serviceType":"MEDIA",
- "handledRPCs":[39,41]
+ "rpcSpecVersion": {
+ "majorVersion": 5,
+ "minorVersion": 1,
+ "patchVersion": 0
+ },
+ "serviceName": "Mobile_MEDIA",
+ "serviceType": "MEDIA",
+ "handledRPCs": [
+ 39,
+ 41
+ ]
}
}
},
- "response":{
- "name":"PublishAppServiceResponse",
- "correlationID":52,
- "parameters":{
+ "response": {
+ "name": "PublishAppServiceResponse",
+ "correlationID": 52,
+ "parameters": {
"appServiceRecord": {
"serviceID": "test",
"serviceManifest": {
@@ -32,10 +36,13 @@
"serviceName": "Mobile_MEDIA",
"serviceType": "MEDIA",
"serviceIcon": "test",
- "handledRPCs": [39,41]
+ "handledRPCs": [
+ 39,
+ 41
+ ]
},
"servicePublished": true,
- "serviceActive":true
+ "serviceActive": true
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/PutFile.json b/android/sdl_android/src/androidTest/assets/json/PutFile.json
index e989a62aa..9bec8540d 100644
--- a/android/sdl_android/src/androidTest/assets/json/PutFile.json
+++ b/android/sdl_android/src/androidTest/assets/json/PutFile.json
@@ -1,27 +1,27 @@
{
- "request":{
- "name":"PutFile",
- "correlationID":137,
- "parameters":{
- "persistentFile":true,
- "systemFile":false,
- "fileType":"GRAPHIC_JPEG",
- "syncFileName":"filename.txt",
- "offset":2,
- "length":456,
- "crc":2020,
- "bulkData":[
+ "request": {
+ "name": "PutFile",
+ "correlationID": 137,
+ "parameters": {
+ "persistentFile": true,
+ "systemFile": false,
+ "fileType": "GRAPHIC_JPEG",
+ "syncFileName": "filename.txt",
+ "offset": 2,
+ "length": 456,
+ "crc": 2020,
+ "bulkData": [
0,
1,
2
]
}
},
- "response":{
- "name":"PutFileResponse",
- "correlationID":138,
- "parameters":{
- "spaceAvailable":43567543
+ "response": {
+ "name": "PutFileResponse",
+ "correlationID": 138,
+ "parameters": {
+ "spaceAvailable": 43567543
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ReadDID.json b/android/sdl_android/src/androidTest/assets/json/ReadDID.json
index 5cb3403fb..159b921bd 100644
--- a/android/sdl_android/src/androidTest/assets/json/ReadDID.json
+++ b/android/sdl_android/src/androidTest/assets/json/ReadDID.json
@@ -1,10 +1,10 @@
{
- "request":{
- "name":"ReadDID",
- "correlationID":139,
- "parameters":{
- "ecuName":526,
- "didLocation":[
+ "request": {
+ "name": "ReadDID",
+ "correlationID": 139,
+ "parameters": {
+ "ecuName": 526,
+ "didLocation": [
5436,
34574,
27,
@@ -16,20 +16,20 @@
]
}
},
- "response":{
- "name":"ReadDIDResponse",
- "correlationID":140,
- "parameters":{
- "didResult":[
+ "response": {
+ "name": "ReadDIDResponse",
+ "correlationID": 140,
+ "parameters": {
+ "didResult": [
{
- "resultCode":"USER_DISALLOWED",
- "data":"dataGoesHere",
- "didLocation":56484
+ "resultCode": "USER_DISALLOWED",
+ "data": "dataGoesHere",
+ "didLocation": 56484
},
{
- "resultCode":"SUCCESS",
- "data":"moreDataGoesHere",
- "didLocation":1647
+ "resultCode": "SUCCESS",
+ "data": "moreDataGoesHere",
+ "didLocation": 1647
}
]
}
diff --git a/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json b/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
index 3c5271d9c..5655d59b1 100644
--- a/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
+++ b/android/sdl_android/src/androidTest/assets/json/RegisterAppInterface.json
@@ -1,43 +1,43 @@
{
- "request":{
- "name":"RegisterAppInterface",
- "correlationID":141,
- "parameters":{
- "ttsName":[
+ "request": {
+ "name": "RegisterAppInterface",
+ "correlationID": 141,
+ "parameters": {
+ "ttsName": [
{
- "text":"Phrase 1",
- "type":"TEXT"
+ "text": "Phrase 1",
+ "type": "TEXT"
},
{
- "text":"Phrase 2",
- "type":"TEXT"
+ "text": "Phrase 2",
+ "type": "TEXT"
}
],
- "hmiDisplayLanguageDesired":"EN-US",
- "appHMIType":[
+ "hmiDisplayLanguageDesired": "EN-US",
+ "appHMIType": [
"SOCIAL",
"MEDIA"
],
- "appID":"123e4567e8",
- "fullAppID":"123e4567-e89b-12d3-a456-426655440000",
- "languageDesired":"PT-BR",
- "deviceInfo":{
- "hardware":"My Hardware",
- "firmwareRev":"My Firmware Revision",
- "os":"Windows",
- "osVersion":"95",
- "carrier":"nobody",
- "maxNumberRFCOMMPorts":2
+ "appID": "123e4567e8",
+ "fullAppID": "123e4567-e89b-12d3-a456-426655440000",
+ "languageDesired": "PT-BR",
+ "deviceInfo": {
+ "hardware": "My Hardware",
+ "firmwareRev": "My Firmware Revision",
+ "os": "Windows",
+ "osVersion": "95",
+ "carrier": "nobody",
+ "maxNumberRFCOMMPorts": 2
},
- "appInfo":{
- "appDisplayName":"Test",
- "appBundleID":"com.sample.test",
- "appVersion":"1.0",
- "appIcon":"icon.png"
+ "appInfo": {
+ "appDisplayName": "Test",
+ "appBundleID": "com.sample.test",
+ "appVersion": "1.0",
+ "appIcon": "icon.png"
},
- "appName":"Dumb app",
- "ngnMediaScreenAppName":"DA",
- "isMediaApplication":true,
+ "appName": "Dumb app",
+ "ngnMediaScreenAppName": "DA",
+ "isMediaApplication": true,
"dayColorScheme": {
"backgroundColor": {
"blue": 9,
@@ -72,169 +72,169 @@
"red": 10
}
},
- "vrSynonyms":[
+ "vrSynonyms": [
"dumb",
"really dumb app"
],
- "syncMsgVersion":{
- "majorVersion":3,
- "minorVersion":64
+ "syncMsgVersion": {
+ "majorVersion": 3,
+ "minorVersion": 64
},
- "hashID":"y534htz"
+ "hashID": "y534htz"
}
},
- "response":{
- "name":"RegisterAppInterfaceResponse",
- "correlationID":142,
- "parameters":{
- "vehicleType":{
- "make":"Chrysler",
- "model":"Crossfire",
- "modelYear":"1820",
- "trim":"Gold"
+ "response": {
+ "name": "RegisterAppInterfaceResponse",
+ "correlationID": 142,
+ "parameters": {
+ "vehicleType": {
+ "make": "Chrysler",
+ "model": "Crossfire",
+ "modelYear": "1820",
+ "trim": "Gold"
},
- "speechCapabilities":[
+ "speechCapabilities": [
"SAPI_PHONEMES",
"TEXT",
"PRE_RECORDED"
],
- "vrCapabilities":[
+ "vrCapabilities": [
"Text"
],
- "audioPassThruCapabilities":[
+ "audioPassThruCapabilities": [
{
- "samplingRate":"16KHZ",
- "audioType":"PCM",
- "bitsPerSample":"16_BIT"
+ "samplingRate": "16KHZ",
+ "audioType": "PCM",
+ "bitsPerSample": "16_BIT"
},
{
- "samplingRate":"44KHZ",
- "audioType":"PCM",
- "bitsPerSample":"8_BIT"
+ "samplingRate": "44KHZ",
+ "audioType": "PCM",
+ "bitsPerSample": "8_BIT"
}
],
- "hmiZoneCapabilities":[
+ "hmiZoneCapabilities": [
"FRONT",
"BACK"
],
- "prerecordedSpeech":[
+ "prerecordedSpeech": [
"HELP_JINGLE",
"LISTEN_JINGLE",
"NEGATIVE_JINGLE"
],
- "supportedDiagModes":[
+ "supportedDiagModes": [
324,
2356,
865,
211,
8098
],
- "syncMsgVersion":{
- "majorVersion":3,
- "minorVersion":64
+ "syncMsgVersion": {
+ "majorVersion": 3,
+ "minorVersion": 64
},
- "language":"EN-US",
- "buttonCapabilities":[
+ "language": "EN-US",
+ "buttonCapabilities": [
{
- "name":"SEEKRIGHT",
- "shortPressAvailable":true,
- "longPressAvailable":false,
- "upDownAvailable":true
+ "name": "SEEKRIGHT",
+ "shortPressAvailable": true,
+ "longPressAvailable": false,
+ "upDownAvailable": true
},
{
- "name":"TUNEDOWN",
- "shortPressAvailable":false,
- "longPressAvailable":true,
- "upDownAvailable":false
+ "name": "TUNEDOWN",
+ "shortPressAvailable": false,
+ "longPressAvailable": true,
+ "upDownAvailable": false
}
],
- "displayCapabilities":{
- "displayType":"TYPE2",
- "mediaClockFormats":[
+ "displayCapabilities": {
+ "displayType": "TYPE2",
+ "mediaClockFormats": [
"CLOCKTEXT3",
"CLOCK1"
],
- "textFields":[
+ "textFields": [
{
- "width":480,
- "characterSet":"TYPE5SET",
- "rows":360,
- "name":"alertText2"
+ "width": 480,
+ "characterSet": "TYPE5SET",
+ "rows": 360,
+ "name": "alertText2"
},
{
- "width":1980,
- "characterSet":"UTF_8",
- "rows":960,
- "name":"scrollableMessageBody"
- },
+ "width": 1980,
+ "characterSet": "UTF_8",
+ "rows": 960,
+ "name": "scrollableMessageBody"
+ }
],
- "imageFields":[
+ "imageFields": [
{
- "imageTypeSupported":[
+ "imageTypeSupported": [
"GRAPHIC_JPEG",
"AUDIO_AAC"
],
- "imageResolution":{
- "resolutionWidth":640,
- "resolutionHeight":480
+ "imageResolution": {
+ "resolutionWidth": 640,
+ "resolutionHeight": 480
},
- "name":"menuIcon"
+ "name": "menuIcon"
},
{
- "imageTypeSupported":[
+ "imageTypeSupported": [
"BINARY",
"AUDIO_WAVE"
],
- "imageResolution":{
- "resolutionWidth":320,
- "resolutionHeight":240
+ "imageResolution": {
+ "resolutionWidth": 320,
+ "resolutionHeight": 240
},
- "name":"graphic"
+ "name": "graphic"
}
],
- "graphicSupported":true,
- "screenParams":{
- "resolution":{
- "resolutionWidth":1200,
- "resolutionHeight":800
+ "graphicSupported": true,
+ "screenParams": {
+ "resolution": {
+ "resolutionWidth": 1200,
+ "resolutionHeight": 800
},
- "touchEventAvailable":{
- "pressAvailable":true,
- "multiTouchAvailable":false,
- "doublePressAvailable":true
+ "touchEventAvailable": {
+ "pressAvailable": true,
+ "multiTouchAvailable": false,
+ "doublePressAvailable": true
}
},
- "templatesAvailable":[
+ "templatesAvailable": [
"Template 1",
"Template 2",
"Template 3"
],
- "numCustomPresetsAvailable":5
+ "numCustomPresetsAvailable": 5
},
- "hmiDisplayLanguage":"ES-ES",
- "softButtonCapabilities":[
+ "hmiDisplayLanguage": "ES-ES",
+ "softButtonCapabilities": [
{
- "imageSupported":false,
- "shortPressAvailable":true,
- "longPressAvailable":false,
- "upDownAvailable":true
+ "imageSupported": false,
+ "shortPressAvailable": true,
+ "longPressAvailable": false,
+ "upDownAvailable": true
},
{
- "imageSupported":true,
- "shortPressAvailable":false,
- "longPressAvailable":true,
- "upDownAvailable":false
+ "imageSupported": true,
+ "shortPressAvailable": false,
+ "longPressAvailable": true,
+ "upDownAvailable": false
}
],
- "presetBankCapabilities":{
- "OnScreenPresetsAvailable":false
+ "presetBankCapabilities": {
+ "OnScreenPresetsAvailable": false
},
- "bulkData":[
+ "bulkData": [
0,
1,
2
],
- "iconResumed":true
+ "iconResumed": true
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
index 9f9f60096..fedeb72fc 100644
--- a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
+++ b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
@@ -1,14 +1,14 @@
{
- "request":{
- "name":"ReleaseInteriorVehicleDataModule",
- "correlationID":172,
- "parameters":{
- "moduleType":"CLIMATE",
- "moduleIds":"A0A"
+ "request": {
+ "name": "ReleaseInteriorVehicleDataModule",
+ "correlationID": 172,
+ "parameters": {
+ "moduleType": "CLIMATE",
+ "moduleIds": "A0A"
}
},
- "response":{
- "name":"ReleaseInteriorVehicleDataModule",
- "correlationID":173
+ "response": {
+ "name": "ReleaseInteriorVehicleDataModule",
+ "correlationID": 173
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ResetGlobalProperties.json b/android/sdl_android/src/androidTest/assets/json/ResetGlobalProperties.json
index 02ff2ba26..d9de374e9 100644
--- a/android/sdl_android/src/androidTest/assets/json/ResetGlobalProperties.json
+++ b/android/sdl_android/src/androidTest/assets/json/ResetGlobalProperties.json
@@ -1,17 +1,17 @@
{
- "request":{
- "name":"ResetGlobalProperties",
- "correlationID":143,
- "parameters":{
- "properties":[
+ "request": {
+ "name": "ResetGlobalProperties",
+ "correlationID": 143,
+ "parameters": {
+ "properties": [
"HELPPROMPT",
"VRHELPTITLE",
"VRHELPITEMS"
]
}
},
- "response":{
- "name":"ResetGlobalPropertiesResponse",
- "correlationID":144
+ "response": {
+ "name": "ResetGlobalPropertiesResponse",
+ "correlationID": 144
}
} \ 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 3b14d1a43..7a5dea217 100644
--- a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
+++ b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
@@ -1,39 +1,39 @@
{
- "request":{
- "name":"ScrollableMessage",
- "correlationID":145,
- "parameters":{
- "scrollableMessageBody":"Sample body text",
- "timeout":1000,
- "cancelID":45,
- "softButtons":[
+ "request": {
+ "name": "ScrollableMessage",
+ "correlationID": 145,
+ "parameters": {
+ "scrollableMessageBody": "Sample body text",
+ "timeout": 1000,
+ "cancelID": 45,
+ "softButtons": [
{
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
]
}
},
- "response":{
- "name":"ScrollableMessageResponse",
- "correlationID":146
+ "response": {
+ "name": "ScrollableMessageResponse",
+ "correlationID": 146
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SendHapticData.json b/android/sdl_android/src/androidTest/assets/json/SendHapticData.json
index 42b863aae..522b1c282 100644
--- a/android/sdl_android/src/androidTest/assets/json/SendHapticData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SendHapticData.json
@@ -1,22 +1,23 @@
{
- "request":{
- "name":"SendHapticData",
- "correlationID":1234,
- "parameters":{
- "hapticRectData":[
- {"id":123,
- "rect":{
- "height":1,
- "width":1,
- "x":1,
- "y":1
+ "request": {
+ "name": "SendHapticData",
+ "correlationID": 1234,
+ "parameters": {
+ "hapticRectData": [
+ {
+ "id": 123,
+ "rect": {
+ "height": 1,
+ "width": 1,
+ "x": 1,
+ "y": 1
}
}
]
}
},
- "response":{
- "name":"SendHapticData",
- "correlationID":1234
+ "response": {
+ "name": "SendHapticData",
+ "correlationID": 1234
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SendLocation.json b/android/sdl_android/src/androidTest/assets/json/SendLocation.json
index 9b0ae8901..5c2df8c76 100644
--- a/android/sdl_android/src/androidTest/assets/json/SendLocation.json
+++ b/android/sdl_android/src/androidTest/assets/json/SendLocation.json
@@ -1,26 +1,26 @@
{
- "request":{
- "name":"SendLocation",
- "correlationID":190,
- "parameters":{
- "latitudeDegrees":42,
- "longitudeDegrees":42,
- "locationName":"location",
- "locationDescription":"description",
- "phoneNumber":"999-999-9999",
- "locationImage":{
- "value":"locationImage.png",
- "imageType":"DYNAMIC"
+ "request": {
+ "name": "SendLocation",
+ "correlationID": 190,
+ "parameters": {
+ "latitudeDegrees": 42,
+ "longitudeDegrees": 42,
+ "locationName": "location",
+ "locationDescription": "description",
+ "phoneNumber": "999-999-9999",
+ "locationImage": {
+ "value": "locationImage.png",
+ "imageType": "DYNAMIC"
},
- "addressLines":[
+ "addressLines": [
"line1",
"line2",
"line3"
]
}
},
- "response":{
- "name":"SendLocationResponse",
- "correlationID":191
+ "response": {
+ "name": "SendLocationResponse",
+ "correlationID": 191
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SetAppIcon.json b/android/sdl_android/src/androidTest/assets/json/SetAppIcon.json
index 67f3b0b41..b46d3a5a3 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetAppIcon.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetAppIcon.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"SetAppIcon",
- "correlationID":147,
- "parameters":{
- "syncFileName":"filename.txt"
+ "request": {
+ "name": "SetAppIcon",
+ "correlationID": 147,
+ "parameters": {
+ "syncFileName": "filename.txt"
}
},
- "response":{
- "name":"SetAppIconResponse",
- "correlationID":148
+ "response": {
+ "name": "SetAppIconResponse",
+ "correlationID": 148
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json b/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
index 5ff32ac6a..b4e3e7961 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetDisplayLayout.json
@@ -1,9 +1,9 @@
{
- "request":{
- "name":"SetDisplayLayout",
- "correlationID":149,
- "parameters":{
- "displayLayout":"someDisplayLayout",
+ "request": {
+ "name": "SetDisplayLayout",
+ "correlationID": 149,
+ "parameters": {
+ "displayLayout": "someDisplayLayout",
"dayColorScheme": {
"backgroundColor": {
"blue": 9,
@@ -40,103 +40,103 @@
}
}
},
- "response":{
- "name":"SetDisplayLayoutResponse",
- "correlationID":150,
- "parameters":{
- "buttonCapabilities":[
+ "response": {
+ "name": "SetDisplayLayoutResponse",
+ "correlationID": 150,
+ "parameters": {
+ "buttonCapabilities": [
{
- "name":"SEEKRIGHT",
- "shortPressAvailable":true,
- "longPressAvailable":false,
- "upDownAvailable":true
+ "name": "SEEKRIGHT",
+ "shortPressAvailable": true,
+ "longPressAvailable": false,
+ "upDownAvailable": true
},
{
- "name":"TUNEDOWN",
- "shortPressAvailable":false,
- "longPressAvailable":true,
- "upDownAvailable":false
+ "name": "TUNEDOWN",
+ "shortPressAvailable": false,
+ "longPressAvailable": true,
+ "upDownAvailable": false
}
],
- "displayCapabilities":{
- "displayType":"TYPE2",
- "mediaClockFormats":[
+ "displayCapabilities": {
+ "displayType": "TYPE2",
+ "mediaClockFormats": [
"CLOCKTEXT3",
"CLOCK1"
],
- "textFields":[
+ "textFields": [
{
- "width":480,
- "characterSet":"TYPE5SET",
- "rows":360,
- "name":"alertText2"
+ "width": 480,
+ "characterSet": "TYPE5SET",
+ "rows": 360,
+ "name": "alertText2"
},
{
- "width":1980,
- "characterSet":"UTF_8",
- "rows":960,
- "name":"scrollableMessageBody"
- },
+ "width": 1980,
+ "characterSet": "UTF_8",
+ "rows": 960,
+ "name": "scrollableMessageBody"
+ }
],
- "imageFields":[
+ "imageFields": [
{
- "imageTypeSupported":[
+ "imageTypeSupported": [
"GRAPHIC_JPEG",
"AUDIO_AAC"
],
- "imageResolution":{
- "resolutionWidth":640,
- "resolutionHeight":480
+ "imageResolution": {
+ "resolutionWidth": 640,
+ "resolutionHeight": 480
},
- "name":"menuIcon"
+ "name": "menuIcon"
},
{
- "imageTypeSupported":[
+ "imageTypeSupported": [
"BINARY",
"AUDIO_WAVE"
],
- "imageResolution":{
- "resolutionWidth":320,
- "resolutionHeight":240
+ "imageResolution": {
+ "resolutionWidth": 320,
+ "resolutionHeight": 240
},
- "name":"graphic"
+ "name": "graphic"
}
],
- "graphicSupported":true,
- "screenParams":{
- "resolution":{
- "resolutionWidth":1200,
- "resolutionHeight":800
+ "graphicSupported": true,
+ "screenParams": {
+ "resolution": {
+ "resolutionWidth": 1200,
+ "resolutionHeight": 800
},
- "touchEventAvailable":{
- "pressAvailable":true,
- "multiTouchAvailable":false,
- "doublePressAvailable":true
+ "touchEventAvailable": {
+ "pressAvailable": true,
+ "multiTouchAvailable": false,
+ "doublePressAvailable": true
}
},
- "templatesAvailable":[
+ "templatesAvailable": [
"Template 1",
"Template 2",
"Template 3"
],
- "numCustomPresetsAvailable":5
+ "numCustomPresetsAvailable": 5
},
- "softButtonCapabilities":[
+ "softButtonCapabilities": [
{
- "imageSupported":false,
- "shortPressAvailable":true,
- "longPressAvailable":false,
- "upDownAvailable":true
+ "imageSupported": false,
+ "shortPressAvailable": true,
+ "longPressAvailable": false,
+ "upDownAvailable": true
},
{
- "imageSupported":true,
- "shortPressAvailable":false,
- "longPressAvailable":true,
- "upDownAvailable":false
+ "imageSupported": true,
+ "shortPressAvailable": false,
+ "longPressAvailable": true,
+ "upDownAvailable": false
}
],
- "presetBankCapabilities":{
- "OnScreenPresetsAvailable":false
+ "presetBankCapabilities": {
+ "OnScreenPresetsAvailable": false
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/SetGlobalProperties.json b/android/sdl_android/src/androidTest/assets/json/SetGlobalProperties.json
index 60cdfbffb..0746a0461 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetGlobalProperties.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetGlobalProperties.json
@@ -1,66 +1,66 @@
{
- "request":{
- "name":"SetGlobalProperties",
- "correlationID":151,
- "parameters":{
- "vrHelpTitle":"Help Title",
- "menuTitle":"Menu Title",
- "menuIcon":{
- "value":"imageMenu.png",
- "imageType":"STATIC"
+ "request": {
+ "name": "SetGlobalProperties",
+ "correlationID": 151,
+ "parameters": {
+ "vrHelpTitle": "Help Title",
+ "menuTitle": "Menu Title",
+ "menuIcon": {
+ "value": "imageMenu.png",
+ "imageType": "STATIC"
},
- "keyboardProperties":{
- "keypressMode":"SINGLE_KEYPRESS",
- "keyboardLayout":"QWERTY",
- "limitedCharacterList":[
+ "keyboardProperties": {
+ "keypressMode": "SINGLE_KEYPRESS",
+ "keyboardLayout": "QWERTY",
+ "limitedCharacterList": [
"a",
"b"
],
- "autoCompleteText":"something goes here",
- "language":"EN-US"
+ "autoCompleteText": "something goes here",
+ "language": "EN-US"
},
- "helpPrompt":[
+ "helpPrompt": [
{
- "text":"Phrase 1",
- "type":"TEXT"
+ "text": "Phrase 1",
+ "type": "TEXT"
},
{
- "text":"Phrase 2",
- "type":"TEXT"
+ "text": "Phrase 2",
+ "type": "TEXT"
}
],
- "timeoutPrompt":[
+ "timeoutPrompt": [
{
- "text":"Phrase 1",
- "type":"TEXT"
+ "text": "Phrase 1",
+ "type": "TEXT"
},
{
- "text":"Phrase 2",
- "type":"TEXT"
+ "text": "Phrase 2",
+ "type": "TEXT"
}
],
- "vrHelp":[
+ "vrHelp": [
{
- "position":2,
- "text":"Text 1",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "position": 2,
+ "text": "Text 1",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "position":5,
- "text":"Text 2",
- "image":{
- "value":"image2.png",
- "imageType":"DYNAMIC"
+ "position": 5,
+ "text": "Text 2",
+ "image": {
+ "value": "image2.png",
+ "imageType": "DYNAMIC"
}
}
]
}
},
- "response":{
- "name":"SetGlobalPropertiesResponse",
- "correlationID":152
+ "response": {
+ "name": "SetGlobalPropertiesResponse",
+ "correlationID": 152
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json b/android/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json
index 9bcdc01dc..aed8e59d5 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json
@@ -1,54 +1,54 @@
{
- "request":{
- "name":"SetInteriorVehicleData",
- "correlationID":126,
- "parameters":{
- "moduleData":{
- "moduleType":"CLIMATE",
- "climateControlData":{
- "circulateAirEnable":true,
- "ventilationMode":"BOTH",
- "acEnable":true,
- "currentTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "request": {
+ "name": "SetInteriorVehicleData",
+ "correlationID": 126,
+ "parameters": {
+ "moduleData": {
+ "moduleType": "CLIMATE",
+ "climateControlData": {
+ "circulateAirEnable": true,
+ "ventilationMode": "BOTH",
+ "acEnable": true,
+ "currentTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "acMaxEnable":true,
- "desiredTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "acMaxEnable": true,
+ "desiredTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "dualModeEnable":true,
- "autoModeEnable":true,
- "fanSpeed":100,
- "defrostZone":"ALL"
+ "dualModeEnable": true,
+ "autoModeEnable": true,
+ "fanSpeed": 100,
+ "defrostZone": "ALL"
}
}
}
},
- "response":{
- "name":"SetInteriorVehicleDataResponse",
- "correlationID":127,
- "parameters":{
- "moduleData":{
- "moduleType":"CLIMATE",
- "climateControlData":{
- "circulateAirEnable":true,
- "ventilationMode":"BOTH",
- "acEnable":true,
- "currentTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "response": {
+ "name": "SetInteriorVehicleDataResponse",
+ "correlationID": 127,
+ "parameters": {
+ "moduleData": {
+ "moduleType": "CLIMATE",
+ "climateControlData": {
+ "circulateAirEnable": true,
+ "ventilationMode": "BOTH",
+ "acEnable": true,
+ "currentTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "acMaxEnable":true,
- "desiredTemperature":{
- "unit":"CELSIUS",
- "value":100.0
+ "acMaxEnable": true,
+ "desiredTemperature": {
+ "unit": "CELSIUS",
+ "value": 100.0
},
- "dualModeEnable":true,
- "autoModeEnable":true,
- "fanSpeed":100,
- "defrostZone":"ALL"
+ "dualModeEnable": true,
+ "autoModeEnable": true,
+ "fanSpeed": 100,
+ "defrostZone": "ALL"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json b/android/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json
index e4950d05d..bd1297398 100644
--- a/android/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json
+++ b/android/sdl_android/src/androidTest/assets/json/SetMediaClockTimer.json
@@ -1,24 +1,24 @@
{
- "request":{
- "name":"SetMediaClockTimer",
- "correlationID":153,
- "parameters":{
- "startTime":{
- "minutes":49,
- "seconds":37,
- "hours":12
+ "request": {
+ "name": "SetMediaClockTimer",
+ "correlationID": 153,
+ "parameters": {
+ "startTime": {
+ "minutes": 49,
+ "seconds": 37,
+ "hours": 12
},
- "endTime":{
- "minutes":55,
- "seconds":19,
- "hours":12
+ "endTime": {
+ "minutes": 55,
+ "seconds": 19,
+ "hours": 12
},
- "updateMode":"COUNTDOWN",
- "audioStreamingIndicator":"PLAY"
+ "updateMode": "COUNTDOWN",
+ "audioStreamingIndicator": "PLAY"
}
},
- "response":{
- "name":"SetMediaClockTimerResponse",
- "correlationID":154
+ "response": {
+ "name": "SetMediaClockTimerResponse",
+ "correlationID": 154
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/Show.json b/android/sdl_android/src/androidTest/assets/json/Show.json
index 6afe27d72..05f0826e7 100644
--- a/android/sdl_android/src/androidTest/assets/json/Show.json
+++ b/android/sdl_android/src/androidTest/assets/json/Show.json
@@ -1,28 +1,28 @@
{
- "request":{
- "name":"Show",
- "correlationID":155,
- "parameters":{
- "graphic":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "request": {
+ "name": "Show",
+ "correlationID": 155,
+ "parameters": {
+ "graphic": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
},
- "customPresets":[
+ "customPresets": [
"Preset 1",
"Preset 2",
"Preset 3",
"Preset 4"
],
- "mainField1":"Main Field 1",
- "mainField2":"Main Field 2",
- "mainField3":"Main Field 3",
- "mainField4":"Main Field 4",
- "templateTitle":"Template Title",
- "statusBar":"Status",
- "mediaClock":"Media Clock",
- "alignment":"LEFT_ALIGNED",
- "mediaTrack":"Media Track",
- "windowID":10,
+ "mainField1": "Main Field 1",
+ "mainField2": "Main Field 2",
+ "mainField3": "Main Field 3",
+ "mainField4": "Main Field 4",
+ "templateTitle": "Template Title",
+ "statusBar": "Status",
+ "mediaClock": "Media Clock",
+ "alignment": "LEFT_ALIGNED",
+ "mediaTrack": "Media Track",
+ "windowID": 10,
"templateConfiguration": {
"template": "template",
"dayColorScheme": {
@@ -60,38 +60,38 @@
}
}
},
- "secondaryGraphic":{
- "value":"image2.png",
- "imageType":"STATIC"
+ "secondaryGraphic": {
+ "value": "image2.png",
+ "imageType": "STATIC"
},
- "softButtons":[
+ "softButtons": [
{
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
]
}
},
- "response":{
- "name":"ShowResponse",
- "correlationID":156
+ "response": {
+ "name": "ShowResponse",
+ "correlationID": 156
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
index 8870423de..137d38afa 100644
--- a/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
+++ b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"ShowAppMenu",
- "correlationID":187,
- "parameters":{
- "menuID":100
+ "request": {
+ "name": "ShowAppMenu",
+ "correlationID": 187,
+ "parameters": {
+ "menuID": 100
}
},
- "response":{
- "name":"ShowAppMenuResponse",
- "correlationID":188
+ "response": {
+ "name": "ShowAppMenuResponse",
+ "correlationID": 188
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ShowConstantTBT.json b/android/sdl_android/src/androidTest/assets/json/ShowConstantTBT.json
index 0a0c30b0c..765e48062 100644
--- a/android/sdl_android/src/androidTest/assets/json/ShowConstantTBT.json
+++ b/android/sdl_android/src/androidTest/assets/json/ShowConstantTBT.json
@@ -1,52 +1,52 @@
{
- "request":{
- "name":"ShowConstantTbt",
- "correlationID":196,
- "parameters":{
- "navigationText1":"text1",
- "navigationText2":"text2",
- "eta":"10 minutes",
- "totalDistance":"10km",
- "distanceToManeuver":10.00,
- "distanceToManeuverScale":1.00,
- "turnIcon":{
- "value":"turn.png",
- "imageType":"STATIC"
- },
- "nextTurnIcon":{
- "value":"nextTurn.png",
- "imageType":"STATIC"
- },
- "maneuverComplete":true,
- "softButtons":[
+ "request": {
+ "name": "ShowConstantTbt",
+ "correlationID": 196,
+ "parameters": {
+ "navigationText1": "text1",
+ "navigationText2": "text2",
+ "eta": "10 minutes",
+ "totalDistance": "10km",
+ "distanceToManeuver": 10.00,
+ "distanceToManeuverScale": 1.00,
+ "turnIcon": {
+ "value": "turn.png",
+ "imageType": "STATIC"
+ },
+ "nextTurnIcon": {
+ "value": "nextTurn.png",
+ "imageType": "STATIC"
+ },
+ "maneuverComplete": true,
+ "softButtons": [
{
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
],
- "timeToDestination":"52 minutes"
+ "timeToDestination": "52 minutes"
}
},
- "response":{
- "name":"ShowConstantTbtResponse",
- "correlationID":197
+ "response": {
+ "name": "ShowConstantTbtResponse",
+ "correlationID": 197
}
} \ 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 5b69f4728..73a0859d7 100644
--- a/android/sdl_android/src/androidTest/assets/json/Slider.json
+++ b/android/sdl_android/src/androidTest/assets/json/Slider.json
@@ -1,26 +1,26 @@
{
- "request":{
- "name":"Slider",
- "correlationID":157,
- "parameters":{
- "numTicks":6,
- "sliderHeader":"Example Header",
- "sliderFooter":[
+ "request": {
+ "name": "Slider",
+ "correlationID": 157,
+ "parameters": {
+ "numTicks": 6,
+ "sliderHeader": "Example Header",
+ "sliderFooter": [
"Header Line 1",
"Header Line 2",
"Header Line 3",
"Header Line 4"
],
- "position":11,
- "timeout":30000,
- "cancelID":45
+ "position": 11,
+ "timeout": 30000,
+ "cancelID": 45
}
},
- "response":{
- "name":"SliderResponse",
- "correlationID":158,
- "parameters":{
- "sliderPosition":4
+ "response": {
+ "name": "SliderResponse",
+ "correlationID": 158,
+ "parameters": {
+ "sliderPosition": 4
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/Speak.json b/android/sdl_android/src/androidTest/assets/json/Speak.json
index 413535ac6..6ecd05aec 100644
--- a/android/sdl_android/src/androidTest/assets/json/Speak.json
+++ b/android/sdl_android/src/androidTest/assets/json/Speak.json
@@ -1,22 +1,22 @@
{
- "request":{
- "name":"Speak",
- "correlationID":159,
- "parameters":{
- "ttsChunks":[
+ "request": {
+ "name": "Speak",
+ "correlationID": 159,
+ "parameters": {
+ "ttsChunks": [
{
- "text":"Phrase 1",
- "type":"TEXT"
+ "text": "Phrase 1",
+ "type": "TEXT"
},
{
- "text":"Phrase 2",
- "type":"TEXT"
+ "text": "Phrase 2",
+ "type": "TEXT"
}
]
}
},
- "response":{
- "name":"SpeakResponse",
- "correlationID":160
+ "response": {
+ "name": "SpeakResponse",
+ "correlationID": 160
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeButton.json b/android/sdl_android/src/androidTest/assets/json/SubscribeButton.json
index bfb660c7e..f5037ed7a 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeButton.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeButton.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"SubscribeButton",
- "correlationID":161,
- "parameters":{
- "buttonName":"TUNEUP"
+ "request": {
+ "name": "SubscribeButton",
+ "correlationID": 161,
+ "parameters": {
+ "buttonName": "TUNEUP"
}
},
- "response":{
- "name":"SubscribeButtonResponse",
- "correlationID":162
+ "response": {
+ "name": "SubscribeButtonResponse",
+ "correlationID": 162
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
index 697e830bf..51123213c 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
@@ -1,178 +1,178 @@
{
- "request":{
- "name":"SubscribeVehicleData",
- "correlationID":163,
- "parameters":{
- "speed":true,
- "rpm":true,
- "externalTemperature":false,
- "fuelLevel":true,
- "prndl":true,
- "tirePressure":true,
- "engineTorque":false,
- "engineOilLife":true,
- "odometer":true,
- "gps":false,
- "fuelLevel_State":true,
- "instantFuelConsumption":false,
- "beltStatus":true,
- "bodyInformation":false,
- "deviceStatus":true,
- "driverBraking":true,
- "wiperStatus":false,
- "headLampStatus":true,
- "accPedalPosition":true,
- "steeringWheelAngle":true,
- "eCallInfo":false,
- "airbagStatus":true,
- "emergencyEvent":false,
- "clusterModeStatus":true,
- "myKey":true,
- "fuelRange":true,
- "turnSignal":true,
- "electronicParkBrakeStatus":true,
+ "request": {
+ "name": "SubscribeVehicleData",
+ "correlationID": 163,
+ "parameters": {
+ "speed": true,
+ "rpm": true,
+ "externalTemperature": false,
+ "fuelLevel": true,
+ "prndl": true,
+ "tirePressure": true,
+ "engineTorque": false,
+ "engineOilLife": true,
+ "odometer": true,
+ "gps": false,
+ "fuelLevel_State": true,
+ "instantFuelConsumption": false,
+ "beltStatus": true,
+ "bodyInformation": false,
+ "deviceStatus": true,
+ "driverBraking": true,
+ "wiperStatus": false,
+ "headLampStatus": true,
+ "accPedalPosition": true,
+ "steeringWheelAngle": true,
+ "eCallInfo": false,
+ "airbagStatus": true,
+ "emergencyEvent": false,
+ "clusterModeStatus": true,
+ "myKey": true,
+ "fuelRange": true,
+ "turnSignal": true,
+ "electronicParkBrakeStatus": true,
"stabilityControlsStatus": true,
"gearStatus": true,
- "oemCustomVehicleDataName":true,
+ "oemCustomVehicleDataName": true,
"windowStatus": true,
"handsOffSteering": true
}
},
- "response":{
- "name":"SubscribeVehicleDataResponse",
- "correlationID":164,
- "parameters":{
- "speed":{
- "dataType":"VEHICLEDATA_SPEED",
- "resultCode":"SUCCESS"
- },
- "rpm":{
- "dataType":"VEHICLEDATA_RPM",
- "resultCode":"SUCCESS"
- },
- "externalTemperature":{
- "dataType":"VEHICLEDATA_EXTERNTEMP",
- "resultCode":"SUCCESS"
- },
- "fuelLevel":{
- "dataType":"VEHICLEDATA_FUELLEVEL",
- "resultCode":"SUCCESS"
- },
- "prndl":{
- "dataType":"VEHICLEDATA_PRNDL",
- "resultCode":"SUCCESS"
- },
- "tirePressure":{
- "dataType":"VEHICLEDATA_TIREPRESSURE",
- "resultCode":"VEHICLE_DATA_NOT_AVAILABLE"
- },
- "engineTorque":{
- "dataType":"VEHICLEDATA_SPEED",
- "resultCode":"INVALID_ID"
- },
- "engineOilLife":{
- "dataType":"VEHICLEDATA_ENGINEOILLIFE",
- "resultCode":"SUCCESS"
- },
- "odometer":{
- "dataType":"VEHICLEDATA_ODOMETER",
- "resultCode":"SUCCESS"
- },
- "gps":{
- "dataType":"VEHICLEDATA_GPS",
- "resultCode":"SUCCESS"
- },
- "fuelLevel_State":{
- "dataType":"VEHICLEDATA_FUELLEVEL_STATE",
- "resultCode":"DISALLOWED"
- },
- "instantFuelConsumption":{
- "dataType":"VEHICLEDATA_FUELCONSUMPTION",
- "resultCode":"USER_DISALLOWED"
- },
- "beltStatus":{
- "dataType":"VEHICLEDATA_BELTSTATUS",
- "resultCode":"SUCCESS"
- },
- "bodyInformation":{
- "dataType":"VEHICLEDATA_BODYINFO",
- "resultCode":"SUCCESS"
- },
- "deviceStatus":{
- "dataType":"VEHICLEDATA_DEVICESTATUS",
- "resultCode":"SUCCESS"
- },
- "driverBraking":{
- "dataType":"VEHICLEDATA_BRAKING",
- "resultCode":"DISALLOWED"
- },
- "wiperStatus":{
- "dataType":"VEHICLEDATA_WIPERSTATUS",
- "resultCode":"VEHICLE_DATA_NOT_AVAILABLE"
- },
- "headLampStatus":{
- "dataType":"VEHICLEDATA_HEADLAMPSTATUS",
- "resultCode":"USER_DISALLOWED"
- },
- "accPedalPosition":{
- "dataType":"VEHICLEDATA_ACCPEDAL",
- "resultCode":"DISALLOWED"
- },
- "steeringWheelAngle":{
- "dataType":"VEHICLEDATA_STEERINGWHEEL",
- "resultCode":"DATA_NOT_SUBSCRIBED"
- },
- "eCallInfo":{
- "dataType":"VEHICLEDATA_ECALLINFO",
- "resultCode":"SUCCESS"
- },
- "airbagStatus":{
- "dataType":"VEHICLEDATA_AIRBAGSTATUS",
- "resultCode":"DATA_ALREADY_SUBSCRIBED"
- },
- "emergencyEvent":{
- "dataType":"VEHICLEDATA_EMERGENCYEVENT",
- "resultCode":"DISALLOWED"
- },
- "clusterModes":{
- "dataType":"VEHICLEDATA_CLUSTERMODESTATUS",
- "resultCode":"SUCCESS"
- },
- "myKey":{
- "dataType":"VEHICLEDATA_MYKEY",
- "resultCode":"IGNORED"
- },
- "fuelRange":{
- "dataType":"VEHICLEDATA_FUELRANGE",
- "resultCode":"SUCCESS"
+ "response": {
+ "name": "SubscribeVehicleDataResponse",
+ "correlationID": 164,
+ "parameters": {
+ "speed": {
+ "dataType": "VEHICLEDATA_SPEED",
+ "resultCode": "SUCCESS"
+ },
+ "rpm": {
+ "dataType": "VEHICLEDATA_RPM",
+ "resultCode": "SUCCESS"
+ },
+ "externalTemperature": {
+ "dataType": "VEHICLEDATA_EXTERNTEMP",
+ "resultCode": "SUCCESS"
+ },
+ "fuelLevel": {
+ "dataType": "VEHICLEDATA_FUELLEVEL",
+ "resultCode": "SUCCESS"
+ },
+ "prndl": {
+ "dataType": "VEHICLEDATA_PRNDL",
+ "resultCode": "SUCCESS"
+ },
+ "tirePressure": {
+ "dataType": "VEHICLEDATA_TIREPRESSURE",
+ "resultCode": "VEHICLE_DATA_NOT_AVAILABLE"
+ },
+ "engineTorque": {
+ "dataType": "VEHICLEDATA_SPEED",
+ "resultCode": "INVALID_ID"
+ },
+ "engineOilLife": {
+ "dataType": "VEHICLEDATA_ENGINEOILLIFE",
+ "resultCode": "SUCCESS"
+ },
+ "odometer": {
+ "dataType": "VEHICLEDATA_ODOMETER",
+ "resultCode": "SUCCESS"
+ },
+ "gps": {
+ "dataType": "VEHICLEDATA_GPS",
+ "resultCode": "SUCCESS"
+ },
+ "fuelLevel_State": {
+ "dataType": "VEHICLEDATA_FUELLEVEL_STATE",
+ "resultCode": "DISALLOWED"
+ },
+ "instantFuelConsumption": {
+ "dataType": "VEHICLEDATA_FUELCONSUMPTION",
+ "resultCode": "USER_DISALLOWED"
+ },
+ "beltStatus": {
+ "dataType": "VEHICLEDATA_BELTSTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "bodyInformation": {
+ "dataType": "VEHICLEDATA_BODYINFO",
+ "resultCode": "SUCCESS"
+ },
+ "deviceStatus": {
+ "dataType": "VEHICLEDATA_DEVICESTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "driverBraking": {
+ "dataType": "VEHICLEDATA_BRAKING",
+ "resultCode": "DISALLOWED"
+ },
+ "wiperStatus": {
+ "dataType": "VEHICLEDATA_WIPERSTATUS",
+ "resultCode": "VEHICLE_DATA_NOT_AVAILABLE"
+ },
+ "headLampStatus": {
+ "dataType": "VEHICLEDATA_HEADLAMPSTATUS",
+ "resultCode": "USER_DISALLOWED"
+ },
+ "accPedalPosition": {
+ "dataType": "VEHICLEDATA_ACCPEDAL",
+ "resultCode": "DISALLOWED"
+ },
+ "steeringWheelAngle": {
+ "dataType": "VEHICLEDATA_STEERINGWHEEL",
+ "resultCode": "DATA_NOT_SUBSCRIBED"
+ },
+ "eCallInfo": {
+ "dataType": "VEHICLEDATA_ECALLINFO",
+ "resultCode": "SUCCESS"
+ },
+ "airbagStatus": {
+ "dataType": "VEHICLEDATA_AIRBAGSTATUS",
+ "resultCode": "DATA_ALREADY_SUBSCRIBED"
+ },
+ "emergencyEvent": {
+ "dataType": "VEHICLEDATA_EMERGENCYEVENT",
+ "resultCode": "DISALLOWED"
+ },
+ "clusterModes": {
+ "dataType": "VEHICLEDATA_CLUSTERMODESTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "myKey": {
+ "dataType": "VEHICLEDATA_MYKEY",
+ "resultCode": "IGNORED"
+ },
+ "fuelRange": {
+ "dataType": "VEHICLEDATA_FUELRANGE",
+ "resultCode": "SUCCESS"
},
- "turnSignal":{
- "dataType":"VEHICLEDATA_TURNSIGNAL",
- "resultCode":"IGNORED"
+ "turnSignal": {
+ "dataType": "VEHICLEDATA_TURNSIGNAL",
+ "resultCode": "IGNORED"
},
- "electronicParkBrakeStatus":{
- "dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
- "resultCode":"SUCCESS"
+ "electronicParkBrakeStatus": {
+ "dataType": "VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
+ "resultCode": "SUCCESS"
},
- "handsOffSteering":{
- "dataType":"VEHICLEDATA_HANDSOFFSTEERING",
- "resultCode":"SUCCESS"
+ "handsOffSteering": {
+ "dataType": "VEHICLEDATA_HANDSOFFSTEERING",
+ "resultCode": "SUCCESS"
},
- "stabilityControlsStatus":{
- "dataType":"VEHICLEDATA_STABILITYCONTROLSSTATUS",
- "resultCode":"SUCCESS"
+ "stabilityControlsStatus": {
+ "dataType": "VEHICLEDATA_STABILITYCONTROLSSTATUS",
+ "resultCode": "SUCCESS"
},
- "gearStatus":{
- "dataType":"VEHICLEDATA_GEARSTATUS",
- "resultCode":"SUCCESS"
+ "gearStatus": {
+ "dataType": "VEHICLEDATA_GEARSTATUS",
+ "resultCode": "SUCCESS"
},
- "oemCustomVehicleDataName":{
- "oemCustomDataType":"oemCustomVehicleDataName",
- "resultCode":"SUCCESS"
+ "oemCustomVehicleDataName": {
+ "oemCustomDataType": "oemCustomVehicleDataName",
+ "resultCode": "SUCCESS"
},
- "windowStatus":{
- "dataType":"VEHICLEDATA_WINDOWSTATUS",
- "resultCode":"SUCCESS"
+ "windowStatus": {
+ "dataType": "VEHICLEDATA_WINDOWSTATUS",
+ "resultCode": "SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json b/android/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json
index bd1eee5c6..578da9a7d 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeWayPoints.json
@@ -1,10 +1,10 @@
{
- "request":{
- "name":"SubscribeWayPoints",
- "correlationID":199
+ "request": {
+ "name": "SubscribeWayPoints",
+ "correlationID": 199
},
- "response":{
- "name":"SubscribeWayPointsResponse",
- "correlationID":200
+ "response": {
+ "name": "SubscribeWayPointsResponse",
+ "correlationID": 200
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/SystemRequest.json b/android/sdl_android/src/androidTest/assets/json/SystemRequest.json
index 44c6d5205..d0495236b 100644
--- a/android/sdl_android/src/androidTest/assets/json/SystemRequest.json
+++ b/android/sdl_android/src/androidTest/assets/json/SystemRequest.json
@@ -1,12 +1,12 @@
{
- "request":{
- "name":"SystemRequest",
- "correlationID":165,
- "parameters":{
- "fileName":"fileName.txt",
- "requestType":"OEM_SPECIFIC",
- "requestSubType":"TEST",
- "data":[
+ "request": {
+ "name": "SystemRequest",
+ "correlationID": 165,
+ "parameters": {
+ "fileName": "fileName.txt",
+ "requestType": "OEM_SPECIFIC",
+ "requestSubType": "TEST",
+ "data": [
"data1",
"data2",
"data3",
@@ -14,8 +14,8 @@
]
}
},
- "response":{
- "name":"SystemRequestResponse",
- "correlationID":166
+ "response": {
+ "name": "SystemRequestResponse",
+ "correlationID": 166
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json b/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json
index 70521a278..ce99ad1b7 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"UnpublishAppService",
- "correlationID":184,
- "parameters":{
- "serviceID":"test"
+ "request": {
+ "name": "UnpublishAppService",
+ "correlationID": 184,
+ "parameters": {
+ "serviceID": "test"
}
},
- "response":{
- "name":"UnpublishAppServiceResponse",
- "correlationID":185
+ "response": {
+ "name": "UnpublishAppServiceResponse",
+ "correlationID": 185
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UnregisterAppInterface.json b/android/sdl_android/src/androidTest/assets/json/UnregisterAppInterface.json
index f9cc9f0de..e31c4c70b 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnregisterAppInterface.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnregisterAppInterface.json
@@ -1,10 +1,10 @@
{
- "request":{
- "name":"UnregisterAppInterface",
- "correlationID":167
+ "request": {
+ "name": "UnregisterAppInterface",
+ "correlationID": 167
},
- "response":{
- "name":"UnregisterAppInterfaceResponse",
- "correlationID":168
+ "response": {
+ "name": "UnregisterAppInterfaceResponse",
+ "correlationID": 168
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeButton.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeButton.json
index cb2164d94..6d8efc1cd 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeButton.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeButton.json
@@ -1,13 +1,13 @@
{
- "request":{
- "name":"UnsubscribeButton",
- "correlationID":169,
- "parameters":{
- "buttonName":"OK"
+ "request": {
+ "name": "UnsubscribeButton",
+ "correlationID": 169,
+ "parameters": {
+ "buttonName": "OK"
}
},
- "response":{
- "name":"UnsubscribeButtonResponse",
- "correlationID":170
+ "response": {
+ "name": "UnsubscribeButtonResponse",
+ "correlationID": 170
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
index 5202f1b30..7f57869a5 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
@@ -1,178 +1,178 @@
{
- "request":{
- "name":"UnsubscribeVehicleData",
- "correlationID":171,
- "parameters":{
- "speed":true,
- "rpm":true,
- "externalTemperature":false,
- "fuelLevel":true,
- "prndl":true,
- "tirePressure":true,
- "engineTorque":false,
- "engineOilLife":true,
- "odometer":true,
- "gps":false,
- "fuelLevel_State":true,
- "instantFuelConsumption":false,
- "beltStatus":true,
- "bodyInformation":false,
- "deviceStatus":true,
- "driverBraking":true,
- "wiperStatus":false,
- "headLampStatus":true,
- "accPedalPosition":true,
- "steeringWheelAngle":true,
- "eCallInfo":false,
- "airbagStatus":true,
- "emergencyEvent":false,
- "clusterModeStatus":true,
- "myKey":true,
- "fuelRange":true,
- "turnSignal":true,
- "electronicParkBrakeStatus":true,
+ "request": {
+ "name": "UnsubscribeVehicleData",
+ "correlationID": 171,
+ "parameters": {
+ "speed": true,
+ "rpm": true,
+ "externalTemperature": false,
+ "fuelLevel": true,
+ "prndl": true,
+ "tirePressure": true,
+ "engineTorque": false,
+ "engineOilLife": true,
+ "odometer": true,
+ "gps": false,
+ "fuelLevel_State": true,
+ "instantFuelConsumption": false,
+ "beltStatus": true,
+ "bodyInformation": false,
+ "deviceStatus": true,
+ "driverBraking": true,
+ "wiperStatus": false,
+ "headLampStatus": true,
+ "accPedalPosition": true,
+ "steeringWheelAngle": true,
+ "eCallInfo": false,
+ "airbagStatus": true,
+ "emergencyEvent": false,
+ "clusterModeStatus": true,
+ "myKey": true,
+ "fuelRange": true,
+ "turnSignal": true,
+ "electronicParkBrakeStatus": true,
"stabilityControlsStatus": true,
"handsOffSteering": true,
"gearStatus": true,
- "oemCustomVehicleDataName":true,
+ "oemCustomVehicleDataName": true,
"windowStatus": true
}
},
- "response":{
- "name":"UnsubscribeVehicleDataResponse",
- "correlationID":172,
- "parameters":{
- "speed":{
- "dataType":"VEHICLEDATA_SPEED",
- "resultCode":"SUCCESS"
- },
- "rpm":{
- "dataType":"VEHICLEDATA_RPM",
- "resultCode":"SUCCESS"
- },
- "externalTemperature":{
- "dataType":"VEHICLEDATA_EXTERNTEMP",
- "resultCode":"SUCCESS"
- },
- "fuelLevel":{
- "dataType":"VEHICLEDATA_FUELLEVEL",
- "resultCode":"SUCCESS"
- },
- "prndl":{
- "dataType":"VEHICLEDATA_PRNDL",
- "resultCode":"SUCCESS"
- },
- "tirePressure":{
- "dataType":"VEHICLEDATA_TIREPRESSURE",
- "resultCode":"VEHICLE_DATA_NOT_AVAILABLE"
- },
- "engineTorque":{
- "dataType":"VEHICLEDATA_SPEED",
- "resultCode":"INVALID_ID"
- },
- "engineOilLife":{
- "dataType":"VEHICLEDATA_ENGINEOILLIFE",
- "resultCode":"SUCCESS"
- },
- "odometer":{
- "dataType":"VEHICLEDATA_ODOMETER",
- "resultCode":"SUCCESS"
- },
- "gps":{
- "dataType":"VEHICLEDATA_GPS",
- "resultCode":"SUCCESS"
- },
- "fuelLevel_State":{
- "dataType":"VEHICLEDATA_FUELLEVEL_STATE",
- "resultCode":"DISALLOWED"
- },
- "instantFuelConsumption":{
- "dataType":"VEHICLEDATA_FUELCONSUMPTION",
- "resultCode":"USER_DISALLOWED"
- },
- "beltStatus":{
- "dataType":"VEHICLEDATA_BELTSTATUS",
- "resultCode":"SUCCESS"
- },
- "bodyInformation":{
- "dataType":"VEHICLEDATA_BODYINFO",
- "resultCode":"SUCCESS"
- },
- "deviceStatus":{
- "dataType":"VEHICLEDATA_DEVICESTATUS",
- "resultCode":"SUCCESS"
- },
- "driverBraking":{
- "dataType":"VEHICLEDATA_BRAKING",
- "resultCode":"DISALLOWED"
- },
- "wiperStatus":{
- "dataType":"VEHICLEDATA_WIPERSTATUS",
- "resultCode":"VEHICLE_DATA_NOT_AVAILABLE"
- },
- "headLampStatus":{
- "dataType":"VEHICLEDATA_HEADLAMPSTATUS",
- "resultCode":"USER_DISALLOWED"
- },
- "accPedalPosition":{
- "dataType":"VEHICLEDATA_ACCPEDAL",
- "resultCode":"DISALLOWED"
- },
- "steeringWheelAngle":{
- "dataType":"VEHICLEDATA_STEERINGWHEEL",
- "resultCode":"DATA_NOT_SUBSCRIBED"
- },
- "eCallInfo":{
- "dataType":"VEHICLEDATA_ECALLINFO",
- "resultCode":"SUCCESS"
- },
- "airbagStatus":{
- "dataType":"VEHICLEDATA_AIRBAGSTATUS",
- "resultCode":"DATA_ALREADY_SUBSCRIBED"
- },
- "emergencyEvent":{
- "dataType":"VEHICLEDATA_EMERGENCYEVENT",
- "resultCode":"DISALLOWED"
- },
- "clusterModes":{
- "dataType":"VEHICLEDATA_CLUSTERMODESTATUS",
- "resultCode":"SUCCESS"
- },
- "myKey":{
- "dataType":"VEHICLEDATA_MYKEY",
- "resultCode":"IGNORED"
- },
- "fuelRange":{
- "dataType":"VEHICLEDATA_FUELRANGE",
- "resultCode":"SUCCESS"
+ "response": {
+ "name": "UnsubscribeVehicleDataResponse",
+ "correlationID": 172,
+ "parameters": {
+ "speed": {
+ "dataType": "VEHICLEDATA_SPEED",
+ "resultCode": "SUCCESS"
+ },
+ "rpm": {
+ "dataType": "VEHICLEDATA_RPM",
+ "resultCode": "SUCCESS"
+ },
+ "externalTemperature": {
+ "dataType": "VEHICLEDATA_EXTERNTEMP",
+ "resultCode": "SUCCESS"
+ },
+ "fuelLevel": {
+ "dataType": "VEHICLEDATA_FUELLEVEL",
+ "resultCode": "SUCCESS"
+ },
+ "prndl": {
+ "dataType": "VEHICLEDATA_PRNDL",
+ "resultCode": "SUCCESS"
+ },
+ "tirePressure": {
+ "dataType": "VEHICLEDATA_TIREPRESSURE",
+ "resultCode": "VEHICLE_DATA_NOT_AVAILABLE"
+ },
+ "engineTorque": {
+ "dataType": "VEHICLEDATA_SPEED",
+ "resultCode": "INVALID_ID"
+ },
+ "engineOilLife": {
+ "dataType": "VEHICLEDATA_ENGINEOILLIFE",
+ "resultCode": "SUCCESS"
+ },
+ "odometer": {
+ "dataType": "VEHICLEDATA_ODOMETER",
+ "resultCode": "SUCCESS"
+ },
+ "gps": {
+ "dataType": "VEHICLEDATA_GPS",
+ "resultCode": "SUCCESS"
+ },
+ "fuelLevel_State": {
+ "dataType": "VEHICLEDATA_FUELLEVEL_STATE",
+ "resultCode": "DISALLOWED"
+ },
+ "instantFuelConsumption": {
+ "dataType": "VEHICLEDATA_FUELCONSUMPTION",
+ "resultCode": "USER_DISALLOWED"
+ },
+ "beltStatus": {
+ "dataType": "VEHICLEDATA_BELTSTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "bodyInformation": {
+ "dataType": "VEHICLEDATA_BODYINFO",
+ "resultCode": "SUCCESS"
+ },
+ "deviceStatus": {
+ "dataType": "VEHICLEDATA_DEVICESTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "driverBraking": {
+ "dataType": "VEHICLEDATA_BRAKING",
+ "resultCode": "DISALLOWED"
+ },
+ "wiperStatus": {
+ "dataType": "VEHICLEDATA_WIPERSTATUS",
+ "resultCode": "VEHICLE_DATA_NOT_AVAILABLE"
+ },
+ "headLampStatus": {
+ "dataType": "VEHICLEDATA_HEADLAMPSTATUS",
+ "resultCode": "USER_DISALLOWED"
+ },
+ "accPedalPosition": {
+ "dataType": "VEHICLEDATA_ACCPEDAL",
+ "resultCode": "DISALLOWED"
+ },
+ "steeringWheelAngle": {
+ "dataType": "VEHICLEDATA_STEERINGWHEEL",
+ "resultCode": "DATA_NOT_SUBSCRIBED"
+ },
+ "eCallInfo": {
+ "dataType": "VEHICLEDATA_ECALLINFO",
+ "resultCode": "SUCCESS"
+ },
+ "airbagStatus": {
+ "dataType": "VEHICLEDATA_AIRBAGSTATUS",
+ "resultCode": "DATA_ALREADY_SUBSCRIBED"
+ },
+ "emergencyEvent": {
+ "dataType": "VEHICLEDATA_EMERGENCYEVENT",
+ "resultCode": "DISALLOWED"
+ },
+ "clusterModes": {
+ "dataType": "VEHICLEDATA_CLUSTERMODESTATUS",
+ "resultCode": "SUCCESS"
+ },
+ "myKey": {
+ "dataType": "VEHICLEDATA_MYKEY",
+ "resultCode": "IGNORED"
+ },
+ "fuelRange": {
+ "dataType": "VEHICLEDATA_FUELRANGE",
+ "resultCode": "SUCCESS"
},
- "turnSignal":{
- "dataType":"VEHICLEDATA_TURNSIGNAL",
- "resultCode":"IGNORED"
+ "turnSignal": {
+ "dataType": "VEHICLEDATA_TURNSIGNAL",
+ "resultCode": "IGNORED"
},
- "electronicParkBrakeStatus":{
- "dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
- "resultCode":"SUCCESS"
+ "electronicParkBrakeStatus": {
+ "dataType": "VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
+ "resultCode": "SUCCESS"
},
- "handsOffSteering":{
- "dataType":"VEHICLEDATA_HANDSOFFSTEERING",
- "resultCode":"SUCCESS"
+ "handsOffSteering": {
+ "dataType": "VEHICLEDATA_HANDSOFFSTEERING",
+ "resultCode": "SUCCESS"
},
- "gearStatus":{
- "dataType":"VEHICLEDATA_GEARSTATUS",
- "resultCode":"SUCCESS"
+ "gearStatus": {
+ "dataType": "VEHICLEDATA_GEARSTATUS",
+ "resultCode": "SUCCESS"
},
- "stabilityControlsStatus":{
- "dataType":"VEHICLEDATA_STABILITYCONTROLSSTATUS",
- "resultCode":"SUCCESS"
+ "stabilityControlsStatus": {
+ "dataType": "VEHICLEDATA_STABILITYCONTROLSSTATUS",
+ "resultCode": "SUCCESS"
},
- "oemCustomVehicleDataName":{
- "oemCustomDataType":"oemCustomVehicleDataName",
- "resultCode":"SUCCESS"
+ "oemCustomVehicleDataName": {
+ "oemCustomDataType": "oemCustomVehicleDataName",
+ "resultCode": "SUCCESS"
},
- "windowStatus":{
- "dataType":"VEHICLEDATA_WINDOWSTATUS",
- "resultCode":"SUCCESS"
+ "windowStatus": {
+ "dataType": "VEHICLEDATA_WINDOWSTATUS",
+ "resultCode": "SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json
index 60e2a98e4..ff33e3281 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeWayPoints.json
@@ -1,10 +1,10 @@
{
- "request":{
- "name":"UnsubscribeWayPoints",
- "correlationID":201
+ "request": {
+ "name": "UnsubscribeWayPoints",
+ "correlationID": 201
},
- "response":{
- "name":"UnsubscribeWayPointsResponse",
- "correlationID":202
+ "response": {
+ "name": "UnsubscribeWayPointsResponse",
+ "correlationID": 202
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UpdateTurnList.json b/android/sdl_android/src/androidTest/assets/json/UpdateTurnList.json
index 9cd449acd..fbeb08de5 100644
--- a/android/sdl_android/src/androidTest/assets/json/UpdateTurnList.json
+++ b/android/sdl_android/src/androidTest/assets/json/UpdateTurnList.json
@@ -1,52 +1,52 @@
{
- "request":{
- "name":"UpdateTurnList",
- "correlationID":192,
- "parameters":{
- "softButtons":[
+ "request": {
+ "name": "UpdateTurnList",
+ "correlationID": 192,
+ "parameters": {
+ "softButtons": [
{
- "isHighlighted":true,
- "softButtonID":6,
- "systemAction":"STEAL_FOCUS",
- "text":"Button 1",
- "type":"IMAGE",
- "image":{
- "value":"image.png",
- "imageType":"STATIC"
+ "isHighlighted": true,
+ "softButtonID": 6,
+ "systemAction": "STEAL_FOCUS",
+ "text": "Button 1",
+ "type": "IMAGE",
+ "image": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
},
{
- "isHighlighted":false,
- "softButtonID":3,
- "systemAction":"DEFAULT_ACTION",
- "text":"Button 2",
- "type":"BOTH",
- "image":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "isHighlighted": false,
+ "softButtonID": 3,
+ "systemAction": "DEFAULT_ACTION",
+ "text": "Button 2",
+ "type": "BOTH",
+ "image": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
}
],
- "turnList":[
+ "turnList": [
{
- "navigationText":"nav text 1",
- "turnIcon":{
- "value":"image.png",
- "imageType":"DYNAMIC"
+ "navigationText": "nav text 1",
+ "turnIcon": {
+ "value": "image.png",
+ "imageType": "DYNAMIC"
}
},
{
- "navigationText":"nav text 2",
- "turnIcon":{
- "value":"image.png",
- "imageType":"STATIC"
+ "navigationText": "nav text 2",
+ "turnIcon": {
+ "value": "image.png",
+ "imageType": "STATIC"
}
}
]
}
},
- "response":{
- "name":"UpdateTurnListResponse",
- "correlationID":193
+ "response": {
+ "name": "UpdateTurnListResponse",
+ "correlationID": 193
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/ManagerUtilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/ManagerUtilityTests.java
index 0257be444..bfa12e8c5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/ManagerUtilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/ManagerUtilityTests.java
@@ -31,174 +31,175 @@ import static junit.framework.TestCase.assertTrue;
public class ManagerUtilityTests {
- @Before
- public void setUp() throws Exception{
-
- }
-
- // TESTS
-
- @Test
- public void testGetAllImageFields(){
-
- List<ImageField> fields = ManagerUtility.WindowCapabilityUtility.getAllImageFields();
- assertNotNull(fields);
- int size = fields.size();
- assertEquals(ImageFieldName.values().length, size);
-
- ImageFieldName[] names = ImageFieldName.values();
-
- boolean found;
- for (ImageFieldName name : names) {
- found = false;
- for(ImageField field : fields) {
- if(field != null
- && field.getName() != null
- && field.getName().equals(name)) {
- found = true;
- break;
- }
- }
- assertTrue(found);
- }
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ // TESTS
+
+ @Test
+ public void testGetAllImageFields() {
+
+ List<ImageField> fields = ManagerUtility.WindowCapabilityUtility.getAllImageFields();
+ assertNotNull(fields);
+ int size = fields.size();
+ assertEquals(ImageFieldName.values().length, size);
+
+ ImageFieldName[] names = ImageFieldName.values();
+
+ boolean found;
+ for (ImageFieldName name : names) {
+ found = false;
+ for (ImageField field : fields) {
+ if (field != null
+ && field.getName() != null
+ && field.getName().equals(name)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue(found);
+ }
- }
-
- @Test
- public void testGetAllTextFields(){
-
- List<TextField> fields = ManagerUtility.WindowCapabilityUtility.getAllTextFields();
- assertNotNull(fields);
- int size = fields.size();
- assertEquals(TextFieldName.values().length, size);
-
- TextFieldName[] names = TextFieldName.values();
-
- boolean found;
- for (TextFieldName name : names) {
- found = false;
- for(TextField field : fields) {
- if(field != null
- && field.getName() != null
- && field.getName().equals(name)) {
- found = true;
- break;
- }
- }
- assertTrue(found);
- }
-
- }
-
- @Test
- public void testHasTextFieldOfName() {
- WindowCapability capability = new WindowCapability();
- List<TextField> textFieldList = new ArrayList<>();
- textFieldList.add(new TextField(TextFieldName.mainField1, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(textFieldList);
-
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
-
- textFieldList.add(new TextField(TextFieldName.alertText3, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(textFieldList);
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
-
- textFieldList.clear();
- textFieldList.add(null);
- capability.setTextFields(textFieldList);
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
-
- textFieldList.add(new TextField(TextFieldName.alertText3, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(textFieldList);
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
-
- }
-
- @Test
- public void testHasImageFieldOfName() {
-
- WindowCapability capability = new WindowCapability();
- List<FileType> allImageFileTypes = Arrays.asList(FileType.GRAPHIC_BMP, FileType.GRAPHIC_JPEG, FileType.GRAPHIC_PNG);
-
- List<ImageField> imageFieldList = new ArrayList<>();
- imageFieldList.add(new ImageField(ImageFieldName.graphic, allImageFileTypes));
- capability.setImageFields(imageFieldList);
-
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
-
- imageFieldList.add(new ImageField(ImageFieldName.alertIcon, allImageFileTypes));
- capability.setImageFields(imageFieldList);
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));;
-
- imageFieldList.clear();
- imageFieldList.add(null);
- capability.setImageFields(imageFieldList);
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
-
- imageFieldList.add(new ImageField(ImageFieldName.alertIcon, allImageFileTypes));
- capability.setImageFields(imageFieldList);
- assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
- assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
-
- }
-
-
- @Test
- public void testGetMaxNumberOfMainFieldLines() {
-
- WindowCapability capability = new WindowCapability();
- capability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
-
- int maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
-
- assertEquals(4, maxNumerOfLines);
-
- //Single line
- List<TextField> singleLineList = new ArrayList<>();
- singleLineList.add(new TextField(TextFieldName.mainField1, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(singleLineList);
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(1, maxNumerOfLines);
-
- singleLineList.add(new TextField(TextFieldName.mainField2, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(singleLineList);
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(2, maxNumerOfLines);
-
- singleLineList.add(new TextField(TextFieldName.mainField3, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(singleLineList);
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(3, maxNumerOfLines);
-
- singleLineList.add(new TextField(TextFieldName.mainField4, CharacterSet.UTF_8, 500, 8));
- capability.setTextFields(singleLineList);
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(4, maxNumerOfLines);
-
- List<TextField> nullList = new ArrayList<>();
- nullList.add(null);
- assertNotNull(nullList);
- capability.setTextFields(nullList);
- assertNotNull(capability);
- assertNotNull(capability.getTextFields());
-
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(0, maxNumerOfLines);
-
- nullList.add(new TextField(TextFieldName.mainField4, CharacterSet.UTF_8, 500, 8));
- assertNotNull(nullList);
- capability.setTextFields(nullList);
- assertNotNull(capability);
- assertNotNull(capability.getTextFields());
- maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
- assertEquals(4, maxNumerOfLines);
-
- }
+ }
+
+ @Test
+ public void testGetAllTextFields() {
+
+ List<TextField> fields = ManagerUtility.WindowCapabilityUtility.getAllTextFields();
+ assertNotNull(fields);
+ int size = fields.size();
+ assertEquals(TextFieldName.values().length, size);
+
+ TextFieldName[] names = TextFieldName.values();
+
+ boolean found;
+ for (TextFieldName name : names) {
+ found = false;
+ for (TextField field : fields) {
+ if (field != null
+ && field.getName() != null
+ && field.getName().equals(name)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue(found);
+ }
+
+ }
+
+ @Test
+ public void testHasTextFieldOfName() {
+ WindowCapability capability = new WindowCapability();
+ List<TextField> textFieldList = new ArrayList<>();
+ textFieldList.add(new TextField(TextFieldName.mainField1, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(textFieldList);
+
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
+
+ textFieldList.add(new TextField(TextFieldName.alertText3, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(textFieldList);
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
+
+ textFieldList.clear();
+ textFieldList.add(null);
+ capability.setTextFields(textFieldList);
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
+
+ textFieldList.add(new TextField(TextFieldName.alertText3, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(textFieldList);
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.mainField1));
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(capability, TextFieldName.alertText3));
+
+ }
+
+ @Test
+ public void testHasImageFieldOfName() {
+
+ WindowCapability capability = new WindowCapability();
+ List<FileType> allImageFileTypes = Arrays.asList(FileType.GRAPHIC_BMP, FileType.GRAPHIC_JPEG, FileType.GRAPHIC_PNG);
+
+ List<ImageField> imageFieldList = new ArrayList<>();
+ imageFieldList.add(new ImageField(ImageFieldName.graphic, allImageFileTypes));
+ capability.setImageFields(imageFieldList);
+
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
+
+ imageFieldList.add(new ImageField(ImageFieldName.alertIcon, allImageFileTypes));
+ capability.setImageFields(imageFieldList);
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
+ ;
+
+ imageFieldList.clear();
+ imageFieldList.add(null);
+ capability.setImageFields(imageFieldList);
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
+
+ imageFieldList.add(new ImageField(ImageFieldName.alertIcon, allImageFileTypes));
+ capability.setImageFields(imageFieldList);
+ assertFalse(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.graphic));
+ assertTrue(ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(capability, ImageFieldName.alertIcon));
+
+ }
+
+
+ @Test
+ public void testGetMaxNumberOfMainFieldLines() {
+
+ WindowCapability capability = new WindowCapability();
+ capability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
+
+ int maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+
+ assertEquals(4, maxNumerOfLines);
+
+ //Single line
+ List<TextField> singleLineList = new ArrayList<>();
+ singleLineList.add(new TextField(TextFieldName.mainField1, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(singleLineList);
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(1, maxNumerOfLines);
+
+ singleLineList.add(new TextField(TextFieldName.mainField2, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(singleLineList);
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(2, maxNumerOfLines);
+
+ singleLineList.add(new TextField(TextFieldName.mainField3, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(singleLineList);
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(3, maxNumerOfLines);
+
+ singleLineList.add(new TextField(TextFieldName.mainField4, CharacterSet.UTF_8, 500, 8));
+ capability.setTextFields(singleLineList);
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(4, maxNumerOfLines);
+
+ List<TextField> nullList = new ArrayList<>();
+ nullList.add(null);
+ assertNotNull(nullList);
+ capability.setTextFields(nullList);
+ assertNotNull(capability);
+ assertNotNull(capability.getTextFields());
+
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(0, maxNumerOfLines);
+
+ nullList.add(new TextField(TextFieldName.mainField4, CharacterSet.UTF_8, 500, 8));
+ assertNotNull(nullList);
+ capability.setTextFields(nullList);
+ assertNotNull(capability);
+ assertNotNull(capability.getTextFields());
+ maxNumerOfLines = ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(capability);
+ assertEquals(4, maxNumerOfLines);
+
+ }
}
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 760a8e40d..c263db59d 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
@@ -51,364 +51,364 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class SdlManagerTests {
- public static BaseTransportConfig transport = null;
- private Context mTestContext;
- private Vector<AppHMIType> appType;
- private TemplateColorScheme templateColorScheme;
- private int listenerCalledCounter;
- private SdlManager sdlManager;
- private ISdl internalInterface;
-
- // transport related
- @SuppressWarnings("FieldCanBeLocal")
- private int TCP_PORT = 12345;
- @SuppressWarnings("FieldCanBeLocal")
- private String DEV_MACHINE_IP_ADDRESS = "0.0.0.0";
-
- @Before
- public void setUp() throws Exception{
- mTestContext = Mockito.mock(Context.class);
-
- // set transport
- transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
-
- // add AppTypes
- appType = new Vector<>();
- appType.add(AppHMIType.DEFAULT);
-
- // Color Scheme
- templateColorScheme = new TemplateColorScheme();
- templateColorScheme.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
- templateColorScheme.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
- templateColorScheme.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
-
- sdlManager = createSampleManager("heyApp", "123456", TestValues.GENERAL_LOCKSCREENCONFIG);
- }
-
- // SETUP / HELPERS
-
- private Context getTestContext() {
- return mTestContext;
- }
-
- private SdlManager createSampleManager(String appName, String appId, LockScreenConfig lockScreenConfig){
- SdlManager manager;
-
- SdlManagerListener listener = new SdlManagerListener() {
- @Override
- public void onStart() {
- listenerCalledCounter++;
- }
-
- @Override
- public void onDestroy() {
-
- }
-
- @Override
- public void onError(String info, Exception e) {
-
- }
-
- @Override
- public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
- return null;
- }
- };
-
- // build manager object - use all setters, will test using getters below
- SdlManager.Builder builder = new SdlManager.Builder(getTestContext(),appId,appName,listener);
- builder.setShortAppName(appName);
- builder.setAppTypes(appType);
- builder.setTransportType(transport);
- builder.setLanguage(Language.EN_US);
- builder.setDayColorScheme(templateColorScheme);
- builder.setNightColorScheme(templateColorScheme);
- builder.setVrSynonyms(TestValues.GENERAL_VECTOR_STRING);
- builder.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
- builder.setLockScreenConfig(lockScreenConfig);
- builder.setMinimumProtocolVersion(TestValues.GENERAL_VERSION);
- builder.setMinimumRPCVersion(TestValues.GENERAL_VERSION);
- builder.setContext(mTestContext);
- manager = builder.build();
-
- // mock internalInterface and set it manually
- internalInterface = mock(ISdl.class);
- when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
- manager._internalInterface = internalInterface;
-
- return manager;
- }
-
- // TESTS
-
- @Test
- public void testNotNull(){
- assertNotNull(createSampleManager("app","123456", TestValues.GENERAL_LOCKSCREENCONFIG));
- }
-
- @Test
- public void testMissingAppName() {
- try {
- createSampleManager(null,"123456", TestValues.GENERAL_LOCKSCREENCONFIG);
- } catch (IllegalArgumentException ex) {
- assertSame(ex.getMessage(), "You must specify an app name by calling setAppName");
- }
- }
-
- @Test
- public void testMissingAppId() {
- try {
- createSampleManager("app",null, TestValues.GENERAL_LOCKSCREENCONFIG);
- } catch (IllegalArgumentException ex) {
- assertSame(ex.getMessage(), "You must specify an app ID by calling setAppId");
- }
- }
-
- @Test
- public void testManagerSetters() {
- assertEquals("123456", sdlManager.getAppId());
- assertEquals("heyApp", sdlManager.getAppName());
- assertEquals("heyApp", sdlManager.getShortAppName());
- assertEquals(appType, sdlManager.getAppTypes());
- assertEquals(Language.EN_US, sdlManager.getHmiLanguage());
- assertEquals(Language.EN_US, sdlManager.getLanguage());
- assertEquals(transport, sdlManager.getTransport());
- assertEquals(templateColorScheme, sdlManager.getDayColorScheme());
- assertEquals(templateColorScheme, sdlManager.getNightColorScheme());
- assertEquals(TestValues.GENERAL_VECTOR_STRING, sdlManager.getVrSynonyms());
- assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, sdlManager.getTtsChunks());
- assertEquals(TestValues.GENERAL_LOCKSCREENCONFIG, sdlManager.getLockScreenConfig());
- assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumProtocolVersion());
- assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumRPCVersion());
- }
-
- @Test
- public void testStartingManager(){
- listenerCalledCounter = 0;
-
- try {
- sdlManager.start();
- } catch (Exception e) {
- }
-
- // Create and force all sub managers to be ready manually. Because SdlManager will not start until all sub managers are ready.
- // Note: SdlManager.initialize() will not be called automatically by proxy as in real life because we have mock proxy not a real one
- sdlManager.initialize();
-
- // Set all sub managers' states to ready
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
-
- // Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
- }
-
- @Test
- public void testManagerStates() {
- SdlManager sdlManager = createSampleManager("test", "00000", new LockScreenConfig());
- sdlManager.initialize();
-
-
- // Case 1-A:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.checkState();
- assertEquals(BaseSubManager.READY, sdlManager.getState());
-
-
- // Case 1-B:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.checkState();
- assertEquals(BaseSubManager.READY, sdlManager.getState());
-
-
- // Case 2-A:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.checkState();
- assertEquals(BaseSubManager.ERROR, sdlManager.getState());
-
-
- // Case 1-B:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.checkState();
- assertEquals(BaseSubManager.ERROR, sdlManager.getState());
-
-
- // Case 3-A:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.LIMITED);
- sdlManager.checkState();
- assertEquals(BaseSubManager.SETTING_UP, sdlManager.getState());
-
-
- // Case 3-B:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.checkState();
- assertEquals(BaseSubManager.SETTING_UP, sdlManager.getState());
-
-
- // Case 4-A:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.checkState();
- assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
-
-
- // Case 4-B:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.checkState();
- assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
-
-
- // Case 5-A:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.LIMITED);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
- sdlManager.checkState();
- assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
-
-
- // Case 5-B:
- sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
- sdlManager.getFileManager().transitionToState(BaseSubManager.LIMITED);
- sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
- sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
- sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
- sdlManager.checkState();
- assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
-
-
- // Case 6
- sdlManager.dispose();
- assertEquals(BaseSubManager.SHUTDOWN, sdlManager.getState());
- }
-
- @Test
- public void testSendRPC(){
- listenerCalledCounter = 0;
-
- // When internalInterface.sendRPC() is called, create a fake success response
- Answer<Void> answer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest request = (RPCRequest) args[0];
- RPCResponse response = new RPCResponse(FunctionID.GET_VEHICLE_DATA.toString());
- response.setSuccess(true);
- request.getOnRPCResponseListener().onResponse(0, response);
- return null;
- }
- };
- doAnswer(answer).when(internalInterface).sendRPC(any(RPCMessage.class));
-
-
- // Test send RPC request
- final GetVehicleData request = new GetVehicleData();
- request.setGps(true);
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- assertTrue(response.getSuccess());
- listenerCalledCounter++;
- }
- });
-
- sdlManager.sendRPC(request);
-
- // Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
- }
-
- @Test
- public void testSendRPCs(){
- testSendMultipleRPCs(false);
- }
-
- @Test
- public void testSendSequentialRPCs(){
- testSendMultipleRPCs(true);
- }
-
- private void testSendMultipleRPCs(boolean sequentialSend) {
- listenerCalledCounter = 0;
-
- // When internalInterface.sendRPCs() is called, call listener.onFinished() to fake the response
- final Answer<Void> answer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- listener.onFinished();
- return null;
- }
- };
-
- if (sequentialSend) {
- doAnswer(answer).when(internalInterface).sendSequentialRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- } else {
- doAnswer(answer).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
- }
-
-
- // Test send RPC requests
- List<RPCMessage> rpcsList = Arrays.asList(new GetVehicleData(), new Show(), new OnAppServiceData(), new GetAppServiceDataResponse());
- OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
- }
-
- @Override
- public void onFinished() {
- listenerCalledCounter++;
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- }
- };
- if (sequentialSend) {
- sdlManager.sendSequentialRPCs(rpcsList, onMultipleRequestListener);
- } else {
- sdlManager.sendRPCs(rpcsList, onMultipleRequestListener);
- }
-
-
- // Make sure the listener is called exactly once
- assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
- }
+ public static BaseTransportConfig transport = null;
+ private Context mTestContext;
+ private Vector<AppHMIType> appType;
+ private TemplateColorScheme templateColorScheme;
+ private int listenerCalledCounter;
+ private SdlManager sdlManager;
+ private ISdl internalInterface;
+
+ // transport related
+ @SuppressWarnings("FieldCanBeLocal")
+ private int TCP_PORT = 12345;
+ @SuppressWarnings("FieldCanBeLocal")
+ private String DEV_MACHINE_IP_ADDRESS = "0.0.0.0";
+
+ @Before
+ public void setUp() throws Exception {
+ mTestContext = Mockito.mock(Context.class);
+
+ // set transport
+ transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
+
+ // add AppTypes
+ appType = new Vector<>();
+ appType.add(AppHMIType.DEFAULT);
+
+ // Color Scheme
+ templateColorScheme = new TemplateColorScheme();
+ templateColorScheme.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
+ templateColorScheme.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
+ templateColorScheme.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
+
+ sdlManager = createSampleManager("heyApp", "123456", TestValues.GENERAL_LOCKSCREENCONFIG);
+ }
+
+ // SETUP / HELPERS
+
+ private Context getTestContext() {
+ return mTestContext;
+ }
+
+ private SdlManager createSampleManager(String appName, String appId, LockScreenConfig lockScreenConfig) {
+ SdlManager manager;
+
+ SdlManagerListener listener = new SdlManagerListener() {
+ @Override
+ public void onStart() {
+ listenerCalledCounter++;
+ }
+
+ @Override
+ public void onDestroy() {
+
+ }
+
+ @Override
+ public void onError(String info, Exception e) {
+
+ }
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
+ return null;
+ }
+ };
+
+ // build manager object - use all setters, will test using getters below
+ SdlManager.Builder builder = new SdlManager.Builder(getTestContext(), appId, appName, listener);
+ builder.setShortAppName(appName);
+ builder.setAppTypes(appType);
+ builder.setTransportType(transport);
+ builder.setLanguage(Language.EN_US);
+ builder.setDayColorScheme(templateColorScheme);
+ builder.setNightColorScheme(templateColorScheme);
+ builder.setVrSynonyms(TestValues.GENERAL_VECTOR_STRING);
+ builder.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
+ builder.setLockScreenConfig(lockScreenConfig);
+ builder.setMinimumProtocolVersion(TestValues.GENERAL_VERSION);
+ builder.setMinimumRPCVersion(TestValues.GENERAL_VERSION);
+ builder.setContext(mTestContext);
+ manager = builder.build();
+
+ // mock internalInterface and set it manually
+ internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
+ manager._internalInterface = internalInterface;
+
+ return manager;
+ }
+
+ // TESTS
+
+ @Test
+ public void testNotNull() {
+ assertNotNull(createSampleManager("app", "123456", TestValues.GENERAL_LOCKSCREENCONFIG));
+ }
+
+ @Test
+ public void testMissingAppName() {
+ try {
+ createSampleManager(null, "123456", TestValues.GENERAL_LOCKSCREENCONFIG);
+ } catch (IllegalArgumentException ex) {
+ assertSame(ex.getMessage(), "You must specify an app name by calling setAppName");
+ }
+ }
+
+ @Test
+ public void testMissingAppId() {
+ try {
+ createSampleManager("app", null, TestValues.GENERAL_LOCKSCREENCONFIG);
+ } catch (IllegalArgumentException ex) {
+ assertSame(ex.getMessage(), "You must specify an app ID by calling setAppId");
+ }
+ }
+
+ @Test
+ public void testManagerSetters() {
+ assertEquals("123456", sdlManager.getAppId());
+ assertEquals("heyApp", sdlManager.getAppName());
+ assertEquals("heyApp", sdlManager.getShortAppName());
+ assertEquals(appType, sdlManager.getAppTypes());
+ assertEquals(Language.EN_US, sdlManager.getHmiLanguage());
+ assertEquals(Language.EN_US, sdlManager.getLanguage());
+ assertEquals(transport, sdlManager.getTransport());
+ assertEquals(templateColorScheme, sdlManager.getDayColorScheme());
+ assertEquals(templateColorScheme, sdlManager.getNightColorScheme());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, sdlManager.getVrSynonyms());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, sdlManager.getTtsChunks());
+ assertEquals(TestValues.GENERAL_LOCKSCREENCONFIG, sdlManager.getLockScreenConfig());
+ assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumProtocolVersion());
+ assertEquals(TestValues.GENERAL_VERSION, sdlManager.getMinimumRPCVersion());
+ }
+
+ @Test
+ public void testStartingManager() {
+ listenerCalledCounter = 0;
+
+ try {
+ sdlManager.start();
+ } catch (Exception e) {
+ }
+
+ // Create and force all sub managers to be ready manually. Because SdlManager will not start until all sub managers are ready.
+ // Note: SdlManager.initialize() will not be called automatically by proxy as in real life because we have mock proxy not a real one
+ sdlManager.initialize();
+
+ // Set all sub managers' states to ready
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
+
+ // Make sure the listener is called exactly once
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
+ }
+
+ @Test
+ public void testManagerStates() {
+ SdlManager sdlManager = createSampleManager("test", "00000", new LockScreenConfig());
+ sdlManager.initialize();
+
+
+ // Case 1-A:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.READY, sdlManager.getState());
+
+
+ // Case 1-B:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.READY, sdlManager.getState());
+
+
+ // Case 2-A:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.ERROR, sdlManager.getState());
+
+
+ // Case 1-B:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.ERROR, sdlManager.getState());
+
+
+ // Case 3-A:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.LIMITED);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.SETTING_UP, sdlManager.getState());
+
+
+ // Case 3-B:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.SETTING_UP, sdlManager.getState());
+
+
+ // Case 4-A:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
+
+
+ // Case 4-B:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
+
+
+ // Case 5-A:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.LIMITED);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.READY);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
+
+
+ // Case 5-B:
+ sdlManager.getPermissionManager().transitionToState(BaseSubManager.READY);
+ sdlManager.getFileManager().transitionToState(BaseSubManager.LIMITED);
+ sdlManager.getScreenManager().transitionToState(BaseSubManager.ERROR);
+ sdlManager.getLockScreenConfig().setDisplayMode(LockScreenConfig.DISPLAY_MODE_NEVER);
+ sdlManager.getLockScreenManager().transitionToState(BaseSubManager.SETTING_UP);
+ sdlManager.checkState();
+ assertEquals(BaseSubManager.LIMITED, sdlManager.getState());
+
+
+ // Case 6
+ sdlManager.dispose();
+ assertEquals(BaseSubManager.SHUTDOWN, sdlManager.getState());
+ }
+
+ @Test
+ public void testSendRPC() {
+ listenerCalledCounter = 0;
+
+ // When internalInterface.sendRPC() is called, create a fake success response
+ Answer<Void> answer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest request = (RPCRequest) args[0];
+ RPCResponse response = new RPCResponse(FunctionID.GET_VEHICLE_DATA.toString());
+ response.setSuccess(true);
+ request.getOnRPCResponseListener().onResponse(0, response);
+ return null;
+ }
+ };
+ doAnswer(answer).when(internalInterface).sendRPC(any(RPCMessage.class));
+
+
+ // Test send RPC request
+ final GetVehicleData request = new GetVehicleData();
+ request.setGps(true);
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ assertTrue(response.getSuccess());
+ listenerCalledCounter++;
+ }
+ });
+
+ sdlManager.sendRPC(request);
+
+ // Make sure the listener is called exactly once
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
+ }
+
+ @Test
+ public void testSendRPCs() {
+ testSendMultipleRPCs(false);
+ }
+
+ @Test
+ public void testSendSequentialRPCs() {
+ testSendMultipleRPCs(true);
+ }
+
+ private void testSendMultipleRPCs(boolean sequentialSend) {
+ listenerCalledCounter = 0;
+
+ // When internalInterface.sendRPCs() is called, call listener.onFinished() to fake the response
+ final Answer<Void> answer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ listener.onFinished();
+ return null;
+ }
+ };
+
+ if (sequentialSend) {
+ doAnswer(answer).when(internalInterface).sendSequentialRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ } else {
+ doAnswer(answer).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+
+ // Test send RPC requests
+ List<RPCMessage> rpcsList = Arrays.asList(new GetVehicleData(), new Show(), new OnAppServiceData(), new GetAppServiceDataResponse());
+ OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+ }
+
+ @Override
+ public void onFinished() {
+ listenerCalledCounter++;
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ }
+ };
+ if (sequentialSend) {
+ sdlManager.sendSequentialRPCs(rpcsList, onMultipleRequestListener);
+ } else {
+ sdlManager.sendRPCs(rpcsList, onMultipleRequestListener);
+ }
+
+
+ // Make sure the listener is called exactly once
+ assertEquals("Listener was not called or called more/less frequently than expected", 1, listenerCalledCounter);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/audio/AudioStreamManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/audio/AudioStreamManagerTest.java
index cf6735ab6..ce8183b9d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/audio/AudioStreamManagerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/audio/AudioStreamManagerTest.java
@@ -9,20 +9,20 @@ import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.audio.AudioStreamManager.SampleType;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.streaming.audio.IAudioStreamListener;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.protocol.ISdlServiceListener;
+import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AudioType;
import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.session.SdlSession;
+import com.smartdevicelink.streaming.audio.IAudioStreamListener;
import junit.framework.TestCase;
@@ -83,6 +83,7 @@ public class AudioStreamManagerTest extends TestCase {
Answer<Void> audioServiceAnswer = new Answer<Void>() {
ISdlServiceListener serviceListener = null;
+
@Override
public Void answer(InvocationOnMock invocation) {
Method method = invocation.getMethod();
@@ -228,6 +229,7 @@ public class AudioStreamManagerTest extends TestCase {
private int testFullAudioManagerDecodeFlowCorrectCounter = 0;
private int testFullAudioManagerDecodeFlowWrongCounter = 0;
+
private void runFullAudioManagerDecodeFlowWithSquareSampleAudio(final int sampleRate, final @SampleType int sampleType, final AudioPassThruCapabilities audioCapabilities) {
testFullAudioManagerDecodeFlowCorrectCounter = 0;
testFullAudioManagerDecodeFlowWrongCounter = 0;
@@ -272,6 +274,7 @@ public class AudioStreamManagerTest extends TestCase {
Answer<Void> audioServiceAnswer = new Answer<Void>() {
ISdlServiceListener serviceListener = null;
+
@Override
public Void answer(InvocationOnMock invocation) {
Method method = invocation.getMethod();
@@ -310,7 +313,7 @@ public class AudioStreamManagerTest extends TestCase {
assertEquals(true, success);
// not more than 2.5 percent samples must be wrong
- double relation = 100.0 * (double)testFullAudioManagerDecodeFlowWrongCounter / (double)testFullAudioManagerDecodeFlowCorrectCounter;
+ double relation = 100.0 * (double) testFullAudioManagerDecodeFlowWrongCounter / (double) testFullAudioManagerDecodeFlowCorrectCounter;
Log.v(TAG, "Validating number of correct samples (" + Math.round(relation) + "%)");
if (relation > 2.5) {
fail("Validating raw audio failed. " + Math.round(relation) + " % wrong samples detected. Correct: " + testFullAudioManagerDecodeFlowCorrectCounter + ", Wrong: " + testFullAudioManagerDecodeFlowWrongCounter);
@@ -411,11 +414,11 @@ public class AudioStreamManagerTest extends TestCase {
// channel count, sample rate, sample type
int key_channel_count = 0, key_sample_rate = 1, key_sample_type = 2, key_sample_type_result = 3;
- int[][] tests = new int[][] {
- { 47, 42000, AudioFormat.ENCODING_PCM_8BIT, SampleType.UNSIGNED_8_BIT },
- { 2, 16000, AudioFormat.ENCODING_PCM_16BIT, SampleType.SIGNED_16_BIT },
- { 1, 22050, AudioFormat.ENCODING_PCM_FLOAT, SampleType.FLOAT },
- { 3, 48000, AudioFormat.ENCODING_INVALID, SampleType.SIGNED_16_BIT },
+ int[][] tests = new int[][]{
+ {47, 42000, AudioFormat.ENCODING_PCM_8BIT, SampleType.UNSIGNED_8_BIT},
+ {2, 16000, AudioFormat.ENCODING_PCM_16BIT, SampleType.SIGNED_16_BIT},
+ {1, 22050, AudioFormat.ENCODING_PCM_FLOAT, SampleType.FLOAT},
+ {3, 48000, AudioFormat.ENCODING_INVALID, SampleType.SIGNED_16_BIT},
};
for (int[] test : tests) {
@@ -502,6 +505,7 @@ public class AudioStreamManagerTest extends TestCase {
Answer<Void> audioServiceAnswer = new Answer<Void>() {
ISdlServiceListener serviceListener = null;
+
@Override
public Void answer(InvocationOnMock invocation) {
Method method = invocation.getMethod();
@@ -629,7 +633,7 @@ public class AudioStreamManagerTest extends TestCase {
}
});
- verify(audioStreamListener, timeout(10000)).sendAudio(any(ByteBuffer.class), any(Long.class), eq(completionListener));
+ verify(audioStreamListener, timeout(10000)).sendAudio(any(ByteBuffer.class), any(Long.class), eq(completionListener));
}
private Method getSampleAtTargetMethod() {
@@ -666,10 +670,10 @@ public class AudioStreamManagerTest extends TestCase {
header[2] = 'F';
header[3] = 'F';
// Total data length (UInt32).
- header[4] = (byte)((datalength) & 0xff);
- header[5] = (byte)((datalength >> 8) & 0xff);
- header[6] = (byte)((datalength >> 16) & 0xff);
- header[7] = (byte)((datalength >> 24) & 0xff);
+ header[4] = (byte) ((datalength) & 0xff);
+ header[5] = (byte) ((datalength >> 8) & 0xff);
+ header[6] = (byte) ((datalength >> 16) & 0xff);
+ header[7] = (byte) ((datalength >> 24) & 0xff);
// WAVE header.
header[8] = 'W';
header[9] = 'A';
@@ -686,42 +690,44 @@ public class AudioStreamManagerTest extends TestCase {
header[18] = 0;
header[19] = 0;
// Format type (UInt16). Set 1 for PCM.
- header[20] = (byte)((format) & 0xff);
- header[21] = (byte)((format >> 8) & 0xff);
+ header[20] = (byte) ((format) & 0xff);
+ header[21] = (byte) ((format >> 8) & 0xff);
// Channels
- header[22] = (byte)((channels) & 0xff);
- header[23] = (byte)((channels >> 8) & 0xff);
+ header[22] = (byte) ((channels) & 0xff);
+ header[23] = (byte) ((channels >> 8) & 0xff);
// Sample rate (UInt32).
- header[24] = (byte)((samplerate) & 0xff);
- header[25] = (byte)((samplerate >> 8) & 0xff);
- header[26] = (byte)((samplerate >> 16) & 0xff);
- header[27] = (byte)((samplerate >> 24) & 0xff);
+ header[24] = (byte) ((samplerate) & 0xff);
+ header[25] = (byte) ((samplerate >> 8) & 0xff);
+ header[26] = (byte) ((samplerate >> 16) & 0xff);
+ header[27] = (byte) ((samplerate >> 24) & 0xff);
// Byte rate (UInt32).
- header[28] = (byte)((byterate) & 0xff);
- header[29] = (byte)((byterate >> 8) & 0xff);
- header[30] = (byte)((byterate >> 16) & 0xff);
- header[31] = (byte)((byterate >> 24) & 0xff);
+ header[28] = (byte) ((byterate) & 0xff);
+ header[29] = (byte) ((byterate >> 8) & 0xff);
+ header[30] = (byte) ((byterate >> 16) & 0xff);
+ header[31] = (byte) ((byterate >> 24) & 0xff);
// Block alignment (UInt16).
- header[32] = (byte)((blockalign) & 0xff);
- header[33] = (byte)((blockalign >> 8) & 0xff);
+ header[32] = (byte) ((blockalign) & 0xff);
+ header[33] = (byte) ((blockalign >> 8) & 0xff);
// Bits per sample (UInt16).
- header[34] = (byte)((bitspersample) & 0xff);
- header[35] = (byte)((bitspersample >> 8) & 0xff);
+ header[34] = (byte) ((bitspersample) & 0xff);
+ header[35] = (byte) ((bitspersample >> 8) & 0xff);
// Data header
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
// Total audio length (UInt32).
- header[40] = (byte)((audiolength) & 0xff);
- header[41] = (byte)((audiolength >> 8) & 0xff);
- header[42] = (byte)((audiolength >> 16) & 0xff);
- header[43] = (byte)((audiolength >> 24) & 0xff);
+ header[40] = (byte) ((audiolength) & 0xff);
+ header[41] = (byte) ((audiolength >> 8) & 0xff);
+ header[42] = (byte) ((audiolength >> 16) & 0xff);
+ header[43] = (byte) ((audiolength >> 24) & 0xff);
stream.write(header, 0, header.length);
}
- /** Updates the data length and audio length of an existing RIFF/WAVE header in the file pointed by the RandomAccessFile object. */
+ /**
+ * Updates the data length and audio length of an existing RIFF/WAVE header in the file pointed by the RandomAccessFile object.
+ */
private void updateWaveHeaderLength(RandomAccessFile stream, long audiolength) throws IOException {
// the data header is 36 bytes large
long datalength = 36 + audiolength;
@@ -729,16 +735,16 @@ public class AudioStreamManagerTest extends TestCase {
// Seek from the beginning to data length
stream.seek(4);
// Overwrite total data length
- stream.write((int)((datalength) & 0xff));
- stream.write((int)((datalength >> 8) & 0xff));
- stream.write((int)((datalength >> 16) & 0xff));
- stream.write((int)((datalength >> 24) & 0xff));
+ stream.write((int) ((datalength) & 0xff));
+ stream.write((int) ((datalength >> 8) & 0xff));
+ stream.write((int) ((datalength >> 16) & 0xff));
+ stream.write((int) ((datalength >> 24) & 0xff));
// Seek from the end of data length to audio length
stream.seek(40);
// overwrite total audio length
- stream.write((int)((audiolength) & 0xff));
- stream.write((int)((audiolength >> 8) & 0xff));
- stream.write((int)((audiolength >> 16) & 0xff));
- stream.write((int)((audiolength >> 24) & 0xff));
+ stream.write((int) ((audiolength) & 0xff));
+ stream.write((int) ((audiolength >> 8) & 0xff));
+ stream.write((int) ((audiolength >> 16) & 0xff));
+ stream.write((int) ((audiolength >> 24) & 0xff));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
index a99214774..e45d455e0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
@@ -7,11 +7,11 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteFile;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.ListFiles;
@@ -51,957 +51,958 @@ import static org.mockito.Mockito.verify;
*/
@RunWith(AndroidJUnit4.class)
public class FileManagerTests {
- public static final String TAG = "FileManagerTests";
- private Context mTestContext;
- private SdlFile validFile;
-
- // SETUP / HELPERS
-
- @Before
- public void setUp() throws Exception{
- mTestContext = getInstrumentation().getTargetContext();
- validFile = new SdlFile();
- validFile.setName(TestValues.GENERAL_STRING);
- validFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile.setPersistent(false);
- }
-
- private Answer<Void> onPutFileFailureOnError = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- RPCRequest message = (RPCRequest) args[0];
- if (message instanceof PutFile) {
- int correlationId = message.getCorrelationID();
- PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
- putFileResponse.setInfo("Binary data empty");
- message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
- }
- return null;
- }
- };
-
- private Answer<Void> onSendRequestsFailOnError = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof PutFile) {
- for (RPCRequest message : rpcs) {
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
- putFileResponse.setInfo("Binary data empty");
- listener.onResponse(correlationId, putFileResponse);
- }
- listener.onFinished();
- }
- return null;
- }
- };
-
- private Answer<Void> onListFileUploadSuccess = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof PutFile) {
- for (RPCRequest message : rpcs) {
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(true);
- listener.onResponse(correlationId, putFileResponse);
- }
- listener.onFinished();
- }
- return null;
- }
- };
-
- private Answer<Void> onListFilesSuccess = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest message = (RPCRequest) args[0];
- if(message instanceof ListFiles){
- int correlationId = message.getCorrelationID();
- ListFilesResponse listFilesResponse = new ListFilesResponse();
- listFilesResponse.setFilenames(TestValues.GENERAL_STRING_LIST);
- listFilesResponse.setSpaceAvailable(TestValues.GENERAL_INT);
- listFilesResponse.setSuccess(true);
- message.getOnRPCResponseListener().onResponse(correlationId, listFilesResponse);
- }
- return null;
- }
- };
-
- private Answer<Void> onPutFileSuccess = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest message = (RPCRequest) args[0];
- if(message instanceof PutFile){
- int correlationId = message.getCorrelationID();
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(true);
- putFileResponse.setSpaceAvailable(TestValues.GENERAL_INT);
- message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
- }
- return null;
- }
- };
-
- private Answer<Void> onPutFileFailure = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest message = (RPCRequest) args[0];
- if(message instanceof PutFile){
- int correlationId = message.getCorrelationID();
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(false);
- message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
- }
- return null;
- }
- };
-
- private Answer<Void> onListDeleteRequestSuccess = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof DeleteFile) {
- for (RPCRequest message : rpcs) {
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- DeleteFileResponse deleteFileResponse = new DeleteFileResponse();
- deleteFileResponse.setSuccess(true);
- listener.onResponse(correlationId, deleteFileResponse);
- }
- listener.onFinished();
- }
- return null;
- }
- };
-
- private Answer<Void> onListDeleteRequestFail = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof DeleteFile) {
- for (RPCRequest message : rpcs) {
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- DeleteFileResponse deleteFileResponse = new DeleteFileResponse(false, Result.REJECTED);
- deleteFileResponse.setInfo("Binary data empty");
- listener.onResponse(correlationId, deleteFileResponse);
- }
- listener.onFinished();
- }
- return null;
- }
- };
-
- private Answer<Void> onSendRequestsFailPartialOnError = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof PutFile) {
- boolean flip = false;
- for (RPCRequest message : rpcs) {
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse();
- if (flip) {
- putFileResponse.setSuccess(true);
- flip = false;
- listener.onResponse(correlationId, putFileResponse);
- } else {
- flip = true;
- putFileResponse.setSuccess(false);
- putFileResponse.setResultCode(Result.REJECTED);
- putFileResponse.setInfo("Binary data empty");
- listener.onResponse(correlationId, putFileResponse);
- }
- }
- listener.onFinished();
- }
- return null;
- }
- };
-
- // TESTS
-
- /**
- * Test deleting list of files, success
- */
- @Test
- public void testDeleteRemoteFilesWithNamesSuccess(){
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListDeleteRequestSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- final List<String> fileNames = new ArrayList<>();
- fileNames.add("Julian");
- fileNames.add("Jake");
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setFileRetryCount(2);
-
- final FileManager fileManager = new FileManager(internalInterface,mTestContext,fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.deleteRemoteFilesWithNames(fileNames, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors == null);
- }
- });
- }
- });
- }
-
- /**
- * Test deleting list of files, fail
- */
- @Test
- public void testDeleteRemoteFilesWithNamesFail(){
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListDeleteRequestFail).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- final List<String> fileNames = new ArrayList<>();
- fileNames.add("Julian");
- fileNames.add("Jake");
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setFileRetryCount(2);
-
- final FileManager fileManager = new FileManager(internalInterface,mTestContext,fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.deleteRemoteFilesWithNames(fileNames, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors.size() == 2);
- }
- });
- }
- });
- }
-
- /**
- * Test reUploading failed file
- */
- @Test
- public void testFileUploadRetry(){
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onPutFileFailureOnError).when(internalInterface).sendRPC(any(PutFile.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setFileRetryCount(2);
-
- validFile.setType(FileType.AUDIO_MP3);
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext,fileManagerConfig);
-
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- }
- });
- }
- });
- verify(internalInterface, times(4)).sendRPC(any(RPCMessage.class));
- }
-
- /**
- * Test reUploading failed Artwork
- */
- @Test
- public void testArtworkUploadRetry(){
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onPutFileFailureOnError).when(internalInterface).sendRPC(any(PutFile.class));
-
- final SdlFile validFile2 = new SdlFile();
- validFile2.setName(TestValues.GENERAL_STRING + "2");
- validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile2.setPersistent(false);
- validFile2.setType(FileType.GRAPHIC_PNG);
-
- final SdlFile validFile3 = new SdlFile();
- validFile3.setName(TestValues.GENERAL_STRING + "3");
- validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile3.setPersistent(false);
- validFile3.setType(FileType.GRAPHIC_BMP);
-
- validFile.setType(FileType.GRAPHIC_JPEG);
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setArtworkRetryCount(2);
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext,fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- verify(internalInterface, times(4)).sendRPC(any(RPCMessage.class));
- }
- });
-
- fileManager.uploadFile(validFile2, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- verify(internalInterface, times(7)).sendRPC(any(RPCMessage.class));
- }
- });
-
- fileManager.uploadFile(validFile3, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- }
- });
- }
- });
- verify(internalInterface, times(10)).sendRPC(any(RPCMessage.class));
- }
-
- /**
- * Test retry uploading failed list of files
- */
- @Test
- public void testListFilesUploadRetry(){
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onSendRequestsFailOnError).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- SdlFile validFile2 = new SdlFile();
- validFile2.setName(TestValues.GENERAL_STRING + "2");
- validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile2.setPersistent(false);
- validFile2.setType(FileType.GRAPHIC_JPEG);
-
- validFile.setType(FileType.AUDIO_WAVE);
-
- final List<SdlFile> list = new ArrayList<>();
- list.add(validFile);
- list.add(validFile2);
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setArtworkRetryCount(2);
- fileManagerConfig.setFileRetryCount(4);
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext,fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors.size() == 2); // We need to make sure it kept track of both Files
- }
- });
-
- }
- });
- verify(internalInterface, times(5)).sendRPCs(any(List.class),any(OnMultipleRequestListener.class));
- }
-
- /**
- * Testing the initialization of FileManager
- */
- @Test
- public void testInitializationSuccess() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- assertEquals(fileManager.getState(), BaseSubManager.READY);
- assertEquals(fileManager.getRemoteFileNames(), TestValues.GENERAL_STRING_LIST);
- assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
- }
- });
- }
-
- /**
- * Test file upload, success
- */
- @Test
- public void testFileUploadSuccess() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onPutFileSuccess).when(internalInterface).sendRPC(any(PutFile.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- }
- });
- }
- });
- assertTrue(fileManager.getRemoteFileNames().contains(validFile.getName()));
- assertTrue(fileManager.hasUploadedFile(validFile));
- assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
- }
-
- /**
- * Testing failed file upload.
- */
- @Test
- public void testFileUploadFailure() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onPutFileFailure).when(internalInterface).sendRPC(any(PutFile.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- assertFalse(fileManager.getRemoteFileNames().contains(validFile.getName()));
- assertFalse(fileManager.hasUploadedFile(validFile));
- }
- });
- }
- });
- }
-
- /**
- * Testing uploadFile for a staticIcon, verifying that it doesn't actually upload.
- */
- @Test
- public void testFileUploadForStaticIcon() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
- fileManager.uploadFile(artwork, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- }
- });
- }
- });
- verify(internalInterface, times(1)).sendRPC(any(RPCMessage.class));
- }
-
- /**
- * Testing uploadFiles for staticIcons, verifying that it doesn't actually upload.
- */
- @Test
- public void testMultipleFileUploadsForStaticIcon() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
- SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
- List<SdlArtwork> testStaticIconUpload = new ArrayList<>();
- testStaticIconUpload.add(artwork);
- testStaticIconUpload.add(artwork2);
- fileManager.uploadFiles(testStaticIconUpload, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors == null);
- }
- });
- }
- });
- verify(internalInterface, times(0)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
- }
-
- /**
- * Testing uploadFiles for static icons and nonStatic icons in the same list.
- */
- @Test
- public void testMultipleFileUploadsForPartialStaticIcon() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
- SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
- List<SdlFile> testFileuploads = new ArrayList<>();
- testFileuploads.add(artwork);
- testFileuploads.add(artwork2);
- testFileuploads.add(validFile);
- fileManager.uploadFiles(testFileuploads, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors == null);
- }
- });
- }
- });
- verify(internalInterface, times(1)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
- }
-
- /**
- * Test to make sure you cannot upload an SdlFile with invalid data
- */
- @Test
- public void testInvalidSdlFileInput() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- SdlFile sdlFile = new SdlFile();
- // Don't set name
- sdlFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- checkForUploadFailure(fileManager, sdlFile);
-
- sdlFile = new SdlFile();
- sdlFile.setName(TestValues.GENERAL_STRING);
- // Don't set data
- checkForUploadFailure(fileManager, sdlFile);
-
- sdlFile = new SdlFile();
- sdlFile.setName(TestValues.GENERAL_STRING);
- // Give an invalid resource ID
- sdlFile.setResourceId(TestValues.GENERAL_INT);
- checkForUploadFailure(fileManager, sdlFile);
-
- sdlFile = new SdlFile();
- sdlFile.setName(TestValues.GENERAL_STRING);
- // Set invalid Uri
- Uri testUri = Uri.parse("http://www.google.com");
- sdlFile.setUri(testUri);
- checkForUploadFailure(fileManager, sdlFile);
- }
- });
- }
-
- /**
- * Used to try and upload SdlFiles with invalid data, throw an assert error if file uploads
- *
- * @param fileManager - FileManager used to manage and upload files
- * @param sdlFile - SdlFile with invalid data to test uploading
- */
- private void checkForUploadFailure(FileManager fileManager, SdlFile sdlFile){
- boolean error = false;
-
- try {
- fileManager.uploadFile(sdlFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {}
- });
- }catch (IllegalArgumentException e){
- error = true;
- }
-
- assertTrue(error);
- }
-
- /**
- * Test Invalid SdlArtWork FileTypes
- * SdlArtwork FileTypes can only be: GRAPHIC_BMP, GRAPHIC_PNG or GRAPHIC_JPEG
- */
- @Test
- public void testInvalidSdlArtworkInput(){
- SdlArtwork sdlArtwork = new SdlArtwork();
- // Set invalid type
- for(FileType fileType : FileType.values()){
- boolean shouldError = true, didError = false;
- if(fileType.equals(FileType.GRAPHIC_BMP) || fileType.equals(FileType.GRAPHIC_PNG)
- || fileType.equals(FileType.GRAPHIC_JPEG)){
- shouldError = false;
- }
- try{
- sdlArtwork.setType(fileType);
- }catch(IllegalArgumentException e){
- didError = true;
- }
- assertEquals(shouldError, didError);
- }
- }
-
- /**
- * Test Multiple File Uploads, success
- */
- @Test
- public void testMultipleFileUpload() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- final List<SdlFile> filesToUpload = new ArrayList<>();
- filesToUpload.add(validFile);
-
- SdlFile validFile2 = new SdlFile();
- validFile2.setName(TestValues.GENERAL_STRING + "2");
- validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile2.setPersistent(false);
- validFile2.setType(FileType.GRAPHIC_JPEG);
- filesToUpload.add(validFile2);
-
- fileManager.uploadFiles(filesToUpload, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertNull(errors);
- }
- });
- }
- });
- }
-
- /**
- * Testing uploading multiple files with some failing.
- */
- @Test
- public void testMultipleFileUploadPartialFailure() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onSendRequestsFailPartialOnError).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- SdlFile validFile2 = new SdlFile();
- validFile2.setName(TestValues.GENERAL_STRING + "2");
- validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile2.setPersistent(false);
- validFile2.setType(FileType.GRAPHIC_JPEG);
-
- SdlFile validFile3 = new SdlFile();
- validFile3.setName(TestValues.GENERAL_STRING + "3");
- validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile3.setPersistent(false);
- validFile3.setType(FileType.GRAPHIC_JPEG);
-
- validFile.setType(FileType.AUDIO_WAVE);
-
- final List<SdlFile> filesToUpload = new ArrayList<>();
- filesToUpload.add(validFile);
- filesToUpload.add(validFile2);
- filesToUpload.add(validFile3);
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setArtworkRetryCount(0);
- fileManagerConfig.setFileRetryCount(0);
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- fileManager.uploadFiles(filesToUpload,
- new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertTrue(errors.size() == 2);
- }
- });
- }
- });
- assertFalse(fileManager.hasUploadedFile(validFile) && fileManager.hasUploadedFile(validFile3));
- assertTrue(fileManager.hasUploadedFile(validFile2));
- }
-
- /**
- * Testing uploading multiple SdlArtwork files.
- */
- @Test
- public void testMultipleArtworkUploadSuccess(){
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- int fileNum = 1;
- final List<SdlArtwork> artworkToUpload = new ArrayList<>();
- SdlArtwork sdlArtwork = new SdlArtwork();
- sdlArtwork.setName("art" + fileNum++);
- Uri uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
- sdlArtwork.setUri(uri);
- sdlArtwork.setType(FileType.GRAPHIC_PNG);
- artworkToUpload.add(sdlArtwork);
-
- sdlArtwork = new SdlArtwork();
- sdlArtwork.setName("art" + fileNum++);
- uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/sdl_tray_icon");
- sdlArtwork.setUri(uri);
- sdlArtwork.setType(FileType.GRAPHIC_PNG);
- artworkToUpload.add(sdlArtwork);
-
- fileManager.uploadFiles(artworkToUpload,
- new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertNull(errors);
- List < String > uploadedFileNames = fileManager.getRemoteFileNames();
- for(SdlArtwork artwork : artworkToUpload){
- assertTrue(uploadedFileNames.contains(artwork.getName()));
- }
- }
- });
- }
- });
- }
-
- /**
- * Testing uploading persistent SdlFile
- */
- @Test
- public void testPersistentFileUploaded(){
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
-
- final SdlFile file = new SdlFile();
- file.setName(TestValues.GENERAL_STRING_LIST.get(0));
- file.setPersistent(true);
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(fileManager.hasUploadedFile(file));
- }
- });
- }
-
- /**
- * Test FileManagerConfig
- */
- @Test
- public void testFileManagerConfig() {
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setFileRetryCount(2);
- fileManagerConfig.setArtworkRetryCount(2);
- assertEquals(fileManagerConfig.getArtworkRetryCount(), 2);
- assertEquals(fileManagerConfig.getFileRetryCount(), 2);
- }
-
- /**
- * Tests overwrite property for uploading a file.
- * Checks to make sure file does not overwrite itself if overwrite property is set to false
- */
- @Test
- public void testOverwriteFileProperty() {
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onPutFileSuccess).when(internalInterface).sendRPC(any(PutFile.class));
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- validFile.setOverwrite(false);
- fileManager.uploadFile(validFile, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- }
- });
-
- }
- });
- }
- });
- verify(internalInterface, times(2)).sendRPC(any(RPCMessage.class));
- }
-
- /**
- * Tests overwrite property for uploading a list of files.
- * Checks to make sure files do not overwrite themselves if overwrite property is set to false.
- */
- @Test
- public void testOverWriteFilePropertyListFiles() {
- final ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
-
- final SdlFile validFile2 = new SdlFile();
- validFile2.setName(TestValues.GENERAL_STRING + "2");
- validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- validFile2.setPersistent(false);
- validFile2.setType(FileType.GRAPHIC_JPEG);
-
- final List<SdlFile> list = new ArrayList<>();
- list.add(validFile);
- list.add(validFile2);
-
- FileManagerConfig fileManagerConfig = new FileManagerConfig();
- fileManagerConfig.setArtworkRetryCount(2);
- fileManagerConfig.setFileRetryCount(4);
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- validFile.setOverwrite(false);
- validFile2.setOverwrite(false);
- fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- assertNull(errors);
- }
- });
- }
- });
-
- }
- });
- verify(internalInterface, times(1)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
- }
-
- /**
- * Test custom overridden SdlFile equals method
- */
- @Test
- public void testSdlFileEquals() {
- // Case 1: object is null, assertFalse
- SdlFile artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
- SdlFile artwork2 = null;
- assertFalse(artwork1.equals(artwork2));
-
- // Case 2 SoftButtonObjects are the same, assertTrue
- assertTrue(artwork1.equals(artwork1));
-
- // Case 3: object is not an instance of SoftButtonObject, assertFalse
- assertFalse(artwork1.equals("Test"));
-
- // Case 4: different StaticIcon status, assertFalse
- artwork1.setStaticIcon(true);
- artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
- artwork2.setStaticIcon(false);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 5: different Persistent status, assertFalse
- artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 6: different name, assertFalse
- artwork2 = new SdlFile("image2", FileType.GRAPHIC_PNG, 1, false);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 7: different Uri
- Uri uri1 = Uri.parse("testUri1");
- Uri uri2 = Uri.parse("testUri2");
- artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, uri1, false);
- artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, uri2, false);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 8: different FileData
- artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- byte[] GENERAL_BYTE_ARRAY2 = new byte[2];
- artwork1.setFileData(TestValues.GENERAL_BYTE_ARRAY);
- artwork2.setFileData(GENERAL_BYTE_ARRAY2);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 9 different FileType, assertFalse
- artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- artwork2 = new SdlFile("image1", FileType.AUDIO_WAVE, 1, false);
- assertFalse(artwork1.equals(artwork2));
-
- // Case 10: they are equal, assertTrue
- artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
- assertTrue(artwork1.equals(artwork2));
- }
+ public static final String TAG = "FileManagerTests";
+ private Context mTestContext;
+ private SdlFile validFile;
+
+ // SETUP / HELPERS
+
+ @Before
+ public void setUp() throws Exception {
+ mTestContext = getInstrumentation().getTargetContext();
+ validFile = new SdlFile();
+ validFile.setName(TestValues.GENERAL_STRING);
+ validFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile.setPersistent(false);
+ }
+
+ private Answer<Void> onPutFileFailureOnError = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof PutFile) {
+ int correlationId = message.getCorrelationID();
+ PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onSendRequestsFailOnError = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ if (rpcs.get(0) instanceof PutFile) {
+ for (RPCRequest message : rpcs) {
+ int correlationId = message.getCorrelationID();
+ listener.addCorrelationId(correlationId);
+ PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, putFileResponse);
+ }
+ listener.onFinished();
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onListFileUploadSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ if (rpcs.get(0) instanceof PutFile) {
+ for (RPCRequest message : rpcs) {
+ int correlationId = message.getCorrelationID();
+ listener.addCorrelationId(correlationId);
+ PutFileResponse putFileResponse = new PutFileResponse();
+ putFileResponse.setSuccess(true);
+ listener.onResponse(correlationId, putFileResponse);
+ }
+ listener.onFinished();
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onListFilesSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof ListFiles) {
+ int correlationId = message.getCorrelationID();
+ ListFilesResponse listFilesResponse = new ListFilesResponse();
+ listFilesResponse.setFilenames(TestValues.GENERAL_STRING_LIST);
+ listFilesResponse.setSpaceAvailable(TestValues.GENERAL_INT);
+ listFilesResponse.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(correlationId, listFilesResponse);
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onPutFileSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof PutFile) {
+ int correlationId = message.getCorrelationID();
+ PutFileResponse putFileResponse = new PutFileResponse();
+ putFileResponse.setSuccess(true);
+ putFileResponse.setSpaceAvailable(TestValues.GENERAL_INT);
+ message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onPutFileFailure = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof PutFile) {
+ int correlationId = message.getCorrelationID();
+ PutFileResponse putFileResponse = new PutFileResponse();
+ putFileResponse.setSuccess(false);
+ message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onListDeleteRequestSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ if (rpcs.get(0) instanceof DeleteFile) {
+ for (RPCRequest message : rpcs) {
+ int correlationId = message.getCorrelationID();
+ listener.addCorrelationId(correlationId);
+ DeleteFileResponse deleteFileResponse = new DeleteFileResponse();
+ deleteFileResponse.setSuccess(true);
+ listener.onResponse(correlationId, deleteFileResponse);
+ }
+ listener.onFinished();
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onListDeleteRequestFail = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ if (rpcs.get(0) instanceof DeleteFile) {
+ for (RPCRequest message : rpcs) {
+ int correlationId = message.getCorrelationID();
+ listener.addCorrelationId(correlationId);
+ DeleteFileResponse deleteFileResponse = new DeleteFileResponse(false, Result.REJECTED);
+ deleteFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, deleteFileResponse);
+ }
+ listener.onFinished();
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onSendRequestsFailPartialOnError = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
+ OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
+ if (rpcs.get(0) instanceof PutFile) {
+ boolean flip = false;
+ for (RPCRequest message : rpcs) {
+ int correlationId = message.getCorrelationID();
+ listener.addCorrelationId(correlationId);
+ PutFileResponse putFileResponse = new PutFileResponse();
+ if (flip) {
+ putFileResponse.setSuccess(true);
+ flip = false;
+ listener.onResponse(correlationId, putFileResponse);
+ } else {
+ flip = true;
+ putFileResponse.setSuccess(false);
+ putFileResponse.setResultCode(Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, putFileResponse);
+ }
+ }
+ listener.onFinished();
+ }
+ return null;
+ }
+ };
+
+ // TESTS
+
+ /**
+ * Test deleting list of files, success
+ */
+ @Test
+ public void testDeleteRemoteFilesWithNamesSuccess() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListDeleteRequestSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ final List<String> fileNames = new ArrayList<>();
+ fileNames.add("Julian");
+ fileNames.add("Jake");
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setFileRetryCount(2);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.deleteRemoteFilesWithNames(fileNames, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors == null);
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Test deleting list of files, fail
+ */
+ @Test
+ public void testDeleteRemoteFilesWithNamesFail() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListDeleteRequestFail).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ final List<String> fileNames = new ArrayList<>();
+ fileNames.add("Julian");
+ fileNames.add("Jake");
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setFileRetryCount(2);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.deleteRemoteFilesWithNames(fileNames, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors.size() == 2);
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Test reUploading failed file
+ */
+ @Test
+ public void testFileUploadRetry() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileFailureOnError).when(internalInterface).sendRPC(any(PutFile.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setFileRetryCount(2);
+
+ validFile.setType(FileType.AUDIO_MP3);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertFalse(success);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(4)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Test reUploading failed Artwork
+ */
+ @Test
+ public void testArtworkUploadRetry() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileFailureOnError).when(internalInterface).sendRPC(any(PutFile.class));
+
+ final SdlFile validFile2 = new SdlFile();
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_PNG);
+
+ final SdlFile validFile3 = new SdlFile();
+ validFile3.setName(TestValues.GENERAL_STRING + "3");
+ validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile3.setPersistent(false);
+ validFile3.setType(FileType.GRAPHIC_BMP);
+
+ validFile.setType(FileType.GRAPHIC_JPEG);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(2);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertFalse(success);
+ verify(internalInterface, times(4)).sendRPC(any(RPCMessage.class));
+ }
+ });
+
+ fileManager.uploadFile(validFile2, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertFalse(success);
+ verify(internalInterface, times(7)).sendRPC(any(RPCMessage.class));
+ }
+ });
+
+ fileManager.uploadFile(validFile3, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertFalse(success);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(10)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Test retry uploading failed list of files
+ */
+ @Test
+ public void testListFilesUploadRetry() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onSendRequestsFailOnError).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ SdlFile validFile2 = new SdlFile();
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
+
+ validFile.setType(FileType.AUDIO_WAVE);
+
+ final List<SdlFile> list = new ArrayList<>();
+ list.add(validFile);
+ list.add(validFile2);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(2);
+ fileManagerConfig.setFileRetryCount(4);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors.size() == 2); // We need to make sure it kept track of both Files
+ }
+ });
+
+ }
+ });
+ verify(internalInterface, times(5)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+ /**
+ * Testing the initialization of FileManager
+ */
+ @Test
+ public void testInitializationSuccess() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ assertEquals(fileManager.getState(), BaseSubManager.READY);
+ assertEquals(fileManager.getRemoteFileNames(), TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
+ }
+ });
+ }
+
+ /**
+ * Test file upload, success
+ */
+ @Test
+ public void testFileUploadSuccess() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileSuccess).when(internalInterface).sendRPC(any(PutFile.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ }
+ });
+ }
+ });
+ assertTrue(fileManager.getRemoteFileNames().contains(validFile.getName()));
+ assertTrue(fileManager.hasUploadedFile(validFile));
+ assertEquals(TestValues.GENERAL_INT, fileManager.getBytesAvailable());
+ }
+
+ /**
+ * Testing failed file upload.
+ */
+ @Test
+ public void testFileUploadFailure() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileFailure).when(internalInterface).sendRPC(any(PutFile.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertFalse(success);
+ assertFalse(fileManager.getRemoteFileNames().contains(validFile.getName()));
+ assertFalse(fileManager.hasUploadedFile(validFile));
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Testing uploadFile for a staticIcon, verifying that it doesn't actually upload.
+ */
+ @Test
+ public void testFileUploadForStaticIcon() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ fileManager.uploadFile(artwork, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(1)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Testing uploadFiles for staticIcons, verifying that it doesn't actually upload.
+ */
+ @Test
+ public void testMultipleFileUploadsForStaticIcon() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
+ List<SdlArtwork> testStaticIconUpload = new ArrayList<>();
+ testStaticIconUpload.add(artwork);
+ testStaticIconUpload.add(artwork2);
+ fileManager.uploadFiles(testStaticIconUpload, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors == null);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(0)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+ /**
+ * Testing uploadFiles for static icons and nonStatic icons in the same list.
+ */
+ @Test
+ public void testMultipleFileUploadsForPartialStaticIcon() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
+ List<SdlFile> testFileuploads = new ArrayList<>();
+ testFileuploads.add(artwork);
+ testFileuploads.add(artwork2);
+ testFileuploads.add(validFile);
+ fileManager.uploadFiles(testFileuploads, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors == null);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(1)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+ /**
+ * Test to make sure you cannot upload an SdlFile with invalid data
+ */
+ @Test
+ public void testInvalidSdlFileInput() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlFile sdlFile = new SdlFile();
+ // Don't set name
+ sdlFile.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ checkForUploadFailure(fileManager, sdlFile);
+
+ sdlFile = new SdlFile();
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ // Don't set data
+ checkForUploadFailure(fileManager, sdlFile);
+
+ sdlFile = new SdlFile();
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ // Give an invalid resource ID
+ sdlFile.setResourceId(TestValues.GENERAL_INT);
+ checkForUploadFailure(fileManager, sdlFile);
+
+ sdlFile = new SdlFile();
+ sdlFile.setName(TestValues.GENERAL_STRING);
+ // Set invalid Uri
+ Uri testUri = Uri.parse("http://www.google.com");
+ sdlFile.setUri(testUri);
+ checkForUploadFailure(fileManager, sdlFile);
+ }
+ });
+ }
+
+ /**
+ * Used to try and upload SdlFiles with invalid data, throw an assert error if file uploads
+ *
+ * @param fileManager - FileManager used to manage and upload files
+ * @param sdlFile - SdlFile with invalid data to test uploading
+ */
+ private void checkForUploadFailure(FileManager fileManager, SdlFile sdlFile) {
+ boolean error = false;
+
+ try {
+ fileManager.uploadFile(sdlFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ }
+ });
+ } catch (IllegalArgumentException e) {
+ error = true;
+ }
+
+ assertTrue(error);
+ }
+
+ /**
+ * Test Invalid SdlArtWork FileTypes
+ * SdlArtwork FileTypes can only be: GRAPHIC_BMP, GRAPHIC_PNG or GRAPHIC_JPEG
+ */
+ @Test
+ public void testInvalidSdlArtworkInput() {
+ SdlArtwork sdlArtwork = new SdlArtwork();
+ // Set invalid type
+ for (FileType fileType : FileType.values()) {
+ boolean shouldError = true, didError = false;
+ if (fileType.equals(FileType.GRAPHIC_BMP) || fileType.equals(FileType.GRAPHIC_PNG)
+ || fileType.equals(FileType.GRAPHIC_JPEG)) {
+ shouldError = false;
+ }
+ try {
+ sdlArtwork.setType(fileType);
+ } catch (IllegalArgumentException e) {
+ didError = true;
+ }
+ assertEquals(shouldError, didError);
+ }
+ }
+
+ /**
+ * Test Multiple File Uploads, success
+ */
+ @Test
+ public void testMultipleFileUpload() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ final List<SdlFile> filesToUpload = new ArrayList<>();
+ filesToUpload.add(validFile);
+
+ SdlFile validFile2 = new SdlFile();
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
+ filesToUpload.add(validFile2);
+
+ fileManager.uploadFiles(filesToUpload, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertNull(errors);
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Testing uploading multiple files with some failing.
+ */
+ @Test
+ public void testMultipleFileUploadPartialFailure() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onSendRequestsFailPartialOnError).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ SdlFile validFile2 = new SdlFile();
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
+
+ SdlFile validFile3 = new SdlFile();
+ validFile3.setName(TestValues.GENERAL_STRING + "3");
+ validFile3.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile3.setPersistent(false);
+ validFile3.setType(FileType.GRAPHIC_JPEG);
+
+ validFile.setType(FileType.AUDIO_WAVE);
+
+ final List<SdlFile> filesToUpload = new ArrayList<>();
+ filesToUpload.add(validFile);
+ filesToUpload.add(validFile2);
+ filesToUpload.add(validFile3);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(0);
+ fileManagerConfig.setFileRetryCount(0);
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ fileManager.uploadFiles(filesToUpload,
+ new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors.size() == 2);
+ }
+ });
+ }
+ });
+ assertFalse(fileManager.hasUploadedFile(validFile) && fileManager.hasUploadedFile(validFile3));
+ assertTrue(fileManager.hasUploadedFile(validFile2));
+ }
+
+ /**
+ * Testing uploading multiple SdlArtwork files.
+ */
+ @Test
+ public void testMultipleArtworkUploadSuccess() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ int fileNum = 1;
+ final List<SdlArtwork> artworkToUpload = new ArrayList<>();
+ SdlArtwork sdlArtwork = new SdlArtwork();
+ sdlArtwork.setName("art" + fileNum++);
+ Uri uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ sdlArtwork.setUri(uri);
+ sdlArtwork.setType(FileType.GRAPHIC_PNG);
+ artworkToUpload.add(sdlArtwork);
+
+ sdlArtwork = new SdlArtwork();
+ sdlArtwork.setName("art" + fileNum++);
+ uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/sdl_tray_icon");
+ sdlArtwork.setUri(uri);
+ sdlArtwork.setType(FileType.GRAPHIC_PNG);
+ artworkToUpload.add(sdlArtwork);
+
+ fileManager.uploadFiles(artworkToUpload,
+ new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertNull(errors);
+ List<String> uploadedFileNames = fileManager.getRemoteFileNames();
+ for (SdlArtwork artwork : artworkToUpload) {
+ assertTrue(uploadedFileNames.contains(artwork.getName()));
+ }
+ }
+ });
+ }
+ });
+ }
+
+ /**
+ * Testing uploading persistent SdlFile
+ */
+ @Test
+ public void testPersistentFileUploaded() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+
+ final SdlFile file = new SdlFile();
+ file.setName(TestValues.GENERAL_STRING_LIST.get(0));
+ file.setPersistent(true);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(fileManager.hasUploadedFile(file));
+ }
+ });
+ }
+
+ /**
+ * Test FileManagerConfig
+ */
+ @Test
+ public void testFileManagerConfig() {
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setFileRetryCount(2);
+ fileManagerConfig.setArtworkRetryCount(2);
+ assertEquals(fileManagerConfig.getArtworkRetryCount(), 2);
+ assertEquals(fileManagerConfig.getFileRetryCount(), 2);
+ }
+
+ /**
+ * Tests overwrite property for uploading a file.
+ * Checks to make sure file does not overwrite itself if overwrite property is set to false
+ */
+ @Test
+ public void testOverwriteFileProperty() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileSuccess).when(internalInterface).sendRPC(any(PutFile.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ validFile.setOverwrite(false);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ }
+ });
+
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(2)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Tests overwrite property for uploading a list of files.
+ * Checks to make sure files do not overwrite themselves if overwrite property is set to false.
+ */
+ @Test
+ public void testOverWriteFilePropertyListFiles() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+
+ final SdlFile validFile2 = new SdlFile();
+ validFile2.setName(TestValues.GENERAL_STRING + "2");
+ validFile2.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
+
+ final List<SdlFile> list = new ArrayList<>();
+ list.add(validFile);
+ list.add(validFile2);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(2);
+ fileManagerConfig.setFileRetryCount(4);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ validFile.setOverwrite(false);
+ validFile2.setOverwrite(false);
+ fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertNull(errors);
+ }
+ });
+ }
+ });
+
+ }
+ });
+ verify(internalInterface, times(1)).sendRPCs(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+ /**
+ * Test custom overridden SdlFile equals method
+ */
+ @Test
+ public void testSdlFileEquals() {
+ // Case 1: object is null, assertFalse
+ SdlFile artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
+ SdlFile artwork2 = null;
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 2 SoftButtonObjects are the same, assertTrue
+ assertTrue(artwork1.equals(artwork1));
+
+ // Case 3: object is not an instance of SoftButtonObject, assertFalse
+ assertFalse(artwork1.equals("Test"));
+
+ // Case 4: different StaticIcon status, assertFalse
+ artwork1.setStaticIcon(true);
+ artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
+ artwork2.setStaticIcon(false);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 5: different Persistent status, assertFalse
+ artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, true);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 6: different name, assertFalse
+ artwork2 = new SdlFile("image2", FileType.GRAPHIC_PNG, 1, false);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 7: different Uri
+ Uri uri1 = Uri.parse("testUri1");
+ Uri uri2 = Uri.parse("testUri2");
+ artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, uri1, false);
+ artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, uri2, false);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 8: different FileData
+ artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ byte[] GENERAL_BYTE_ARRAY2 = new byte[2];
+ artwork1.setFileData(TestValues.GENERAL_BYTE_ARRAY);
+ artwork2.setFileData(GENERAL_BYTE_ARRAY2);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 9 different FileType, assertFalse
+ artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ artwork2 = new SdlFile("image1", FileType.AUDIO_WAVE, 1, false);
+ assertFalse(artwork1.equals(artwork2));
+
+ // Case 10: they are equal, assertTrue
+ artwork1 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ artwork2 = new SdlFile("image1", FileType.GRAPHIC_PNG, 1, false);
+ assertTrue(artwork1.equals(artwork2));
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
index 3f6f6cff5..f4fb5e3d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/filetypes/SdlArtworkTests.java
@@ -17,7 +17,7 @@ import static junit.framework.TestCase.assertTrue;
public class SdlArtworkTests {
@Test
- public void testClone(){
+ public void testClone() {
SdlArtwork original = TestValues.GENERAL_ARTWORK;
SdlArtwork clone = original.clone();
@@ -36,11 +36,11 @@ public class SdlArtworkTests {
}
- public static boolean equalTest(SdlArtwork original, SdlArtwork clone){
+ public static boolean equalTest(SdlArtwork original, SdlArtwork clone) {
assertNotNull(original);
assertNotNull(clone);
- assertNotSame(original,clone);
+ assertNotSame(original, clone);
assertEquals(original.getResourceId(), clone.getResourceId());
@@ -50,7 +50,7 @@ public class SdlArtworkTests {
assertNotNull(original.getImageRPC());
assertNotNull(clone.getImageRPC());
- assertNotSame(original.getImageRPC(),clone.getImageRPC());
+ assertNotSame(original.getImageRPC(), clone.getImageRPC());
assertEquals(original.getImageRPC().getIsTemplate(), clone.getImageRPC().getIsTemplate());
assertEquals(original.getImageRPC().getValue(), clone.getImageRPC().getValue());
assertEquals(original.getImageRPC().getImageType(), clone.getImageRPC().getImageType());
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
index 02509a96a..97ce59a51 100644
--- 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
@@ -47,32 +47,32 @@ import static junit.framework.TestCase.assertEquals;
@RunWith(AndroidJUnit4.class)
public class LifecycleConfigurationUpdateTest {
- @Test
- public void testIndividualSettersAndGetters(){
+ @Test
+ public void testIndividualSettersAndGetters() {
- LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate();
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate();
- lifecycleConfigurationUpdate.setAppName(TestValues.GENERAL_STRING);
- lifecycleConfigurationUpdate.setShortAppName(TestValues.GENERAL_STRING);
- lifecycleConfigurationUpdate.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
- lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(TestValues.GENERAL_VECTOR_STRING);
+ lifecycleConfigurationUpdate.setAppName(TestValues.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setShortAppName(TestValues.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setTtsName(TestValues.GENERAL_VECTOR_TTS_CHUNKS);
+ lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(TestValues.GENERAL_VECTOR_STRING);
- assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
- assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
- assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
- assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
- }
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
- @Test
- public void testHelperConstructor(){
+ @Test
+ public void testHelperConstructor() {
- LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_VECTOR_TTS_CHUNKS, TestValues.GENERAL_VECTOR_STRING);
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_VECTOR_TTS_CHUNKS, TestValues.GENERAL_VECTOR_STRING);
- assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
- assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
- assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
- assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
- }
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(TestValues.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(TestValues.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(TestValues.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
index d8bf8422a..e2d17fd54 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
@@ -21,19 +21,19 @@ import static junit.framework.TestCase.assertNotNull;
@RunWith(AndroidJUnit4.class)
public class RpcConverterTest {
- private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
- private static final String RESPONSE_KEY = "Response";
- private static final Version MAX_RPC_VERSION = new Version(5,1,0);
+ private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
+ private static final String RESPONSE_KEY = "Response";
+ private static final Version MAX_RPC_VERSION = new Version(5, 1, 0);
/**
* The RPC converter relies on the function id json name to match the class name exactly.
* Therefore we will test to ensure that they match up first.
*/
@Test
- public void testFunctionIdsAgainstFileNames(){
+ public void testFunctionIdsAgainstFileNames() {
FunctionID[] functionIDs = FunctionID.values();
- for(FunctionID functionID : functionIDs) {
- switch (functionID){
+ for (FunctionID functionID : functionIDs) {
+ switch (functionID) {
case RESERVED:
case SYNC_P_DATA:
case ON_SYNC_P_DATA:
@@ -89,12 +89,12 @@ public class RpcConverterTest {
}
@Test
- public void testRpcCreation(){
+ public void testRpcCreation() {
FunctionID[] functionIDs = FunctionID.values();
- for(FunctionID functionID : functionIDs){
- switch (functionID){
+ for (FunctionID functionID : functionIDs) {
+ switch (functionID) {
case RESERVED:
case SYNC_P_DATA:
case ON_SYNC_P_DATA:
@@ -116,22 +116,22 @@ public class RpcConverterTest {
}
}
- private void assertRpc(Class rpcClass){
+ private void assertRpc(Class rpcClass) {
RPCMessage message = generateRpcMessage(rpcClass);
assertNotNull(message);
ProtocolMessage protocolMessage = generateProtocolMessageForRpc(message);
assertNotNull(protocolMessage);
- RPCMessage newMessage = RpcConverter.extractRpc(protocolMessage,MAX_RPC_VERSION);
+ RPCMessage newMessage = RpcConverter.extractRpc(protocolMessage, MAX_RPC_VERSION);
assertNotNull(newMessage);
assertEquals(message.getMessageType(), newMessage.getMessageType());
assertEquals(message.getFunctionID(), newMessage.getFunctionID());
}
- private RPCMessage generateRpcMessage(Class rpcClass){
+ private RPCMessage generateRpcMessage(Class rpcClass) {
try {
- java.lang.reflect.Constructor rpcConstructor = rpcClass.getConstructor();
- return (RPCMessage)rpcConstructor.newInstance();
+ java.lang.reflect.Constructor rpcConstructor = rpcClass.getConstructor();
+ return (RPCMessage) rpcConstructor.newInstance();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
@@ -144,15 +144,15 @@ public class RpcConverterTest {
return null;
}
- private ProtocolMessage generateProtocolMessageForRpc(RPCMessage message){
+ private ProtocolMessage generateProtocolMessageForRpc(RPCMessage message) {
try {
- message.format(MAX_RPC_VERSION,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte)5);
+ message.format(MAX_RPC_VERSION, true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte) 5);
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
- pm.setSessionID((byte)0);
+ pm.setSessionID((byte) 0);
pm.setMessageType(MessageType.RPC);
pm.setSessionType(SessionType.RPC);
@@ -160,16 +160,16 @@ public class RpcConverterTest {
pm.setPayloadProtected(message.isPayloadProtected());
if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- pm.setRPCType((byte)0x00);
- }else if (message.getMessageType().equals(RPCMessage.KEY_RESPONSE)){
- pm.setRPCType((byte)0x01);
- }else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)){
- pm.setRPCType((byte)0x02);
- }else{
+ pm.setRPCType((byte) 0x00);
+ } else if (message.getMessageType().equals(RPCMessage.KEY_RESPONSE)) {
+ pm.setRPCType((byte) 0x01);
+ } else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) {
+ pm.setRPCType((byte) 0x02);
+ } else {
return null;
}
- if (message.getBulkData() != null){
+ if (message.getBulkData() != null) {
pm.setBulkData(message.getBulkData());
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java
index 47b6a5cec..23684820c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java
@@ -5,13 +5,13 @@ import android.util.SparseArray;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Taskmaster;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.ManagerUtility;
+import com.smartdevicelink.protocol.ISdlServiceListener;
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.managers.ISdl;
-import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.proxy.rpc.AppServiceCapability;
import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
@@ -85,965 +85,980 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class SystemCapabilityManagerTests {
- public static final String TAG = "SystemCapabilityManagerTests";
- public static SystemCapabilityManager systemCapabilityManager;
- private SystemCapability systemCapability;
- private VideoStreamingCapability videoStreamingCapability;
-
- @Before
- public void setUp() throws Exception{
-
- systemCapability = new SystemCapability(SystemCapabilityType.VIDEO_STREAMING);
- videoStreamingCapability = new VideoStreamingCapability();
- videoStreamingCapability.setMaxBitrate(TestValues.GENERAL_INT);
- videoStreamingCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
- videoStreamingCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- systemCapability.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- }
-
- public SystemCapabilityManager createSampleManager(){
- return createSampleManager(new InternalSDLInterface());
- }
-
- public SystemCapabilityManager createSampleManager(InternalSDLInterface iSdl){
- SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSdl);
-
- RegisterAppInterfaceResponse raiResponse = new RegisterAppInterfaceResponse();
-
- raiResponse.setHmiCapabilities(TestValues.GENERAL_HMICAPABILITIES);
- raiResponse.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
- raiResponse.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
- raiResponse.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
- raiResponse.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
- raiResponse.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
- raiResponse.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- raiResponse.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
- raiResponse.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
- raiResponse.setSuccess(true);
-
- systemCapabilityManager.parseRAIResponse(raiResponse);
- return systemCapabilityManager;
- }
-
- private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
- WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
-
- DisplayCapability displayCapability = new DisplayCapability();
- displayCapability.setDisplayName(display != null ? display.getDisplayName() : null);
- displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
-
- WindowCapability defaultWindowCapability = new WindowCapability();
- defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
- defaultWindowCapability.setButtonCapabilities(button);
- defaultWindowCapability.setSoftButtonCapabilities(softButton);
-
- if (display == null) {
- defaultWindowCapability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
- defaultWindowCapability.setImageFields(ManagerUtility.WindowCapabilityUtility.getAllImageFields());
- displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
- return Collections.singletonList(displayCapability);
- }
-
- defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
- defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
- defaultWindowCapability.setTextFields(display.getTextFields());
- defaultWindowCapability.setImageFields(display.getImageFields());
- ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
- imageTypeSupported.add(ImageType.STATIC);
- if (display.getGraphicSupported()) {
- imageTypeSupported.add(ImageType.DYNAMIC);
- }
- defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
-
- displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
- return Collections.singletonList(displayCapability);
- }
-
- private DisplayCapabilities createDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
- DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
- convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
- convertedCapabilities.setDisplayName(displayName);
- convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
- convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
- convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
- convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
- convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
- convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
-
- return convertedCapabilities;
- }
-
- @Test
- public void testParseRAI() {
- systemCapabilityManager = createSampleManager();
-
- List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- assertTrue(TestValues.TRUE,
- Validator.validateDisplayCapabilityList(displayCapabilityList, (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateHMICapabilities(TestValues.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities> )systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateHMIZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validateSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH, null, false)));
- assertTrue(TestValues.TRUE,
- Validator.validatePreRecordedSpeechCapabilities(TestValues.GENERAL_PRERECORDEDSPEECH_LIST, (List<PrerecordedSpeech>) systemCapabilityManager.getCapability(SystemCapabilityType.PRERECORDED_SPEECH, null, false)));
-
- }
-
- @Test
- public void testNullDisplayCapabilitiesEnablesAllTextAndImageFields() {
- List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(null, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getTextFields().size(), 32);
- assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getImageFields().size(), 16);
- }
-
- @Test
- public void testGetVSCapability(){
- VideoStreamingCapability vsCapability = new VideoStreamingCapability();
- vsCapability.setMaxBitrate(TestValues.GENERAL_INT);
- vsCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
- vsCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
-
- SystemCapability cap = new SystemCapability();
- cap.setSystemCapabilityType(SystemCapabilityType.VIDEO_STREAMING);
- cap.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, vsCapability);
-
- final SystemCapability referenceCapability = cap;
-
- systemCapabilityManager = new SystemCapabilityManager(new InternalSDLInterface() {
- @Override
- public void sendRPC(RPCMessage message) {
- GetSystemCapabilityResponse response = new GetSystemCapabilityResponse();
- response.setSystemCapability(referenceCapability);
- response.setSuccess(true);
- if (message instanceof RPCRequest) {
- RPCRequest request = (RPCRequest) message;
- request.getOnRPCResponseListener().onResponse(CorrelationIdGenerator.generateId(), response);
- }
- }
-
- @Override
- public void addOnRPCListener(FunctionID messageId, OnRPCListener listener) {
- listener.onReceived(new OnHMIStatus(HMILevel.HMI_FULL, AudioStreamingState.NOT_AUDIBLE, SystemContext.SYSCTXT_MAIN));
- }
- });
-
- systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- assertTrue(TestValues.TRUE,
- Validator.validateVideoStreamingCapability(
- (VideoStreamingCapability) referenceCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING),
- (VideoStreamingCapability) capability));
- }
-
- @Override
- public void onError(String info) {
- assertTrue(false);
- }
- }, false);
- }
-
- private Answer<Void> createOnHMIStatusAnswer(final HMILevel hmiLevel){
- Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- OnRPCListener onHMIStatusListener = (OnRPCListener) args[1];
- OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
- onHMIStatusFakeNotification.setHmiLevel(hmiLevel);
- onHMIStatusListener.onReceived(onHMIStatusFakeNotification);
- return null;
- }
- };
- return onHMIStatusAnswer;
- }
-
- private Answer<Void> createOnSendGetSystemCapabilityAnswer (final boolean success, final Boolean subscribe) {
- Answer<Void> onSendGetSystemCapabilityAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- GetSystemCapability getSystemCapability = (GetSystemCapability) args[0];
- if (subscribe != null) {
- assertEquals(subscribe, getSystemCapability.getSubscribe());
- }
- GetSystemCapabilityResponse response;
- if (success) {
- response = new GetSystemCapabilityResponse(Result.SUCCESS, true);
- } else {
- response = new GetSystemCapabilityResponse(Result.REJECTED, false);
- }
- response.setSystemCapability(systemCapability);
- getSystemCapability.getOnRPCResponseListener().onResponse(CorrelationIdGenerator.generateId(), response);
- return null;
- }
- };
- return onSendGetSystemCapabilityAnswer;
- }
-
- @Test
- public void testGetCapability() {
- ISdl internalInterface;
- SystemCapabilityManager scm;
- OnSystemCapabilityListener onSystemCapabilityListener;
- VideoStreamingCapability retrievedCapability;
-
-
- // Test case 1 (capability not cached, listener not null, forceUpdate false)
- internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- scm = new SystemCapabilityManager(internalInterface);
- onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
- retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
- assertNull(retrievedCapability);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Test case 2 (capability cached, listener not null, forceUpdate true)
- internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- scm = new SystemCapabilityManager(internalInterface);
- onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
- assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Test case 3 (capability cached, listener null, forceUpdate true)
- internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- scm = new SystemCapabilityManager(internalInterface);
- onSystemCapabilityListener = null;
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
- assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
-
-
- // Test case 4 (capability cached, listener null, forceUpdate false)
- internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- scm = new SystemCapabilityManager(internalInterface);
- onSystemCapabilityListener = null;
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
- assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- }
-
- @Test
- public void testGetCapabilityHmiNone() {
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_NONE)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- OnSystemCapabilityListener onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
- VideoStreamingCapability retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
- assertNull(retrievedCapability);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener, times(0)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener, times(1)).onError(any(String.class));
- }
-
- @Test
- public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityCached() {
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
- sdlMsgVersion.setPatchVersion(0);
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
-
-
- // Add listener1
- // When the first listener is added, GetSystemCapability request should go out with subscribe=true
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Add listener2
- OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Add listener3
- OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Remove listener1
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
-
-
- // Remove listener2
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
-
-
- // Remove listener3
- // When the last listener is removed, GetSystemCapability request should go out with subscribe=false
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
- }
-
- @Test
- public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityNotCached() {
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
- sdlMsgVersion.setPatchVersion(0);
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
-
-
- // Add listener1
- // When the first listener is added, GetSystemCapability request should go out with subscribe=true
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Add listener2
- OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
-
-
- // Add listener3
- OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
-
+ public static final String TAG = "SystemCapabilityManagerTests";
+ public static SystemCapabilityManager systemCapabilityManager;
+ private SystemCapability systemCapability;
+ private VideoStreamingCapability videoStreamingCapability;
+
+ @Before
+ public void setUp() throws Exception {
+
+ systemCapability = new SystemCapability(SystemCapabilityType.VIDEO_STREAMING);
+ videoStreamingCapability = new VideoStreamingCapability();
+ videoStreamingCapability.setMaxBitrate(TestValues.GENERAL_INT);
+ videoStreamingCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ videoStreamingCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ systemCapability.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ }
+
+ public SystemCapabilityManager createSampleManager() {
+ return createSampleManager(new InternalSDLInterface());
+ }
+
+ public SystemCapabilityManager createSampleManager(InternalSDLInterface iSdl) {
+ SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSdl);
+
+ RegisterAppInterfaceResponse raiResponse = new RegisterAppInterfaceResponse();
+
+ raiResponse.setHmiCapabilities(TestValues.GENERAL_HMICAPABILITIES);
+ raiResponse.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ raiResponse.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ raiResponse.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ raiResponse.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
+ raiResponse.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ raiResponse.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ raiResponse.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
+ raiResponse.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
+ raiResponse.setSuccess(true);
+
+ systemCapabilityManager.parseRAIResponse(raiResponse);
+ return systemCapabilityManager;
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
+ WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
+
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setDisplayName(display != null ? display.getDisplayName() : null);
+ displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
+
+ WindowCapability defaultWindowCapability = new WindowCapability();
+ defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ defaultWindowCapability.setButtonCapabilities(button);
+ defaultWindowCapability.setSoftButtonCapabilities(softButton);
+
+ if (display == null) {
+ defaultWindowCapability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
+ defaultWindowCapability.setImageFields(ManagerUtility.WindowCapabilityUtility.getAllImageFields());
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
+ defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
+ defaultWindowCapability.setTextFields(display.getTextFields());
+ defaultWindowCapability.setImageFields(display.getImageFields());
+ ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
+ imageTypeSupported.add(ImageType.STATIC);
+ if (display.getGraphicSupported()) {
+ imageTypeSupported.add(ImageType.DYNAMIC);
+ }
+ defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
+
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ private DisplayCapabilities createDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
+ DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
+ convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
+ convertedCapabilities.setDisplayName(displayName);
+ convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
+ convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
+ convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
+ convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
+ convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
+ convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
+
+ return convertedCapabilities;
+ }
+
+ @Test
+ public void testParseRAI() {
+ systemCapabilityManager = createSampleManager();
+
+ List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ assertTrue(TestValues.TRUE,
+ Validator.validateDisplayCapabilityList(displayCapabilityList, (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateHMICapabilities(TestValues.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateHMIZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validateSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH, null, false)));
+ assertTrue(TestValues.TRUE,
+ Validator.validatePreRecordedSpeechCapabilities(TestValues.GENERAL_PRERECORDEDSPEECH_LIST, (List<PrerecordedSpeech>) systemCapabilityManager.getCapability(SystemCapabilityType.PRERECORDED_SPEECH, null, false)));
+
+ }
+
+ @Test
+ public void testNullDisplayCapabilitiesEnablesAllTextAndImageFields() {
+ List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(null, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getTextFields().size(), 32);
+ assertEquals(displayCapabilityList.get(0).getWindowCapabilities().get(0).getImageFields().size(), 16);
+ }
+
+ @Test
+ public void testGetVSCapability() {
+ VideoStreamingCapability vsCapability = new VideoStreamingCapability();
+ vsCapability.setMaxBitrate(TestValues.GENERAL_INT);
+ vsCapability.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ vsCapability.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+
+ SystemCapability cap = new SystemCapability();
+ cap.setSystemCapabilityType(SystemCapabilityType.VIDEO_STREAMING);
+ cap.setCapabilityForType(SystemCapabilityType.VIDEO_STREAMING, vsCapability);
+
+ final SystemCapability referenceCapability = cap;
+
+ systemCapabilityManager = new SystemCapabilityManager(new InternalSDLInterface() {
+ @Override
+ public void sendRPC(RPCMessage message) {
+ GetSystemCapabilityResponse response = new GetSystemCapabilityResponse();
+ response.setSystemCapability(referenceCapability);
+ response.setSuccess(true);
+ if (message instanceof RPCRequest) {
+ RPCRequest request = (RPCRequest) message;
+ request.getOnRPCResponseListener().onResponse(CorrelationIdGenerator.generateId(), response);
+ }
+ }
+
+ @Override
+ public void addOnRPCListener(FunctionID messageId, OnRPCListener listener) {
+ listener.onReceived(new OnHMIStatus(HMILevel.HMI_FULL, AudioStreamingState.NOT_AUDIBLE, SystemContext.SYSCTXT_MAIN));
+ }
+ });
+
+ systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ assertTrue(TestValues.TRUE,
+ Validator.validateVideoStreamingCapability(
+ (VideoStreamingCapability) referenceCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING),
+ (VideoStreamingCapability) capability));
+ }
+
+ @Override
+ public void onError(String info) {
+ assertTrue(false);
+ }
+ }, false);
+ }
+
+ private Answer<Void> createOnHMIStatusAnswer(final HMILevel hmiLevel) {
+ Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnRPCListener onHMIStatusListener = (OnRPCListener) args[1];
+ OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
+ onHMIStatusFakeNotification.setHmiLevel(hmiLevel);
+ onHMIStatusListener.onReceived(onHMIStatusFakeNotification);
+ return null;
+ }
+ };
+ return onHMIStatusAnswer;
+ }
+
+ private Answer<Void> createOnSendGetSystemCapabilityAnswer(final boolean success, final Boolean subscribe) {
+ Answer<Void> onSendGetSystemCapabilityAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ GetSystemCapability getSystemCapability = (GetSystemCapability) args[0];
+ if (subscribe != null) {
+ assertEquals(subscribe, getSystemCapability.getSubscribe());
+ }
+ GetSystemCapabilityResponse response;
+ if (success) {
+ response = new GetSystemCapabilityResponse(Result.SUCCESS, true);
+ } else {
+ response = new GetSystemCapabilityResponse(Result.REJECTED, false);
+ }
+ response.setSystemCapability(systemCapability);
+ getSystemCapability.getOnRPCResponseListener().onResponse(CorrelationIdGenerator.generateId(), response);
+ return null;
+ }
+ };
+ return onSendGetSystemCapabilityAnswer;
+ }
+
+ @Test
+ public void testGetCapability() {
+ ISdl internalInterface;
+ SystemCapabilityManager scm;
+ OnSystemCapabilityListener onSystemCapabilityListener;
+ VideoStreamingCapability retrievedCapability;
+
+
+ // Test case 1 (capability not cached, listener not null, forceUpdate false)
+ internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ scm = new SystemCapabilityManager(internalInterface);
+ onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
+ retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
+ assertNull(retrievedCapability);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Test case 2 (capability cached, listener not null, forceUpdate true)
+ internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ scm = new SystemCapabilityManager(internalInterface);
+ onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Test case 3 (capability cached, listener null, forceUpdate true)
+ internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ scm = new SystemCapabilityManager(internalInterface);
+ onSystemCapabilityListener = null;
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, true);
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+
+
+ // Test case 4 (capability cached, listener null, forceUpdate false)
+ internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ scm = new SystemCapabilityManager(internalInterface);
+ onSystemCapabilityListener = null;
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
+ assertTrue(TestValues.TRUE, Validator.validateVideoStreamingCapability((VideoStreamingCapability) systemCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING), retrievedCapability));
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ }
+
+ @Test
+ public void testGetCapabilityHmiNone() {
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_NONE)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ OnSystemCapabilityListener onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
+ VideoStreamingCapability retrievedCapability = (VideoStreamingCapability) scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener, false);
+ assertNull(retrievedCapability);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener, times(0)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener, times(1)).onError(any(String.class));
+ }
+
+ @Test
+ public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityCached() {
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
+ sdlMsgVersion.setPatchVersion(0);
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+
+
+ // Add listener1
+ // When the first listener is added, GetSystemCapability request should go out with subscribe=true
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Add listener2
+ OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Add listener3
+ OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Remove listener1
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+
+
+ // Remove listener2
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+
+
+ // Remove listener3
+ // When the last listener is removed, GetSystemCapability request should go out with subscribe=false
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
+ }
+
+ @Test
+ public void testAddOnSystemCapabilityListenerWithSubscriptionsSupportedAndCapabilityNotCached() {
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(6, 0); // This version supports capability subscriptions
+ sdlMsgVersion.setPatchVersion(0);
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
+
+
+ // Add listener1
+ // When the first listener is added, GetSystemCapability request should go out with subscribe=true
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+
+
+ // Add listener2
+ OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener1
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ // Add listener3
+ OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener2
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ // Remove listener1
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- // Remove listener3
- // When the last listener is removed, GetSystemCapability request should go out with subscribe=false
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
- }
- @Test
- public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityCached() {
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
- sdlMsgVersion.setPatchVersion(0);
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ // Remove listener2
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- // Add listener1
- // When the first listener is added, GetSystemCapability request should not go out because subscription is not supported and the capability is cached
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Remove listener3
+ // When the last listener is removed, GetSystemCapability request should go out with subscribe=false
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
+ }
+ @Test
+ public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityCached() {
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
+ sdlMsgVersion.setPatchVersion(0);
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- // Add listener2
- OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Add listener1
+ // When the first listener is added, GetSystemCapability request should not go out because subscription is not supported and the capability is cached
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, true)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
- // Add listener3
- OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Add listener2
+ OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener1
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ // Add listener3
+ OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener2
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ // Remove listener1
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- // Remove listener3
- // When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- }
- @Test
- public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityNotCached() {
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
- sdlMsgVersion.setPatchVersion(0);
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
+ // Remove listener2
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- // Add listener1
- // When the first listener is added, GetSystemCapability request should out because because capability is not cached
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Remove listener3
+ // When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ }
+ @Test
+ public void testAddOnSystemCapabilityListenerWithSubscriptionsNotSupportedAndCapabilityNotCached() {
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
+ sdlMsgVersion.setPatchVersion(0);
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, null);
- // Add listener2
- OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Add listener1
+ // When the first listener is added, GetSystemCapability request should out because because capability is not cached
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
- // Add listener3
- OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Add listener2
+ OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener1
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ // Add listener3
+ OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener2
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ // Remove listener1
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- // Remove listener3
- // When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- }
- @Test
- public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsAreNotSupported() {
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
- sdlMsgVersion.setPatchVersion(0);
- ISdl internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
- SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
- scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
+ // Remove listener2
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- // Add listener1
- // When the first listener is added, GetSystemCapability request should go out with subscribe=false
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Remove listener3
+ // When the last listener is removed, GetSystemCapability request should not go out because subscription is not supported
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ }
+ @Test
+ public void testAddOnSystemCapabilityListenerThenGetCapabilityWhenSubscriptionsAreNotSupported() {
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(5, 0); // This version doesn't support capability subscriptions
+ sdlMsgVersion.setPatchVersion(0);
+ ISdl internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(sdlMsgVersion);
+ SystemCapabilityManager scm = new SystemCapabilityManager(internalInterface);
+ scm.setCapability(SystemCapabilityType.VIDEO_STREAMING, videoStreamingCapability);
- // Get Capability (should notify listener1 again)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(2)).onCapabilityRetrieved(any(Object.class));
+ // Add listener1
+ // When the first listener is added, GetSystemCapability request should go out with subscribe=false
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, false)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
- // Add listener2
- OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Get Capability (should notify listener1 again)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(1)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(2)).onCapabilityRetrieved(any(Object.class));
- // Get Capability (should notify listener1 & listener2 again)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(3)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener2, times(2)).onCapabilityRetrieved(any(Object.class));
+ // Add listener2
+ OnSystemCapabilityListener onSystemCapabilityListener2 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ verify(onSystemCapabilityListener2, times(1)).onCapabilityRetrieved(any(Object.class));
- // Add listener3
- OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
+ // Get Capability (should notify listener1 & listener2 again)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(2)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(3)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener2, times(2)).onCapabilityRetrieved(any(Object.class));
- // Get Capability (should notify listener1 & listener2 & listener3 again)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(3)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener2, times(3)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener3, times(2)).onCapabilityRetrieved(any(Object.class));
+ // Add listener3
+ OnSystemCapabilityListener onSystemCapabilityListener3 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(onSystemCapabilityListener3, times(1)).onCapabilityRetrieved(any(Object.class));
- // Remove listener1
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
+ // Get Capability (should notify listener1 & listener2 & listener3 again)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(3)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener2, times(3)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener3, times(2)).onCapabilityRetrieved(any(Object.class));
- // Get Capability (should notify listener2 & listener3 again)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(4)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener3, times(3)).onCapabilityRetrieved(any(Object.class));
+ // Remove listener1
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener1);
- // Remove listener2
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
+ // Get Capability (should notify listener2 & listener3 again)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(4)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener3, times(3)).onCapabilityRetrieved(any(Object.class));
- // Get Capability (should notify listener3 again)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
+ // Remove listener2
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener2);
- // Remove listener3
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
- verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
+ // Get Capability (should notify listener3 again)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
- // Get Capability (should not notify any listener again because they are all removed)
- scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
- verify(internalInterface, times(6)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
- }
- @Test
- public void testGetAndAddListenerForDisplaysCapability() {
- ISdl internalInterface;
- SystemCapabilityManager scm;
- OnSystemCapabilityListener onSystemCapabilityListener;
- DisplayCapabilities retrievedCapability;
-
-
- // Test case 1 (capability cached, listener not null, forceUpdate true)
- internalInterface = mock(ISdl.class);
- doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
- scm = new SystemCapabilityManager(internalInterface);
- onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
- doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
- scm.setCapability(SystemCapabilityType.DISPLAYS, new DisplayCapabilities());
- retrievedCapability = (DisplayCapabilities) scm.getCapability(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener, true);
- assertNotNull(retrievedCapability);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
- verify(onSystemCapabilityListener, times(0)).onError(any(String.class));
+ // Remove listener3
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.VIDEO_STREAMING, onSystemCapabilityListener3);
+ verify(internalInterface, times(5)).sendRPC(any(GetSystemCapability.class));
- // Test case 2 (Add listener)
- // When the first DISPLAYS listener is added, GetSystemCapability request should not go out
- OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
- scm.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener1);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
-
+ // Get Capability (should not notify any listener again because they are all removed)
+ scm.getCapability(SystemCapabilityType.VIDEO_STREAMING, null, true);
+ verify(internalInterface, times(6)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener2, times(4)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener3, times(4)).onCapabilityRetrieved(any(Object.class));
+ }
- // Test case 3 (Remove listener)
- // When the last DISPLAYS listener is removed, GetSystemCapability request should not go out
- scm.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener1);
- verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
- }
-
- @Test
- public void testListConversion(){
- SystemCapabilityManager systemCapabilityManager = createSampleManager();
- Object capability = systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON, null, false);
- assertNotNull(capability);
- List<SoftButtonCapabilities> list = SystemCapabilityManager.convertToList(capability, SoftButtonCapabilities.class);
- assertNotNull(list);
- }
-
- @Test
- public void testFalsePositive(){
- SystemCapabilityManager systemCapabilityManager = createSampleManager();
- systemCapabilityManager.setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, null);
- assertFalse(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.AUDIO_PASSTHROUGH));
- }
-
- @Test
- public void testOnSystemCapabilityUpdateWithNoExistingCap(){
- InternalSDLInterface iSDL = new InternalSDLInterface();
- SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
- OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
- assertNotNull(scmRpcListener);
-
- assertNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false));
+ @Test
+ public void testGetAndAddListenerForDisplaysCapability() {
+ ISdl internalInterface;
+ SystemCapabilityManager scm;
+ OnSystemCapabilityListener onSystemCapabilityListener;
+ DisplayCapabilities retrievedCapability;
+
+
+ // Test case 1 (capability cached, listener not null, forceUpdate true)
+ internalInterface = mock(ISdl.class);
+ doAnswer(createOnHMIStatusAnswer(HMILevel.HMI_FULL)).when(internalInterface).addOnRPCListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCListener.class));
+ scm = new SystemCapabilityManager(internalInterface);
+ onSystemCapabilityListener = mock(OnSystemCapabilityListener.class);
+ doAnswer(createOnSendGetSystemCapabilityAnswer(true, null)).when(internalInterface).sendRPC(any(GetSystemCapability.class));
+ scm.setCapability(SystemCapabilityType.DISPLAYS, new DisplayCapabilities());
+ retrievedCapability = (DisplayCapabilities) scm.getCapability(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener, true);
+ assertNotNull(retrievedCapability);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener, times(1)).onCapabilityRetrieved(any(Object.class));
+ verify(onSystemCapabilityListener, times(0)).onError(any(String.class));
- /* PERFORM A NOTIFICATION SEND THROUGH THE SCM */
- AppServiceCapability addServiceID = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "test", "3453", true, null);
- AppServicesCapabilities serviceIdASC = new AppServicesCapabilities();
- serviceIdASC.setAppServices(Collections.singletonList(addServiceID));
- SystemCapability systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
- systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, serviceIdASC);
-
- OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ // Test case 2 (Add listener)
+ // When the first DISPLAYS listener is added, GetSystemCapability request should not go out
+ OnSystemCapabilityListener onSystemCapabilityListener1 = mock(OnSystemCapabilityListener.class);
+ scm.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener1);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ verify(onSystemCapabilityListener1, times(1)).onCapabilityRetrieved(any(Object.class));
+
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ // Test case 3 (Remove listener)
+ // When the last DISPLAYS listener is removed, GetSystemCapability request should not go out
+ scm.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onSystemCapabilityListener1);
+ verify(internalInterface, times(0)).sendRPC(any(GetSystemCapability.class));
+ }
+
+ @Test
+ public void testListConversion() {
+ SystemCapabilityManager systemCapabilityManager = createSampleManager();
+ Object capability = systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON, null, false);
+ assertNotNull(capability);
+ List<SoftButtonCapabilities> list = SystemCapabilityManager.convertToList(capability, SoftButtonCapabilities.class);
+ assertNotNull(list);
+ }
+
+ @Test
+ public void testFalsePositive() {
+ SystemCapabilityManager systemCapabilityManager = createSampleManager();
+ systemCapabilityManager.setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, null);
+ assertFalse(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.AUDIO_PASSTHROUGH));
+ }
+
+ @Test
+ public void testOnSystemCapabilityUpdateWithNoExistingCap() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
+ assertNotNull(scmRpcListener);
+
+ assertNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false));
- assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false));
- }
-
- @Test
- public void testOnSystemCapabilityUpdatedForDISPLAYS() {
- InternalSDLInterface iSDL = new InternalSDLInterface();
- SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
- OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
- assertNotNull(scmRpcListener);
+ /* PERFORM A NOTIFICATION SEND THROUGH THE SCM */
+ AppServiceCapability addServiceID = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "test", "3453", true, null);
+ AppServicesCapabilities serviceIdASC = new AppServicesCapabilities();
+ serviceIdASC.setAppServices(Collections.singletonList(addServiceID));
+
+ SystemCapability systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
+ systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, serviceIdASC);
+
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
+
+ assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false));
+ }
+
+ @Test
+ public void testOnSystemCapabilityUpdatedForDISPLAYS() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
+ assertNotNull(scmRpcListener);
+
+ assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false));
+ assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false));
+
+ List<DisplayCapability> newCaps = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ ;
+
+ SystemCapability systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.DISPLAYS);
+ systemCapability.setCapabilityForType(SystemCapabilityType.DISPLAYS, newCaps);
+
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false));
- assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false));
-
- List<DisplayCapability> newCaps = createDisplayCapabilityList(TestValues.GENERAL_DISPLAYCAPABILITIES, TestValues.GENERAL_BUTTONCAPABILITIES_LIST, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);;
-
- SystemCapability systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.DISPLAYS);
- systemCapability.setCapabilityForType(SystemCapabilityType.DISPLAYS, newCaps);
-
- OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
-
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ List<DisplayCapability> appliedCaps = (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false);
+ assertNotNull(appliedCaps);
+ assertTrue(Validator.validateDisplayCapabilityList(newCaps, appliedCaps));
+
+ DisplayCapabilities appliedConvertedCaps = (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false);
+ assertNotNull(appliedConvertedCaps);
+ DisplayCapabilities testConvertedCaps = createDisplayCapabilities(newCaps.get(0).getDisplayName(), newCaps.get(0).getWindowCapabilities().get(0));
+ assertTrue(Validator.validateDisplayCapabilities(appliedConvertedCaps, testConvertedCaps));
+ }
+
+ @Test
+ public void testOnSystemCapabilityUpdated() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ String baseName = "NavTest", baseID = "37F98053AE";
+ AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, null, true, null);
- List<DisplayCapability> appliedCaps = (List<DisplayCapability>)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false);
- assertNotNull(appliedCaps);
- assertTrue(Validator.validateDisplayCapabilityList(newCaps, appliedCaps));
-
- DisplayCapabilities appliedConvertedCaps = (DisplayCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false);
- assertNotNull(appliedConvertedCaps);
- DisplayCapabilities testConvertedCaps = createDisplayCapabilities(newCaps.get(0).getDisplayName(), newCaps.get(0).getWindowCapabilities().get(0));
- assertTrue(Validator.validateDisplayCapabilities(appliedConvertedCaps, testConvertedCaps));
- }
-
- @Test
- public void testOnSystemCapabilityUpdated(){
- InternalSDLInterface iSDL = new InternalSDLInterface();
- String baseName = "NavTest", baseID = "37F98053AE";
- AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, null, true, null);
+ AppServicesCapabilities appServicesCapabilities = new AppServicesCapabilities();
+ appServicesCapabilities.setAppServices(Collections.singletonList(capability1));
- AppServicesCapabilities appServicesCapabilities = new AppServicesCapabilities();
- appServicesCapabilities.setAppServices(Collections.singletonList(capability1));
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ assertNotNull(iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()));
+ OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
+ assertNotNull(scmRpcListener);
- SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
- assertNotNull(iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()));
- OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
- assertNotNull(scmRpcListener);
+ /* CONFIRM THE CAP DOESN'T EXIST IN SCM */
+ AppServicesCapabilities cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNull(cachedCap);
- /* CONFIRM THE CAP DOESN'T EXIST IN SCM */
- AppServicesCapabilities cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNull(cachedCap);
+ /* ADD THE CAP IN SCM */
+ systemCapabilityManager.setCapability(SystemCapabilityType.APP_SERVICES, appServicesCapabilities);
+ /* CONFIRM THE CAP DOES EXIST IN SCM */
+ cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNotNull(cachedCap);
+ /* CONFIRM THE CAP IN SCM EQUALS ORIGINAL*/
+ assertEquals(cachedCap, appServicesCapabilities);
+ assertNull(cachedCap.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID());
- /* ADD THE CAP IN SCM */
- systemCapabilityManager.setCapability(SystemCapabilityType.APP_SERVICES, appServicesCapabilities);
- /* CONFIRM THE CAP DOES EXIST IN SCM */
- cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNotNull(cachedCap);
- /* CONFIRM THE CAP IN SCM EQUALS ORIGINAL*/
- assertEquals(cachedCap, appServicesCapabilities);
- assertNull(cachedCap.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID());
+ /* PERFORM A NOTIFICATION SEND THROUGH THE SCM */
+ AppServiceCapability addServiceID = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
+ AppServicesCapabilities serviceIdASC = new AppServicesCapabilities();
+ serviceIdASC.setAppServices(Collections.singletonList(addServiceID));
- /* PERFORM A NOTIFICATION SEND THROUGH THE SCM */
- AppServiceCapability addServiceID = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
- AppServicesCapabilities serviceIdASC = new AppServicesCapabilities();
- serviceIdASC.setAppServices(Collections.singletonList(addServiceID));
+ SystemCapability systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
+ systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, serviceIdASC);
- SystemCapability systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
- systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, serviceIdASC);
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
- OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNotNull(cachedCap);
- cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNotNull(cachedCap);
+ assertTrue(cachedCap.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equals(baseID));
- assertTrue(cachedCap.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equals(baseID));
+ appServicesCapabilities.updateAppServices(Collections.singletonList(addServiceID));
+ assertTrue(serviceIdASC.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equalsIgnoreCase(appServicesCapabilities.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID()));
- appServicesCapabilities.updateAppServices(Collections.singletonList(addServiceID));
- assertTrue(serviceIdASC.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equalsIgnoreCase(appServicesCapabilities.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID()));
+ assertEquals(cachedCap, appServicesCapabilities);
- assertEquals(cachedCap, appServicesCapabilities);
+ /* PERFORM A NOTIFICATION SEND THROUGH AN UPDATED SERVICE NAME */
+ AppServiceCapability newServiceName = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "TestNav", baseID, true, null);
+ AppServicesCapabilities newServiceNameASC = new AppServicesCapabilities();
+ newServiceNameASC.setAppServices(Collections.singletonList(newServiceName));
- /* PERFORM A NOTIFICATION SEND THROUGH AN UPDATED SERVICE NAME */
- AppServiceCapability newServiceName = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "TestNav", baseID, true, null);
- AppServicesCapabilities newServiceNameASC = new AppServicesCapabilities();
- newServiceNameASC.setAppServices(Collections.singletonList(newServiceName));
+ systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
+ systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, newServiceNameASC);
- systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
- systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, newServiceNameASC);
+ onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
- onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNotNull(cachedCap);
+ assertEquals(cachedCap.getAppServices().size(), 1);
- cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNotNull(cachedCap);
- assertEquals(cachedCap.getAppServices().size(), 1);
+ /* PERFORM A NOTIFICATION SEND THROUGH THE SCM WITH DIFFERENT SERVICE */
+ AppServiceCapability newService = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", false, null);
+ AppServicesCapabilities newServiceASC = new AppServicesCapabilities();
+ newServiceASC.setAppServices(Collections.singletonList(newService));
- /* PERFORM A NOTIFICATION SEND THROUGH THE SCM WITH DIFFERENT SERVICE */
- AppServiceCapability newService = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", false, null);
- AppServicesCapabilities newServiceASC = new AppServicesCapabilities();
- newServiceASC.setAppServices(Collections.singletonList(newService));
+ systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
+ systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, newServiceASC);
- systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
- systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, newServiceASC);
+ onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
- onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNotNull(cachedCap);
+ assertEquals(cachedCap.getAppServices().size(), 2);
- cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNotNull(cachedCap);
- assertEquals(cachedCap.getAppServices().size(), 2);
+ /* PERFORM A NOTIFICATION SEND THROUGH THE SCM WITH A REMOVED SERVICE */
+ AppServiceCapability removedService = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", false, null);
+ removedService.setUpdateReason(ServiceUpdateReason.REMOVED);
+ AppServicesCapabilities removedServiceASC = new AppServicesCapabilities();
+ removedServiceASC.setAppServices(Collections.singletonList(removedService));
+
+ systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
+ systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, removedServiceASC);
- /* PERFORM A NOTIFICATION SEND THROUGH THE SCM WITH A REMOVED SERVICE */
- AppServiceCapability removedService = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", false, null);
- removedService.setUpdateReason(ServiceUpdateReason.REMOVED);
- AppServicesCapabilities removedServiceASC = new AppServicesCapabilities();
- removedServiceASC.setAppServices(Collections.singletonList(removedService));
+ onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
- systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.APP_SERVICES);
- systemCapability.setCapabilityForType(SystemCapabilityType.APP_SERVICES, removedServiceASC);
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ cachedCap = (AppServicesCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
+ assertNotNull(cachedCap);
+ assertEquals(cachedCap.getAppServices().size(), 1);
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ }
- cachedCap = (AppServicesCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES, null, false);
- assertNotNull(cachedCap);
- assertEquals(cachedCap.getAppServices().size(), 1);
- }
+ @Test
+ public void testOnSystemCapabilityUpdatedOverwrite() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
+ assertNotNull(scmRpcListener);
+ systemCapabilityManager.setCapability(SystemCapabilityType.PHONE_CALL, TestValues.GENERAL_PHONECAPABILITY);
+ PhoneCapability phoneCapability = (PhoneCapability) systemCapabilityManager.getCapability(SystemCapabilityType.PHONE_CALL, null, false);
+ assertNotNull(phoneCapability);
+ assertEquals(phoneCapability, TestValues.GENERAL_PHONECAPABILITY);
- @Test
- public void testOnSystemCapabilityUpdatedOverwrite(){
- InternalSDLInterface iSDL = new InternalSDLInterface();
- SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
- OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
- assertNotNull(scmRpcListener);
- systemCapabilityManager.setCapability(SystemCapabilityType.PHONE_CALL, TestValues.GENERAL_PHONECAPABILITY);
+ phoneCapability.setDialNumberEnabled(!TestValues.GENERAL_PHONECAPABILITY.getDialNumberEnabled()); //Flip it
+ SystemCapability systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.PHONE_CALL);
+ systemCapability.setCapabilityForType(SystemCapabilityType.PHONE_CALL, phoneCapability);
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
- PhoneCapability phoneCapability = (PhoneCapability)systemCapabilityManager.getCapability(SystemCapabilityType.PHONE_CALL, null, false);
- assertNotNull(phoneCapability);
- assertEquals(phoneCapability, TestValues.GENERAL_PHONECAPABILITY);
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
- phoneCapability.setDialNumberEnabled(!TestValues.GENERAL_PHONECAPABILITY.getDialNumberEnabled()); //Flip it
- SystemCapability systemCapability = new SystemCapability();
- systemCapability.setSystemCapabilityType(SystemCapabilityType.PHONE_CALL);
- systemCapability.setCapabilityForType(SystemCapabilityType.PHONE_CALL, phoneCapability);
- OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
- onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+ PhoneCapability phoneCapabilityUpdated = (PhoneCapability) systemCapabilityManager.getCapability(SystemCapabilityType.PHONE_CALL, null, false);
+ assertNotNull(phoneCapabilityUpdated);
+ assertFalse(phoneCapabilityUpdated.getDialNumberEnabled());
+ assertEquals(phoneCapability, phoneCapabilityUpdated);
+ }
- scmRpcListener.onReceived(onSystemCapabilityUpdated);
+ @Test
+ public void testOnSetDisplayLayout() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener dlRpcListener = iSDL.rpcListeners.get(FunctionID.SET_DISPLAY_LAYOUT.getId()).get(0);
+ assertNotNull(dlRpcListener);
- PhoneCapability phoneCapabilityUpdated = (PhoneCapability)systemCapabilityManager.getCapability(SystemCapabilityType.PHONE_CALL, null, false);
- assertNotNull(phoneCapabilityUpdated);
- assertFalse(phoneCapabilityUpdated.getDialNumberEnabled());
- assertEquals(phoneCapability, phoneCapabilityUpdated);
- }
+ SetDisplayLayoutResponse newLayout = new SetDisplayLayoutResponse();
+ newLayout.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ newLayout.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ newLayout.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ newLayout.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ newLayout.setSuccess(true);
+ newLayout.setResultCode(Result.SUCCESS);
+
+ dlRpcListener.onReceived(newLayout);
- @Test
- public void testOnSetDisplayLayout() {
- InternalSDLInterface iSDL = new InternalSDLInterface();
- SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
- OnRPCListener dlRpcListener = iSDL.rpcListeners.get(FunctionID.SET_DISPLAY_LAYOUT.getId()).get(0);
- assertNotNull(dlRpcListener);
- SetDisplayLayoutResponse newLayout = new SetDisplayLayoutResponse();
- newLayout.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
- newLayout.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
- newLayout.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- newLayout.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
- newLayout.setSuccess(true);
- newLayout.setResultCode(Result.SUCCESS);
-
- dlRpcListener.onReceived(newLayout);
-
-
- DisplayCapabilities appliedCaps = (DisplayCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false);
- assertNotNull(appliedCaps);
- assertTrue(Validator.validateDisplayCapabilities(newLayout.getDisplayCapabilities(), appliedCaps));
-
- List<DisplayCapability> convertedCaps = (List<DisplayCapability>)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false);
- assertNotNull(convertedCaps);
- List<DisplayCapability> testCaps = createDisplayCapabilityList(newLayout.getDisplayCapabilities(), newLayout.getButtonCapabilities(), newLayout.getSoftButtonCapabilities());
- assertTrue(Validator.validateDisplayCapabilityList(convertedCaps, testCaps));
-
- WindowCapability matchWindowCapability = testCaps.get(0).getWindowCapabilities().get(0);
- WindowCapability testWindowCapability = systemCapabilityManager.getDefaultMainWindowCapability();
- assertTrue(Validator.validateWindowCapability(matchWindowCapability, testWindowCapability));
- assertNull(systemCapabilityManager.getWindowCapability(42));
- }
-
- @Test
- public void testManagerBeforeDisplayUpdate() {
- InternalSDLInterface iSDL = new InternalSDLInterface();
- SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSDL);
- assertNull(systemCapabilityManager.getDefaultMainWindowCapability());
- assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue()));
- assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.PRIMARY_WIDGET.getValue()));
- }
-
- private class InternalSDLInterface implements ISdl{
- private final Object RPC_LISTENER_LOCK = new Object();
- SparseArray<CopyOnWriteArrayList<OnRPCListener>> rpcListeners = new SparseArray<>();
-
- @Override
- public void start(){}
-
- @Override
- public void stop() {}
-
- @Override
- public boolean isConnected() {return false; }
-
- @Override
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {}
-
- @Override
- public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {}
-
- @Override
- public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) { }
-
- @Override
- public void sendRPC(RPCMessage message) {}
-
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
-
- }
-
- @Override
- public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
-
- }
-
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
-
- }
-
- @Override
- public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {return false;}
-
- @Override
- public void addOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
-
- }
-
- @Override
- public boolean removeOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
- return false;
- }
- @Override
- public void addOnRPCListener(FunctionID messageId, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(messageId != null && listener != null){
- if(rpcListeners.indexOfKey(messageId.getId()) < 0 ){
- rpcListeners.put(messageId.getId(),new CopyOnWriteArrayList<OnRPCListener>());
- }
- rpcListeners.get(messageId.getId()).add(listener);
- }
- }
- }
- @Override
- public boolean removeOnRPCListener(FunctionID messageId, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(rpcListeners!= null
- && messageId != null
- && listener != null
- && rpcListeners.indexOfKey(messageId.getId()) >= 0){
- return rpcListeners.get(messageId.getId()).remove(listener);
- }
- }
- return false;
- }
-
-
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
- return null;
- }
-
- @Override
- public SdlMsgVersion getSdlMsgVersion() {
- return null;
- }
-
- @Override
- public Version getProtocolVersion() {
- return new Version(1,0,0);
- }
-
- @Override
- public boolean isTransportForServiceAvailable(SessionType serviceType) {
- return false;
- }
-
- @Override
- public void startAudioService(boolean encrypted){}
-
- @Override
- public void startRPCEncryption() {}
-
- @Override
- public Taskmaster getTaskmaster() {
- return null;
- }
-
- @Override
- public SystemCapabilityManager getSystemCapabilityManager() {
- return null;
- }
- }
+ DisplayCapabilities appliedCaps = (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY, null, false);
+ assertNotNull(appliedCaps);
+ assertTrue(Validator.validateDisplayCapabilities(newLayout.getDisplayCapabilities(), appliedCaps));
+
+ List<DisplayCapability> convertedCaps = (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS, null, false);
+ assertNotNull(convertedCaps);
+ List<DisplayCapability> testCaps = createDisplayCapabilityList(newLayout.getDisplayCapabilities(), newLayout.getButtonCapabilities(), newLayout.getSoftButtonCapabilities());
+ assertTrue(Validator.validateDisplayCapabilityList(convertedCaps, testCaps));
+
+ WindowCapability matchWindowCapability = testCaps.get(0).getWindowCapabilities().get(0);
+ WindowCapability testWindowCapability = systemCapabilityManager.getDefaultMainWindowCapability();
+ assertTrue(Validator.validateWindowCapability(matchWindowCapability, testWindowCapability));
+ assertNull(systemCapabilityManager.getWindowCapability(42));
+ }
+
+ @Test
+ public void testManagerBeforeDisplayUpdate() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSDL);
+ assertNull(systemCapabilityManager.getDefaultMainWindowCapability());
+ assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue()));
+ assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.PRIMARY_WIDGET.getValue()));
+ }
+
+ private class InternalSDLInterface implements ISdl {
+ private final Object RPC_LISTENER_LOCK = new Object();
+ SparseArray<CopyOnWriteArrayList<OnRPCListener>> rpcListeners = new SparseArray<>();
+
+ @Override
+ public void start() {
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ @Override
+ public boolean isConnected() {
+ return false;
+ }
+
+ @Override
+ public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ }
+
+ @Override
+ public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ }
+
+ @Override
+ public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
+ }
+
+ @Override
+ public void sendRPC(RPCMessage message) {
+ }
+
+ @Override
+ public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
+
+ }
+
+ @Override
+ public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
+
+ }
+
+ @Override
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+
+ }
+
+ @Override
+ public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ return false;
+ }
+
+ @Override
+ public void addOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
+
+ }
+
+ @Override
+ public boolean removeOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
+ return false;
+ }
+
+ @Override
+ public void addOnRPCListener(FunctionID messageId, OnRPCListener listener) {
+ synchronized (RPC_LISTENER_LOCK) {
+ if (messageId != null && listener != null) {
+ if (rpcListeners.indexOfKey(messageId.getId()) < 0) {
+ rpcListeners.put(messageId.getId(), new CopyOnWriteArrayList<OnRPCListener>());
+ }
+ rpcListeners.get(messageId.getId()).add(listener);
+ }
+ }
+ }
+
+ @Override
+ public boolean removeOnRPCListener(FunctionID messageId, OnRPCListener listener) {
+ synchronized (RPC_LISTENER_LOCK) {
+ if (rpcListeners != null
+ && messageId != null
+ && listener != null
+ && rpcListeners.indexOfKey(messageId.getId()) >= 0) {
+ return rpcListeners.get(messageId.getId()).remove(listener);
+ }
+ }
+ return false;
+ }
+
+
+ @Override
+ public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
+ return null;
+ }
+
+ @Override
+ public SdlMsgVersion getSdlMsgVersion() {
+ return null;
+ }
+
+ @Override
+ public Version getProtocolVersion() {
+ return new Version(1, 0, 0);
+ }
+
+ @Override
+ public boolean isTransportForServiceAvailable(SessionType serviceType) {
+ return false;
+ }
+
+ @Override
+ public void startAudioService(boolean encrypted) {
+ }
+
+ @Override
+ public void startRPCEncryption() {
+ }
+
+ @Override
+ public Taskmaster getTaskmaster() {
+ return null;
+ }
+
+ @Override
+ public SystemCapabilityManager getSystemCapabilityManager() {
+ return null;
+ }
+ }
}
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 500680e02..bafecb62c 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
@@ -14,34 +14,34 @@ import static junit.framework.TestCase.assertTrue;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenConfig}
- *
+ * <p>
* We currently do not need to test null values, as each currently is a primitive
*/
@RunWith(AndroidJUnit4.class)
public class LockScreenConfigTests {
- private LockScreenConfig lockScreenConfig;
-
- @Before
- public void setUp() throws Exception {
- // set info for all the setters
- lockScreenConfig = new LockScreenConfig();
- lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
- lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
- lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
- lockScreenConfig.showDeviceLogo(true);
- lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
- }
-
- @Test
- public void testLockScreenConfig() {
-
- // get the info and make sure its correct
- assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getCustomView());
- assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getAppIcon());
- assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getBackgroundColor());
- assertTrue(lockScreenConfig.isDeviceLogoEnabled());
- assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenConfig.getDisplayMode());
- }
+ private LockScreenConfig lockScreenConfig;
+
+ @Before
+ public void setUp() throws Exception {
+ // set info for all the setters
+ lockScreenConfig = new LockScreenConfig();
+ lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
+ lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
+ lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
+ lockScreenConfig.showDeviceLogo(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
+ }
+
+ @Test
+ public void testLockScreenConfig() {
+
+ // get the info and make sure its correct
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getCustomView());
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getAppIcon());
+ assertEquals(TestValues.GENERAL_INT, lockScreenConfig.getBackgroundColor());
+ 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/LockScreenDeviceIconManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
index 727c043cc..86d755161 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManagerTests.java
@@ -85,7 +85,7 @@ public class LockScreenDeviceIconManagerTests {
lockScreenDeviceIconManager.retrieveIcon(ICON_URL, listener);
verify(listener, times(1)).onImageRetrieved((Bitmap) any());
}
-
+
private String daysToMillisecondsAsString(int days) {
long milliSeconds = (long) days * 24 * 60 * 60 * 1000;
long previousDay = System.currentTimeMillis() - milliSeconds;
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 dd606a2c0..d18908dbe 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
@@ -4,8 +4,8 @@ import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -36,138 +36,138 @@ import static org.mockito.Mockito.mock;
@RunWith(AndroidJUnit4.class)
public class LockScreenManagerTests {
- private LockScreenManager lockScreenManager;
- private OnRPCNotificationListener onDDListener;
-
- @Before
- public void setUp() throws Exception{
-
- 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 = getInstrumentation().getContext();
- // create config
- LockScreenConfig lockScreenConfig = new LockScreenConfig();
- lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
- lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
- lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
- lockScreenConfig.showDeviceLogo(true);
- lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
-
- lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
- }
-
- @Test
- public void testVariables() {
- assertEquals(TestValues.GENERAL_INT, lockScreenManager.customView);
- assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenIcon);
- assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenColor);
- assertTrue(lockScreenManager.deviceLogoEnabled);
- assertTrue(lockScreenManager.lockScreenEnabled);
- assertNull(lockScreenManager.deviceLogo);
- assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
- }
-
- @Test
- public void testGetLockScreenStatusHmiNoneDDOff(){
- lockScreenManager.driverDistStatus = false;
- lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
- assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiBackgroundDDOff(){
- lockScreenManager.driverDistStatus = false;
- lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
- assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiNoneDDOn(){
- lockScreenManager.driverDistStatus = true;
- lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
- assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiFullDDOff(){
- lockScreenManager.driverDistStatus = false;
- lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
- assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiFullDDOn(){
- lockScreenManager.driverDistStatus = true;
- lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
- assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiLimitedDDOff(){
- lockScreenManager.driverDistStatus = false;
- lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
- assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- public void testGetLockScreenStatusHmiLimitedDDOn(){
- lockScreenManager.driverDistStatus = true;
- lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
- assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
- }
-
- @Test
- 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);
- }
-
- @Test
- 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);
- }
-
- @Test
- 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);
- }
-
- @Test
- 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);
- }
+ private LockScreenManager lockScreenManager;
+ private OnRPCNotificationListener onDDListener;
+
+ @Before
+ public void setUp() throws Exception {
+
+ 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 = getInstrumentation().getContext();
+ // create config
+ LockScreenConfig lockScreenConfig = new LockScreenConfig();
+ lockScreenConfig.setCustomView(TestValues.GENERAL_INT);
+ lockScreenConfig.setAppIcon(TestValues.GENERAL_INT);
+ lockScreenConfig.setBackgroundColor(TestValues.GENERAL_INT);
+ lockScreenConfig.showDeviceLogo(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
+
+ lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
+ }
+
+ @Test
+ public void testVariables() {
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.customView);
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenIcon);
+ assertEquals(TestValues.GENERAL_INT, lockScreenManager.lockScreenColor);
+ assertTrue(lockScreenManager.deviceLogoEnabled);
+ assertTrue(lockScreenManager.lockScreenEnabled);
+ assertNull(lockScreenManager.deviceLogo);
+ assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiNoneDDOff() {
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
+ assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiBackgroundDDOff() {
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
+ assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiNoneDDOn() {
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiFullDDOff() {
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiFullDDOn() {
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiLimitedDDOff() {
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ public void testGetLockScreenStatusHmiLimitedDDOn() {
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ @Test
+ 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);
+ }
+
+ @Test
+ 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);
+ }
+
+ @Test
+ 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);
+ }
+
+ @Test
+ 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/permission/PermissionManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
index 973625106..6649d2b7f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/permission/PermissionManagerTests.java
@@ -3,8 +3,8 @@ package com.smartdevicelink.managers.permission;
import androidx.annotation.NonNull;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
@@ -114,13 +114,13 @@ public class PermissionManagerTests {
permissionManager.addListener(permissionElements, PermissionManager.PERMISSION_GROUP_TYPE_ALL_ALLOWED, new OnPermissionChangeListener() {
@Override
public void onPermissionsChange(@NonNull Map<FunctionID, PermissionStatus> allowedPermissions, @NonNull int permissionGroupStatus) {
- // Make sure is the actual result matches the expected one
- assertEquals(PERMISSION_GROUP_STATUS_ALLOWED, permissionGroupStatus);
- assertTrue(allowedPermissions.get(FunctionID.SHOW).getIsRPCAllowed());
- assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getIsRPCAllowed());
- assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getAllowedParameters().get("rpm"));
- assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getAllowedParameters().get("airbagStatus"));
- listenerCalledCounter++;
+ // Make sure is the actual result matches the expected one
+ assertEquals(PERMISSION_GROUP_STATUS_ALLOWED, permissionGroupStatus);
+ assertTrue(allowedPermissions.get(FunctionID.SHOW).getIsRPCAllowed());
+ assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getIsRPCAllowed());
+ assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getAllowedParameters().get("rpm"));
+ assertTrue(allowedPermissions.get(FunctionID.GET_VEHICLE_DATA).getAllowedParameters().get("airbagStatus"));
+ listenerCalledCounter++;
}
});
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 5e9203e99..627a900f6 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
@@ -4,10 +4,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.BaseSubManager;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.screen.menu.DynamicMenuUpdatesMode;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
@@ -32,144 +32,146 @@ import static org.mockito.Mockito.when;
*/
@RunWith(AndroidJUnit4.class)
public class ScreenManagerTests {
- private ScreenManager screenManager;
- private SdlArtwork testArtwork;
-
- @Before
- public void setUp() throws Exception {
-
-
- ISdl internalInterface = mock(ISdl.class);
- when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
- FileManager fileManager = mock(FileManager.class);
- screenManager = new ScreenManager(internalInterface, fileManager);
- screenManager.start(null);
- testArtwork = new SdlArtwork("testFile", FileType.GRAPHIC_PNG, 1, false);
- }
-
- @Test
- public void testInstantiation(){
- assertNull(screenManager.getTextField1());
- assertNull(screenManager.getTextField2());
- assertNull(screenManager.getTextField3());
- assertNull(screenManager.getTextField4());
- assertNull(screenManager.getTitle());
- assertNull(screenManager.getMediaTrackTextField());
- assertNull(screenManager.getPrimaryGraphic());
- assertNull(screenManager.getSecondaryGraphic());
- assertEquals(screenManager.getTextAlignment(), TextAlignment.CENTERED);
- assertNull(screenManager.getTextField1Type());
- assertNull(screenManager.getTextField2Type());
- assertNull(screenManager.getTextField3Type());
- assertNull(screenManager.getTextField4Type());
- assertNull(screenManager.getMenu());
- assertNull(screenManager.getVoiceCommands());
- assertTrue(screenManager.getSoftButtonObjects().isEmpty());
- assertNull(screenManager.getSoftButtonObjectByName("test"));
- assertNull(screenManager.getSoftButtonObjectById(1));
- assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
- assertEquals(screenManager.getState(), BaseSubManager.READY);
- assertNull(screenManager.getMenuConfiguration());
- }
-
- @Test
- public void testSetTextField() {
- screenManager.setTextField1("It is");
- screenManager.setTextField2("Wednesday");
- screenManager.setTextField3("My");
- screenManager.setTextField4("Dudes");
- screenManager.setTitle("title");
- assertEquals(screenManager.getTextField1(), "It is");
- assertEquals(screenManager.getTextField2(), "Wednesday");
- assertEquals(screenManager.getTextField3(), "My");
- assertEquals(screenManager.getTextField4(), "Dudes");
- assertEquals(screenManager.getTitle(), "title");
- }
-
- @Test
- public void testMediaTrackTextFields() {
- String songTitle = "Wild For The Night";
- screenManager.setMediaTrackTextField(songTitle);
- assertEquals(screenManager.getMediaTrackTextField(), songTitle);
- }
-
- @Test
- public void testSetPrimaryGraphic() {
- screenManager.setPrimaryGraphic(testArtwork);
- assertEquals(screenManager.getPrimaryGraphic(), testArtwork);
- }
- @Test
- public void testSetPrimaryGraphicWithBlankImage() {
- screenManager.setPrimaryGraphic(null);
- assertNull(screenManager.getPrimaryGraphic());
- }
- @Test
- public void testSetSecondaryGraphic() {
- screenManager.setSecondaryGraphic(testArtwork);
- assertEquals(screenManager.getSecondaryGraphic(), testArtwork);
- }
-
- @Test
- public void testSetSecondaryGraphicWithBlankImage() {
- screenManager.setSecondaryGraphic(null);
- assertNull(screenManager.getSecondaryGraphic());
- }
-
- @Test
- public void testAlignment() {
- screenManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
- assertEquals(screenManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
- }
-
- @Test
- public void testSetTextFieldTypes() {
- screenManager.setTextField1Type(MetadataType.MEDIA_TITLE);
- screenManager.setTextField2Type(MetadataType.MEDIA_ALBUM);
- screenManager.setTextField3Type(MetadataType.MEDIA_ARTIST);
- screenManager.setTextField4Type(MetadataType.MEDIA_GENRE);
- assertEquals(screenManager.getTextField1Type(), MetadataType.MEDIA_TITLE);
- assertEquals(screenManager.getTextField2Type(), MetadataType.MEDIA_ALBUM);
- assertEquals(screenManager.getTextField3Type(), MetadataType.MEDIA_ARTIST);
- assertEquals(screenManager.getTextField4Type(), MetadataType.MEDIA_GENRE);
- }
-
- @Test
- public void testSetMenuManagerFields(){
- screenManager.setDynamicMenuUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- screenManager.setMenu(TestValues.GENERAL_MENUCELL_LIST);
- screenManager.setMenuConfiguration(TestValues.GENERAL_MENU_CONFIGURATION);
-
- assertEquals(screenManager.getMenu(), TestValues.GENERAL_MENUCELL_LIST);
- assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.FORCE_ON);
- // Should not set because of improper RAI response and improper HMI states
- assertNull(screenManager.getMenuConfiguration());
- }
-
- @Test
- public void testSetVoiceCommands(){
- screenManager.setVoiceCommands(TestValues.GENERAL_VOICE_COMMAND_LIST);
- assertEquals(screenManager.getVoiceCommands(), TestValues.GENERAL_VOICE_COMMAND_LIST);
- }
-
- @Test
- public void testSetSoftButtonObjects(){
- // Create softButtonObject1
- SoftButtonState softButtonState1 = new SoftButtonState("object1-state1", "it is", testArtwork);
- SoftButtonState softButtonState2 = new SoftButtonState("object1-state2", "Wed", testArtwork);
- SoftButtonObject softButtonObject1 = new SoftButtonObject("object1", Arrays.asList(softButtonState1, softButtonState2), softButtonState1.getName(),null);
- softButtonObject1.setButtonId(100);
-
- // Create softButtonObject2
- SoftButtonState softButtonState3 = new SoftButtonState("object2-state1", "my", testArtwork);
- SoftButtonState softButtonState4 = new SoftButtonState("object2-state2", "dudes!", null);
- SoftButtonObject softButtonObject2 = new SoftButtonObject("object2", Arrays.asList(softButtonState3, softButtonState4), softButtonState3.getName(), null);
- softButtonObject2.setButtonId(200);
-
- List<SoftButtonObject> softButtonObjects = Arrays.asList(softButtonObject1, softButtonObject2);
- screenManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
- assertEquals(screenManager.getSoftButtonObjects(), softButtonObjects);
- assertEquals(screenManager.getSoftButtonObjectByName("object2"), softButtonObject2);
- assertEquals(screenManager.getSoftButtonObjectById(200), softButtonObject2);
- }
+ private ScreenManager screenManager;
+ private SdlArtwork testArtwork;
+
+ @Before
+ public void setUp() throws Exception {
+
+
+ ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(new Taskmaster.Builder().build());
+ FileManager fileManager = mock(FileManager.class);
+ screenManager = new ScreenManager(internalInterface, fileManager);
+ screenManager.start(null);
+ testArtwork = new SdlArtwork("testFile", FileType.GRAPHIC_PNG, 1, false);
+ }
+
+ @Test
+ public void testInstantiation() {
+ assertNull(screenManager.getTextField1());
+ assertNull(screenManager.getTextField2());
+ assertNull(screenManager.getTextField3());
+ assertNull(screenManager.getTextField4());
+ assertNull(screenManager.getTitle());
+ assertNull(screenManager.getMediaTrackTextField());
+ assertNull(screenManager.getPrimaryGraphic());
+ assertNull(screenManager.getSecondaryGraphic());
+ assertEquals(screenManager.getTextAlignment(), TextAlignment.CENTERED);
+ assertNull(screenManager.getTextField1Type());
+ assertNull(screenManager.getTextField2Type());
+ assertNull(screenManager.getTextField3Type());
+ assertNull(screenManager.getTextField4Type());
+ assertNull(screenManager.getMenu());
+ assertNull(screenManager.getVoiceCommands());
+ assertTrue(screenManager.getSoftButtonObjects().isEmpty());
+ assertNull(screenManager.getSoftButtonObjectByName("test"));
+ assertNull(screenManager.getSoftButtonObjectById(1));
+ assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
+ assertEquals(screenManager.getState(), BaseSubManager.READY);
+ assertNull(screenManager.getMenuConfiguration());
+ }
+
+ @Test
+ public void testSetTextField() {
+ screenManager.setTextField1("It is");
+ screenManager.setTextField2("Wednesday");
+ screenManager.setTextField3("My");
+ screenManager.setTextField4("Dudes");
+ screenManager.setTitle("title");
+ assertEquals(screenManager.getTextField1(), "It is");
+ assertEquals(screenManager.getTextField2(), "Wednesday");
+ assertEquals(screenManager.getTextField3(), "My");
+ assertEquals(screenManager.getTextField4(), "Dudes");
+ assertEquals(screenManager.getTitle(), "title");
+ }
+
+ @Test
+ public void testMediaTrackTextFields() {
+ String songTitle = "Wild For The Night";
+ screenManager.setMediaTrackTextField(songTitle);
+ assertEquals(screenManager.getMediaTrackTextField(), songTitle);
+ }
+
+ @Test
+ public void testSetPrimaryGraphic() {
+ screenManager.setPrimaryGraphic(testArtwork);
+ assertEquals(screenManager.getPrimaryGraphic(), testArtwork);
+ }
+
+ @Test
+ public void testSetPrimaryGraphicWithBlankImage() {
+ screenManager.setPrimaryGraphic(null);
+ assertNull(screenManager.getPrimaryGraphic());
+ }
+
+ @Test
+ public void testSetSecondaryGraphic() {
+ screenManager.setSecondaryGraphic(testArtwork);
+ assertEquals(screenManager.getSecondaryGraphic(), testArtwork);
+ }
+
+ @Test
+ public void testSetSecondaryGraphicWithBlankImage() {
+ screenManager.setSecondaryGraphic(null);
+ assertNull(screenManager.getSecondaryGraphic());
+ }
+
+ @Test
+ public void testAlignment() {
+ screenManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
+ assertEquals(screenManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
+ }
+
+ @Test
+ public void testSetTextFieldTypes() {
+ screenManager.setTextField1Type(MetadataType.MEDIA_TITLE);
+ screenManager.setTextField2Type(MetadataType.MEDIA_ALBUM);
+ screenManager.setTextField3Type(MetadataType.MEDIA_ARTIST);
+ screenManager.setTextField4Type(MetadataType.MEDIA_GENRE);
+ assertEquals(screenManager.getTextField1Type(), MetadataType.MEDIA_TITLE);
+ assertEquals(screenManager.getTextField2Type(), MetadataType.MEDIA_ALBUM);
+ assertEquals(screenManager.getTextField3Type(), MetadataType.MEDIA_ARTIST);
+ assertEquals(screenManager.getTextField4Type(), MetadataType.MEDIA_GENRE);
+ }
+
+ @Test
+ public void testSetMenuManagerFields() {
+ screenManager.setDynamicMenuUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ screenManager.setMenu(TestValues.GENERAL_MENUCELL_LIST);
+ screenManager.setMenuConfiguration(TestValues.GENERAL_MENU_CONFIGURATION);
+
+ assertEquals(screenManager.getMenu(), TestValues.GENERAL_MENUCELL_LIST);
+ assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.FORCE_ON);
+ // Should not set because of improper RAI response and improper HMI states
+ assertNull(screenManager.getMenuConfiguration());
+ }
+
+ @Test
+ public void testSetVoiceCommands() {
+ screenManager.setVoiceCommands(TestValues.GENERAL_VOICE_COMMAND_LIST);
+ assertEquals(screenManager.getVoiceCommands(), TestValues.GENERAL_VOICE_COMMAND_LIST);
+ }
+
+ @Test
+ public void testSetSoftButtonObjects() {
+ // Create softButtonObject1
+ SoftButtonState softButtonState1 = new SoftButtonState("object1-state1", "it is", testArtwork);
+ SoftButtonState softButtonState2 = new SoftButtonState("object1-state2", "Wed", testArtwork);
+ SoftButtonObject softButtonObject1 = new SoftButtonObject("object1", Arrays.asList(softButtonState1, softButtonState2), softButtonState1.getName(), null);
+ softButtonObject1.setButtonId(100);
+
+ // Create softButtonObject2
+ SoftButtonState softButtonState3 = new SoftButtonState("object2-state1", "my", testArtwork);
+ SoftButtonState softButtonState4 = new SoftButtonState("object2-state2", "dudes!", null);
+ SoftButtonObject softButtonObject2 = new SoftButtonObject("object2", Arrays.asList(softButtonState3, softButtonState4), softButtonState3.getName(), null);
+ softButtonObject2.setButtonId(200);
+
+ List<SoftButtonObject> softButtonObjects = Arrays.asList(softButtonObject1, softButtonObject2);
+ screenManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
+ assertEquals(screenManager.getSoftButtonObjects(), softButtonObjects);
+ assertEquals(screenManager.getSoftButtonObjectByName("object2"), softButtonObject2);
+ assertEquals(screenManager.getSoftButtonObjectById(200), softButtonObject2);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
index 713aae4fd..01635dd7d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
@@ -4,13 +4,13 @@ package com.smartdevicelink.managers.screen;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Taskmaster;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
@@ -202,7 +202,7 @@ public class SoftButtonManagerTests {
// Check that everything got called as expected
assertEquals("FileManager.uploadArtworks() did not get called correctly", 1, fileManagerUploadArtworksListenerCalledCounter);
- assertEquals("InternalInterface.sendRPC() did not get called correctly",2, internalInterfaceSendRPCListenerCalledCounter);
+ assertEquals("InternalInterface.sendRPC() did not get called correctly", 2, internalInterfaceSendRPCListenerCalledCounter);
// Test getSoftButtonObjects
@@ -231,7 +231,7 @@ public class SoftButtonManagerTests {
}
@Test
- public void testSoftButtonState(){
+ public void testSoftButtonState() {
// Test SoftButtonState.getName()
String nameExpectedValue = "object1-state1";
assertEquals("Returned state name doesn't match the expected value", nameExpectedValue, softButtonState1.getName());
@@ -254,7 +254,7 @@ public class SoftButtonManagerTests {
}
@Test
- public void testSoftButtonObject(){
+ public void testSoftButtonObject() {
// Test SoftButtonObject.getName()
assertEquals("Returned object name doesn't match the expected value", "object1", softButtonObject1.getName());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
index e0fcc5d0a..dee5f50dd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
@@ -3,9 +3,9 @@ package com.smartdevicelink.managers.screen;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.managers.BaseSubManager;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.SubscribeButton;
@@ -40,12 +40,12 @@ public class SubscribeButtonManagerTest {
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
RPCRequest message = (RPCRequest) args[0];
- if(message instanceof SubscribeButton){
+ if (message instanceof SubscribeButton) {
SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse();
subscribeButtonResponse.setSuccess(true);
- message.getOnRPCResponseListener().onResponse(message.getCorrelationID(),subscribeButtonResponse);
+ message.getOnRPCResponseListener().onResponse(message.getCorrelationID(), subscribeButtonResponse);
}
- if(message instanceof UnsubscribeButton) {
+ if (message instanceof UnsubscribeButton) {
UnsubscribeButtonResponse unsubscribeButtonResponse = new UnsubscribeButtonResponse();
unsubscribeButtonResponse.setSuccess(true);
message.getOnRPCResponseListener().onResponse(message.getCorrelationID(), unsubscribeButtonResponse);
@@ -60,7 +60,7 @@ public class SubscribeButtonManagerTest {
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
RPCRequest message = (RPCRequest) args[0];
- if(message instanceof SubscribeButton){
+ if (message instanceof SubscribeButton) {
SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse(false, Result.GENERIC_ERROR);
subscribeButtonResponse.setInfo("Fail");
message.getOnRPCResponseListener().onResponse(message.getCorrelationID(), subscribeButtonResponse);
@@ -109,7 +109,7 @@ public class SubscribeButtonManagerTest {
}
@Test
- public void testInstantiation(){
+ public void testInstantiation() {
assertNotNull(subscribeButtonManager.onButtonListeners);
assertEquals(subscribeButtonManager.getState(), BaseSubManager.SETTING_UP);
}
@@ -137,7 +137,7 @@ public class SubscribeButtonManagerTest {
}
@Test
- public void testAddButtonListenerError(){
+ public void testAddButtonListenerError() {
doAnswer(onSubscribeFail).when(internalInterface).sendRPC(any(RPCMessage.class));
subscribeButtonManager.addButtonListener(ButtonName.VOLUME_UP, listener);
assertFalse(subscribeButtonManager.onButtonListeners.containsKey(ButtonName.VOLUME_UP));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
index 58e5b8fda..9b948f808 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
@@ -8,13 +8,13 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Task;
import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.BaseSubManager;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
@@ -59,324 +59,325 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class TextAndGraphicManagerTests {
- // SETUP / HELPERS
- private TextAndGraphicManager textAndGraphicManager;
- private SdlArtwork testArtwork1, testArtwork2;
- private TemplateConfiguration configuration1, configuration2;
-
- @Before
- public void setUp() throws Exception{
- Context mTestContext = getInstrumentation().getContext();
-
- // mock things
- ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
- SoftButtonManager softButtonManager = mock(SoftButtonManager.class);
-
- testArtwork1 = new SdlArtwork();
- testArtwork1.setName("testFile");
- Uri uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
- testArtwork1.setUri(uri);
- testArtwork1.setType(FileType.GRAPHIC_PNG);
-
- testArtwork2 = new SdlArtwork();
- testArtwork2.setName("testFile2");
- Uri uri2 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
- testArtwork2.setUri(uri2);
- testArtwork2.setType(FileType.GRAPHIC_PNG);
-
- configuration1 = new TemplateConfiguration(PredefinedLayout.GRAPHIC_WITH_TEXT.toString());
- configuration2 = new TemplateConfiguration(PredefinedLayout.DOUBLE_GRAPHIC_WITH_SOFTBUTTONS.toString());
-
- Taskmaster taskmaster = new Taskmaster.Builder().build();
- taskmaster.start();
- when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
-
- Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- OnRPCNotificationListener onHMIStatusListener = (OnRPCNotificationListener) args[1];
- OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
- onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
- onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
- return null;
- }
- };
- doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
-
- Answer<Void> onSystemCapabilityAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- OnSystemCapabilityListener onSystemCapabilityListener = (OnSystemCapabilityListener) args[1];
- WindowCapability windowCapability = getWindowCapability(4);
- DisplayCapability displayCapability = new DisplayCapability();
- displayCapability.setWindowCapabilities(Collections.singletonList(windowCapability));
- List<DisplayCapability> capabilities = Collections.singletonList(displayCapability);
- onSystemCapabilityListener.onCapabilityRetrieved(capabilities);
- return null;
- }
- };
- SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
- doAnswer(onSystemCapabilityAnswer).when(systemCapabilityManager).addOnSystemCapabilityListener(eq(SystemCapabilityType.DISPLAYS), any(OnSystemCapabilityListener.class));
- doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
-
- textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager, softButtonManager);
- }
-
-
- private WindowCapability getWindowCapability(int numberOfMainFields){
-
- TextField mainField1 = new TextField();
- mainField1.setName(TextFieldName.mainField1);
- TextField mainField2 = new TextField();
- mainField2.setName(TextFieldName.mainField2);
- TextField mainField3 = new TextField();
- mainField3.setName(TextFieldName.mainField3);
- TextField mainField4 = new TextField();
- mainField4.setName(TextFieldName.mainField4);
-
- List<TextField> textFieldList = new ArrayList<>();
-
- textFieldList.add(mainField1);
- textFieldList.add(mainField2);
- textFieldList.add(mainField3);
- textFieldList.add(mainField4);
-
- List<TextField> returnList = new ArrayList<>();
-
- if (numberOfMainFields > 0){
- for (int i = 0; i < numberOfMainFields; i++) {
- returnList.add(textFieldList.get(i));
- }
- }
-
- WindowCapability windowCapability = new WindowCapability();
- windowCapability.setTextFields(returnList);
-
- return windowCapability;
- }
-
- /**
- * Used to simulate WindowCapability having no capabilities set
- * @return windowCapability that has no capabilities set
- */
- private WindowCapability getNullVarWindowCapability() {
-
- WindowCapability windowCapability = new WindowCapability();
- return windowCapability;
- }
-
- @Test
- public void testInstantiation(){
- assertNull(textAndGraphicManager.getTextField1());
- assertNull(textAndGraphicManager.getTextField2());
- assertNull(textAndGraphicManager.getTextField3());
- assertNull(textAndGraphicManager.getTextField4());
- assertNull(textAndGraphicManager.getTitle());
- assertNull(textAndGraphicManager.getMediaTrackTextField());
- assertNull(textAndGraphicManager.getPrimaryGraphic());
- assertNull(textAndGraphicManager.getSecondaryGraphic());
- assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.CENTERED);
- assertNull(textAndGraphicManager.getTextField1Type());
- assertNull(textAndGraphicManager.getTextField2Type());
- assertNull(textAndGraphicManager.getTextField3Type());
- assertNull(textAndGraphicManager.getTextField4Type());
- assertNotNull(textAndGraphicManager.currentScreenData);
- assertNotNull(textAndGraphicManager.defaultMainWindowCapability);
- assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_FULL);
- assertFalse(textAndGraphicManager.isDirty);
- assertEquals(textAndGraphicManager.getState(), BaseSubManager.SETTING_UP);
- assertNotNull(textAndGraphicManager.getBlankArtwork());
- }
-
- /**
- * Test getting number of lines available to be set based off of windowCapability
- */
- @Test
- public void testGetMainLines(){
-
- // We want to test that the looping works. By default, it will return 4 if display cap is null
- textAndGraphicManager.defaultMainWindowCapability = getNullVarWindowCapability();
-
- // Null test
- assertEquals(0, ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability));
-
- // The tests.java class has an example of this, but we must build it to do what
- // we need it to do. Build display cap w/ 3 main fields and test that it returns 3
- textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(3);
- assertEquals(ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability), 3);
- }
-
- @Test
- public void testMediaTrackTextField() {
-
- String songTitle = "Wild For The Night";
- textAndGraphicManager.setMediaTrackTextField(songTitle);
- assertEquals(textAndGraphicManager.getMediaTrackTextField(), songTitle);
- }
-
- @Test
- public void testTemplateTitle() {
-
- String title = "template title";
- textAndGraphicManager.setTitle(title);
- assertEquals(textAndGraphicManager.getTitle(), title);
- }
-
- @Test
- public void testAlignment() {
-
- textAndGraphicManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
- assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
- }
-
- // TEST IMAGES
-
- @Test
- public void testSetPrimaryGraphic() {
- textAndGraphicManager.setPrimaryGraphic(testArtwork1);
- assertEquals(textAndGraphicManager.getPrimaryGraphic(), testArtwork1);
- }
-
- @Test
- public void testSetSecondaryGraphic() {
- textAndGraphicManager.setSecondaryGraphic(testArtwork1);
- assertEquals(textAndGraphicManager.getSecondaryGraphic(), testArtwork1);
- }
-
- // TEST DISPOSE
-
- @Test
- public void testDispose() {
- textAndGraphicManager.dispose();
-
- assertNull(textAndGraphicManager.getTextField1());
- assertNull(textAndGraphicManager.getTextField2());
- assertNull(textAndGraphicManager.getTextField3());
- assertNull(textAndGraphicManager.getTextField4());
- assertNull(textAndGraphicManager.getMediaTrackTextField());
- assertNull(textAndGraphicManager.getPrimaryGraphic());
- assertNull(textAndGraphicManager.getSecondaryGraphic());
- assertNull(textAndGraphicManager.getTextAlignment());
- assertNull(textAndGraphicManager.getTextField1Type());
- assertNull(textAndGraphicManager.getTextField2Type());
- assertNull(textAndGraphicManager.getTextField3Type());
- assertNull(textAndGraphicManager.getTextField4Type());
- assertNull(textAndGraphicManager.getTitle());
- assertNotNull(textAndGraphicManager.getBlankArtwork());
- assertNull(textAndGraphicManager.currentScreenData);
- assertNull(textAndGraphicManager.defaultMainWindowCapability);
- assertFalse(textAndGraphicManager.isDirty);
- assertEquals(textAndGraphicManager.getState(), BaseSubManager.SHUTDOWN);
- }
-
- @Test
- public void testOperationManagement() {
- textAndGraphicManager.isDirty = true;
- textAndGraphicManager.updateOperation = null;
- textAndGraphicManager.update(null);
- assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
-
- textAndGraphicManager.transactionQueue.clear();
- textAndGraphicManager.updateOperation = null;
-
- assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 0);
-
- textAndGraphicManager.isDirty = true;
- textAndGraphicManager.update(null);
-
- assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
-
- assertTrue(textAndGraphicManager.transactionQueue.getTasksAsList().get(0).getState() == Task.READY);
- }
-
- @Test
- public void testHasData() {
- assertFalse(textAndGraphicManager.hasData());
-
- textAndGraphicManager.setTextField1("HI");
- assertTrue(textAndGraphicManager.hasData());
-
- textAndGraphicManager.setTextField1(null);
- textAndGraphicManager.setPrimaryGraphic(testArtwork1);
- assertTrue(textAndGraphicManager.hasData());
- }
-
- @Test
- public void resetFieldsToCurrentScreenDataTest() {
- textAndGraphicManager.setTextField1("textField1");
- textAndGraphicManager.setTextField2("textField2");
- textAndGraphicManager.setTextField3("textField3");
- textAndGraphicManager.setTextField4("textField4");
- textAndGraphicManager.setTextField1Type(MetadataType.MEDIA_TITLE);
- textAndGraphicManager.setTextField2Type(MetadataType.MEDIA_TITLE);
- textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_TITLE);
- textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_TITLE);
- textAndGraphicManager.setMediaTrackTextField("mediaTrackTextField");
- textAndGraphicManager.setTitle("title");
- textAndGraphicManager.setPrimaryGraphic(testArtwork1);
- textAndGraphicManager.setSecondaryGraphic(testArtwork2);
- textAndGraphicManager.changeLayout(configuration1, null);
- textAndGraphicManager.currentScreenData = textAndGraphicManager.currentState();
-
- assertTrue(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
- assertTrue(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
- assertTrue(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
- assertTrue(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
- assertTrue(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
-
- textAndGraphicManager.setTextField1("BadData");
- textAndGraphicManager.setTextField2("BadData");
- textAndGraphicManager.setTextField3("BadData");
- textAndGraphicManager.setTextField4("BadData");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
- textAndGraphicManager.setTextField2Type(MetadataType.HUMIDITY);
- textAndGraphicManager.setTextField3Type(MetadataType.HUMIDITY);
- textAndGraphicManager.setTextField4Type(MetadataType.HUMIDITY);
- textAndGraphicManager.setMediaTrackTextField("BadData");
- textAndGraphicManager.setTitle("BadData");
- textAndGraphicManager.setPrimaryGraphic(testArtwork2);
- textAndGraphicManager.setSecondaryGraphic(testArtwork1);
- textAndGraphicManager.changeLayout(configuration2, null);
-
- assertFalse(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
- assertFalse(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
- assertFalse(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
- assertFalse(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
- assertFalse(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
- assertFalse(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
- assertFalse(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
-
- textAndGraphicManager.resetFieldsToCurrentScreenData();
-
- assertTrue(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
- assertTrue(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
- assertTrue(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
- assertTrue(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
- assertTrue(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
- assertTrue(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
- }
+ // SETUP / HELPERS
+ private TextAndGraphicManager textAndGraphicManager;
+ private SdlArtwork testArtwork1, testArtwork2;
+ private TemplateConfiguration configuration1, configuration2;
+
+ @Before
+ public void setUp() throws Exception {
+ Context mTestContext = getInstrumentation().getContext();
+
+ // mock things
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+ SoftButtonManager softButtonManager = mock(SoftButtonManager.class);
+
+ testArtwork1 = new SdlArtwork();
+ testArtwork1.setName("testFile");
+ Uri uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork1.setUri(uri);
+ testArtwork1.setType(FileType.GRAPHIC_PNG);
+
+ testArtwork2 = new SdlArtwork();
+ testArtwork2.setName("testFile2");
+ Uri uri2 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork2.setUri(uri2);
+ testArtwork2.setType(FileType.GRAPHIC_PNG);
+
+ configuration1 = new TemplateConfiguration(PredefinedLayout.GRAPHIC_WITH_TEXT.toString());
+ configuration2 = new TemplateConfiguration(PredefinedLayout.DOUBLE_GRAPHIC_WITH_SOFTBUTTONS.toString());
+
+ Taskmaster taskmaster = new Taskmaster.Builder().build();
+ taskmaster.start();
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
+
+ Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnRPCNotificationListener onHMIStatusListener = (OnRPCNotificationListener) args[1];
+ OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
+ onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
+ onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
+ return null;
+ }
+ };
+ doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onSystemCapabilityAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnSystemCapabilityListener onSystemCapabilityListener = (OnSystemCapabilityListener) args[1];
+ WindowCapability windowCapability = getWindowCapability(4);
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setWindowCapabilities(Collections.singletonList(windowCapability));
+ List<DisplayCapability> capabilities = Collections.singletonList(displayCapability);
+ onSystemCapabilityListener.onCapabilityRetrieved(capabilities);
+ return null;
+ }
+ };
+ SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
+ doAnswer(onSystemCapabilityAnswer).when(systemCapabilityManager).addOnSystemCapabilityListener(eq(SystemCapabilityType.DISPLAYS), any(OnSystemCapabilityListener.class));
+ doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
+
+ textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager, softButtonManager);
+ }
+
+
+ private WindowCapability getWindowCapability(int numberOfMainFields) {
+
+ TextField mainField1 = new TextField();
+ mainField1.setName(TextFieldName.mainField1);
+ TextField mainField2 = new TextField();
+ mainField2.setName(TextFieldName.mainField2);
+ TextField mainField3 = new TextField();
+ mainField3.setName(TextFieldName.mainField3);
+ TextField mainField4 = new TextField();
+ mainField4.setName(TextFieldName.mainField4);
+
+ List<TextField> textFieldList = new ArrayList<>();
+
+ textFieldList.add(mainField1);
+ textFieldList.add(mainField2);
+ textFieldList.add(mainField3);
+ textFieldList.add(mainField4);
+
+ List<TextField> returnList = new ArrayList<>();
+
+ if (numberOfMainFields > 0) {
+ for (int i = 0; i < numberOfMainFields; i++) {
+ returnList.add(textFieldList.get(i));
+ }
+ }
+
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setTextFields(returnList);
+
+ return windowCapability;
+ }
+
+ /**
+ * Used to simulate WindowCapability having no capabilities set
+ *
+ * @return windowCapability that has no capabilities set
+ */
+ private WindowCapability getNullVarWindowCapability() {
+
+ WindowCapability windowCapability = new WindowCapability();
+ return windowCapability;
+ }
+
+ @Test
+ public void testInstantiation() {
+ assertNull(textAndGraphicManager.getTextField1());
+ assertNull(textAndGraphicManager.getTextField2());
+ assertNull(textAndGraphicManager.getTextField3());
+ assertNull(textAndGraphicManager.getTextField4());
+ assertNull(textAndGraphicManager.getTitle());
+ assertNull(textAndGraphicManager.getMediaTrackTextField());
+ assertNull(textAndGraphicManager.getPrimaryGraphic());
+ assertNull(textAndGraphicManager.getSecondaryGraphic());
+ assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.CENTERED);
+ assertNull(textAndGraphicManager.getTextField1Type());
+ assertNull(textAndGraphicManager.getTextField2Type());
+ assertNull(textAndGraphicManager.getTextField3Type());
+ assertNull(textAndGraphicManager.getTextField4Type());
+ assertNotNull(textAndGraphicManager.currentScreenData);
+ assertNotNull(textAndGraphicManager.defaultMainWindowCapability);
+ assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_FULL);
+ assertFalse(textAndGraphicManager.isDirty);
+ assertEquals(textAndGraphicManager.getState(), BaseSubManager.SETTING_UP);
+ assertNotNull(textAndGraphicManager.getBlankArtwork());
+ }
+
+ /**
+ * Test getting number of lines available to be set based off of windowCapability
+ */
+ @Test
+ public void testGetMainLines() {
+
+ // We want to test that the looping works. By default, it will return 4 if display cap is null
+ textAndGraphicManager.defaultMainWindowCapability = getNullVarWindowCapability();
+
+ // Null test
+ assertEquals(0, ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability));
+
+ // The tests.java class has an example of this, but we must build it to do what
+ // we need it to do. Build display cap w/ 3 main fields and test that it returns 3
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(3);
+ assertEquals(ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicManager.defaultMainWindowCapability), 3);
+ }
+
+ @Test
+ public void testMediaTrackTextField() {
+
+ String songTitle = "Wild For The Night";
+ textAndGraphicManager.setMediaTrackTextField(songTitle);
+ assertEquals(textAndGraphicManager.getMediaTrackTextField(), songTitle);
+ }
+
+ @Test
+ public void testTemplateTitle() {
+
+ String title = "template title";
+ textAndGraphicManager.setTitle(title);
+ assertEquals(textAndGraphicManager.getTitle(), title);
+ }
+
+ @Test
+ public void testAlignment() {
+
+ textAndGraphicManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
+ assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
+ }
+
+ // TEST IMAGES
+
+ @Test
+ public void testSetPrimaryGraphic() {
+ textAndGraphicManager.setPrimaryGraphic(testArtwork1);
+ assertEquals(textAndGraphicManager.getPrimaryGraphic(), testArtwork1);
+ }
+
+ @Test
+ public void testSetSecondaryGraphic() {
+ textAndGraphicManager.setSecondaryGraphic(testArtwork1);
+ assertEquals(textAndGraphicManager.getSecondaryGraphic(), testArtwork1);
+ }
+
+ // TEST DISPOSE
+
+ @Test
+ public void testDispose() {
+ textAndGraphicManager.dispose();
+
+ assertNull(textAndGraphicManager.getTextField1());
+ assertNull(textAndGraphicManager.getTextField2());
+ assertNull(textAndGraphicManager.getTextField3());
+ assertNull(textAndGraphicManager.getTextField4());
+ assertNull(textAndGraphicManager.getMediaTrackTextField());
+ assertNull(textAndGraphicManager.getPrimaryGraphic());
+ assertNull(textAndGraphicManager.getSecondaryGraphic());
+ assertNull(textAndGraphicManager.getTextAlignment());
+ assertNull(textAndGraphicManager.getTextField1Type());
+ assertNull(textAndGraphicManager.getTextField2Type());
+ assertNull(textAndGraphicManager.getTextField3Type());
+ assertNull(textAndGraphicManager.getTextField4Type());
+ assertNull(textAndGraphicManager.getTitle());
+ assertNotNull(textAndGraphicManager.getBlankArtwork());
+ assertNull(textAndGraphicManager.currentScreenData);
+ assertNull(textAndGraphicManager.defaultMainWindowCapability);
+ assertFalse(textAndGraphicManager.isDirty);
+ assertEquals(textAndGraphicManager.getState(), BaseSubManager.SHUTDOWN);
+ }
+
+ @Test
+ public void testOperationManagement() {
+ textAndGraphicManager.isDirty = true;
+ textAndGraphicManager.updateOperation = null;
+ textAndGraphicManager.update(null);
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
+
+ textAndGraphicManager.transactionQueue.clear();
+ textAndGraphicManager.updateOperation = null;
+
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 0);
+
+ textAndGraphicManager.isDirty = true;
+ textAndGraphicManager.update(null);
+
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
+
+ assertTrue(textAndGraphicManager.transactionQueue.getTasksAsList().get(0).getState() == Task.READY);
+ }
+
+ @Test
+ public void testHasData() {
+ assertFalse(textAndGraphicManager.hasData());
+
+ textAndGraphicManager.setTextField1("HI");
+ assertTrue(textAndGraphicManager.hasData());
+
+ textAndGraphicManager.setTextField1(null);
+ textAndGraphicManager.setPrimaryGraphic(testArtwork1);
+ assertTrue(textAndGraphicManager.hasData());
+ }
+
+ @Test
+ public void resetFieldsToCurrentScreenDataTest() {
+ textAndGraphicManager.setTextField1("textField1");
+ textAndGraphicManager.setTextField2("textField2");
+ textAndGraphicManager.setTextField3("textField3");
+ textAndGraphicManager.setTextField4("textField4");
+ textAndGraphicManager.setTextField1Type(MetadataType.MEDIA_TITLE);
+ textAndGraphicManager.setTextField2Type(MetadataType.MEDIA_TITLE);
+ textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_TITLE);
+ textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_TITLE);
+ textAndGraphicManager.setMediaTrackTextField("mediaTrackTextField");
+ textAndGraphicManager.setTitle("title");
+ textAndGraphicManager.setPrimaryGraphic(testArtwork1);
+ textAndGraphicManager.setSecondaryGraphic(testArtwork2);
+ textAndGraphicManager.changeLayout(configuration1, null);
+ textAndGraphicManager.currentScreenData = textAndGraphicManager.currentState();
+
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
+ assertTrue(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
+ assertTrue(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
+
+ textAndGraphicManager.setTextField1("BadData");
+ textAndGraphicManager.setTextField2("BadData");
+ textAndGraphicManager.setTextField3("BadData");
+ textAndGraphicManager.setTextField4("BadData");
+ textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
+ textAndGraphicManager.setTextField2Type(MetadataType.HUMIDITY);
+ textAndGraphicManager.setTextField3Type(MetadataType.HUMIDITY);
+ textAndGraphicManager.setTextField4Type(MetadataType.HUMIDITY);
+ textAndGraphicManager.setMediaTrackTextField("BadData");
+ textAndGraphicManager.setTitle("BadData");
+ textAndGraphicManager.setPrimaryGraphic(testArtwork2);
+ textAndGraphicManager.setSecondaryGraphic(testArtwork1);
+ textAndGraphicManager.changeLayout(configuration2, null);
+
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
+ assertFalse(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
+ assertFalse(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
+ assertFalse(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
+ assertFalse(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
+
+ textAndGraphicManager.resetFieldsToCurrentScreenData();
+
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField1().equals(textAndGraphicManager.getTextField1()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField2().equals(textAndGraphicManager.getTextField2()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField3().equals(textAndGraphicManager.getTextField3()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField4().equals(textAndGraphicManager.getTextField4()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTitle().equals(textAndGraphicManager.getTitle()));
+ assertTrue(textAndGraphicManager.currentScreenData.getMediaTrackTextField().equals(textAndGraphicManager.getMediaTrackTextField()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField1Type().toString().equals(textAndGraphicManager.getTextField1Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField2Type().toString().equals(textAndGraphicManager.getTextField2Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField3Type().toString().equals(textAndGraphicManager.getTextField3Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTextField4Type().toString().equals(textAndGraphicManager.getTextField4Type().toString()));
+ assertTrue(textAndGraphicManager.currentScreenData.getPrimaryGraphic().getName().equals(textAndGraphicManager.getPrimaryGraphic().getName()));
+ assertTrue(textAndGraphicManager.currentScreenData.getSecondaryGraphic().getName().equals(textAndGraphicManager.getSecondaryGraphic().getName()));
+ assertTrue(textAndGraphicManager.currentScreenData.getTemplateConfiguration().getStore().equals(textAndGraphicManager.getTemplateConfiguration().getStore()));
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java
index e00ce9b02..a893a76a7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java
@@ -7,13 +7,13 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.R;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
@@ -399,7 +399,6 @@ public class TextAndGraphicUpdateOperationTest {
}
-
/**
* Test getting number of lines available to be set based off of windowCapability
*/
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
index fb8308e5f..789d33dcf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
@@ -54,38 +54,38 @@ import static org.mockito.Mockito.mock;
@RunWith(AndroidJUnit4.class)
public class CheckChoiceVROptionalOperationTests {
- private CheckChoiceVROptionalOperation checkChoiceVROptionalOperation;
+ private CheckChoiceVROptionalOperation checkChoiceVROptionalOperation;
- @Before
- public void setUp() throws Exception{
+ @Before
+ public void setUp() throws Exception {
- ISdl internalInterface = mock(ISdl.class);
- CheckChoiceVROptionalInterface checkChoiceVROptionalInterface = mock(CheckChoiceVROptionalInterface.class);
- checkChoiceVROptionalOperation = new CheckChoiceVROptionalOperation(internalInterface, checkChoiceVROptionalInterface);
- }
+ ISdl internalInterface = mock(ISdl.class);
+ CheckChoiceVROptionalInterface checkChoiceVROptionalInterface = mock(CheckChoiceVROptionalInterface.class);
+ checkChoiceVROptionalOperation = new CheckChoiceVROptionalOperation(internalInterface, checkChoiceVROptionalInterface);
+ }
- @Test
- public void testCreateChoiceNoVR(){
- CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(false);
- assertNotNull(setNoVR);
- // This set only has one choice
- Choice choice = setNoVR.getChoiceSet().get(0);
- assertNull(choice.getVrCommands());
- }
+ @Test
+ public void testCreateChoiceNoVR() {
+ CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(false);
+ assertNotNull(setNoVR);
+ // This set only has one choice
+ Choice choice = setNoVR.getChoiceSet().get(0);
+ assertNull(choice.getVrCommands());
+ }
- @Test
- public void testCreateChoiceWithVR(){
- CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(true);
- assertNotNull(setNoVR);
- // This set only has one choice
- Choice choice = setNoVR.getChoiceSet().get(0);
- assertEquals(choice.getVrCommands().get(0), "Test VR");
- }
+ @Test
+ public void testCreateChoiceWithVR() {
+ CreateInteractionChoiceSet setNoVR = checkChoiceVROptionalOperation.testCellWithVR(true);
+ assertNotNull(setNoVR);
+ // This set only has one choice
+ Choice choice = setNoVR.getChoiceSet().get(0);
+ assertEquals(choice.getVrCommands().get(0), "Test VR");
+ }
- @Test
- public void testDeleteInteractionChoiceSet(){
- DeleteInteractionChoiceSet deleteSet = checkChoiceVROptionalOperation.createDeleteInteractionChoiceSet();
- assertNotNull(deleteSet);
- }
+ @Test
+ public void testDeleteInteractionChoiceSet() {
+ DeleteInteractionChoiceSet deleteSet = checkChoiceVROptionalOperation.createDeleteInteractionChoiceSet();
+ assertNotNull(deleteSet);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
index 420ab1d72..4bdd3ff93 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCellTests.java
@@ -52,7 +52,7 @@ public class ChoiceCellTests {
private SdlArtwork artwork = new SdlArtwork("image", FileType.GRAPHIC_PNG, 1, true);
@Test
- public void testSettersAndGetters(){
+ public void testSettersAndGetters() {
// set everything
ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING);
@@ -100,7 +100,7 @@ public class ChoiceCellTests {
}
@Test
- public void testCellEquality(){
+ public void testCellEquality() {
ChoiceCell choiceCell = new ChoiceCell(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING_LIST, artwork);
choiceCell.setSecondaryText(TestValues.GENERAL_STRING);
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 482d29b90..c7c0df7e4 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
@@ -39,8 +39,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.BaseSubManager;
-import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
@@ -76,243 +76,245 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class ChoiceSetManagerTests {
- private ChoiceSetManager csm;
- Taskmaster taskmaster;
-
- @Before
- public void setUp() throws Exception{
-
- ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
- taskmaster = new Taskmaster.Builder().build();
- when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
- csm = new ChoiceSetManager(internalInterface, fileManager);
-
- assertEquals(csm.getState(), BaseSubManager.SETTING_UP);
- assertEquals(csm.currentSystemContext, SystemContext.SYSCTXT_MAIN);
- assertEquals(csm.currentHMILevel, HMILevel.HMI_NONE);
- assertEquals(csm.choiceCellIdMin, 1);
- assertEquals(csm.nextChoiceId, 1);
- assertFalse(csm.isVROptional);
- assertNotNull(csm.fileManager);
- assertNotNull(csm.preloadedChoices);
- assertNotNull(csm.pendingPreloadChoices);
- assertNotNull(csm.transactionQueue);
- assertNotNull(csm.hmiListener);
- assertNotNull(csm.onDisplayCapabilityListener);
- assertNull(csm.pendingPresentOperation);
- }
-
- @After
- public void tearDown() throws Exception {
-
- csm.dispose();
-
- assertNull(csm.currentHMILevel);
- assertNull(csm.currentSystemContext);
- assertNull(csm.defaultMainWindowCapability);
- assertNull(csm.pendingPresentationSet);
- assertNull(csm.pendingPresentOperation);
-
- assertEquals(csm.transactionQueue.getTasksAsList().size(), 0);
- assertEquals(csm.nextChoiceId, 1);
-
- assertFalse(csm.isVROptional);
-
- assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
-
- }
-
- @Test
- public void testDefaultKeyboardConfiguration(){
- KeyboardProperties properties = csm.defaultKeyboardConfiguration();
- assertEquals(properties.getLanguage(), Language.EN_US);
- assertEquals(properties.getKeyboardLayout(), KeyboardLayout.QWERTY);
- assertEquals(properties.getKeypressMode(), KeypressMode.RESEND_CURRENT_ENTRY);
- }
-
- @Test
- public void testSetupChoiceSet(){
-
- ChoiceSetSelectionListener choiceSetSelectionListener = new ChoiceSetSelectionListener() {
- @Override
- public void onChoiceSelected(ChoiceCell choiceCell, TriggerSource triggerSource, int rowIndex) {}
-
- @Override
- public void onError(String error) {}
- };
-
- // Cannot send choice set with empty or null choice list
- ChoiceSet choiceSet1 = new ChoiceSet("test", Collections.<ChoiceCell>emptyList(), choiceSetSelectionListener);
- assertFalse(csm.setUpChoiceSet(choiceSet1));
-
- // cells cant have duplicate text
- ChoiceCell cell1 = new ChoiceCell("test");
- ChoiceCell cell2 = new ChoiceCell("test");
- ChoiceSet choiceSet2 = new ChoiceSet("test", Arrays.asList(cell1, cell2), choiceSetSelectionListener);
- assertFalse(csm.setUpChoiceSet(choiceSet2));
-
- // cells cannot mix and match VR / non-VR
- ChoiceCell cell3 = new ChoiceCell("test", Collections.singletonList("Test"), null);
- ChoiceCell cell4 = new ChoiceCell("test2");
- ChoiceSet choiceSet3 = new ChoiceSet("test", Arrays.asList(cell3, cell4), choiceSetSelectionListener);
- assertFalse(csm.setUpChoiceSet(choiceSet3));
-
- // VR Commands must be unique
- ChoiceCell cell5 = new ChoiceCell("test", Collections.singletonList("Test"), null);
- ChoiceCell cell6 = new ChoiceCell("test2", Collections.singletonList("Test"), null);
- ChoiceSet choiceSet4 = new ChoiceSet("test", Arrays.asList(cell5, cell6), choiceSetSelectionListener);
- assertFalse(csm.setUpChoiceSet(choiceSet4));
-
- // Passing Case
- ChoiceCell cell7 = new ChoiceCell("test", Collections.singletonList("Test"), null);
- ChoiceCell cell8 = new ChoiceCell("test2", Collections.singletonList("Test2"), null);
- ChoiceSet choiceSet5 = new ChoiceSet("test", Arrays.asList(cell7, cell8), choiceSetSelectionListener);
- assertTrue(csm.setUpChoiceSet(choiceSet5));
- }
-
- @Test
- public void testFindIfPresent(){
-
- ChoiceCell cell1 = new ChoiceCell("test");
- ChoiceCell cell2 = new ChoiceCell("test2");
- ChoiceCell cell3 = new ChoiceCell("test3");
- HashSet<ChoiceCell> cellSet = new HashSet<>();
- cellSet.add(cell1);
- cellSet.add(cell2);
-
- assertNotNull(csm.findIfPresent(cell1, cellSet));
- assertNull(csm.findIfPresent(cell3, cellSet));
- }
-
- @Test
- public void testUpdateIdsOnChoices(){
-
- ChoiceCell cell1 = new ChoiceCell("test");
- ChoiceCell cell2 = new ChoiceCell("test2");
- ChoiceCell cell3 = new ChoiceCell("test3");
- HashSet<ChoiceCell> cellSet = new HashSet<>();
- cellSet.add(cell1);
- cellSet.add(cell2);
- cellSet.add(cell3);
- // Cells are initially set to MAX_ID
- assertEquals(cell1.getChoiceId(), 2000000000);
- assertEquals(cell2.getChoiceId(), 2000000000);
- assertEquals(cell3.getChoiceId(), 2000000000);
- csm.updateIdsOnChoices(cellSet);
- // We are looking for unique IDs
- assertNotSame(cell1.getChoiceId(), 2000000000);
- assertNotSame(cell2.getChoiceId(), 2000000000);
- assertNotSame(cell3.getChoiceId(), 2000000000);
- }
-
- @Test
- public void testChoicesToBeRemovedFromPendingWithArray(){
-
- ChoiceCell cell1 = new ChoiceCell("test");
- ChoiceCell cell2 = new ChoiceCell("test2");
- ChoiceCell cell3 = new ChoiceCell("test3");
-
- HashSet<ChoiceCell> pendingPreloadSet = new HashSet<>();
- pendingPreloadSet.add(cell1);
- pendingPreloadSet.add(cell2);
- pendingPreloadSet.add(cell3);
-
- csm.pendingPreloadChoices.clear();
- csm.pendingPreloadChoices = pendingPreloadSet;
-
- List<ChoiceCell> choices = new ArrayList<>();
- choices.add(cell2);
-
- HashSet<ChoiceCell> returnedChoices = csm.choicesToBeRemovedFromPendingWithArray(choices);
-
- assertEquals(returnedChoices.size(), 1);
- for (ChoiceCell cell : returnedChoices){
- assertEquals(cell.getText(), "test2");
- }
- }
-
- @Test
- public void testChoicesToBeUploadedWithArray(){
-
- ChoiceCell cell1 = new ChoiceCell("test");
- ChoiceCell cell2 = new ChoiceCell("test2");
- ChoiceCell cell3 = new ChoiceCell("test3");
-
- HashSet<ChoiceCell> pendingDeleteSet = new HashSet<>();
- pendingDeleteSet.add(cell1);
- pendingDeleteSet.add(cell2);
- pendingDeleteSet.add(cell3);
-
- csm.preloadedChoices.clear();
- csm.preloadedChoices = pendingDeleteSet;
-
- List<ChoiceCell> choices = new ArrayList<>();
- choices.add(cell2);
-
- HashSet<ChoiceCell> returnedChoices = csm.choicesToBeDeletedWithArray(choices);
-
- assertEquals(returnedChoices.size(), 1);
- for (ChoiceCell cell : returnedChoices){
- assertEquals(cell.getText(), "test2");
- }
- }
-
- @Test
- public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
- ISdl internalInterface = mock(ISdl.class);
- when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
- 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);
- }
-
- @Test
- public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
- ISdl internalInterface = mock(ISdl.class);
- when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
- 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);
- }
-
- @Test
- 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();
- }
-
- @Test
- public void testDismissingQueuedKeyboard(){
- Integer testCancelID = 42;
-
- // Currently executing operation
- PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
- doReturn(96).when(testKeyboardOp).getCancelID();
- csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
-
- // Queued operations
- PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
- doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
- csm.currentlyPresentedKeyboardOperation = testKeyboardOp2;
-
- // Queued operation should be canceled
- csm.dismissKeyboard(testCancelID);
- verify(testKeyboardOp, times(0)).dismissKeyboard();
- verify(testKeyboardOp2, times(1)).dismissKeyboard();
- }
+ private ChoiceSetManager csm;
+ Taskmaster taskmaster;
+
+ @Before
+ public void setUp() throws Exception {
+
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+ taskmaster = new Taskmaster.Builder().build();
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
+ csm = new ChoiceSetManager(internalInterface, fileManager);
+
+ assertEquals(csm.getState(), BaseSubManager.SETTING_UP);
+ assertEquals(csm.currentSystemContext, SystemContext.SYSCTXT_MAIN);
+ assertEquals(csm.currentHMILevel, HMILevel.HMI_NONE);
+ assertEquals(csm.choiceCellIdMin, 1);
+ assertEquals(csm.nextChoiceId, 1);
+ assertFalse(csm.isVROptional);
+ assertNotNull(csm.fileManager);
+ assertNotNull(csm.preloadedChoices);
+ assertNotNull(csm.pendingPreloadChoices);
+ assertNotNull(csm.transactionQueue);
+ assertNotNull(csm.hmiListener);
+ assertNotNull(csm.onDisplayCapabilityListener);
+ assertNull(csm.pendingPresentOperation);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ csm.dispose();
+
+ assertNull(csm.currentHMILevel);
+ assertNull(csm.currentSystemContext);
+ assertNull(csm.defaultMainWindowCapability);
+ assertNull(csm.pendingPresentationSet);
+ assertNull(csm.pendingPresentOperation);
+
+ assertEquals(csm.transactionQueue.getTasksAsList().size(), 0);
+ assertEquals(csm.nextChoiceId, 1);
+
+ assertFalse(csm.isVROptional);
+
+ assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
+
+ }
+
+ @Test
+ public void testDefaultKeyboardConfiguration() {
+ KeyboardProperties properties = csm.defaultKeyboardConfiguration();
+ assertEquals(properties.getLanguage(), Language.EN_US);
+ assertEquals(properties.getKeyboardLayout(), KeyboardLayout.QWERTY);
+ assertEquals(properties.getKeypressMode(), KeypressMode.RESEND_CURRENT_ENTRY);
+ }
+
+ @Test
+ public void testSetupChoiceSet() {
+
+ ChoiceSetSelectionListener choiceSetSelectionListener = new ChoiceSetSelectionListener() {
+ @Override
+ public void onChoiceSelected(ChoiceCell choiceCell, TriggerSource triggerSource, int rowIndex) {
+ }
+
+ @Override
+ public void onError(String error) {
+ }
+ };
+
+ // Cannot send choice set with empty or null choice list
+ ChoiceSet choiceSet1 = new ChoiceSet("test", Collections.<ChoiceCell>emptyList(), choiceSetSelectionListener);
+ assertFalse(csm.setUpChoiceSet(choiceSet1));
+
+ // cells cant have duplicate text
+ ChoiceCell cell1 = new ChoiceCell("test");
+ ChoiceCell cell2 = new ChoiceCell("test");
+ ChoiceSet choiceSet2 = new ChoiceSet("test", Arrays.asList(cell1, cell2), choiceSetSelectionListener);
+ assertFalse(csm.setUpChoiceSet(choiceSet2));
+
+ // cells cannot mix and match VR / non-VR
+ ChoiceCell cell3 = new ChoiceCell("test", Collections.singletonList("Test"), null);
+ ChoiceCell cell4 = new ChoiceCell("test2");
+ ChoiceSet choiceSet3 = new ChoiceSet("test", Arrays.asList(cell3, cell4), choiceSetSelectionListener);
+ assertFalse(csm.setUpChoiceSet(choiceSet3));
+
+ // VR Commands must be unique
+ ChoiceCell cell5 = new ChoiceCell("test", Collections.singletonList("Test"), null);
+ ChoiceCell cell6 = new ChoiceCell("test2", Collections.singletonList("Test"), null);
+ ChoiceSet choiceSet4 = new ChoiceSet("test", Arrays.asList(cell5, cell6), choiceSetSelectionListener);
+ assertFalse(csm.setUpChoiceSet(choiceSet4));
+
+ // Passing Case
+ ChoiceCell cell7 = new ChoiceCell("test", Collections.singletonList("Test"), null);
+ ChoiceCell cell8 = new ChoiceCell("test2", Collections.singletonList("Test2"), null);
+ ChoiceSet choiceSet5 = new ChoiceSet("test", Arrays.asList(cell7, cell8), choiceSetSelectionListener);
+ assertTrue(csm.setUpChoiceSet(choiceSet5));
+ }
+
+ @Test
+ public void testFindIfPresent() {
+
+ ChoiceCell cell1 = new ChoiceCell("test");
+ ChoiceCell cell2 = new ChoiceCell("test2");
+ ChoiceCell cell3 = new ChoiceCell("test3");
+ HashSet<ChoiceCell> cellSet = new HashSet<>();
+ cellSet.add(cell1);
+ cellSet.add(cell2);
+
+ assertNotNull(csm.findIfPresent(cell1, cellSet));
+ assertNull(csm.findIfPresent(cell3, cellSet));
+ }
+
+ @Test
+ public void testUpdateIdsOnChoices() {
+
+ ChoiceCell cell1 = new ChoiceCell("test");
+ ChoiceCell cell2 = new ChoiceCell("test2");
+ ChoiceCell cell3 = new ChoiceCell("test3");
+ HashSet<ChoiceCell> cellSet = new HashSet<>();
+ cellSet.add(cell1);
+ cellSet.add(cell2);
+ cellSet.add(cell3);
+ // Cells are initially set to MAX_ID
+ assertEquals(cell1.getChoiceId(), 2000000000);
+ assertEquals(cell2.getChoiceId(), 2000000000);
+ assertEquals(cell3.getChoiceId(), 2000000000);
+ csm.updateIdsOnChoices(cellSet);
+ // We are looking for unique IDs
+ assertNotSame(cell1.getChoiceId(), 2000000000);
+ assertNotSame(cell2.getChoiceId(), 2000000000);
+ assertNotSame(cell3.getChoiceId(), 2000000000);
+ }
+
+ @Test
+ public void testChoicesToBeRemovedFromPendingWithArray() {
+
+ ChoiceCell cell1 = new ChoiceCell("test");
+ ChoiceCell cell2 = new ChoiceCell("test2");
+ ChoiceCell cell3 = new ChoiceCell("test3");
+
+ HashSet<ChoiceCell> pendingPreloadSet = new HashSet<>();
+ pendingPreloadSet.add(cell1);
+ pendingPreloadSet.add(cell2);
+ pendingPreloadSet.add(cell3);
+
+ csm.pendingPreloadChoices.clear();
+ csm.pendingPreloadChoices = pendingPreloadSet;
+
+ List<ChoiceCell> choices = new ArrayList<>();
+ choices.add(cell2);
+
+ HashSet<ChoiceCell> returnedChoices = csm.choicesToBeRemovedFromPendingWithArray(choices);
+
+ assertEquals(returnedChoices.size(), 1);
+ for (ChoiceCell cell : returnedChoices) {
+ assertEquals(cell.getText(), "test2");
+ }
+ }
+
+ @Test
+ public void testChoicesToBeUploadedWithArray() {
+
+ ChoiceCell cell1 = new ChoiceCell("test");
+ ChoiceCell cell2 = new ChoiceCell("test2");
+ ChoiceCell cell3 = new ChoiceCell("test3");
+
+ HashSet<ChoiceCell> pendingDeleteSet = new HashSet<>();
+ pendingDeleteSet.add(cell1);
+ pendingDeleteSet.add(cell2);
+ pendingDeleteSet.add(cell3);
+
+ csm.preloadedChoices.clear();
+ csm.preloadedChoices = pendingDeleteSet;
+
+ List<ChoiceCell> choices = new ArrayList<>();
+ choices.add(cell2);
+
+ HashSet<ChoiceCell> returnedChoices = csm.choicesToBeDeletedWithArray(choices);
+
+ assertEquals(returnedChoices.size(), 1);
+ for (ChoiceCell cell : returnedChoices) {
+ assertEquals(cell.getText(), "test2");
+ }
+ }
+
+ @Test
+ public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
+ 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);
+ }
+
+ @Test
+ public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
+ 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);
+ }
+
+ @Test
+ 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();
+ }
+
+ @Test
+ public void testDismissingQueuedKeyboard() {
+ Integer testCancelID = 42;
+
+ // Currently executing operation
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(96).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+
+ // Queued operations
+ PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
+ doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp2;
+
+ // 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 5bd8216d2..4eeb04927 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
@@ -57,7 +57,7 @@ public class ChoiceSetTests {
private Boolean canceledHandlerCalled;
@Before
- public void setUp() throws Exception{
+ public void setUp() throws Exception {
listener = mock(ChoiceSetSelectionListener.class);
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
@@ -68,7 +68,7 @@ public class ChoiceSetTests {
@Test
- public void testSettersAndGetters(){
+ public void testSettersAndGetters() {
// test small constructor
ChoiceSet choiceSet = new ChoiceSet(TestValues.GENERAL_STRING, choices, listener);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
index ca5c7df56..2b472eda8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
@@ -54,30 +54,30 @@ import static org.mockito.Mockito.mock;
@RunWith(AndroidJUnit4.class)
public class DeleteChoicesOperationTests {
- private DeleteChoicesOperation deleteChoicesOperation;
+ private DeleteChoicesOperation deleteChoicesOperation;
- @Before
- public void setUp() throws Exception{
+ @Before
+ public void setUp() throws Exception {
- ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2");
- HashSet<ChoiceCell> cellsToDelete = new HashSet<>();
- cellsToDelete.add(cell1);
- cellsToDelete.add(cell2);
+ ChoiceCell cell1 = new ChoiceCell("cell 1");
+ ChoiceCell cell2 = new ChoiceCell("cell 2");
+ HashSet<ChoiceCell> cellsToDelete = new HashSet<>();
+ cellsToDelete.add(cell1);
+ cellsToDelete.add(cell2);
- ISdl internalInterface = mock(ISdl.class);
- deleteChoicesOperation = new DeleteChoicesOperation(internalInterface, cellsToDelete, null);
- }
+ ISdl internalInterface = mock(ISdl.class);
+ deleteChoicesOperation = new DeleteChoicesOperation(internalInterface, cellsToDelete, null);
+ }
- @Test
- public void testCreateListDeleteInteractionSets(){
- List<DeleteInteractionChoiceSet> deletes = deleteChoicesOperation.createDeleteSets();
- assertNotNull(deletes);
- assertEquals(deletes.size(), 2);
- for (DeleteInteractionChoiceSet delete : deletes) {
- assertNotNull(delete);
- }
- }
+ @Test
+ public void testCreateListDeleteInteractionSets() {
+ List<DeleteInteractionChoiceSet> deletes = deleteChoicesOperation.createDeleteSets();
+ assertNotNull(deletes);
+ assertEquals(deletes.size(), 2);
+ for (DeleteInteractionChoiceSet delete : deletes) {
+ assertNotNull(delete);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
index f5094917f..db592dfb6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
@@ -37,9 +37,9 @@ package com.smartdevicelink.managers.screen.choiceset;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.WindowCapability;
@@ -68,125 +68,125 @@ import static org.mockito.Mockito.mock;
@RunWith(AndroidJUnit4.class)
public class PreloadChoicesOperationTests {
- private PreloadChoicesOperation preloadChoicesOperation;
- private PreloadChoicesOperation preloadChoicesOperationNullCapability;
- private PreloadChoicesOperation preloadChoicesOperationEmptyCapability;
-
-
- @Before
- public void setUp() throws Exception{
-
- ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
- HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
- cellsToPreload.add(cell1);
- cellsToPreload.add(cell2);
-
- ImageField imageField = new ImageField(ImageFieldName.choiceImage, Arrays.asList(FileType.GRAPHIC_PNG, FileType.GRAPHIC_JPEG));
- ImageField imageField2 = new ImageField();
- imageField2.setName(ImageFieldName.choiceSecondaryImage);
- TextField textField = new TextField(TextFieldName.menuName, CharacterSet.CID1SET, 2, 2);
-
- TextField textField2 = new TextField();
- TextField textField3 = new TextField();
-
- textField2.setName(TextFieldName.secondaryText);
- textField3.setName(TextFieldName.tertiaryText);
-
-
- WindowCapability windowCapability = new WindowCapability();
- windowCapability.setImageFields(Arrays.asList(imageField, imageField2));
- windowCapability.setImageTypeSupported(Arrays.asList(ImageType.STATIC, ImageType.DYNAMIC));
- windowCapability.setTextFields(Arrays.asList(textField, textField2, textField3));
-
- ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
- preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager, null, windowCapability, true, cellsToPreload, null);
- }
-
- /**
- * Sets up PreloadChoicesOperation with WindowCapability being null
- */
- public void setUpNullWindowCapability() {
-
- ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
- HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
- cellsToPreload.add(cell1);
- cellsToPreload.add(cell2);
-
- ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
- preloadChoicesOperationNullCapability = new PreloadChoicesOperation(internalInterface, fileManager, null, null, true, cellsToPreload, null);
- }
-
- /**
- * Sets up PreloadChoicesOperation with an Capability not being set
- * certain imageFields and TextFields
- */
- public void setUpEmptyWindowCapability() {
-
- ChoiceCell cell1 = new ChoiceCell("cell 1");
- ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
- HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
- cellsToPreload.add(cell1);
- cellsToPreload.add(cell2);
-
- ImageField imageField = new ImageField();
- imageField.setName(ImageFieldName.alertIcon);
-
- TextField textField = new TextField();
- textField.setName(TextFieldName.mainField1);
-
- WindowCapability windowCapability = new WindowCapability();
- windowCapability.setImageFields(Collections.singletonList(imageField));
- windowCapability.setTextFields(Collections.singletonList(textField));
-
- ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
- preloadChoicesOperationEmptyCapability = new PreloadChoicesOperation(internalInterface, fileManager, null, windowCapability, true, cellsToPreload, null);
- }
-
-
- @Test
- public void testArtworkNeedsUpload(){
- boolean test = preloadChoicesOperation.artworkNeedsUpload(TestValues.GENERAL_ARTWORK);
- assertTrue(test);
- }
-
- @Test
- public void testArtworksToUpload(){
- List<SdlArtwork> artworksToUpload = preloadChoicesOperation.artworksToUpload();
- assertNotNull(artworksToUpload);
- assertEquals(artworksToUpload.size(), 1);
- }
-
- /**
- * Testing shouldSend method's with varying WindowCapability set.
- */
- @Test
- public void testShouldSendText() {
-
- setUpNullWindowCapability();
- assertTrue(preloadChoicesOperationNullCapability.shouldSendChoicePrimaryImage());
- assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceSecondaryImage());
- assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceSecondaryText());
- assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceTertiaryText());
- assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceText());
-
-
- assertTrue(preloadChoicesOperation.shouldSendChoicePrimaryImage());
- assertTrue(preloadChoicesOperation.shouldSendChoiceSecondaryImage());
- assertTrue(preloadChoicesOperation.shouldSendChoiceSecondaryText());
- assertTrue(preloadChoicesOperation.shouldSendChoiceTertiaryText());
- assertTrue(preloadChoicesOperation.shouldSendChoiceText());
-
- setUpEmptyWindowCapability();
- assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoicePrimaryImage());
- assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceSecondaryImage());
- assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceSecondaryText());
- assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceTertiaryText());
- assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceText());
- }
+ private PreloadChoicesOperation preloadChoicesOperation;
+ private PreloadChoicesOperation preloadChoicesOperationNullCapability;
+ private PreloadChoicesOperation preloadChoicesOperationEmptyCapability;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ ChoiceCell cell1 = new ChoiceCell("cell 1");
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
+ HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
+ cellsToPreload.add(cell1);
+ cellsToPreload.add(cell2);
+
+ ImageField imageField = new ImageField(ImageFieldName.choiceImage, Arrays.asList(FileType.GRAPHIC_PNG, FileType.GRAPHIC_JPEG));
+ ImageField imageField2 = new ImageField();
+ imageField2.setName(ImageFieldName.choiceSecondaryImage);
+ TextField textField = new TextField(TextFieldName.menuName, CharacterSet.CID1SET, 2, 2);
+
+ TextField textField2 = new TextField();
+ TextField textField3 = new TextField();
+
+ textField2.setName(TextFieldName.secondaryText);
+ textField3.setName(TextFieldName.tertiaryText);
+
+
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setImageFields(Arrays.asList(imageField, imageField2));
+ windowCapability.setImageTypeSupported(Arrays.asList(ImageType.STATIC, ImageType.DYNAMIC));
+ windowCapability.setTextFields(Arrays.asList(textField, textField2, textField3));
+
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+ preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager, null, windowCapability, true, cellsToPreload, null);
+ }
+
+ /**
+ * Sets up PreloadChoicesOperation with WindowCapability being null
+ */
+ public void setUpNullWindowCapability() {
+
+ ChoiceCell cell1 = new ChoiceCell("cell 1");
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
+ HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
+ cellsToPreload.add(cell1);
+ cellsToPreload.add(cell2);
+
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+ preloadChoicesOperationNullCapability = new PreloadChoicesOperation(internalInterface, fileManager, null, null, true, cellsToPreload, null);
+ }
+
+ /**
+ * Sets up PreloadChoicesOperation with an Capability not being set
+ * certain imageFields and TextFields
+ */
+ public void setUpEmptyWindowCapability() {
+
+ ChoiceCell cell1 = new ChoiceCell("cell 1");
+ ChoiceCell cell2 = new ChoiceCell("cell 2", null, TestValues.GENERAL_ARTWORK);
+ HashSet<ChoiceCell> cellsToPreload = new HashSet<>();
+ cellsToPreload.add(cell1);
+ cellsToPreload.add(cell2);
+
+ ImageField imageField = new ImageField();
+ imageField.setName(ImageFieldName.alertIcon);
+
+ TextField textField = new TextField();
+ textField.setName(TextFieldName.mainField1);
+
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setImageFields(Collections.singletonList(imageField));
+ windowCapability.setTextFields(Collections.singletonList(textField));
+
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+ preloadChoicesOperationEmptyCapability = new PreloadChoicesOperation(internalInterface, fileManager, null, windowCapability, true, cellsToPreload, null);
+ }
+
+
+ @Test
+ public void testArtworkNeedsUpload() {
+ boolean test = preloadChoicesOperation.artworkNeedsUpload(TestValues.GENERAL_ARTWORK);
+ assertTrue(test);
+ }
+
+ @Test
+ public void testArtworksToUpload() {
+ List<SdlArtwork> artworksToUpload = preloadChoicesOperation.artworksToUpload();
+ assertNotNull(artworksToUpload);
+ assertEquals(artworksToUpload.size(), 1);
+ }
+
+ /**
+ * Testing shouldSend method's with varying WindowCapability set.
+ */
+ @Test
+ public void testShouldSendText() {
+
+ setUpNullWindowCapability();
+ assertTrue(preloadChoicesOperationNullCapability.shouldSendChoicePrimaryImage());
+ assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceSecondaryImage());
+ assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceSecondaryText());
+ assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceTertiaryText());
+ assertTrue(preloadChoicesOperationNullCapability.shouldSendChoiceText());
+
+
+ assertTrue(preloadChoicesOperation.shouldSendChoicePrimaryImage());
+ assertTrue(preloadChoicesOperation.shouldSendChoiceSecondaryImage());
+ assertTrue(preloadChoicesOperation.shouldSendChoiceSecondaryText());
+ assertTrue(preloadChoicesOperation.shouldSendChoiceTertiaryText());
+ assertTrue(preloadChoicesOperation.shouldSendChoiceText());
+
+ setUpEmptyWindowCapability();
+ assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoicePrimaryImage());
+ assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceSecondaryImage());
+ assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceSecondaryText());
+ assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceTertiaryText());
+ assertFalse(preloadChoicesOperationEmptyCapability.shouldSendChoiceText());
+ }
}
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 6da649165..3d22f352b 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
@@ -40,9 +40,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Queue;
import com.livio.taskmaster.Task;
import com.livio.taskmaster.Taskmaster;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
@@ -75,221 +75,221 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class PresentChoiceSetOperationTests {
- private PresentChoiceSetOperation presentChoiceSetOperation;
- private ChoiceSet choiceSet;
- private ISdl internalInterface;
- private KeyboardListener keyboardListener;
- private ChoiceSetSelectionListener choiceSetSelectionListener;
-
- private Taskmaster taskmaster;
- private Queue queue;
-
- @Before
- public void setUp() throws Exception{
-
- internalInterface = mock(ISdl.class);
-
- keyboardListener = mock(KeyboardListener.class);
- choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
-
- ChoiceCell cell1 = new ChoiceCell("Cell1");
- cell1.setChoiceId(0);
- choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
-
- taskmaster = new Taskmaster.Builder().build();
- queue = taskmaster.createQueue("test", 100, false);
- taskmaster.start();
- }
-
-
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
- }
-
- @Test
- 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, TestValues.GENERAL_INTEGER);
-
- assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
- presentChoiceSetOperation.keyboardListener = null;
- assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
- }
-
- @Test
- public void testGetPerformInteraction(){
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.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(), TestValues.GENERAL_INTEGER);
- assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
- }
-
- @Test
- public void testSetSelectedCellWithId(){
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
-
- assertNull(presentChoiceSetOperation.selectedCellRow);
- presentChoiceSetOperation.setSelectedCellWithId(0);
- assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
- }
-
- private void sleep() {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- queue.add(presentChoiceSetOperation, false);
-
- sleep();
-
- assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
-
- 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(), TestValues.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));
+ private PresentChoiceSetOperation presentChoiceSetOperation;
+ private ChoiceSet choiceSet;
+ private ISdl internalInterface;
+ private KeyboardListener keyboardListener;
+ private ChoiceSetSelectionListener choiceSetSelectionListener;
+
+ private Taskmaster taskmaster;
+ private Queue queue;
+
+ @Before
+ public void setUp() throws Exception {
+
+ internalInterface = mock(ISdl.class);
+
+ keyboardListener = mock(KeyboardListener.class);
+ choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+
+ ChoiceCell cell1 = new ChoiceCell("Cell1");
+ cell1.setChoiceId(0);
+ choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
+
+ taskmaster = new Taskmaster.Builder().build();
+ queue = taskmaster.createQueue("test", 100, false);
+ taskmaster.start();
+ }
+
+
+ private KeyboardProperties getKeyBoardProperties() {
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
+ @Test
+ 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, TestValues.GENERAL_INTEGER);
+
+ assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
+ presentChoiceSetOperation.keyboardListener = null;
+ assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
+ }
+
+ @Test
+ public void testGetPerformInteraction() {
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.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(), TestValues.GENERAL_INTEGER);
+ assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
+ }
+
+ @Test
+ public void testSetSelectedCellWithId() {
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+
+ assertNull(presentChoiceSetOperation.selectedCellRow);
+ presentChoiceSetOperation.setSelectedCellWithId(0);
+ assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
+
+ sleep();
+
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
+
+ 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(), TestValues.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));
- assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
- }
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
+ }
- @Test
- public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- queue.add(presentChoiceSetOperation, false);
- sleep();
+ @Test
+ public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
- choiceSet.cancel();
- Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+ 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(), TestValues.GENERAL_INTEGER);
- assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+ assertEquals(cancelInteraction.getCancelID(), TestValues.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);
+ 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));
+ 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));
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
- }
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
+ }
- @Test
- public void testCancelingChoiceSetIfThreadHasFinished(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- presentChoiceSetOperation.finishOperation();
+ @Test
+ public void testCancelingChoiceSetIfThreadHasFinished() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ presentChoiceSetOperation.finishOperation();
- assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
+ assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
- choiceSet.cancel();
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ choiceSet.cancel();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
- }
+ assertEquals(Task.FINISHED, presentChoiceSetOperation.getState());
+ }
- @Test
- public void testCancelingChoiceSetIfThreadHasNotYetRun(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
+ @Test
+ public void testCancelingChoiceSetIfThreadHasNotYetRun() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, TestValues.GENERAL_INTEGER);
- assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
+ assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
- choiceSet.cancel();
+ choiceSet.cancel();
- // Once the operation has started
- queue.add(presentChoiceSetOperation, false);
- sleep();
+ // Once the operation has started
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
+ assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
- // 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));
- }
+ // 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));
+ }
- @Test
- 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, TestValues.GENERAL_INTEGER);
- queue.add(presentChoiceSetOperation, false);
- sleep();
+ @Test
+ 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, TestValues.GENERAL_INTEGER);
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
+ assertEquals(Task.IN_PROGRESS, presentChoiceSetOperation.getState());
- choiceSet.cancel();
+ choiceSet.cancel();
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- }
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
- @Test
- 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, TestValues.GENERAL_INTEGER);
+ @Test
+ 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, TestValues.GENERAL_INTEGER);
- assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
+ assertEquals(Task.BLOCKED, presentChoiceSetOperation.getState());
- choiceSet.cancel();
+ choiceSet.cancel();
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- // Once the operation has started
- queue.add(presentChoiceSetOperation, false);
- sleep();
+ // Once the operation has started
+ queue.add(presentChoiceSetOperation, false);
+ sleep();
- assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
+ assertEquals(Task.CANCELED, presentChoiceSetOperation.getState());
- // 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));
- }
+ // 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 6eb3a1912..5d6df7958 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
@@ -40,9 +40,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Queue;
import com.livio.taskmaster.Task;
import com.livio.taskmaster.Taskmaster;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
@@ -73,204 +73,204 @@ import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class)
public class PresentKeyboardOperationTests {
- private PresentKeyboardOperation presentKeyboardOperation;
- private KeyboardListener keyboardListener;
- private ISdl internalInterface;
-
- private Taskmaster taskmaster;
- private Queue queue;
-
- @Before
- public void setUp() throws Exception{
-
- 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));
-
- taskmaster = new Taskmaster.Builder().build();
- queue = taskmaster.createQueue("test", 100, false);
- taskmaster.start();
- }
-
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
- }
-
- @Test
- public void testGetPerformInteraction(){
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, TestValues.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(), TestValues.GENERAL_INTEGER);
- }
-
- private void sleep() {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
- queue.add(presentKeyboardOperation, false);
- sleep();
-
- assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
-
- 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(), TestValues.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));
-
- assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
- }
-
- @Test
- public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
+ private PresentKeyboardOperation presentKeyboardOperation;
+ private KeyboardListener keyboardListener;
+ private ISdl internalInterface;
+
+ private Taskmaster taskmaster;
+ private Queue queue;
+
+ @Before
+ public void setUp() throws Exception {
+
+ 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));
+
+ taskmaster = new Taskmaster.Builder().build();
+ queue = taskmaster.createQueue("test", 100, false);
+ taskmaster.start();
+ }
+
+ private KeyboardProperties getKeyBoardProperties() {
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
+ @Test
+ public void testGetPerformInteraction() {
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, TestValues.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(), TestValues.GENERAL_INTEGER);
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCancelingKeyboardSuccessfullyIfThreadIsRunning() {
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
queue.add(presentKeyboardOperation, false);
sleep();
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
+
presentKeyboardOperation.dismissKeyboard();
Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
- assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+ assertEquals(cancelInteraction.getCancelID(), TestValues.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);
+ 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));
+ 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));
- assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
- }
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
+ }
- @Test
- public void testCancelingKeyboardIfThreadHasFinished(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
- presentKeyboardOperation.finishOperation();
+ @Test
+ public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
- presentKeyboardOperation.dismissKeyboard();
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ assertEquals(cancelInteraction.getCancelID(), TestValues.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
- assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
- }
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
- @Test
- public void testCancelingKeyboardIfThreadHasNotYetRun(){
- when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
- assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- presentKeyboardOperation.dismissKeyboard();
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
+ }
- // Once the operation has started
- queue.add(presentKeyboardOperation, false);
- sleep();
+ @Test
+ public void testCancelingKeyboardIfThreadHasFinished() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
+ presentKeyboardOperation.finishOperation();
- assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
+ assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
- // 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));
- }
+ presentKeyboardOperation.dismissKeyboard();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- @Test
- 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, TestValues.GENERAL_INTEGER);
- queue.add(presentKeyboardOperation, false);
- sleep();
+ assertEquals(Task.FINISHED, presentKeyboardOperation.getState());
+ }
- assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
+ @Test
+ public void testCancelingKeyboardIfThreadHasNotYetRun() {
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, TestValues.GENERAL_INTEGER);
- presentKeyboardOperation.dismissKeyboard();
+ assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
- verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
- }
+ presentKeyboardOperation.dismissKeyboard();
- @Test
- 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, TestValues.GENERAL_INTEGER);
+ // Once the operation has started
+ queue.add(presentKeyboardOperation, false);
+ sleep();
+
+ assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
- assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
+ // 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));
+ }
- presentKeyboardOperation.dismissKeyboard();
+ @Test
+ 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, TestValues.GENERAL_INTEGER);
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ assertEquals(Task.IN_PROGRESS, presentKeyboardOperation.getState());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
- // Once the operation has started
- queue.add(presentKeyboardOperation, false);
- sleep();
+ @Test
+ 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, TestValues.GENERAL_INTEGER);
+
+ assertEquals(Task.BLOCKED, presentKeyboardOperation.getState());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ queue.add(presentKeyboardOperation, false);
+ sleep();
- assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
+ assertEquals(Task.CANCELED, presentKeyboardOperation.getState());
- // 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));
- }
+ // 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/DynamicMenuUpdatesModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesModeTests.java
index 2d2a8853c..27cd9ff1c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesModeTests.java
@@ -40,60 +40,60 @@ import java.util.List;
public class DynamicMenuUpdatesModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "FORCE_ON";
- DynamicMenuUpdatesMode forceOn = DynamicMenuUpdatesMode.valueForString(example);
- example = "FORCE_OFF";
- DynamicMenuUpdatesMode forceOff = DynamicMenuUpdatesMode.valueForString(example);
- example = "ON_WITH_COMPAT_MODE";
- DynamicMenuUpdatesMode onWithCompatMode = DynamicMenuUpdatesMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "FORCE_ON";
+ DynamicMenuUpdatesMode forceOn = DynamicMenuUpdatesMode.valueForString(example);
+ example = "FORCE_OFF";
+ DynamicMenuUpdatesMode forceOff = DynamicMenuUpdatesMode.valueForString(example);
+ example = "ON_WITH_COMPAT_MODE";
+ DynamicMenuUpdatesMode onWithCompatMode = DynamicMenuUpdatesMode.valueForString(example);
- assertNotNull("FORCE_ON returned null", forceOn);
- assertNotNull("FORCE_OFF returned null", forceOff);
- assertNotNull("ON_WITH_COMPAT_MODE returned null", onWithCompatMode);
- }
+ assertNotNull("FORCE_ON returned null", forceOn);
+ assertNotNull("FORCE_OFF returned null", forceOff);
+ assertNotNull("ON_WITH_COMPAT_MODE returned null", onWithCompatMode);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "deFaUlt";
- try {
- DynamicMenuUpdatesMode temp = DynamicMenuUpdatesMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "deFaUlt";
+ try {
+ DynamicMenuUpdatesMode temp = DynamicMenuUpdatesMode.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 {
- DynamicMenuUpdatesMode temp = DynamicMenuUpdatesMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DynamicMenuUpdatesMode temp = DynamicMenuUpdatesMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of DynamicMenuUpdatesMode.
- */
- public void testListEnum() {
- List<DynamicMenuUpdatesMode> enumValueList = Arrays.asList(DynamicMenuUpdatesMode.values());
+ /**
+ * Verifies the possible enum values of DynamicMenuUpdatesMode.
+ */
+ public void testListEnum() {
+ List<DynamicMenuUpdatesMode> enumValueList = Arrays.asList(DynamicMenuUpdatesMode.values());
- List<DynamicMenuUpdatesMode> enumTestList = new ArrayList<>();
- enumTestList.add(DynamicMenuUpdatesMode.FORCE_ON);
- enumTestList.add(DynamicMenuUpdatesMode.FORCE_OFF);
- enumTestList.add(DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
+ List<DynamicMenuUpdatesMode> enumTestList = new ArrayList<>();
+ enumTestList.add(DynamicMenuUpdatesMode.FORCE_ON);
+ enumTestList.add(DynamicMenuUpdatesMode.FORCE_OFF);
+ enumTestList.add(DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/managers/screen/menu/MenuCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
index eae5b530a..dfd0477e5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
@@ -54,116 +54,115 @@ import static junit.framework.TestCase.assertTrue;
@RunWith(AndroidJUnit4.class)
public class MenuCellTests {
- private MenuSelectionListener menuSelectionListener = new MenuSelectionListener() {
- @Override
- public void onTriggered(TriggerSource trigger) {
- // stuff
- }
- };
+ private MenuSelectionListener menuSelectionListener = new MenuSelectionListener() {
+ @Override
+ public void onTriggered(TriggerSource trigger) {
+ // stuff
+ }
+ };
- @Test
- public void testSettersAndGetters(){
+ @Test
+ public void testSettersAndGetters() {
- // set everything
- MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, null, null, menuSelectionListener);
- menuCell.setIcon(TestValues.GENERAL_ARTWORK);
- menuCell.setVoiceCommands(TestValues.GENERAL_STRING_LIST);
- menuCell.setMenuSelectionListener(menuSelectionListener);
- menuCell.setSubMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
+ // set everything
+ MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, null, null, menuSelectionListener);
+ menuCell.setIcon(TestValues.GENERAL_ARTWORK);
+ menuCell.setVoiceCommands(TestValues.GENERAL_STRING_LIST);
+ menuCell.setMenuSelectionListener(menuSelectionListener);
+ menuCell.setSubMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
- // use getters and assert equality
- assertEquals(menuCell.getTitle(), TestValues.GENERAL_STRING);
- assertEquals(menuCell.getIcon(), TestValues.GENERAL_ARTWORK);
- assertEquals(menuCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
- assertEquals(menuCell.getMenuSelectionListener(), menuSelectionListener);
- assertEquals(menuCell.getCellId(), TestValues.GENERAL_MENU_MAX_ID);
- assertEquals(menuCell.getParentCellId(), TestValues.GENERAL_MENU_MAX_ID);
- assertEquals(menuCell.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
- }
+ // use getters and assert equality
+ assertEquals(menuCell.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
+ assertEquals(menuCell.getMenuSelectionListener(), menuSelectionListener);
+ assertEquals(menuCell.getCellId(), TestValues.GENERAL_MENU_MAX_ID);
+ assertEquals(menuCell.getParentCellId(), TestValues.GENERAL_MENU_MAX_ID);
+ assertEquals(menuCell.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ }
- @Test
- public void testConstructors(){
+ @Test
+ public void testConstructors() {
- // first constructor was tested in previous method, use the last two here
+ // first constructor was tested in previous method, use the last two here
- MenuCell menuCell3 =new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
- assertEquals(menuCell3.getTitle(), TestValues.GENERAL_STRING);
- assertEquals(menuCell3.getIcon(), TestValues.GENERAL_ARTWORK);
- assertEquals(menuCell3.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
- assertEquals(menuCell3.getMenuSelectionListener(), menuSelectionListener);
+ MenuCell menuCell3 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ assertEquals(menuCell3.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell3.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell3.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
+ assertEquals(menuCell3.getMenuSelectionListener(), menuSelectionListener);
- MenuCell menuCell4 =new MenuCell(TestValues.GENERAL_STRING,null, null, menuSelectionListener);
- assertEquals(menuCell4.getTitle(), TestValues.GENERAL_STRING);
- assertEquals(menuCell4.getMenuSelectionListener(), menuSelectionListener);
+ MenuCell menuCell4 = new MenuCell(TestValues.GENERAL_STRING, null, null, menuSelectionListener);
+ assertEquals(menuCell4.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell4.getMenuSelectionListener(), menuSelectionListener);
- MenuCell menuCell5 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_MENUCELL_LIST);
- assertEquals(menuCell5.getTitle(), TestValues.GENERAL_STRING);
- assertEquals(menuCell5.getIcon(), TestValues.GENERAL_ARTWORK);
- assertEquals(menuCell5.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
- assertEquals(menuCell5.getSubCells(), TestValues.GENERAL_MENUCELL_LIST);
- }
+ MenuCell menuCell5 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_MENUCELL_LIST);
+ assertEquals(menuCell5.getTitle(), TestValues.GENERAL_STRING);
+ assertEquals(menuCell5.getIcon(), TestValues.GENERAL_ARTWORK);
+ assertEquals(menuCell5.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ assertEquals(menuCell5.getSubCells(), TestValues.GENERAL_MENUCELL_LIST);
+ }
- @Test
- public void testEquality(){
+ @Test
+ public void testEquality() {
- //We should use assertTrue (or assertFalse) because we want to use the overridden equals() method
+ //We should use assertTrue (or assertFalse) because we want to use the overridden equals() method
- MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
- MenuCell menuCell2 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell2 = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
- // these are the same object, should be equal.
- assertTrue(menuCell.equals(menuCell));
+ // these are the same object, should be equal.
+ assertTrue(menuCell.equals(menuCell));
- // Make sure these are marked as equals, even though they are different objects
- assertTrue(menuCell.equals(menuCell2));
+ // Make sure these are marked as equals, even though they are different objects
+ assertTrue(menuCell.equals(menuCell2));
- MenuCell menuCell3 = new MenuCell(TestValues.GENERAL_STRING, null, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell menuCell3 = new MenuCell(TestValues.GENERAL_STRING, null, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
- // these should be different
- assertFalse(menuCell.equals(menuCell3));
- }
+ // these should be different
+ assertFalse(menuCell.equals(menuCell3));
+ }
- @Test
- public void testClone(){
- MenuCell original = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
- MenuCell clone = original.clone();
+ @Test
+ public void testClone() {
+ MenuCell original = new MenuCell(TestValues.GENERAL_STRING, TestValues.GENERAL_ARTWORK, TestValues.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell clone = original.clone();
- assertNotNull(clone);
- assertNotSame(original, clone);
+ assertNotNull(clone);
+ assertNotSame(original, clone);
- assertEquals(original.getTitle(), clone.getTitle());
- assertEquals(original.getCellId(), clone.getCellId());
- assertEquals(original.getParentCellId(), clone.getParentCellId());
+ assertEquals(original.getTitle(), clone.getTitle());
+ assertEquals(original.getCellId(), clone.getCellId());
+ assertEquals(original.getParentCellId(), clone.getParentCellId());
- SdlArtworkTests.equalTest(original.getIcon(), clone.getIcon());
+ SdlArtworkTests.equalTest(original.getIcon(), clone.getIcon());
- //Test subcells
- List<MenuCell> subcells = new ArrayList<>();
- subcells.add(original.clone());
- subcells.add(clone.clone());
+ //Test subcells
+ List<MenuCell> subcells = new ArrayList<>();
+ subcells.add(original.clone());
+ subcells.add(clone.clone());
- original = new MenuCell(TestValues.GENERAL_STRING, MenuLayout.LIST, TestValues.GENERAL_ARTWORK,subcells);
- clone = original.clone();
+ original = new MenuCell(TestValues.GENERAL_STRING, MenuLayout.LIST, TestValues.GENERAL_ARTWORK, subcells);
+ clone = original.clone();
- assertNotNull(original.getSubCells());
- assertNotNull(clone.getSubCells());
- assertNotSame(original.getSubCells(), clone.getSubCells());
+ assertNotNull(original.getSubCells());
+ assertNotNull(clone.getSubCells());
+ assertNotSame(original.getSubCells(), clone.getSubCells());
- List<MenuCell> originalSubCells = original.getSubCells();
- List<MenuCell> cloneSubCells = clone.getSubCells();
+ List<MenuCell> originalSubCells = original.getSubCells();
+ List<MenuCell> cloneSubCells = clone.getSubCells();
- assertEquals(originalSubCells.size(), cloneSubCells.size());
+ assertEquals(originalSubCells.size(), cloneSubCells.size());
- for(int i = 0; i < originalSubCells.size(); i++){
+ for (int i = 0; i < originalSubCells.size(); i++) {
- assertNotNull(originalSubCells.get(i));
- assertNotNull(cloneSubCells.get(i));
+ assertNotNull(originalSubCells.get(i));
+ assertNotNull(cloneSubCells.get(i));
- assertNotSame(originalSubCells.get(i), cloneSubCells.get(i));
- }
+ assertNotSame(originalSubCells.get(i), cloneSubCells.get(i));
+ }
-
- }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
index 2986d496a..5498ebe73 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
@@ -48,14 +48,14 @@ import static junit.framework.TestCase.assertEquals;
public class MenuConfigurationTests {
- @Test
- public void testSettersAndGetters(){
+ @Test
+ public void testSettersAndGetters() {
- // set everything - we only use the constructor to set variables in the Menu Manager
- MenuConfiguration menuConfiguration = new MenuConfiguration(TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
+ // set everything - we only use the constructor to set variables in the Menu Manager
+ MenuConfiguration menuConfiguration = new MenuConfiguration(TestValues.GENERAL_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
- // use getters and assert equality
- assertEquals(menuConfiguration.getMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
- assertEquals(menuConfiguration.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
- }
+ // use getters and assert equality
+ assertEquals(menuConfiguration.getMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ assertEquals(menuConfiguration.getSubMenuLayout(), TestValues.GENERAL_MENU_LAYOUT);
+ }
}
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 08b0deb86..43392b626 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
@@ -37,12 +37,12 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.R;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
@@ -85,673 +85,673 @@ import static org.mockito.Mockito.verify;
@RunWith(AndroidJUnit4.class)
public class MenuManagerTests {
- private OnRPCNotificationListener onHMIStatusListener, commandListener;
- private MenuManager menuManager;
- private List<MenuCell> cells;
- private MenuCell mainCell1, mainCell4;
-
- // SETUP / HELPERS
-
- @Before
- public void setUp() throws Exception{
-
- cells = createTestCells();
-
- final ISdl internalInterface = mock(ISdl.class);
- FileManager fileManager = mock(FileManager.class);
-
- // When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
- // inside MenuManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
- // to emulate what Core does when it sends OnHMIStatus notification
- Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- onHMIStatusListener = (OnRPCNotificationListener) args[1];
- return null;
- }
- };
- doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
-
- Answer<Void> onCommandAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- commandListener = (OnRPCNotificationListener) args[1];
- return null;
- }
- };
- doAnswer(onCommandAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_COMMAND), any(OnRPCNotificationListener.class));
-
- Answer<Void> answer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest request = (RPCRequest) args[0];
- RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
- response.setSuccess(true);
- request.getOnRPCResponseListener().onResponse(0, response);
- return null;
- }
- };
- doAnswer(answer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
-
- menuManager = new MenuManager(internalInterface, fileManager);
-
- // Check some stuff during setup
- assertEquals(menuManager.currentHMILevel, HMILevel.HMI_NONE);
- assertEquals(menuManager.getState(), BaseSubManager.SETTING_UP);
- assertEquals(menuManager.currentSystemContext, SystemContext.SYSCTXT_MAIN);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
- assertEquals(menuManager.lastMenuId, 1);
- assertNull(menuManager.menuCells);
- assertNull(menuManager.waitingUpdateMenuCells);
- assertNull(menuManager.oldMenuCells);
- assertNull(menuManager.inProgressUpdate);
- assertNull(menuManager.keepsNew);
- assertNull(menuManager.keepsOld);
- assertNull(menuManager.menuConfiguration);
- assertNotNull(menuManager.hmiListener);
- assertNotNull(menuManager.commandListener);
- assertNotNull(menuManager.onDisplaysCapabilityListener);
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- menuManager.dispose();
-
- assertEquals(menuManager.currentSystemContext, SystemContext.SYSCTXT_MAIN);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
- assertEquals(menuManager.lastMenuId, 1);
- assertNull(menuManager.menuCells);
- assertNull(menuManager.oldMenuCells);
- assertNull(menuManager.currentHMILevel);
- assertNull(menuManager.defaultMainWindowCapability);
- assertNull(menuManager.inProgressUpdate);
- assertNull(menuManager.waitingUpdateMenuCells);
- assertNull(menuManager.keepsNew);
- assertNull(menuManager.keepsOld);
- assertNull(menuManager.menuConfiguration);
-
- // after everything, make sure we are in the correct state
- assertEquals(menuManager.getState(), BaseSubManager.SHUTDOWN);
-
- }
-
- @Test
- public void testStartMenuManager(){
-
- menuManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- // Make sure the state has changed, as the Screen Manager is dependant on it
- assertEquals(menuManager.getState(), BaseSubManager.READY);
- }
- });
- }
-
- @Test
- public void testHMINotReady(){
-
- menuManager.currentHMILevel = HMILevel.HMI_NONE;
- menuManager.setMenuCells(cells);
-
- // updating voice commands before HMI is ready
- assertTrue(menuManager.waitingOnHMIUpdate);
- // these are the 2 commands we have waiting
- assertEquals(menuManager.waitingUpdateMenuCells.size(), 4);
- assertEquals(menuManager.currentHMILevel, HMILevel.HMI_NONE);
- // The Menu Manager should send new menu once HMI full occurs
- sendFakeCoreOnHMIFullNotifications();
- // Listener should be triggered - which sets new HMI level and should proceed to send our pending update
- assertEquals(menuManager.currentHMILevel, HMILevel.HMI_FULL);
- // This being false means it received the hmi notification and sent the pending commands
- assertFalse(menuManager.waitingOnHMIUpdate);
- }
-
- @Test
- public void testUpdatingOldWay(){
-
- // Force Menu Manager to use the old way of deleting / sending all
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_OFF);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_OFF);
- // when we only send one command to update, we should only be returned one add command
- List<MenuCell> newArray = Arrays.asList(mainCell1, mainCell4);
- assertEquals(menuManager.allCommandsForCells(newArray, false).size(), 4); // 1 root cells, 1 sub menu root cell, 2 sub menu cells
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- menuManager.setMenuCells(newArray);
- // Algorithm should NOT have run
- assertNull(menuManager.keepsNew);
- assertNull(menuManager.keepsOld);
-
- // Unlike voice commands, the Menu Manager dynamically assigns Cell ID's. Because of this, we need to get the updated
- // cell list after setting it and then test the listeners, as they use the newly assigned cell ID's.
- List<MenuCell> updatedCells = menuManager.getMenuCells();
-
- for (MenuCell cell : updatedCells){
-
- // grab 2 of our newly updated cells - 1 root and 1 sub cell, and make sure they can get triggered
- if (cell.getTitle().equalsIgnoreCase("Test Cell 1")){
- // Fake onCommand - we want to make sure that we can pass back onCommand events to our root Menu Cell
- OnCommand onCommand = new OnCommand();
- onCommand.setCmdID(cell.getCellId());
- onCommand.setTriggerSource(TriggerSource.TS_MENU); // these are menu commands
- commandListener.onNotified(onCommand); // send off the notification
-
- // verify the mock listener has only been hit once for a root cell
- verify(cell.getMenuSelectionListener(), times(1)).onTriggered(TriggerSource.TS_MENU);
- }
-
- if (cell.getTitle().equalsIgnoreCase("SubCell 2")){
- // Fake onCommand - we want to make sure that we can pass back onCommand events to our sub Menu Cell
- OnCommand onCommand2 = new OnCommand();
- onCommand2.setCmdID(cell.getCellId());
- onCommand2.setTriggerSource(TriggerSource.TS_MENU); // these are menu commands
- commandListener.onNotified(onCommand2); // send off the notification
-
- // verify the mock listener has only been hit once for a sub cell
- verify(cell.getMenuSelectionListener(), times(1)).onTriggered(TriggerSource.TS_MENU);
- }
- }
- }
-
- @Test
- public void testAlgorithmTest1(){
-
- // Force Menu Manager to use the new way
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
-
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu1();
- List<MenuCell> newMenu = createDynamicMenu1New();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- // this happens in the menu manager but lets make sure its behaving
- RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
-
- List<Integer> oldMenuScore = Arrays.asList(0,0,0,0);
- List<Integer> newMenuScore = Arrays.asList(0,0,0,0,1);
-
- assertEquals(runScore.getScore(), 1);
- assertEquals(runScore.getOldMenu(), oldMenuScore);
- assertEquals(runScore.getCurrentMenu(), newMenuScore);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 5);
- assertEquals(menuManager.keepsNew.size(), 4);
- assertEquals(menuManager.keepsOld.size(), 4);
- }
-
- @Test
- public void testAlgorithmTest2(){
-
- // Force Menu Manager to use the new way
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
-
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu2();
- List<MenuCell> newMenu = createDynamicMenu2New();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- // this happens in the menu manager but lets make sure its behaving
- RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
-
- List<Integer> oldMenuScore = Arrays.asList(0,0,0,2);
- List<Integer> newMenuScore = Arrays.asList(0,0,0);
-
- assertEquals(runScore.getScore(), 0);
- assertEquals(runScore.getOldMenu(), oldMenuScore);
- assertEquals(runScore.getCurrentMenu(), newMenuScore);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 3);
- assertEquals(menuManager.keepsNew.size(), 3);
- assertEquals(menuManager.keepsOld.size(), 3);
- }
-
- @Test
- public void testAlgorithmTest3(){
-
- // Force Menu Manager to use the new way
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
-
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu3();
- List<MenuCell> newMenu = createDynamicMenu3New();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 3);
-
- // this happens in the menu manager but lets make sure its behaving
- RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
-
- List<Integer> oldMenuScore = Arrays.asList(2,2,2);
- List<Integer> newMenuScore = Arrays.asList(1,1,1);
-
- assertEquals(runScore.getScore(), 3);
- assertEquals(runScore.getOldMenu(), oldMenuScore);
- assertEquals(runScore.getCurrentMenu(), newMenuScore);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 3);
- assertEquals(menuManager.keepsNew.size(), 0);
- assertEquals(menuManager.keepsOld.size(), 0);
- }
-
- @Test
- public void testAlgorithmTest4(){
-
- // Force Menu Manager to use the new way
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
-
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu4();
- List<MenuCell> newMenu = createDynamicMenu4New();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- // this happens in the menu manager but lets make sure its behaving
- RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
-
- List<Integer> oldMenuScore = Arrays.asList(0,2,0,2);
- List<Integer> newMenuScore = Arrays.asList(1,0,1,0);
-
- assertEquals(runScore.getScore(), 2);
- assertEquals(runScore.getOldMenu(), oldMenuScore);
- assertEquals(runScore.getCurrentMenu(), newMenuScore);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 4);
- assertEquals(menuManager.keepsNew.size(), 2);
- assertEquals(menuManager.keepsOld.size(), 2);
- }
-
- @Test
- public void testAlgorithmTest5(){
-
- // Force Menu Manager to use the new way
- menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
- assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
-
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu5();
- List<MenuCell> newMenu = createDynamicMenu5New();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- // this happens in the menu manager but lets make sure its behaving
- RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
-
- List<Integer> oldMenuScore = Arrays.asList(2,0,0,0);
- List<Integer> newMenuScore = Arrays.asList(0,0,0,1);
-
- assertEquals(runScore.getScore(), 1);
- assertEquals(runScore.getOldMenu(), oldMenuScore);
- assertEquals(runScore.getCurrentMenu(), newMenuScore);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 4);
- assertEquals(menuManager.keepsNew.size(), 3);
- assertEquals(menuManager.keepsOld.size(), 3);
- }
-
- @Test
- public void testSettingNullMenu(){
-
- // Make sure we can send an empty menu with no issues
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu1();
- List<MenuCell> newMenu = null;
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 0);
- }
-
- @Test
- public void testClearingMenu(){
-
- // Make sure we can send an empty menu with no issues
- // start fresh
- menuManager.oldMenuCells = null;
- menuManager.menuCells = null;
- menuManager.inProgressUpdate = null;
- menuManager.waitingUpdateMenuCells = null;
- menuManager.waitingOnHMIUpdate = false;
-
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- // send new cells. They should set the old way
- List<MenuCell> oldMenu = createDynamicMenu1();
- List<MenuCell> newMenu = Collections.emptyList();
- menuManager.setMenuCells(oldMenu);
- assertEquals(menuManager.menuCells.size(), 4);
-
- menuManager.setMenuCells(newMenu);
- assertEquals(menuManager.menuCells.size(), 0);
- }
-
- @Test
- public void testOpeningMainMenu(){
- // call open Menu
- MenuManager mockMenuManager = mock(MenuManager.class);
- mockMenuManager.openMenu();
- verify(mockMenuManager, Mockito.times(1)).openMenu();
- }
-
- @Test
- public void testOpeningSubMenuNullCells(){
- // call open Menu
- MenuManager mockMenuManager = mock(MenuManager.class);
- MenuCell cell = mock(MenuCell.class);
- mockMenuManager.oldMenuCells = null;
- assertFalse(mockMenuManager.openSubMenu(cell));
- }
-
- @Test
- 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)));
- }
+ private OnRPCNotificationListener onHMIStatusListener, commandListener;
+ private MenuManager menuManager;
+ private List<MenuCell> cells;
+ private MenuCell mainCell1, mainCell4;
+
+ // SETUP / HELPERS
+
+ @Before
+ public void setUp() throws Exception {
+
+ cells = createTestCells();
+
+ final ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ // When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
+ // inside MenuManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
+ // to emulate what Core does when it sends OnHMIStatus notification
+ Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ onHMIStatusListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onCommandAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ commandListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onCommandAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_COMMAND), any(OnRPCNotificationListener.class));
+
+ Answer<Void> answer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest request = (RPCRequest) args[0];
+ RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
+ response.setSuccess(true);
+ request.getOnRPCResponseListener().onResponse(0, response);
+ return null;
+ }
+ };
+ doAnswer(answer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
+
+ menuManager = new MenuManager(internalInterface, fileManager);
+
+ // Check some stuff during setup
+ assertEquals(menuManager.currentHMILevel, HMILevel.HMI_NONE);
+ assertEquals(menuManager.getState(), BaseSubManager.SETTING_UP);
+ assertEquals(menuManager.currentSystemContext, SystemContext.SYSCTXT_MAIN);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
+ assertEquals(menuManager.lastMenuId, 1);
+ assertNull(menuManager.menuCells);
+ assertNull(menuManager.waitingUpdateMenuCells);
+ assertNull(menuManager.oldMenuCells);
+ assertNull(menuManager.inProgressUpdate);
+ assertNull(menuManager.keepsNew);
+ assertNull(menuManager.keepsOld);
+ assertNull(menuManager.menuConfiguration);
+ assertNotNull(menuManager.hmiListener);
+ assertNotNull(menuManager.commandListener);
+ assertNotNull(menuManager.onDisplaysCapabilityListener);
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ menuManager.dispose();
+
+ assertEquals(menuManager.currentSystemContext, SystemContext.SYSCTXT_MAIN);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
+ assertEquals(menuManager.lastMenuId, 1);
+ assertNull(menuManager.menuCells);
+ assertNull(menuManager.oldMenuCells);
+ assertNull(menuManager.currentHMILevel);
+ assertNull(menuManager.defaultMainWindowCapability);
+ assertNull(menuManager.inProgressUpdate);
+ assertNull(menuManager.waitingUpdateMenuCells);
+ assertNull(menuManager.keepsNew);
+ assertNull(menuManager.keepsOld);
+ assertNull(menuManager.menuConfiguration);
+
+ // after everything, make sure we are in the correct state
+ assertEquals(menuManager.getState(), BaseSubManager.SHUTDOWN);
+
+ }
+
+ @Test
+ public void testStartMenuManager() {
+
+ menuManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ // Make sure the state has changed, as the Screen Manager is dependant on it
+ assertEquals(menuManager.getState(), BaseSubManager.READY);
+ }
+ });
+ }
+
+ @Test
+ public void testHMINotReady() {
+
+ menuManager.currentHMILevel = HMILevel.HMI_NONE;
+ menuManager.setMenuCells(cells);
+
+ // updating voice commands before HMI is ready
+ assertTrue(menuManager.waitingOnHMIUpdate);
+ // these are the 2 commands we have waiting
+ assertEquals(menuManager.waitingUpdateMenuCells.size(), 4);
+ assertEquals(menuManager.currentHMILevel, HMILevel.HMI_NONE);
+ // The Menu Manager should send new menu once HMI full occurs
+ sendFakeCoreOnHMIFullNotifications();
+ // Listener should be triggered - which sets new HMI level and should proceed to send our pending update
+ assertEquals(menuManager.currentHMILevel, HMILevel.HMI_FULL);
+ // This being false means it received the hmi notification and sent the pending commands
+ assertFalse(menuManager.waitingOnHMIUpdate);
+ }
+
+ @Test
+ public void testUpdatingOldWay() {
+
+ // Force Menu Manager to use the old way of deleting / sending all
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_OFF);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_OFF);
+ // when we only send one command to update, we should only be returned one add command
+ List<MenuCell> newArray = Arrays.asList(mainCell1, mainCell4);
+ assertEquals(menuManager.allCommandsForCells(newArray, false).size(), 4); // 1 root cells, 1 sub menu root cell, 2 sub menu cells
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ menuManager.setMenuCells(newArray);
+ // Algorithm should NOT have run
+ assertNull(menuManager.keepsNew);
+ assertNull(menuManager.keepsOld);
+
+ // Unlike voice commands, the Menu Manager dynamically assigns Cell ID's. Because of this, we need to get the updated
+ // cell list after setting it and then test the listeners, as they use the newly assigned cell ID's.
+ List<MenuCell> updatedCells = menuManager.getMenuCells();
+
+ for (MenuCell cell : updatedCells) {
+
+ // grab 2 of our newly updated cells - 1 root and 1 sub cell, and make sure they can get triggered
+ if (cell.getTitle().equalsIgnoreCase("Test Cell 1")) {
+ // Fake onCommand - we want to make sure that we can pass back onCommand events to our root Menu Cell
+ OnCommand onCommand = new OnCommand();
+ onCommand.setCmdID(cell.getCellId());
+ onCommand.setTriggerSource(TriggerSource.TS_MENU); // these are menu commands
+ commandListener.onNotified(onCommand); // send off the notification
+
+ // verify the mock listener has only been hit once for a root cell
+ verify(cell.getMenuSelectionListener(), times(1)).onTriggered(TriggerSource.TS_MENU);
+ }
+
+ if (cell.getTitle().equalsIgnoreCase("SubCell 2")) {
+ // Fake onCommand - we want to make sure that we can pass back onCommand events to our sub Menu Cell
+ OnCommand onCommand2 = new OnCommand();
+ onCommand2.setCmdID(cell.getCellId());
+ onCommand2.setTriggerSource(TriggerSource.TS_MENU); // these are menu commands
+ commandListener.onNotified(onCommand2); // send off the notification
+
+ // verify the mock listener has only been hit once for a sub cell
+ verify(cell.getMenuSelectionListener(), times(1)).onTriggered(TriggerSource.TS_MENU);
+ }
+ }
+ }
+
+ @Test
+ public void testAlgorithmTest1() {
+
+ // Force Menu Manager to use the new way
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
+
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu1();
+ List<MenuCell> newMenu = createDynamicMenu1New();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ // this happens in the menu manager but lets make sure its behaving
+ RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
+
+ List<Integer> oldMenuScore = Arrays.asList(0, 0, 0, 0);
+ List<Integer> newMenuScore = Arrays.asList(0, 0, 0, 0, 1);
+
+ assertEquals(runScore.getScore(), 1);
+ assertEquals(runScore.getOldMenu(), oldMenuScore);
+ assertEquals(runScore.getCurrentMenu(), newMenuScore);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 5);
+ assertEquals(menuManager.keepsNew.size(), 4);
+ assertEquals(menuManager.keepsOld.size(), 4);
+ }
+
+ @Test
+ public void testAlgorithmTest2() {
+
+ // Force Menu Manager to use the new way
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
+
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu2();
+ List<MenuCell> newMenu = createDynamicMenu2New();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ // this happens in the menu manager but lets make sure its behaving
+ RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
+
+ List<Integer> oldMenuScore = Arrays.asList(0, 0, 0, 2);
+ List<Integer> newMenuScore = Arrays.asList(0, 0, 0);
+
+ assertEquals(runScore.getScore(), 0);
+ assertEquals(runScore.getOldMenu(), oldMenuScore);
+ assertEquals(runScore.getCurrentMenu(), newMenuScore);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 3);
+ assertEquals(menuManager.keepsNew.size(), 3);
+ assertEquals(menuManager.keepsOld.size(), 3);
+ }
+
+ @Test
+ public void testAlgorithmTest3() {
+
+ // Force Menu Manager to use the new way
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
+
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu3();
+ List<MenuCell> newMenu = createDynamicMenu3New();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 3);
+
+ // this happens in the menu manager but lets make sure its behaving
+ RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
+
+ List<Integer> oldMenuScore = Arrays.asList(2, 2, 2);
+ List<Integer> newMenuScore = Arrays.asList(1, 1, 1);
+
+ assertEquals(runScore.getScore(), 3);
+ assertEquals(runScore.getOldMenu(), oldMenuScore);
+ assertEquals(runScore.getCurrentMenu(), newMenuScore);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 3);
+ assertEquals(menuManager.keepsNew.size(), 0);
+ assertEquals(menuManager.keepsOld.size(), 0);
+ }
+
+ @Test
+ public void testAlgorithmTest4() {
+
+ // Force Menu Manager to use the new way
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
+
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu4();
+ List<MenuCell> newMenu = createDynamicMenu4New();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ // this happens in the menu manager but lets make sure its behaving
+ RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
+
+ List<Integer> oldMenuScore = Arrays.asList(0, 2, 0, 2);
+ List<Integer> newMenuScore = Arrays.asList(1, 0, 1, 0);
+
+ assertEquals(runScore.getScore(), 2);
+ assertEquals(runScore.getOldMenu(), oldMenuScore);
+ assertEquals(runScore.getCurrentMenu(), newMenuScore);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+ assertEquals(menuManager.keepsNew.size(), 2);
+ assertEquals(menuManager.keepsOld.size(), 2);
+ }
+
+ @Test
+ public void testAlgorithmTest5() {
+
+ // Force Menu Manager to use the new way
+ menuManager.setDynamicUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
+ assertEquals(menuManager.dynamicMenuUpdatesMode, DynamicMenuUpdatesMode.FORCE_ON);
+
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu5();
+ List<MenuCell> newMenu = createDynamicMenu5New();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ // this happens in the menu manager but lets make sure its behaving
+ RunScore runScore = menuManager.runMenuCompareAlgorithm(oldMenu, newMenu);
+
+ List<Integer> oldMenuScore = Arrays.asList(2, 0, 0, 0);
+ List<Integer> newMenuScore = Arrays.asList(0, 0, 0, 1);
+
+ assertEquals(runScore.getScore(), 1);
+ assertEquals(runScore.getOldMenu(), oldMenuScore);
+ assertEquals(runScore.getCurrentMenu(), newMenuScore);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+ assertEquals(menuManager.keepsNew.size(), 3);
+ assertEquals(menuManager.keepsOld.size(), 3);
+ }
+
+ @Test
+ public void testSettingNullMenu() {
+
+ // Make sure we can send an empty menu with no issues
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu1();
+ List<MenuCell> newMenu = null;
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 0);
+ }
+
+ @Test
+ public void testClearingMenu() {
+
+ // Make sure we can send an empty menu with no issues
+ // start fresh
+ menuManager.oldMenuCells = null;
+ menuManager.menuCells = null;
+ menuManager.inProgressUpdate = null;
+ menuManager.waitingUpdateMenuCells = null;
+ menuManager.waitingOnHMIUpdate = false;
+
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ // send new cells. They should set the old way
+ List<MenuCell> oldMenu = createDynamicMenu1();
+ List<MenuCell> newMenu = Collections.emptyList();
+ menuManager.setMenuCells(oldMenu);
+ assertEquals(menuManager.menuCells.size(), 4);
+
+ menuManager.setMenuCells(newMenu);
+ assertEquals(menuManager.menuCells.size(), 0);
+ }
+
+ @Test
+ public void testOpeningMainMenu() {
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ mockMenuManager.openMenu();
+ verify(mockMenuManager, Mockito.times(1)).openMenu();
+ }
+
+ @Test
+ public void testOpeningSubMenuNullCells() {
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ MenuCell cell = mock(MenuCell.class);
+ mockMenuManager.oldMenuCells = null;
+ assertFalse(mockMenuManager.openSubMenu(cell));
+ }
+
+ @Test
+ 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)));
+ }
- @Test
- public void testSetMenuConfiguration(){
- menuManager.currentHMILevel = HMILevel.HMI_FULL;
- menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
- menuManager.sdlMsgVersion = new SdlMsgVersion(6,0);
- menuManager.defaultMainWindowCapability = new WindowCapability();
+ @Test
+ public void testSetMenuConfiguration() {
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
+ menuManager.sdlMsgVersion = new SdlMsgVersion(6, 0);
+ menuManager.defaultMainWindowCapability = new WindowCapability();
- List<MenuLayout> menuLayouts = Arrays.asList(MenuLayout.LIST, MenuLayout.TILES);
- menuManager.defaultMainWindowCapability.setMenuLayoutsAvailable(menuLayouts);
+ List<MenuLayout> menuLayouts = Arrays.asList(MenuLayout.LIST, MenuLayout.TILES);
+ menuManager.defaultMainWindowCapability.setMenuLayoutsAvailable(menuLayouts);
- MenuConfiguration menuConfigurationTest = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
- menuManager.setMenuConfiguration(menuConfigurationTest);
- assertEquals(menuManager.menuConfiguration, menuConfigurationTest);
+ MenuConfiguration menuConfigurationTest = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
+ menuManager.setMenuConfiguration(menuConfigurationTest);
+ assertEquals(menuManager.menuConfiguration, menuConfigurationTest);
- }
+ }
- // HELPERS
+ // HELPERS
- // Emulate what happens when Core sends OnHMIStatus notification
- private void sendFakeCoreOnHMIFullNotifications() {
- OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
- onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
- onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
- }
+ // Emulate what happens when Core sends OnHMIStatus notification
+ private void sendFakeCoreOnHMIFullNotifications() {
+ OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
+ onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
+ onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
+ }
- // CREATING CELLS FOR TEST CASES
+ // CREATING CELLS FOR TEST CASES
- private List<MenuCell> createTestCells(){
+ private List<MenuCell> createTestCells() {
- // menu cell mock listener
- MenuSelectionListener menuSelectionListener1 = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListener2 = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListener3 = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerSub1 = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerSub2 = mock(MenuSelectionListener.class);
+ // menu cell mock listener
+ MenuSelectionListener menuSelectionListener1 = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListener2 = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListener3 = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerSub1 = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerSub2 = mock(MenuSelectionListener.class);
- // some arts
- SdlArtwork livio = new SdlArtwork("livio", FileType.GRAPHIC_PNG, R.drawable.sdl_lockscreen_icon, false);
+ // some arts
+ SdlArtwork livio = new SdlArtwork("livio", FileType.GRAPHIC_PNG, R.drawable.sdl_lockscreen_icon, false);
- // some menu cells
- List<String> voice2 = Collections.singletonList("Cell two");
+ // some menu cells
+ List<String> voice2 = Collections.singletonList("Cell two");
- mainCell1 = new MenuCell("Test Cell 1", livio, null, menuSelectionListener1);
- MenuCell mainCell2 = new MenuCell("Test Cell 2", livio, voice2, menuSelectionListener2);
- MenuCell mainCell3 = new MenuCell("Test Cell 3",null, null, menuSelectionListener3);
+ mainCell1 = new MenuCell("Test Cell 1", livio, null, menuSelectionListener1);
+ MenuCell mainCell2 = new MenuCell("Test Cell 2", livio, voice2, menuSelectionListener2);
+ MenuCell mainCell3 = new MenuCell("Test Cell 3", null, null, menuSelectionListener3);
- // SUB MENU
- MenuCell subCell1 = new MenuCell("SubCell 1",null, null, menuSelectionListenerSub1);
- MenuCell subCell2 = new MenuCell("SubCell 2",null, null, menuSelectionListenerSub2);
+ // SUB MENU
+ MenuCell subCell1 = new MenuCell("SubCell 1", null, null, menuSelectionListenerSub1);
+ MenuCell subCell2 = new MenuCell("SubCell 2", null, null, menuSelectionListenerSub2);
- mainCell4 = new MenuCell("Test Cell 4", null, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
- mainCell4.setCellId(4);
+ 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);
- }
+ return Arrays.asList(mainCell1, mainCell2, mainCell3, mainCell4);
+ }
- private List<MenuCell> createDynamicMenu1(){
+ private List<MenuCell> createDynamicMenu1() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(A, B, C, D);
+ return Arrays.asList(A, B, C, D);
- }
+ }
- private List<MenuCell> createDynamicMenu1New(){
+ private List<MenuCell> createDynamicMenu1New() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerE = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerE = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- MenuCell E = new MenuCell("E", null, null, menuSelectionListenerE);
+ MenuCell E = new MenuCell("E", null, null, menuSelectionListenerE);
- return Arrays.asList(A, B, C, D, E);
+ return Arrays.asList(A, B, C, D, E);
- }
+ }
- private List<MenuCell> createDynamicMenu2(){
+ private List<MenuCell> createDynamicMenu2() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(A, B, C, D);
+ return Arrays.asList(A, B, C, D);
- }
+ }
- private List<MenuCell> createDynamicMenu2New(){
+ private List<MenuCell> createDynamicMenu2New() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- return Arrays.asList(A, B, C);
+ return Arrays.asList(A, B, C);
- }
+ }
- private List<MenuCell> createDynamicMenu3(){
+ private List<MenuCell> createDynamicMenu3() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- return Arrays.asList(A, B, C);
+ return Arrays.asList(A, B, C);
- }
+ }
- private List<MenuCell> createDynamicMenu3New(){
+ private List<MenuCell> createDynamicMenu3New() {
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerE = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerF = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerE = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerF = mock(MenuSelectionListener.class);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- MenuCell E = new MenuCell("E", null, null, menuSelectionListenerE);
+ MenuCell E = new MenuCell("E", null, null, menuSelectionListenerE);
- MenuCell F = new MenuCell("F", null, null, menuSelectionListenerF);
+ MenuCell F = new MenuCell("F", null, null, menuSelectionListenerF);
- return Arrays.asList(D, E, F);
+ return Arrays.asList(D, E, F);
- }
+ }
- private List<MenuCell> createDynamicMenu4(){
+ private List<MenuCell> createDynamicMenu4() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(A, B, C, D);
+ return Arrays.asList(A, B, C, D);
- }
+ }
- private List<MenuCell> createDynamicMenu4New(){
+ private List<MenuCell> createDynamicMenu4New() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(B, A, D, C);
+ return Arrays.asList(B, A, D, C);
- }
+ }
- private List<MenuCell> createDynamicMenu5(){
+ private List<MenuCell> createDynamicMenu5() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(A, B, C, D);
+ return Arrays.asList(A, B, C, D);
- }
+ }
- private List<MenuCell> createDynamicMenu5New(){
+ private List<MenuCell> createDynamicMenu5New() {
- MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
- MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerA = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerB = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerC = mock(MenuSelectionListener.class);
+ MenuSelectionListener menuSelectionListenerD = mock(MenuSelectionListener.class);
- MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
+ MenuCell A = new MenuCell("A", null, null, menuSelectionListenerA);
- MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
+ MenuCell B = new MenuCell("B", null, null, menuSelectionListenerB);
- MenuCell C = new MenuCell("C",null, null, menuSelectionListenerC);
+ MenuCell C = new MenuCell("C", null, null, menuSelectionListenerC);
- MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
+ MenuCell D = new MenuCell("D", null, null, menuSelectionListenerD);
- return Arrays.asList(B, C, D, A);
+ return Arrays.asList(B, C, D, A);
- }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
index e3468b803..e92656846 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/RunScoreTests.java
@@ -44,16 +44,16 @@ import static junit.framework.TestCase.assertEquals;
@RunWith(AndroidJUnit4.class)
public class RunScoreTests {
- @Test
- public void testSettersAndGetters(){
+ @Test
+ public void testSettersAndGetters() {
- // set everything - we only use the constructor to set variables in the Menu Manager
- RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
+ // set everything - we only use the constructor to set variables in the Menu Manager
+ RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
- // use getters and assert equality
- assertEquals(runScore.getScore(), TestValues.GENERAL_INT);
- assertEquals(runScore.getCurrentMenu(), TestValues.GENERAL_INTEGER_LIST);
- assertEquals(runScore.getOldMenu(), TestValues.GENERAL_INTEGER_LIST);
- }
+ // use getters and assert equality
+ assertEquals(runScore.getScore(), TestValues.GENERAL_INT);
+ assertEquals(runScore.getCurrentMenu(), TestValues.GENERAL_INTEGER_LIST);
+ assertEquals(runScore.getOldMenu(), TestValues.GENERAL_INTEGER_LIST);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
index 29dd8e7c6..03afc5348 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/SubCellCommandListTests.java
@@ -44,20 +44,20 @@ import static junit.framework.TestCase.assertEquals;
@RunWith(AndroidJUnit4.class)
public class SubCellCommandListTests {
- @Test
- public void testSettersAndGetters() {
+ @Test
+ public void testSettersAndGetters() {
- RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
+ RunScore runScore = new RunScore(TestValues.GENERAL_INT, TestValues.GENERAL_INTEGER_LIST, TestValues.GENERAL_INTEGER_LIST);
- // set everything
- SubCellCommandList subCellCommandList = new SubCellCommandList(TestValues.GENERAL_STRING, TestValues.GENERAL_INTEGER, runScore, TestValues.GENERAL_MENUCELL_LIST, TestValues.GENERAL_MENUCELL_LIST);
+ // set everything
+ SubCellCommandList subCellCommandList = new SubCellCommandList(TestValues.GENERAL_STRING, TestValues.GENERAL_INTEGER, runScore, TestValues.GENERAL_MENUCELL_LIST, TestValues.GENERAL_MENUCELL_LIST);
- // use getters and assert equality
- assertEquals(subCellCommandList.getMenuTitle(), TestValues.GENERAL_STRING);
- assertEquals(subCellCommandList.getParentId(), TestValues.GENERAL_INTEGER);
- assertEquals(runScore, runScore);
- assertEquals(subCellCommandList.getNewList(), TestValues.GENERAL_MENUCELL_LIST);
- assertEquals(subCellCommandList.getOldList(), TestValues.GENERAL_MENUCELL_LIST);
+ // use getters and assert equality
+ assertEquals(subCellCommandList.getMenuTitle(), TestValues.GENERAL_STRING);
+ assertEquals(subCellCommandList.getParentId(), TestValues.GENERAL_INTEGER);
+ assertEquals(runScore, runScore);
+ assertEquals(subCellCommandList.getNewList(), TestValues.GENERAL_MENUCELL_LIST);
+ assertEquals(subCellCommandList.getOldList(), TestValues.GENERAL_MENUCELL_LIST);
- }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
index a3d07438e..98fc161db 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManagerTests.java
@@ -36,8 +36,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
-import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -70,141 +70,141 @@ import static org.mockito.Mockito.verify;
@RunWith(AndroidJUnit4.class)
public class VoiceCommandManagerTests {
- private VoiceCommand command, command3;
- private List<VoiceCommand> commands;
- private VoiceCommandManager voiceCommandManager;
- private static final int voiceCommandIdMin = 1900000000;
- private OnRPCNotificationListener onHMIStatusListener, commandListener;
-
- // SETUP / HELPERS
-
- @Before
- public void setUp() throws Exception{
-
- VoiceCommandSelectionListener mockListener = mock(VoiceCommandSelectionListener.class);
- command = new VoiceCommand(Arrays.asList("Command one", "Command two"), null);
- VoiceCommand command2 = new VoiceCommand(Arrays.asList("Command three", "Command four"), null);
- command3 = new VoiceCommand(Arrays.asList("Command five", "Command six"), mockListener);
- commands = Arrays.asList(command,command2);
-
- ISdl internalInterface = mock(ISdl.class);
-
- // When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
- // inside the VoiceCommandManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
- // to emulate what Core does when it sends OnHMIStatus notification
- Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- onHMIStatusListener = (OnRPCNotificationListener) args[1];
- return null;
- }
- };
- doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
-
- Answer<Void> onCommandAnswer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- commandListener = (OnRPCNotificationListener) args[1];
- return null;
- }
- };
- doAnswer(onCommandAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_COMMAND), any(OnRPCNotificationListener.class));
-
- voiceCommandManager = new VoiceCommandManager(internalInterface);
-
- // Check some stuff during setup
- assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_NONE);
- assertEquals(voiceCommandManager.getState(), BaseSubManager.SETTING_UP);
- assertEquals(voiceCommandManager.lastVoiceCommandId, voiceCommandIdMin);
- assertFalse(voiceCommandManager.hasQueuedUpdate);
- assertFalse(voiceCommandManager.waitingOnHMIUpdate);
- assertNotNull(voiceCommandManager.commandListener);
- assertNotNull(voiceCommandManager.hmiListener);
- assertNull(voiceCommandManager.voiceCommands);
- assertNull(voiceCommandManager.oldVoiceCommands);
- assertNull(voiceCommandManager.inProgressUpdate);
- }
-
- @After
- public void tearDown() throws Exception {
-
- voiceCommandManager.dispose();
-
- assertEquals(voiceCommandManager.lastVoiceCommandId, voiceCommandIdMin);
- assertNull(voiceCommandManager.voiceCommands);
- assertNull(voiceCommandManager.oldVoiceCommands);
- assertNull(voiceCommandManager.currentHMILevel);
- assertNull(voiceCommandManager.inProgressUpdate);
- assertFalse(voiceCommandManager.hasQueuedUpdate);
- assertFalse(voiceCommandManager.waitingOnHMIUpdate);
- // after everything, make sure we are in the correct state
- assertEquals(voiceCommandManager.getState(), BaseSubManager.SHUTDOWN);
- }
-
- @Test
- public void testStartVoiceCommandManager(){
-
- voiceCommandManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- // Make sure the state has changed, as the Screen Manager is dependant on it
- assertEquals(voiceCommandManager.getState(), BaseSubManager.READY);
- }
- });
- }
-
- @Test
- public void testHMINotReady(){
-
- voiceCommandManager.currentHMILevel = HMILevel.HMI_NONE;
- voiceCommandManager.setVoiceCommands(commands);
-
- // updating voice commands before HMI is ready
- assertNull(voiceCommandManager.inProgressUpdate);
- assertTrue(voiceCommandManager.waitingOnHMIUpdate);
- // these are the 2 commands we have waiting
- assertEquals(voiceCommandManager.voiceCommands.size(), 2);
- assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_NONE);
-
- // The VCM should send the pending voice commands once HMI full occurs
- sendFakeCoreOnHMIFullNotifications();
- // Listener should be triggered - which sets new HMI level and should proceed to send our pending update
- assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_FULL);
- // This being false means it received the hmi notification and sent the pending commands
- assertFalse(voiceCommandManager.waitingOnHMIUpdate);
- }
-
- @Test
- public void testUpdatingCommands(){
-
- // we have previously sent 2 VoiceCommand objects. we will now update it and have just one
-
- // make sure the system returns us 2 delete commands
- assertEquals(voiceCommandManager.deleteCommandsForVoiceCommands(commands).size(), 2);
- // when we only send one command to update, we should only be returned one add command
- assertEquals(voiceCommandManager.addCommandsForVoiceCommands(Collections.singletonList(command)).size(), 1);
-
- // Send a new single command, and test that its listener works, as it gets called from the VCM
- voiceCommandManager.setVoiceCommands(Collections.singletonList(command3));
-
- // Fake onCommand - we want to make sure that we can pass back onCommand events to our VoiceCommand Objects
- OnCommand onCommand = new OnCommand();
- onCommand.setCmdID(command3.getCommandId());
- onCommand.setTriggerSource(TriggerSource.TS_VR); // these are voice commands
- commandListener.onNotified(onCommand); // send off the notification
-
- // verify the mock listener has only been hit once
- verify(command3.getVoiceCommandSelectionListener(), times(1)).onVoiceCommandSelected();
- }
-
- // Emulate what happens when Core sends OnHMIStatus notification
- private void sendFakeCoreOnHMIFullNotifications() {
- OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
- onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
- onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
- }
+ private VoiceCommand command, command3;
+ private List<VoiceCommand> commands;
+ private VoiceCommandManager voiceCommandManager;
+ private static final int voiceCommandIdMin = 1900000000;
+ private OnRPCNotificationListener onHMIStatusListener, commandListener;
+
+ // SETUP / HELPERS
+
+ @Before
+ public void setUp() throws Exception {
+
+ VoiceCommandSelectionListener mockListener = mock(VoiceCommandSelectionListener.class);
+ command = new VoiceCommand(Arrays.asList("Command one", "Command two"), null);
+ VoiceCommand command2 = new VoiceCommand(Arrays.asList("Command three", "Command four"), null);
+ command3 = new VoiceCommand(Arrays.asList("Command five", "Command six"), mockListener);
+ commands = Arrays.asList(command, command2);
+
+ ISdl internalInterface = mock(ISdl.class);
+
+ // When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
+ // inside the VoiceCommandManager's constructor, then keep a reference to the OnRPCNotificationListener so we can trigger it later
+ // to emulate what Core does when it sends OnHMIStatus notification
+ Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ onHMIStatusListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onCommandAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ commandListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onCommandAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_COMMAND), any(OnRPCNotificationListener.class));
+
+ voiceCommandManager = new VoiceCommandManager(internalInterface);
+
+ // Check some stuff during setup
+ assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_NONE);
+ assertEquals(voiceCommandManager.getState(), BaseSubManager.SETTING_UP);
+ assertEquals(voiceCommandManager.lastVoiceCommandId, voiceCommandIdMin);
+ assertFalse(voiceCommandManager.hasQueuedUpdate);
+ assertFalse(voiceCommandManager.waitingOnHMIUpdate);
+ assertNotNull(voiceCommandManager.commandListener);
+ assertNotNull(voiceCommandManager.hmiListener);
+ assertNull(voiceCommandManager.voiceCommands);
+ assertNull(voiceCommandManager.oldVoiceCommands);
+ assertNull(voiceCommandManager.inProgressUpdate);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ voiceCommandManager.dispose();
+
+ assertEquals(voiceCommandManager.lastVoiceCommandId, voiceCommandIdMin);
+ assertNull(voiceCommandManager.voiceCommands);
+ assertNull(voiceCommandManager.oldVoiceCommands);
+ assertNull(voiceCommandManager.currentHMILevel);
+ assertNull(voiceCommandManager.inProgressUpdate);
+ assertFalse(voiceCommandManager.hasQueuedUpdate);
+ assertFalse(voiceCommandManager.waitingOnHMIUpdate);
+ // after everything, make sure we are in the correct state
+ assertEquals(voiceCommandManager.getState(), BaseSubManager.SHUTDOWN);
+ }
+
+ @Test
+ public void testStartVoiceCommandManager() {
+
+ voiceCommandManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ // Make sure the state has changed, as the Screen Manager is dependant on it
+ assertEquals(voiceCommandManager.getState(), BaseSubManager.READY);
+ }
+ });
+ }
+
+ @Test
+ public void testHMINotReady() {
+
+ voiceCommandManager.currentHMILevel = HMILevel.HMI_NONE;
+ voiceCommandManager.setVoiceCommands(commands);
+
+ // updating voice commands before HMI is ready
+ assertNull(voiceCommandManager.inProgressUpdate);
+ assertTrue(voiceCommandManager.waitingOnHMIUpdate);
+ // these are the 2 commands we have waiting
+ assertEquals(voiceCommandManager.voiceCommands.size(), 2);
+ assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_NONE);
+
+ // The VCM should send the pending voice commands once HMI full occurs
+ sendFakeCoreOnHMIFullNotifications();
+ // Listener should be triggered - which sets new HMI level and should proceed to send our pending update
+ assertEquals(voiceCommandManager.currentHMILevel, HMILevel.HMI_FULL);
+ // This being false means it received the hmi notification and sent the pending commands
+ assertFalse(voiceCommandManager.waitingOnHMIUpdate);
+ }
+
+ @Test
+ public void testUpdatingCommands() {
+
+ // we have previously sent 2 VoiceCommand objects. we will now update it and have just one
+
+ // make sure the system returns us 2 delete commands
+ assertEquals(voiceCommandManager.deleteCommandsForVoiceCommands(commands).size(), 2);
+ // when we only send one command to update, we should only be returned one add command
+ assertEquals(voiceCommandManager.addCommandsForVoiceCommands(Collections.singletonList(command)).size(), 1);
+
+ // Send a new single command, and test that its listener works, as it gets called from the VCM
+ voiceCommandManager.setVoiceCommands(Collections.singletonList(command3));
+
+ // Fake onCommand - we want to make sure that we can pass back onCommand events to our VoiceCommand Objects
+ OnCommand onCommand = new OnCommand();
+ onCommand.setCmdID(command3.getCommandId());
+ onCommand.setTriggerSource(TriggerSource.TS_VR); // these are voice commands
+ commandListener.onNotified(onCommand); // send off the notification
+
+ // verify the mock listener has only been hit once
+ verify(command3.getVoiceCommandSelectionListener(), times(1)).onVoiceCommandSelected();
+ }
+
+ // Emulate what happens when Core sends OnHMIStatus notification
+ private void sendFakeCoreOnHMIFullNotifications() {
+ OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
+ onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
+ onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
index 00e198a91..0a7673c0c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandTests.java
@@ -44,19 +44,19 @@ import static junit.framework.TestCase.assertEquals;
@RunWith(AndroidJUnit4.class)
public class VoiceCommandTests {
- private VoiceCommandSelectionListener voiceCommandSelectionListener = new VoiceCommandSelectionListener() {
- @Override
- public void onVoiceCommandSelected() {
- // Stuffs
- }
- };
-
- @Test
- public void testSettersAndGetters(){
- VoiceCommand voiceCommand = new VoiceCommand(TestValues.GENERAL_STRING_LIST, voiceCommandSelectionListener);
-
- assertEquals(voiceCommand.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
- assertEquals(voiceCommand.getVoiceCommandSelectionListener(), voiceCommandSelectionListener);
- }
+ private VoiceCommandSelectionListener voiceCommandSelectionListener = new VoiceCommandSelectionListener() {
+ @Override
+ public void onVoiceCommandSelected() {
+ // Stuffs
+ }
+ };
+
+ @Test
+ public void testSettersAndGetters() {
+ VoiceCommand voiceCommand = new VoiceCommand(TestValues.GENERAL_STRING_LIST, voiceCommandSelectionListener);
+
+ assertEquals(voiceCommand.getVoiceCommands(), TestValues.GENERAL_STRING_LIST);
+ assertEquals(voiceCommand.getVoiceCommandSelectionListener(), voiceCommandSelectionListener);
+ }
}
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 c02ba30c4..54d90359d 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
@@ -11,12 +11,12 @@ import androidx.annotation.NonNull;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
+import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.managers.ISdl;
-import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
@@ -67,428 +67,418 @@ import static org.mockito.Mockito.when;
*/
@RunWith(AndroidJUnit4.class)
public class VideoStreamManagerTests {
- public static final String TAG = "VideoStreamManagerTests";
- private Context mTestContext;
- private static boolean touchEventOccured = false;
-
- // SETUP / HELPERS
-
- @Before
- public void setUp() throws Exception{
- mTestContext = getInstrumentation().getContext();
- }
-
- // TEST CLASSES
-
- public static class TestPresentation extends SdlRemoteDisplay {
- View simulatedView = new View(this.getContext());
-
- public TestPresentation(Context context, Display display) {
- super(context, display);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(simulatedView);
- }
-
- @Override
- public boolean onTouchEvent(@NonNull MotionEvent event) {
- touchEventOccured = true;
- return super.onTouchEvent(event);
- }
- }
-
- // TESTS
-
- @Test
- public void testInitialization(){
- ISdl internalInterface = mock(ISdl.class);
- when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,1,0));
-
- RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
- VehicleType mockVehicleType = new VehicleType();
- mockVehicleType.setMake("Ford");
- mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
- when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
-
- Answer<Void> onAddServiceListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- SessionType sessionType = (SessionType) args[0];
- ISdlServiceListener sdlServiceListener = (ISdlServiceListener) args[1];
- assertEquals(sessionType, SessionType.NAV);
- assertNotNull(sdlServiceListener);
- return null;
- }
- };
-
- doAnswer(onAddServiceListener).when(internalInterface).addServiceListener(any(SessionType.class), any(ISdlServiceListener.class));
-
- VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
- videoStreamManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- }
- });
- }
-
- @Test
- public void testHMILevelNotFull(){
- final ISdl internalInterface = mock(ISdl.class);
-
- SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
- doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
-
- when(internalInterface.getProtocolVersion()).thenReturn((new Version(5,0,0)));
-
- RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
- VehicleType mockVehicleType = new VehicleType();
- mockVehicleType.setMake("Ford");
- mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
- when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
-
- when(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true);
-
- final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
- videoStreamManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- VideoStreamingParameters params = new VideoStreamingParameters();
- boolean encrypted = false;
- videoStreamManager.startStreaming(params, encrypted);
- verify(internalInterface, times(0)).startVideoService(params, encrypted);
- }
- });
- }
-
- @Test
- public void testRemoteDisplayStream(){
- ISdl internalInterface = mock(ISdl.class);
-
- RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
- VehicleType mockVehicleType = new VehicleType();
- mockVehicleType.setMake("Ford");
- mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
- when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
-
- final Set<Object> listenerSet = new HashSet<>();
-
- when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,0,0));
-
- SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
- doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
- when(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true);
-
- Answer<Void> onGetCapability = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- OnSystemCapabilityListener systemCapabilityListener = (OnSystemCapabilityListener) args[1];
- systemCapabilityListener.onCapabilityRetrieved(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
- return null;
- }
- };
-
- doAnswer(onGetCapability).when(systemCapabilityManager).getCapability(eq(SystemCapabilityType.VIDEO_STREAMING), any(OnSystemCapabilityListener.class), anyBoolean());
-
- Answer<Void> onAddServiceListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- listenerSet.add(args[1]);
- return null;
- }
- };
-
- doAnswer(onAddServiceListener).when(internalInterface).addServiceListener(eq(SessionType.NAV), any(ISdlServiceListener.class));
-
- final OnRPCNotificationListener[] hmiListener = {null};
-
- Answer<Void> onAddHMIListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- hmiListener[0] = (OnRPCNotificationListener) args[1];
- listenerSet.add(args[1]);
- return null;
- }
- };
-
- doAnswer(onAddHMIListener).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
-
- Answer<Void> onAddTouchListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- listenerSet.add(args[1]);
- return null;
- }
- };
-
- doAnswer(onAddTouchListener).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_TOUCH_EVENT), any(OnRPCNotificationListener.class));
-
- Answer<Void> onRemoveRPCNotificationListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- listenerSet.remove(args[1]);
- return null;
- }
- };
-
- doAnswer(onRemoveRPCNotificationListener).when(internalInterface).removeOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
- doAnswer(onRemoveRPCNotificationListener).when(internalInterface).removeOnRPCNotificationListener(eq(FunctionID.ON_TOUCH_EVENT), any(OnRPCNotificationListener.class));
-
- Answer<Void> onRemoveServiceListener = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- listenerSet.remove(args[1]);
- return null;
- }
- };
-
- doAnswer(onRemoveServiceListener).when(internalInterface).removeServiceListener(eq(SessionType.NAV), any(ISdlServiceListener.class));
-
- when(systemCapabilityManager.getCapability(eq(SystemCapabilityType.VIDEO_STREAMING), any(OnSystemCapabilityListener.class), anyBoolean())).thenReturn(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
-
- final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
- videoStreamManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- assertTrue(listenerSet.size() == 3);
-
- OnHMIStatus fullNotification = new OnHMIStatus();
- fullNotification.setHmiLevel(HMILevel.HMI_FULL);
- hmiListener[0].onNotified(fullNotification);
-
- videoStreamManager.startRemoteDisplayStream(mTestContext, TestPresentation.class, null, false);
-
- //assertTrue(touchEventOccured);
-
- videoStreamManager.dispose();
- assertTrue(listenerSet.isEmpty());
- }
- });
-
- }
-
- @Test
- public void testConvertTouchEvent() {
- ISdl internalInterface = mock(ISdl.class);
-
- RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
- VehicleType mockVehicleType = new VehicleType();
- mockVehicleType.setMake("Ford");
- mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
- when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
-
- VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
- List<MotionEvent> motionEventList;
- long e1TS = 1558124390L, e2TS = 1558125390L, e3TS = 1558126390L;
- int e1x = 50, e1y = 100, e2x = 150, e2y = 200, e3x = 250, e3y = 300;
- int e1Id = 100, e2Id = 101, e3Id = 102;
- int movingStep = 10;
- OnTouchEvent testOnTouchEvent;
- MotionEvent motionEvent;
- TouchEvent touchEvent1 = new TouchEvent(e1Id, Collections.singletonList(e1TS), Collections.singletonList(new TouchCoord(e1x, e1y)));
- TouchEvent touchEvent2 = new TouchEvent(e2Id, Collections.singletonList(e2TS), Collections.singletonList(new TouchCoord(e2x, e2y)));
- TouchEvent touchEvent2AfterMovingPointer = new TouchEvent(e2Id, Collections.singletonList(e2TS), Collections.singletonList(new TouchCoord(e2x + movingStep, e2y + movingStep)));
- TouchEvent touchEvent3 = new TouchEvent(e3Id, Collections.singletonList(e3TS), Collections.singletonList(new TouchCoord(e3x, e3y)));
-
+ public static final String TAG = "VideoStreamManagerTests";
+ private Context mTestContext;
+ private static boolean touchEventOccured = false;
+ // SETUP / HELPERS
- /////////////////////////////////////////////////// First OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1, touchEvent2));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ @Before
+ public void setUp() throws Exception {
+ mTestContext = getInstrumentation().getContext();
+ }
+ // TEST CLASSES
- // First MotionEvent should be ACTION_DOWN and have 1 pointer
- motionEvent = motionEventList.get(0);
- assertEquals(1, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
+ public static class TestPresentation extends SdlRemoteDisplay {
+ View simulatedView = new View(this.getContext());
+ public TestPresentation(Context context, Display display) {
+ super(context, display);
+ }
- // Second MotionEvent should be ACTION_POINTER_DOWN and have 2 pointers
- motionEvent = motionEventList.get(1);
- assertEquals(2, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x, Math.round(motionEvent.getX(1)));
- assertEquals(e2y, Math.round(motionEvent.getY(1)));
- assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(simulatedView);
+ }
+ @Override
+ public boolean onTouchEvent(@NonNull MotionEvent event) {
+ touchEventOccured = true;
+ return super.onTouchEvent(event);
+ }
+ }
+ // TESTS
- /////////////////////////////////////////////////// Second OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent3));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ @Test
+ public void testInitialization() {
+ ISdl internalInterface = mock(ISdl.class);
+ when(internalInterface.getProtocolVersion()).thenReturn(new Version(5, 1, 0));
+
+ RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
+ VehicleType mockVehicleType = new VehicleType();
+ mockVehicleType.setMake("Ford");
+ mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
+ when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
+
+ Answer<Void> onAddServiceListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ SessionType sessionType = (SessionType) args[0];
+ ISdlServiceListener sdlServiceListener = (ISdlServiceListener) args[1];
+ assertEquals(sessionType, SessionType.NAV);
+ assertNotNull(sdlServiceListener);
+ return null;
+ }
+ };
+
+ doAnswer(onAddServiceListener).when(internalInterface).addServiceListener(any(SessionType.class), any(ISdlServiceListener.class));
+ VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ }
+ });
+ }
- // First MotionEvent should be ACTION_POINTER_DOWN and have 3 pointers
- motionEvent = motionEventList.get(0);
- assertEquals(3, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x, Math.round(motionEvent.getX(1)));
- assertEquals(e2y, Math.round(motionEvent.getY(1)));
- assertEquals(e3x, Math.round(motionEvent.getX(2)));
- assertEquals(e3y, Math.round(motionEvent.getY(2)));
- assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ @Test
+ public void testHMILevelNotFull() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
+ doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
+
+ when(internalInterface.getProtocolVersion()).thenReturn((new Version(5, 0, 0)));
+
+ RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
+ VehicleType mockVehicleType = new VehicleType();
+ mockVehicleType.setMake("Ford");
+ mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
+ when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
+
+ when(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true);
+
+ final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ boolean encrypted = false;
+ videoStreamManager.startStreaming(params, encrypted);
+ verify(internalInterface, times(0)).startVideoService(params, encrypted);
+ }
+ });
+ }
+ @Test
+ public void testRemoteDisplayStream() {
+ ISdl internalInterface = mock(ISdl.class);
+ RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
+ VehicleType mockVehicleType = new VehicleType();
+ mockVehicleType.setMake("Ford");
+ mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
+ when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
+
+ final Set<Object> listenerSet = new HashSet<>();
+
+ when(internalInterface.getProtocolVersion()).thenReturn(new Version(5, 0, 0));
+
+ SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class);
+ doReturn(systemCapabilityManager).when(internalInterface).getSystemCapabilityManager();
+ when(systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true);
+
+ Answer<Void> onGetCapability = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnSystemCapabilityListener systemCapabilityListener = (OnSystemCapabilityListener) args[1];
+ systemCapabilityListener.onCapabilityRetrieved(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
+ return null;
+ }
+ };
+
+ doAnswer(onGetCapability).when(systemCapabilityManager).getCapability(eq(SystemCapabilityType.VIDEO_STREAMING), any(OnSystemCapabilityListener.class), anyBoolean());
+
+ Answer<Void> onAddServiceListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ listenerSet.add(args[1]);
+ return null;
+ }
+ };
+
+ doAnswer(onAddServiceListener).when(internalInterface).addServiceListener(eq(SessionType.NAV), any(ISdlServiceListener.class));
+
+ final OnRPCNotificationListener[] hmiListener = {null};
+
+ Answer<Void> onAddHMIListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ hmiListener[0] = (OnRPCNotificationListener) args[1];
+ listenerSet.add(args[1]);
+ return null;
+ }
+ };
+
+ doAnswer(onAddHMIListener).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onAddTouchListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ listenerSet.add(args[1]);
+ return null;
+ }
+ };
+
+ doAnswer(onAddTouchListener).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_TOUCH_EVENT), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onRemoveRPCNotificationListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ listenerSet.remove(args[1]);
+ return null;
+ }
+ };
+
+ doAnswer(onRemoveRPCNotificationListener).when(internalInterface).removeOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+ doAnswer(onRemoveRPCNotificationListener).when(internalInterface).removeOnRPCNotificationListener(eq(FunctionID.ON_TOUCH_EVENT), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onRemoveServiceListener = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ listenerSet.remove(args[1]);
+ return null;
+ }
+ };
+
+ doAnswer(onRemoveServiceListener).when(internalInterface).removeServiceListener(eq(SessionType.NAV), any(ISdlServiceListener.class));
+
+ when(systemCapabilityManager.getCapability(eq(SystemCapabilityType.VIDEO_STREAMING), any(OnSystemCapabilityListener.class), anyBoolean())).thenReturn(TestValues.GENERAL_VIDEOSTREAMINGCAPABILITY);
+
+ final VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ assertTrue(listenerSet.size() == 3);
+
+ OnHMIStatus fullNotification = new OnHMIStatus();
+ fullNotification.setHmiLevel(HMILevel.HMI_FULL);
+ hmiListener[0].onNotified(fullNotification);
+
+ videoStreamManager.startRemoteDisplayStream(mTestContext, TestPresentation.class, null, false);
+
+ //assertTrue(touchEventOccured);
+
+ videoStreamManager.dispose();
+ assertTrue(listenerSet.isEmpty());
+ }
+ });
- /////////////////////////////////////////////////// Third OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.MOVE, Arrays.asList(touchEvent2AfterMovingPointer));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ }
+ @Test
+ public void testConvertTouchEvent() {
+ ISdl internalInterface = mock(ISdl.class);
- // First MotionEvent should be ACTION_MOVE and have 3 pointers
- motionEvent = motionEventList.get(0);
- assertEquals(3, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x + movingStep, Math.round(motionEvent.getX(1)));
- assertEquals(e2y + movingStep, Math.round(motionEvent.getY(1)));
- assertEquals(e3x, Math.round(motionEvent.getX(2)));
- assertEquals(e3y, Math.round(motionEvent.getY(2)));
- assertEquals(MotionEvent.ACTION_MOVE, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
+ VehicleType mockVehicleType = new VehicleType();
+ mockVehicleType.setMake("Ford");
+ mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
+ when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
+ VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ List<MotionEvent> motionEventList;
+ long e1TS = 1558124390L, e2TS = 1558125390L, e3TS = 1558126390L;
+ int e1x = 50, e1y = 100, e2x = 150, e2y = 200, e3x = 250, e3y = 300;
+ int e1Id = 100, e2Id = 101, e3Id = 102;
+ int movingStep = 10;
+ OnTouchEvent testOnTouchEvent;
+ MotionEvent motionEvent;
+ TouchEvent touchEvent1 = new TouchEvent(e1Id, Collections.singletonList(e1TS), Collections.singletonList(new TouchCoord(e1x, e1y)));
+ TouchEvent touchEvent2 = new TouchEvent(e2Id, Collections.singletonList(e2TS), Collections.singletonList(new TouchCoord(e2x, e2y)));
+ TouchEvent touchEvent2AfterMovingPointer = new TouchEvent(e2Id, Collections.singletonList(e2TS), Collections.singletonList(new TouchCoord(e2x + movingStep, e2y + movingStep)));
+ TouchEvent touchEvent3 = new TouchEvent(e3Id, Collections.singletonList(e3TS), Collections.singletonList(new TouchCoord(e3x, e3y)));
- /////////////////////////////////////////////////// Fourth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent2AfterMovingPointer));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ /////////////////////////////////////////////////// First OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1, touchEvent2));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- // First MotionEvent should be ACTION_POINTER_UP and have 3 pointers
- motionEvent = motionEventList.get(0);
- assertEquals(3, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x + movingStep, Math.round(motionEvent.getX(1)));
- assertEquals(e2y + movingStep, Math.round(motionEvent.getY(1)));
- assertEquals(e3x, Math.round(motionEvent.getX(2)));
- assertEquals(e3y, Math.round(motionEvent.getY(2)));
- assertEquals(MotionEvent.ACTION_POINTER_UP, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // First MotionEvent should be ACTION_DOWN and have 1 pointer
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
+ // Second MotionEvent should be ACTION_POINTER_DOWN and have 2 pointers
+ motionEvent = motionEventList.get(1);
+ assertEquals(2, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y, Math.round(motionEvent.getY(1)));
+ assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////// Fifth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent3));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ /////////////////////////////////////////////////// Second OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent3));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- // First MotionEvent should be ACTION_POINTER_UP and have 2 pointers
- motionEvent = motionEventList.get(0);
- assertEquals(2, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e3x, Math.round(motionEvent.getX(1)));
- assertEquals(e3y, Math.round(motionEvent.getY(1)));
- assertEquals(MotionEvent.ACTION_POINTER_UP, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // First MotionEvent should be ACTION_POINTER_DOWN and have 3 pointers
+ motionEvent = motionEventList.get(0);
+ assertEquals(3, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y, Math.round(motionEvent.getY(1)));
+ assertEquals(e3x, Math.round(motionEvent.getX(2)));
+ assertEquals(e3y, Math.round(motionEvent.getY(2)));
+ assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////// Third OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.MOVE, Arrays.asList(touchEvent2AfterMovingPointer));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- /////////////////////////////////////////////////// Sixth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent3));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ // First MotionEvent should be ACTION_MOVE and have 3 pointers
+ motionEvent = motionEventList.get(0);
+ assertEquals(3, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x + movingStep, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y + movingStep, Math.round(motionEvent.getY(1)));
+ assertEquals(e3x, Math.round(motionEvent.getX(2)));
+ assertEquals(e3y, Math.round(motionEvent.getY(2)));
+ assertEquals(MotionEvent.ACTION_MOVE, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////// Fourth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent2AfterMovingPointer));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- // First MotionEvent should be ACTION_UP and have 1 pointer
- motionEvent = motionEventList.get(0);
- assertEquals(1, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // First MotionEvent should be ACTION_POINTER_UP and have 3 pointers
+ motionEvent = motionEventList.get(0);
+ assertEquals(3, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x + movingStep, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y + movingStep, Math.round(motionEvent.getY(1)));
+ assertEquals(e3x, Math.round(motionEvent.getX(2)));
+ assertEquals(e3y, Math.round(motionEvent.getY(2)));
+ assertEquals(MotionEvent.ACTION_POINTER_UP, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////// Fifth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent3));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ // First MotionEvent should be ACTION_POINTER_UP and have 2 pointers
+ motionEvent = motionEventList.get(0);
+ assertEquals(2, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e3x, Math.round(motionEvent.getX(1)));
+ assertEquals(e3y, Math.round(motionEvent.getY(1)));
+ assertEquals(MotionEvent.ACTION_POINTER_UP, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////// Seventh OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1, touchEvent2));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ /////////////////////////////////////////////////// Sixth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent3));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- // First MotionEvent should be ACTION_DOWN and have 1 pointer
- motionEvent = motionEventList.get(0);
- assertEquals(1, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
+ // First MotionEvent should be ACTION_UP and have 1 pointer
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Second MotionEvent should be ACTION_POINTER_DOWN and have 2 pointers
- motionEvent = motionEventList.get(1);
- assertEquals(2, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x, Math.round(motionEvent.getX(1)));
- assertEquals(e2y, Math.round(motionEvent.getY(1)));
- assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////// Seventh OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1, touchEvent2));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- /////////////////////////////////////////////////// Eighth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.CANCEL, Arrays.asList(touchEvent3));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ // First MotionEvent should be ACTION_DOWN and have 1 pointer
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
- // First MotionEvent should be ACTION_CANCEL and have 2 pointers
- motionEvent = motionEventList.get(0);
- assertEquals(2, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(e2x, Math.round(motionEvent.getX(1)));
- assertEquals(e2y, Math.round(motionEvent.getY(1)));
- assertEquals(MotionEvent.ACTION_CANCEL, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Second MotionEvent should be ACTION_POINTER_DOWN and have 2 pointers
+ motionEvent = motionEventList.get(1);
+ assertEquals(2, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y, Math.round(motionEvent.getY(1)));
+ assertEquals(MotionEvent.ACTION_POINTER_DOWN, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////// Eighth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.CANCEL, Arrays.asList(touchEvent3));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- /////////////////////////////////////////////////// Ninth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ // First MotionEvent should be ACTION_CANCEL and have 2 pointers
+ motionEvent = motionEventList.get(0);
+ assertEquals(2, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(e2x, Math.round(motionEvent.getX(1)));
+ assertEquals(e2y, Math.round(motionEvent.getY(1)));
+ assertEquals(MotionEvent.ACTION_CANCEL, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // First MotionEvent should be ACTION_DOWN and have 1 pointer
- motionEvent = motionEventList.get(0);
- assertEquals(1, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////// Ninth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- /////////////////////////////////////////////////// Tenth OnTouchEvent Notification ///////////////////////////////////////////////////
- testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent1));
- motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+ // First MotionEvent should be ACTION_DOWN and have 1 pointer
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(MotionEvent.ACTION_DOWN, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // First MotionEvent should be ACTION_UP and have 1 pointer
- motionEvent = motionEventList.get(0);
- assertEquals(1, motionEvent.getPointerCount());
- assertEquals(e1x, Math.round(motionEvent.getX(0)));
- assertEquals(e1y, Math.round(motionEvent.getY(0)));
- assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- }
+ /////////////////////////////////////////////////// Tenth OnTouchEvent Notification ///////////////////////////////////////////////////
+ testOnTouchEvent = new OnTouchEvent(TouchType.END, Arrays.asList(touchEvent1));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
- @Test
+
+ // First MotionEvent should be ACTION_UP and have 1 pointer
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(e1x, Math.round(motionEvent.getX(0)));
+ assertEquals(e1y, Math.round(motionEvent.getY(0)));
+ assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ }
+
+ @Test
public void testConvertTouchEvent_Scale_1() {
assertMotionEventWithScale(800, 480, 1.0f);
}
@@ -506,11 +496,11 @@ public class VideoStreamManagerTests {
private void assertMotionEventWithScale(int width, int height, float scale) {
ISdl internalInterface = mock(ISdl.class);
- RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
- VehicleType mockVehicleType = new VehicleType();
- mockVehicleType.setMake("Ford");
- mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
- when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
+ RegisterAppInterfaceResponse mockRegisterAppInterfaceResponse = new RegisterAppInterfaceResponse();
+ VehicleType mockVehicleType = new VehicleType();
+ mockVehicleType.setMake("Ford");
+ mockRegisterAppInterfaceResponse.setVehicleType(mockVehicleType);
+ when(internalInterface.getRegisterAppInterfaceResponse()).thenReturn(mockRegisterAppInterfaceResponse);
// Preferred Resolution capability
ImageResolution resolution = new ImageResolution(width, height);
@@ -543,38 +533,38 @@ public class VideoStreamManagerTests {
}
@Test
- public void testIsHMIStateVideoStreamCapable() {
- VideoStreamManager videoStreamManager = new VideoStreamManager(mock(ISdl.class));
-
- // Case 1 (VideoStreamingState = STREAMABLE)
- assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, VideoStreamingState.STREAMABLE)));
- assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, VideoStreamingState.STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, VideoStreamingState.STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, VideoStreamingState.STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, VideoStreamingState.STREAMABLE)));
-
- // Case 2 (VideoStreamingState = NOT_STREAMABLE)
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, VideoStreamingState.NOT_STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, VideoStreamingState.NOT_STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, VideoStreamingState.NOT_STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, VideoStreamingState.NOT_STREAMABLE)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, VideoStreamingState.NOT_STREAMABLE)));
-
- // Case 3 (VideoStreamingState = NULL)
- assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, null)));
- assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, null)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, null)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, null)));
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, null)));
-
- // Case 4 (onHMIStatus = NULL)
- assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(null));
- }
-
- private OnHMIStatus createOnHMIStatus(HMILevel hmiLevel, VideoStreamingState videoStreamingState) {
- OnHMIStatus onHMIStatus = new OnHMIStatus();
- onHMIStatus.setHmiLevel(hmiLevel);
- onHMIStatus.setVideoStreamingState(videoStreamingState);
- return onHMIStatus;
- }
+ public void testIsHMIStateVideoStreamCapable() {
+ VideoStreamManager videoStreamManager = new VideoStreamManager(mock(ISdl.class));
+
+ // Case 1 (VideoStreamingState = STREAMABLE)
+ assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, VideoStreamingState.STREAMABLE)));
+ assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, VideoStreamingState.STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, VideoStreamingState.STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, VideoStreamingState.STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, VideoStreamingState.STREAMABLE)));
+
+ // Case 2 (VideoStreamingState = NOT_STREAMABLE)
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, VideoStreamingState.NOT_STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, VideoStreamingState.NOT_STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, VideoStreamingState.NOT_STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, VideoStreamingState.NOT_STREAMABLE)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, VideoStreamingState.NOT_STREAMABLE)));
+
+ // Case 3 (VideoStreamingState = NULL)
+ assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_FULL, null)));
+ assertTrue(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_LIMITED, null)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_BACKGROUND, null)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(HMILevel.HMI_NONE, null)));
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(createOnHMIStatus(null, null)));
+
+ // Case 4 (onHMIStatus = NULL)
+ assertFalse(videoStreamManager.isHMIStateVideoStreamCapable(null));
+ }
+
+ private OnHMIStatus createOnHMIStatus(HMILevel hmiLevel, VideoStreamingState videoStreamingState) {
+ OnHMIStatus onHMIStatus = new OnHMIStatus();
+ onHMIStatus.setHmiLevel(hmiLevel);
+ onHMIStatus.setVideoStreamingState(videoStreamingState);
+ return onHMIStatus;
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
index bea2a3a46..03c91247a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
@@ -19,78 +19,78 @@ import static junit.framework.TestCase.assertNull;
@RunWith(AndroidJUnit4.class)
public class SdlPacketTests {
- // Test variables
- private final int TEST_HASH_ID = 65537;
- private final String TEST_PROTOCOL_VERSION = "5.0.0";
- private final Long TEST_MTU = (long) 131072;
-
- // Test payload from core representing hashId and mtu size
- private byte[] corePayload = hexStringToByteArray("39000000" +
- "10" +
- "68617368496400" +
- "01000100" +
- "126d747500" +
- "000002" + "0000000000" + "02" +
- "70726f746f636f6c56657273" +
- "696f6e0006000000352e302e300000");
-
- @Test
- public void testNull(){
- byte[] testPayload = hexStringToByteArray(
- "16000000" +
- "02" +
- "68656c6c6f" +"00" + // hello
- "06000000" + "776f726c64" + "00" + //world
- "00");
- String tag = "hello";
-
- SdlPacket sdlPacket = new SdlPacket();
-
- assertNull(sdlPacket.getTag(tag));
- sdlPacket.setPayload(testPayload);
- assertEquals(sdlPacket.getTag("hello"),"world");
-
- assertEquals(1, sdlPacket.getVersion());
-
- sdlPacket.setPriorityCoefficient(TestValues.GENERAL_INT);
- assertEquals(TestValues.GENERAL_INT, sdlPacket.getPrioirtyCoefficient());
-
- sdlPacket.setTransportRecord(new TransportRecord(TransportType.TCP, TestValues.GENERAL_STRING));
- assertEquals(TransportType.TCP, sdlPacket.getTransportRecord().getType());
- assertEquals(TestValues.GENERAL_STRING, sdlPacket.getTransportRecord().getAddress());
- }
-
- @Test
- public void testBsonDecoding(){
- SdlPacket sdlPacket = new SdlPacket();
- sdlPacket.setPayload(corePayload);
- assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID), TEST_HASH_ID);
- assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION), TEST_PROTOCOL_VERSION);
- assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.MTU), TEST_MTU);
- }
-
- @Test
- public void testBsonEncoding(){
- HashMap<String, Object> testMap = new HashMap<>();
- testMap.put(ControlFrameTags.RPC.StartServiceACK.HASH_ID, TEST_HASH_ID);
- testMap.put(ControlFrameTags.RPC.StartServiceACK.MTU, TEST_MTU);
- testMap.put(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, TEST_PROTOCOL_VERSION);
-
- byte[] observed = BsonEncoder.encodeToBytes(testMap);
- assertEquals(observed.length, corePayload.length);
- for(int i = 0; i < observed.length; i++){
- assertEquals(observed[i], corePayload[i]);
- }
- }
-
- // Helper method for converting String to Byte Array
- private static byte[] hexStringToByteArray(String s) {
- int len = s.length();
- byte[] data = new byte[len / 2];
- for (int i = 0; i < len; i += 2) {
- data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
- + Character.digit(s.charAt(i+1), 16));
- }
- return data;
- }
+ // Test variables
+ private final int TEST_HASH_ID = 65537;
+ private final String TEST_PROTOCOL_VERSION = "5.0.0";
+ private final Long TEST_MTU = (long) 131072;
+
+ // Test payload from core representing hashId and mtu size
+ private byte[] corePayload = hexStringToByteArray("39000000" +
+ "10" +
+ "68617368496400" +
+ "01000100" +
+ "126d747500" +
+ "000002" + "0000000000" + "02" +
+ "70726f746f636f6c56657273" +
+ "696f6e0006000000352e302e300000");
+
+ @Test
+ public void testNull() {
+ byte[] testPayload = hexStringToByteArray(
+ "16000000" +
+ "02" +
+ "68656c6c6f" + "00" + // hello
+ "06000000" + "776f726c64" + "00" + //world
+ "00");
+ String tag = "hello";
+
+ SdlPacket sdlPacket = new SdlPacket();
+
+ assertNull(sdlPacket.getTag(tag));
+ sdlPacket.setPayload(testPayload);
+ assertEquals(sdlPacket.getTag("hello"), "world");
+
+ assertEquals(1, sdlPacket.getVersion());
+
+ sdlPacket.setPriorityCoefficient(TestValues.GENERAL_INT);
+ assertEquals(TestValues.GENERAL_INT, sdlPacket.getPrioirtyCoefficient());
+
+ sdlPacket.setTransportRecord(new TransportRecord(TransportType.TCP, TestValues.GENERAL_STRING));
+ assertEquals(TransportType.TCP, sdlPacket.getTransportRecord().getType());
+ assertEquals(TestValues.GENERAL_STRING, sdlPacket.getTransportRecord().getAddress());
+ }
+
+ @Test
+ public void testBsonDecoding() {
+ SdlPacket sdlPacket = new SdlPacket();
+ sdlPacket.setPayload(corePayload);
+ assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID), TEST_HASH_ID);
+ assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION), TEST_PROTOCOL_VERSION);
+ assertEquals(sdlPacket.getTag(ControlFrameTags.RPC.StartServiceACK.MTU), TEST_MTU);
+ }
+
+ @Test
+ public void testBsonEncoding() {
+ HashMap<String, Object> testMap = new HashMap<>();
+ testMap.put(ControlFrameTags.RPC.StartServiceACK.HASH_ID, TEST_HASH_ID);
+ testMap.put(ControlFrameTags.RPC.StartServiceACK.MTU, TEST_MTU);
+ testMap.put(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, TEST_PROTOCOL_VERSION);
+
+ byte[] observed = BsonEncoder.encodeToBytes(testMap);
+ assertEquals(observed.length, corePayload.length);
+ for (int i = 0; i < observed.length; i++) {
+ assertEquals(observed[i], corePayload[i]);
+ }
+ }
+
+ // Helper method for converting String to Byte Array
+ private static byte[] hexStringToByteArray(String s) {
+ int len = s.length();
+ byte[] data = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ + Character.digit(s.charAt(i + 1), 16));
+ }
+ return data;
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
index ba6249e40..86db91b4b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
@@ -39,13 +39,14 @@ public class SdlProtocolTests {
ISdlProtocol defaultListener = mock(ISdlProtocol.class);
- public static class DidReceiveListener implements ISdlProtocol{
+ public static class DidReceiveListener implements ISdlProtocol {
boolean didReceive = false;
- public void reset(){
+ public void reset() {
didReceive = false;
}
- public boolean didReceive(){
+
+ public boolean didReceive() {
return didReceive;
}
@@ -112,137 +113,140 @@ public class SdlProtocolTests {
}
- };
+ }
+
+ ;
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
@Before
- public void setUp(){
+ public void setUp() {
config = new MultiplexTransportConfig(getInstrumentation().getContext(), SdlUnitTestContants.TEST_APP_ID);
- protocol = new SdlProtocol(defaultListener,config);
+ protocol = new SdlProtocol(defaultListener, config);
}
@Test
- public void testBase(){
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ public void testBase() {
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
}
@Test
- public void testVersion(){
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ public void testVersion() {
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
- sdlProtocol.setVersion((byte)0x01);
- assertEquals((byte)0x01,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol.setVersion((byte) 0x01);
+ assertEquals((byte) 0x01, sdlProtocol.getProtocolVersion().getMajor());
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x02);
- assertEquals((byte)0x02,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x02);
+ assertEquals((byte) 0x02, sdlProtocol.getProtocolVersion().getMajor());
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x03);
- assertEquals((byte)0x03,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x03);
+ assertEquals((byte) 0x03, sdlProtocol.getProtocolVersion().getMajor());
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x04);
- assertEquals((byte)0x04,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x04);
+ assertEquals((byte) 0x04, sdlProtocol.getProtocolVersion().getMajor());
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x05);
- assertEquals((byte)0x05,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x05);
+ assertEquals((byte) 0x05, sdlProtocol.getProtocolVersion().getMajor());
//If we get newer than 5, it should fall back to 5
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x06);
- assertEquals((byte)0x05,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x06);
+ assertEquals((byte) 0x05, sdlProtocol.getProtocolVersion().getMajor());
//Is this right?
- sdlProtocol = new SdlProtocol(defaultListener,config);
- sdlProtocol.setVersion((byte)0x00);
- assertEquals((byte)0x01,sdlProtocol.getProtocolVersion().getMajor());
+ sdlProtocol = new SdlProtocol(defaultListener, config);
+ sdlProtocol.setVersion((byte) 0x00);
+ assertEquals((byte) 0x01, sdlProtocol.getProtocolVersion().getMajor());
}
@Test
- public void testMtu(){
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ public void testMtu() {
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
- sdlProtocol.setVersion((byte)0x01);
+ sdlProtocol.setVersion((byte) 0x01);
- try{
- assertEquals(sdlProtocol.getMtu(), 1500-8);
+ try {
+ assertEquals(sdlProtocol.getMtu(), 1500 - 8);
//Version 2
- sdlProtocol.setVersion((byte)0x02);
- assertEquals(sdlProtocol.getMtu(), 1500-12);
+ sdlProtocol.setVersion((byte) 0x02);
+ assertEquals(sdlProtocol.getMtu(), 1500 - 12);
//Version 3
- sdlProtocol.setVersion((byte)0x03);
+ sdlProtocol.setVersion((byte) 0x03);
assertEquals(sdlProtocol.getMtu(), 131072);
//Version 4
- sdlProtocol.setVersion((byte)0x04);
+ sdlProtocol.setVersion((byte) 0x04);
assertEquals(sdlProtocol.getMtu(), 131072);
//Version 5
- sdlProtocol.setVersion((byte)0x05);
+ sdlProtocol.setVersion((byte) 0x05);
assertEquals(sdlProtocol.getMtu(), 131072);
//Version 5+
- sdlProtocol.setVersion((byte)0x06);
+ sdlProtocol.setVersion((byte) 0x06);
assertEquals(sdlProtocol.getMtu(), 131072);
- }catch(Exception e){
+ } catch (Exception e) {
Assert.fail("Exceptin during reflection");
}
}
@Test
- public void testHandleFrame(){
+ public void testHandleFrame() {
SampleRpc sampleRpc = new SampleRpc(4);
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
SdlProtocolBase.MessageFrameAssembler assembler = sdlProtocol.new MessageFrameAssembler();
- try{
+ try {
assembler.handleFrame(sampleRpc.toSdlPacket());
- }catch(Exception e){
+ } catch (Exception e) {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
+
@Test
- public void testHandleFrameCorrupt(){
+ public void testHandleFrameCorrupt() {
SampleRpc sampleRpc = new SampleRpc(4);
BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
header.setJsonSize(Integer.MAX_VALUE);
sampleRpc.setBinaryFrameHeader(header);
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
SdlProtocolBase.MessageFrameAssembler assembler = sdlProtocol.new MessageFrameAssembler();
- try{
+ try {
assembler.handleFrame(sampleRpc.toSdlPacket());
- }catch(Exception e){
+ } catch (Exception e) {
Assert.fail("Exceptin during handleFrame - " + e.toString());
}
}
@Test
- public void testHandleSingleFrameMessageFrame(){
+ public void testHandleSingleFrameMessageFrame() {
SampleRpc sampleRpc = new SampleRpc(4);
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
SdlProtocolBase.MessageFrameAssembler assembler = sdlProtocol.new MessageFrameAssembler();
- try{
- Method method = assembler.getClass().getDeclaredMethod ("handleSingleFrameMessageFrame", SdlPacket.class);
+ try {
+ Method method = assembler.getClass().getDeclaredMethod("handleSingleFrameMessageFrame", SdlPacket.class);
method.setAccessible(true);
- method.invoke (assembler, sampleRpc.toSdlPacket());
- }catch(Exception e){
+ method.invoke(assembler, sampleRpc.toSdlPacket());
+ } catch (Exception e) {
Assert.fail("Exceptin during handleSingleFrameMessageFrame - " + e.toString());
}
}
@Test
- public void testHandleSingleFrameMessageFrameCorruptBfh(){
+ public void testHandleSingleFrameMessageFrameCorruptBfh() {
SampleRpc sampleRpc = new SampleRpc(4);
//Create a corrupted header
@@ -257,34 +261,32 @@ public class SdlProtocolTests {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.payload);
assertNull(binFrameHeader);
- SdlProtocol sdlProtocol = new SdlProtocol(defaultListener,config);
+ SdlProtocol sdlProtocol = new SdlProtocol(defaultListener, config);
sdlProtocol.handlePacketReceived(packet);
assertFalse(onProtocolMessageReceivedListener.didReceive());
onProtocolMessageReceivedListener.reset();
- SdlProtocol.MessageFrameAssembler assembler =sdlProtocol.getFrameAssemblerForFrame(packet);// sdlProtocol.new MessageFrameAssembler();
+ SdlProtocol.MessageFrameAssembler assembler = sdlProtocol.getFrameAssemblerForFrame(packet);// sdlProtocol.new MessageFrameAssembler();
assertNotNull(assembler);
assembler.handleFrame(packet);
assertFalse(onProtocolMessageReceivedListener.didReceive());
- try{
- Method method = assembler.getClass().getDeclaredMethod("handleSingleFrameMessageFrame", SdlPacket.class);
+ try {
+ Method method = assembler.getClass().getDeclaredMethod("handleSingleFrameMessageFrame", SdlPacket.class);
method.setAccessible(true);
- method.invoke (assembler, sampleRpc.toSdlPacket());
- }catch(Exception e){
+ method.invoke(assembler, sampleRpc.toSdlPacket());
+ } catch (Exception e) {
Assert.fail("Exceptin during handleSingleFrameMessageFrame - " + e.toString());
}
}
-
-
@Test
- public void testNormalCase(){
+ public void testNormalCase() {
setUp();
- payload = new byte[]{0x00,0x02,0x05,0x01,0x01,0x01,0x05,0x00};
+ payload = new byte[]{0x00, 0x02, 0x05, 0x01, 0x01, 0x01, 0x05, 0x00};
byte sessionID = 1, version = 1;
int messageID = 1;
boolean encrypted = false;
@@ -295,13 +297,13 @@ public class SdlProtocolTests {
OutOfMemoryError oom_error = null;
NullPointerException np_exception = null;
- try{
+ try {
assembler.handleMultiFrameMessageFrame(sdlPacket);
- }catch(OutOfMemoryError e){
+ } catch (OutOfMemoryError e) {
oom_error = e;
- }catch(NullPointerException z){
+ } catch (NullPointerException z) {
np_exception = z;
- }catch(Exception e){
+ } catch (Exception e) {
e.printStackTrace();
assertNotNull(null);
}
@@ -312,13 +314,13 @@ public class SdlProtocolTests {
payload = new byte[23534];
sdlPacket = SdlPacketFactory.createMultiSendDataRest(SessionType.RPC, sessionID, payload.length, (byte) 3, messageID, version, payload, 0, 1500, encrypted);
assembler = protocol.getFrameAssemblerForFrame(sdlPacket);
- try{
+ try {
assembler.handleMultiFrameMessageFrame(sdlPacket);
- }catch(OutOfMemoryError e){
+ } catch (OutOfMemoryError e) {
oom_error = e;
- }catch(NullPointerException z){
+ } catch (NullPointerException z) {
np_exception = z;
- }catch(Exception e){
+ } catch (Exception e) {
assertNotNull(null);
}
@@ -327,10 +329,10 @@ public class SdlProtocolTests {
}
@Test
- public void testOverallocatingAccumulator(){
+ public void testOverallocatingAccumulator() {
setUp();
ByteArrayOutputStream builder = new ByteArrayOutputStream();
- for(int i = 0; i < 8; i++){
+ for (int i = 0; i < 8; i++) {
builder.write(0x0F);
}
payload = builder.toByteArray();
@@ -342,13 +344,13 @@ public class SdlProtocolTests {
OutOfMemoryError oom_error = null;
NullPointerException np_exception = null;
- try{
+ try {
assembler.handleMultiFrameMessageFrame(sdlPacket);
- }catch(OutOfMemoryError e){
+ } catch (OutOfMemoryError e) {
oom_error = e;
- }catch(NullPointerException z){
+ } catch (NullPointerException z) {
np_exception = z;
- }catch(Exception e){
+ } catch (Exception e) {
assertNotNull(null);
}
@@ -359,13 +361,13 @@ public class SdlProtocolTests {
sdlPacket = SdlPacketFactory.createMultiSendDataRest(SessionType.RPC, sessionID, payload.length, (byte) 3, messageID, version, payload, 0, 1500, encrypted);
assembler = protocol.getFrameAssemblerForFrame(sdlPacket);
- try{
+ try {
assembler.handleMultiFrameMessageFrame(sdlPacket);
- }catch(OutOfMemoryError e){
+ } catch (OutOfMemoryError e) {
oom_error = e;
- }catch(NullPointerException z){
+ } catch (NullPointerException z) {
np_exception = z;
- }catch(Exception e){
+ } catch (Exception e) {
assertNotNull(null);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
index a8aec30ac..48497b0a6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
@@ -23,73 +23,71 @@ import static junit.framework.TestCase.assertTrue;
@RunWith(AndroidJUnit4.class)
public abstract class BaseRpcTests {
- public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
+ public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
private static final int CORR_ID = 402;
protected RPCMessage msg;
/**
- * Sets up the specific RPC message under testing.
- */
+ * Sets up the specific RPC message under testing.
+ */
protected abstract RPCMessage createMessage();
/**
- * Retrieves the RPC message type under testing.
- */
+ * Retrieves the RPC message type under testing.
+ */
protected abstract String getMessageType();
/**
- * Retrieves the RPC command type under testing.
- */
+ * Retrieves the RPC command type under testing.
+ */
protected abstract String getCommandType();
/**
- * Retrieves the JSON translated RPC message under testing.
- */
+ * Retrieves the JSON translated RPC message under testing.
+ */
protected abstract JSONObject getExpectedParameters(int sdlVersion);
@Before
- public void setUp(){
+ public void setUp() {
this.msg = createMessage();
if (msg instanceof RPCRequest) {
- ((RPCRequest) msg).setCorrelationID(CORR_ID);
+ ((RPCRequest) msg).setCorrelationID(CORR_ID);
+ } else if (msg instanceof RPCResponse) {
+ ((RPCResponse) msg).setCorrelationID(CORR_ID);
}
- else if (msg instanceof RPCResponse) {
- ((RPCResponse) msg).setCorrelationID(CORR_ID);
- }
-
+
}
@Test
- public void testCreation(){
+ public void testCreation() {
assertNotNull("Object creation failed.", msg);
}
@Test
- public void testCorrelationId(){
- int correlationId;
- if (msg instanceof RPCRequest) {
- correlationId = ((RPCRequest) msg).getCorrelationID();
+ public void testCorrelationId() {
+ int correlationId;
+ if (msg instanceof RPCRequest) {
+ correlationId = ((RPCRequest) msg).getCorrelationID();
assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, correlationId);
- }
- else if (msg instanceof RPCResponse) {
+ } else if (msg instanceof RPCResponse) {
correlationId = ((RPCResponse) msg).getCorrelationID();
assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, correlationId);
- }
-
+ }
+
}
@Test
- public void testMessageType(){
+ public void testMessageType() {
String messageType = msg.getMessageType();
-
+
assertNotNull("Message type was null.", messageType);
assertEquals("Message type was not REQUEST.", getMessageType(), messageType);
}
@Test
- public void testCommandType(){
+ public void testCommandType() {
String command = msg.getFunctionName();
assertNotNull("Command was null.", command);
@@ -98,7 +96,7 @@ public abstract class BaseRpcTests {
@Test
- public void testFunctionName(){
+ public void testFunctionName() {
String funcName = msg.getFunctionName();
assertNotNull("Function name was null.", funcName);
@@ -106,30 +104,30 @@ public abstract class BaseRpcTests {
}
@Test
- public void testJson(){
- try{
+ public void testJson() {
+ try {
JSONObject reference = buildJsonStore();
- JSONObject underTest = msg.serializeJSON();
-
+ JSONObject underTest = msg.serializeJSON();
+
assertEquals("Size of JSON under test didn't match expected size.", reference.length(), underTest.length());
// loop through all values and verifies they match the RPCMessage parameters
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
Object referenceValue = JsonUtils.readObjectFromJsonObject(reference, key);
testJsonParameters((JSONObject) referenceValue, (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
+ } catch (JSONException e) {
// do nothing
}
}
-
- private JSONObject buildJsonStore() throws JSONException{
+
+ private JSONObject buildJsonStore() throws JSONException {
JSONObject result = new JSONObject(), command = new JSONObject();
if (!getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) {
- command.put(RPCMessage.KEY_CORRELATION_ID, CORR_ID);
+ command.put(RPCMessage.KEY_CORRELATION_ID, CORR_ID);
}
command.put(RPCMessage.KEY_FUNCTION_NAME, msg.getFunctionName());
command.put(RPCMessage.KEY_PARAMETERS, getExpectedParameters(SDL_VERSION_UNDER_TEST));
@@ -138,73 +136,68 @@ public abstract class BaseRpcTests {
return result;
}
-
- private void testJsonParameters(JSONObject reference, JSONObject underTest) throws JSONException{
+
+ private void testJsonParameters(JSONObject reference, JSONObject underTest) throws JSONException {
assertEquals("Size of JSON under test didn't match expected size.", reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
Object referenceValue = JsonUtils.readObjectFromJsonObject(reference, key);
- if(referenceValue instanceof JSONObject){
+ if (referenceValue instanceof JSONObject) {
testJsonParameters((JSONObject) referenceValue, (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- else if(referenceValue instanceof JSONArray){
+ } else if (referenceValue instanceof JSONArray) {
JSONArray array1 = (JSONArray) referenceValue, array2 = (JSONArray) JsonUtils.readObjectFromJsonObject(underTest, key);
testJsonArray(array1, array2, key);
- }
- else{
+ } else {
assertTrue("JSON object didn't match reference object for key \"" + key + "\".", referenceValue.equals(JsonUtils.readObjectFromJsonObject(underTest, key)));
}
}
}
-
- private void testJsonArray(JSONArray reference, JSONArray underTest, String key) throws JSONException{
+
+ private void testJsonArray(JSONArray reference, JSONArray underTest, String key) throws JSONException {
assertEquals("Size of JSON array didn't match expected size.", reference.length(), underTest.length());
int len = reference.length();
- for(int i=0; i<len; i++){
+ for (int i = 0; i < len; i++) {
Object array1Obj = reference.get(i), array2Obj = underTest.get(i);
- if(array1Obj instanceof JSONObject){
+ if (array1Obj instanceof JSONObject) {
testJsonParameters((JSONObject) array1Obj, (JSONObject) array2Obj);
- }
- else if(array1Obj instanceof JSONArray){
+ } else if (array1Obj instanceof JSONArray) {
testJsonArray((JSONArray) array1Obj, (JSONArray) array2Obj, key);
- }
- else{
+ } else {
assertTrue("JSONArray object didn't match reference object for key \"" + key + "\".", array1Obj.equals(array2Obj));
}
}
}
// this method must be manually called from the subclass
- protected void testNullBase(RPCMessage msg){
+ protected void testNullBase(RPCMessage msg) {
assertNotNull("RPCMessage was null.", msg);
-
- Integer correlationId;
- if (msg instanceof RPCRequest) {
- correlationId = ((RPCRequest) msg).getCorrelationID();
+
+ Integer correlationId;
+ if (msg instanceof RPCRequest) {
+ correlationId = ((RPCRequest) msg).getCorrelationID();
assertNotNull("Correlation ID of the RPC message was null.", correlationId);
//assertEquals("Correlation ID didn't match expected correlation ID.", CORR_ID, (int) correlationId);
- }
- else if (msg instanceof RPCResponse) {
+ } else if (msg instanceof RPCResponse) {
correlationId = ((RPCResponse) msg).getCorrelationID();
assertNull("Correlation ID of the RPC message was not null.", correlationId);
//assertEquals("Correlation ID didn't match expected correlation ID.", CORR_ID, (int) correlationId);
- }
+ }
assertNotNull("Message type of the RPC message was null.", msg.getMessageType());
-
+
assertEquals("Message type didn't match expected message type.", getMessageType(), msg.getMessageType());
assertNotNull("Command type of the RPC message was null.", msg.getMessageType());
assertEquals("Command type didn't match expected command type.", getCommandType(), msg.getFunctionName());
- try{
+ try {
assertTrue("Parameters weren't initialized, but the JSON contained 2 or more objects.", (msg.serializeJSON().length() == 1));
- } catch(JSONException e) {
+ } catch (JSONException e) {
//do nothing
}
- }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Config.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Config.java
index 7f424bda9..7655dfe31 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Config.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Config.java
@@ -1,10 +1,11 @@
package com.smartdevicelink.test;
-public class Config{
+public class Config {
+
+ private Config() {
+ }
- private Config(){}
-
public static final int SDL_VERSION_UNDER_TEST = 3;
public static final boolean DEBUG = true;
}
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 5cb0cf719..716022b75 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
@@ -13,257 +13,266 @@ import java.util.List;
public final class JsonUtils {
-
- private JsonUtils(){}
-
- public static JSONObject createJsonObject(byte[] data){
- JSONObject result = null;
- try {
- String jsonStr = new String(data);
- result = new JSONObject(jsonStr);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public static JSONArray createJsonArrayOfJsonObjects(List<? extends RPCStruct> parameterList, int sdlVersion) throws JSONException{
- JSONArray result = new JSONArray();
-
- for(RPCStruct parameter : parameterList){
- //result.put(parameter.getJsonParameters(sdlVersion));
- result.put(parameter.serializeJSON());
- }
-
- return result;
- }
-
- public static JSONArray createJsonArrayOfJsonNames(List<? extends Enum<?>> parameterList, int sdlVersion) throws JSONException{
- JSONArray result = new JSONArray();
-
- for(Enum<?> name : parameterList){
- result.put(name);
- }
-
- return result;
- }
-
- public static <T> JSONArray createJsonArray(List<T> list) throws JSONException{
- JSONArray result = new JSONArray();
-
- for(T str : list){
- result.put(str);
- }
-
- return result;
- }
-
- // this method is basically to get around the annoying JSONException that is thrown when a key doesn't exist
- // in the JSON object. this method returns null instead of throwing an exception.
- public static Object readObjectFromJsonObject(JSONObject json, String key){
- try {
- return json.get(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static Boolean readBooleanFromJsonObject(JSONObject json, String key){
- try {
- return json.getBoolean(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static Double readDoubleFromJsonObject(JSONObject json, String key){
- try {
- return json.getDouble(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static Integer readIntegerFromJsonObject(JSONObject json, String key){
- try {
- return json.getInt(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static JSONArray readJsonArrayFromJsonObject(JSONObject json, String key){
- try {
- return json.getJSONArray(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static List<String> readStringListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<String> result = new ArrayList<String>(len);
- for(int i=0; i<len; i++){
- try {
- String str = jsonArray.getString(i);
- result.add(str);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static List<AppServiceType> readAppServiceTypeListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<AppServiceType> result = new ArrayList<>(len);
- for(int i=0; i<len; i++){
- try {
- AppServiceType serviceType = (AppServiceType) jsonArray.get(i);
- result.add(serviceType);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static List<AppServiceCapability> readAppServiceCapabilityListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
- if(jsonArray != null){
- int len = jsonArray.length();
- List<AppServiceCapability> result = new ArrayList<>(len);
- for(int i=0; i<len; i++){
- try {
- AppServiceCapability serviceCapability = (AppServiceCapability) jsonArray.getJSONArray(0).get(i);
- result.add(serviceCapability);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static List<Integer> readIntegerListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<Integer> result = new ArrayList<Integer>(len);
- for(int i=0; i<len; i++){
- try {
- Integer str = jsonArray.getInt(i);
- result.add(str);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- 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);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<Double> result = new ArrayList<Double>(len);
- for(int i=0; i<len; i++){
- try {
- Double str = jsonArray.getDouble(i);
- result.add(str);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static List<Long> readLongListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<Long> result = new ArrayList<Long>(len);
- for(int i=0; i<len; i++){
- try {
- Long str = jsonArray.getLong(i);
- result.add(str);
- } catch (JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static List<JSONObject> readJsonObjectListFromJsonObject(JSONObject json, String key){
- JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
-
- if(jsonArray != null){
- int len = jsonArray.length();
- List<JSONObject> result = new ArrayList<JSONObject>(len);
- for(int i=0; i<len; i++){
- try{
- JSONObject jsonObject = jsonArray.getJSONObject(i);
- result.add(jsonObject);
- } catch(JSONException e) {}
- }
- return result;
- }
-
- return null;
- }
-
- public static JSONObject readJsonObjectFromJsonObject(JSONObject json, String key){
- try {
- return json.getJSONObject(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static Long readLongFromJsonObject(JSONObject json, String key){
- try {
- return json.getLong(key);
- } catch (JSONException e) {
- return null;
- }
- }
-
- public static String readStringFromJsonObject(JSONObject json, String key){
- try {
- return json.getString(key);
- } catch (JSONException e) {
- return null;
- }
- }
+
+ private JsonUtils() {
+ }
+
+ public static JSONObject createJsonObject(byte[] data) {
+ JSONObject result = null;
+ try {
+ String jsonStr = new String(data);
+ result = new JSONObject(jsonStr);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public static JSONArray createJsonArrayOfJsonObjects(List<? extends RPCStruct> parameterList, int sdlVersion) throws JSONException {
+ JSONArray result = new JSONArray();
+
+ for (RPCStruct parameter : parameterList) {
+ //result.put(parameter.getJsonParameters(sdlVersion));
+ result.put(parameter.serializeJSON());
+ }
+
+ return result;
+ }
+
+ public static JSONArray createJsonArrayOfJsonNames(List<? extends Enum<?>> parameterList, int sdlVersion) throws JSONException {
+ JSONArray result = new JSONArray();
+
+ for (Enum<?> name : parameterList) {
+ result.put(name);
+ }
+
+ return result;
+ }
+
+ public static <T> JSONArray createJsonArray(List<T> list) throws JSONException {
+ JSONArray result = new JSONArray();
+
+ for (T str : list) {
+ result.put(str);
+ }
+
+ return result;
+ }
+
+ // this method is basically to get around the annoying JSONException that is thrown when a key doesn't exist
+ // in the JSON object. this method returns null instead of throwing an exception.
+ public static Object readObjectFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.get(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static Boolean readBooleanFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getBoolean(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static Double readDoubleFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getDouble(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static Integer readIntegerFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getInt(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static JSONArray readJsonArrayFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getJSONArray(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static List<String> readStringListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<String> result = new ArrayList<String>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ String str = jsonArray.getString(i);
+ result.add(str);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<AppServiceType> readAppServiceTypeListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<AppServiceType> result = new ArrayList<>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ AppServiceType serviceType = (AppServiceType) jsonArray.get(i);
+ result.add(serviceType);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<AppServiceCapability> readAppServiceCapabilityListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<AppServiceCapability> result = new ArrayList<>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ AppServiceCapability serviceCapability = (AppServiceCapability) jsonArray.getJSONArray(0).get(i);
+ result.add(serviceCapability);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<Integer> readIntegerListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<Integer> result = new ArrayList<Integer>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ Integer str = jsonArray.getInt(i);
+ result.add(str);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ 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);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<Double> result = new ArrayList<Double>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ Double str = jsonArray.getDouble(i);
+ result.add(str);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<Long> readLongListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<Long> result = new ArrayList<Long>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ Long str = jsonArray.getLong(i);
+ result.add(str);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static List<JSONObject> readJsonObjectListFromJsonObject(JSONObject json, String key) {
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if (jsonArray != null) {
+ int len = jsonArray.length();
+ List<JSONObject> result = new ArrayList<JSONObject>(len);
+ for (int i = 0; i < len; i++) {
+ try {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ result.add(jsonObject);
+ } catch (JSONException e) {
+ }
+ }
+ return result;
+ }
+
+ return null;
+ }
+
+ public static JSONObject readJsonObjectFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getJSONObject(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static Long readLongFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getLong(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
+
+ public static String readStringFromJsonObject(JSONObject json, String key) {
+ try {
+ return json.getString(key);
+ } catch (JSONException e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Logger.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Logger.java
index ab922fd7a..f5caeb6f5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Logger.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Logger.java
@@ -1,16 +1,16 @@
package com.smartdevicelink.test;
+public class Logger {
-public class Logger{
+ private Logger() {
+ }
- private Logger(){}
-
- public static void log(String tag, String msg){
- if(Config.DEBUG){
+ public static void log(String tag, String msg) {
+ if (Config.DEBUG) {
System.out.print(tag + ": ");
System.out.println(msg);
}
}
-
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/NullValues.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/NullValues.java
index ce5972887..b01019460 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/NullValues.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/NullValues.java
@@ -2,14 +2,14 @@ package com.smartdevicelink.test;
/**
* This class is to help with ambiguous method signatures.
- * @author Joey Grover
*
+ * @author Joey Grover
*/
public class NullValues {
- public static final String STRING = null;
- public static final Integer INTEGER = null;
- public static final Boolean BOOLEAN = null;
- public static final Double DOUBLE = null;
-
+ public static final String STRING = null;
+ public static final Integer INTEGER = null;
+ public static final Boolean BOOLEAN = null;
+ public static final Double DOUBLE = null;
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SampleRpc.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SampleRpc.java
index 67c15706c..4965b89c5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SampleRpc.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SampleRpc.java
@@ -12,79 +12,82 @@ import com.smartdevicelink.proxy.rpc.GetVehicleData;
public class SampleRpc {
-
+
private final int SAMPLE_RPC_CORRELATION_ID = 630;
int version = 1;
- int sessionId =1;
+ int sessionId = 1;
ProtocolMessage pm = null;
BinaryFrameHeader binFrameHeader = null;
-
+
/**
* Currently builds a GetVehicleData Request
*/
- public SampleRpc(int version){
- this.version = version;
- createBase();
-
- }
- public void createBase(){
- GetVehicleData request = new GetVehicleData();
- request.setAirbagStatus(true);
- request.setBeltStatus(true);
- request.setBeltStatus(true);
- request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
-
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte)version);
- pm = new ProtocolMessage();
- pm.setData(msgBytes);
- pm.setSessionID((byte)sessionId);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
- pm.setCorrID(request.getCorrelationID());
-
- if (request.getBulkData() != null) {
- pm.setBulkData(request.getBulkData());
- }
-
- }
- public ProtocolMessage getProtocolMessage(){
- return pm;
- }
- public BinaryFrameHeader getBinaryFrameHeader(boolean refresh){
- if(version>1 && (refresh || binFrameHeader == null)){
- binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
- }
- return binFrameHeader;
- }
-
- /**
- * To manually set the bfh. Useful for trying to corrupt data
- */
- public void setBinaryFrameHeader(BinaryFrameHeader binFrameHeader){
- this.binFrameHeader = binFrameHeader;
- }
-
-
- public SdlPacket toSdlPacket(){
- byte[] data = null;
- if(version > 1) { //If greater than v1 we need to include a binary frame header in the data before all the JSON starts
- data = new byte[12 + pm.getJsonSize()];
- if(binFrameHeader == null){
- getBinaryFrameHeader(false);
- }
- System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
- System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
- }else{
- data = pm.getData();
- }
-
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_SINGLE,SdlPacket.SERVICE_TYPE_RPC,0,sessionId,data.length,123,data);
-
- }
-
- public byte[] toByteArray(){
- return toSdlPacket().constructPacket();
- }
+ public SampleRpc(int version) {
+ this.version = version;
+ createBase();
+
+ }
+
+ public void createBase() {
+ GetVehicleData request = new GetVehicleData();
+ request.setAirbagStatus(true);
+ request.setBeltStatus(true);
+ request.setBeltStatus(true);
+ request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
+
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte) version);
+ pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ pm.setSessionID((byte) sessionId);
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
+ pm.setCorrID(request.getCorrelationID());
+
+ if (request.getBulkData() != null) {
+ pm.setBulkData(request.getBulkData());
+ }
+
+ }
+
+ public ProtocolMessage getProtocolMessage() {
+ return pm;
+ }
+
+ public BinaryFrameHeader getBinaryFrameHeader(boolean refresh) {
+ if (version > 1 && (refresh || binFrameHeader == null)) {
+ binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
+ }
+ return binFrameHeader;
+ }
+
+ /**
+ * To manually set the bfh. Useful for trying to corrupt data
+ */
+ public void setBinaryFrameHeader(BinaryFrameHeader binFrameHeader) {
+ this.binFrameHeader = binFrameHeader;
+ }
+
+
+ public SdlPacket toSdlPacket() {
+ byte[] data = null;
+ if (version > 1) { //If greater than v1 we need to include a binary frame header in the data before all the JSON starts
+ data = new byte[12 + pm.getJsonSize()];
+ if (binFrameHeader == null) {
+ getBinaryFrameHeader(false);
+ }
+ System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
+ System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
+ } else {
+ data = pm.getData();
+ }
+
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, 123, data);
+
+ }
+
+ public byte[] toByteArray() {
+ return toSdlPacket().constructPacket();
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java
index ac575dfbc..0255dd839 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.test.SdlConnection;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.test.streaming.MockInterfaceBroker;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -11,38 +11,38 @@ import junit.framework.TestCase;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.session.SdlSession}
*/
public class SdlSessionTests extends TestCase {
- public void testServiceListeners(){
- SdlSession session = new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(),"19216801"));
- ISdlServiceListener test = new ISdlServiceListener() {
- @Override
- public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+ public void testServiceListeners() {
+ SdlSession session = new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "19216801"));
+ ISdlServiceListener test = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
- }
+ }
- @Override
- public void onServiceEnded(SdlSession session, SessionType type) {
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
- }
+ }
- @Override
- public void onServiceError(SdlSession session, SessionType type, String reason) {
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
- }
- };
+ }
+ };
- session.addServiceListener(SessionType.RPC, test);
- assertNotNull(session.getServiceListeners());
+ session.addServiceListener(SessionType.RPC, test);
+ assertNotNull(session.getServiceListeners());
- assertTrue(session.removeServiceListener(SessionType.RPC, test));
+ assertTrue(session.removeServiceListener(SessionType.RPC, test));
- assertFalse(session.removeServiceListener(SessionType.RPC, test));
+ assertFalse(session.removeServiceListener(SessionType.RPC, test));
- }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlUnitTestContants.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlUnitTestContants.java
index 3b38b94f3..d1b7ea30e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlUnitTestContants.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlUnitTestContants.java
@@ -1,6 +1,6 @@
package com.smartdevicelink.test;
public class SdlUnitTestContants {
- public static final String TEST_APP_ID = "123456";
+ public static final String TEST_APP_ID = "123456";
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
index 16c1c9613..48259b157 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
@@ -224,587 +224,589 @@ import java.util.Vector;
public class TestValues {
- //Versions
- public static final Version MAX_RPC_VERSION_SUPPORTED = LifecycleManager.MAX_SUPPORTED_RPC_VERSION;
- /**
- * @see SdlProtocol
- */
- public static final Version MAX_PROTOCOL_VERSION_SUPPORTED = new Version(5, 2, 0);
-
-
- // Test Failure Messages
- public static final String NULL = "Value should be null.";
- public static final String MATCH = "Values should match.";
- public static final String ARRAY = "Array values should match.";
- public static final String TRUE = "Value should be true.";
- public static final String FALSE = "Value should be false.";
- public static final String NOT_NULL = "Value should not be null.";
- public static final String JSON_FAIL = "Json testing failed.";
-
- // RPC Request/Response/Notification/Datatype Test Values
- public static final int GENERAL_INT = 100;
- public static final Integer GENERAL_INTEGER = 100;
- public static final Long GENERAL_LONG = 100L;
- public static final Turn GENERAL_TURN = new Turn();
- public static final Float GENERAL_FLOAT = 100f;
- public static final Image GENERAL_IMAGE = new Image();
- public static final Choice GENERAL_CHOICE = new Choice();
- public static final String GENERAL_STRING = "test";
- public static final Double GENERAL_DOUBLE = 10.01;
- public static final boolean GENERAL_BOOLEAN = true;
- public static final byte[] GENERAL_BYTE_ARRAY = new byte[0];
- public static final TPMS GENERAL_TPMS = TPMS.UNKNOWN;
- public static final TBTState GENERAL_TBTSTATE = TBTState.NEXT_TURN_REQUEST;
- public static final FileType GENERAL_FILETYPE = FileType.BINARY;
- public static final Language GENERAL_LANGUAGE = Language.EN_US;
- public static final HMILevel GENERAL_HMILEVEL = HMILevel.HMI_FULL;
- public static final DIDResult GENERAL_DIDRESULT = new DIDResult();
- public static final TextField GENERAL_TEXTFIELD = new TextField();
- public static final OasisAddress GENERAL_OASISADDRESS = new OasisAddress();
- public static final Coordinate GENERAL_COORDINATE = new Coordinate();
- public static final LocationDetails GENERAL_LOCATIONDETAILS = new LocationDetails();
- public static final Dimension GENERAL_DIMENSION = Dimension._2D;
- public static final ImageType GENERAL_IMAGETYPE = ImageType.DYNAMIC;
- public static final AudioType GENERAL_AUDIOTYPE = AudioType.PCM;
- public static final StartTime GENERAL_STARTTIME = new StartTime();
- public static final TouchType GENERAL_TOUCHTYPE = TouchType.BEGIN;
- public static final TouchEvent GENERAL_TOUCHEVENT = new TouchEvent();
- public static final VrHelpItem GENERAL_VRHELPITEM = new VrHelpItem();
- public static final ImageField GENERAL_IMAGEFIELD = new ImageField();
- public static final DeviceInfo GENERAL_DEVICEINFO = new DeviceInfo();
- public static final AppInfo GENERAL_APPINFO = new AppInfo();
- public static final Uri GENERAL_URI = Uri.parse("http://www.google.com");;
- public static final LayoutMode GENERAL_LAYOUTMODE = LayoutMode.LIST_ONLY;
- public static final MenuParams GENERAL_MENUPARAMS = new MenuParams();
- public static final SoftButton GENERAL_SOFTBUTTON = new SoftButton();
- public static final ButtonName GENERAL_BUTTONNAME = ButtonName.OK;
- public static final UpdateMode GENERAL_UPDATEMODE = UpdateMode.RESUME;
- public static final TouchCoord GENERAL_TOUCHCOORD = new TouchCoord();
- public static final MassageModeData GENERAL_MASSAGEMODEDATA = new MassageModeData();
- public static final MassageCushionFirmness GENERAL_MASSAGECUSHIONFIRMNESS = new MassageCushionFirmness();
- public static final DisplayType GENERAL_DISPLAYTYPE = DisplayType.CID;
- public static final VehicleType GENERAL_VEHICLETYPE = new VehicleType();
- public static final RequestType GENERAL_REQUESTTYPE = RequestType.AUTH_REQUEST;
- public static final SystemAction GENERAL_SYSTEMACTION = SystemAction.DEFAULT_ACTION;
- public static final CharacterSet GENERAL_CHARACTERSET = CharacterSet.CID1SET;
- public static final SamplingRate GENERAL_SAMPLINGRATE = SamplingRate._8KHZ;
- public static final ScreenParams GENERAL_SCREENPARAMS = new ScreenParams();
- public static final KeypressMode GENERAL_KEYPRESSMODE = KeypressMode.QUEUE_KEYPRESSES;
- public static final SystemContext GENERAL_SYSTEMCONTEXT = SystemContext.SYSCTXT_MAIN;
- public static final KeyboardEvent GENERAL_KEYBOARDEVENT = KeyboardEvent.ENTRY_SUBMITTED;
- public static final CarModeStatus GENERAL_CARMODESTATUS = CarModeStatus.NORMAL;
- public static final TextFieldName GENERAL_TEXTFIELDNAME = TextFieldName.ETA;
- public static final TriggerSource GENERAL_TRIGGERSOURCE = TriggerSource.TS_VR;
- public static final BitsPerSample GENERAL_BITSPERSAMPLE = BitsPerSample._8_BIT;
- public static final TextAlignment GENERAL_TEXTALIGNMENT = TextAlignment.CENTERED;
- public static final SdlMsgVersion GENERAL_SDLMSGVERSION = new SdlMsgVersion();
- public static final PermissionItem GENERAL_PERMISSIONITEM = new PermissionItem();
- public static final SoftButtonType GENERAL_SOFTBUTTONTYPE = SoftButtonType.SBT_BOTH;
- public static final MassageZone GENERAL_MASSAGEZONE = MassageZone.LUMBAR;
- public static final MassageMode GENERAL_MASSAGEMODE = MassageMode.HIGH;
- public static final WindowStatus GENERAL_WINDOW_STATUS = new WindowStatus();
- public static final MassageCushion GENERAL_MASSAGECUSHION = MassageCushion.BACK_BOLSTERS;
- public static final SeatMemoryActionType GENERAL_SEATMEMORYACTIONTYPE = SeatMemoryActionType.SAVE;
- public static final SupportedSeat GENERAL_SUPPORTEDSEAT = SupportedSeat.DRIVER;
- public static final KeyboardLayout GENERAL_KEYBOARDLAYOUT = KeyboardLayout.QWERTY;
- public static final ImageFieldName GENERAL_IMAGEFIELDNAME = ImageFieldName.graphic;
- public static final HMIPermissions GENERAL_HMIPERMISSIONS = new HMIPermissions();
- public static final IgnitionStatus GENERAL_IGNITIONSTATUS = IgnitionStatus.RUN;
- public static final ButtonEventMode GENERAL_BUTTONEVENTMODE = ButtonEventMode.BUTTONUP;
- public static final ButtonPressMode GENERAL_BUTTONPRESSMODE = ButtonPressMode.SHORT;
- public static final PowerModeStatus GENERAL_POWERMODESTATUS = PowerModeStatus.RUNNING_2;
- public static final VehicleDataType GENERAL_VEHICLEDATATYPE = VehicleDataType.VEHICLEDATA_BRAKING;
- public static final InteractionMode GENERAL_INTERACTIONMODE = InteractionMode.BOTH;
- public static final ImageResolution GENERAL_IMAGERESOLUTION = new ImageResolution();
- public static final FuelCutoffStatus GENERAL_FUELCUTOFFSTATUS = FuelCutoffStatus.NORMAL_OPERATION;
- public static final CompassDirection GENERAL_COMPASSDIRECTION = CompassDirection.EAST;
- public static final LockScreenStatus GENERAL_LOCKSCREENSTATUS = LockScreenStatus.REQUIRED;
- public static final VehicleDataStatus GENERAL_VEHICLEDATASTATUS = VehicleDataStatus.ON;
- public static final DeviceLevelStatus GENERAL_DEVICELEVELSTATUS = DeviceLevelStatus.FOUR_LEVEL_BARS;
- public static final ButtonCapabilities GENERAL_BUTTONCAPABILITIES = new ButtonCapabilities();
- public static final EmergencyEventType GENERAL_EMERGENCYEVENTTYPE = EmergencyEventType.FAULT;
- public static final AmbientLightStatus GENERAL_AMBIENTLIGHTSTATUS = AmbientLightStatus.NIGHT;
- public static final SpeechCapabilities GENERAL_SPEECHCAPABILITIES = SpeechCapabilities.TEXT;
- public static final WarningLightStatus GENERAL_WARNINGLIGHTSTATUS = WarningLightStatus.OFF;
- public static final KeyboardProperties GENERAL_KEYBOARDPROPERTIES = new KeyboardProperties();
- public static final PrimaryAudioSource GENERAL_PRIMARYAUDIOSOURCE = PrimaryAudioSource.BLUETOOTH_STEREO_BTST;
- public static final AudioStreamingState GENERAL_AUDIOSTREAMINGSTATE = AudioStreamingState.AUDIBLE;
- public static final VideoStreamingState GENERAL_VIDEOSTREAMINGSTATE = VideoStreamingState.STREAMABLE;
- public static final DisplayCapabilities GENERAL_DISPLAYCAPABILITIES = new DisplayCapabilities();
- public static final ParameterPermissions GENERAL_PARAMETERPERMISSIONS = new ParameterPermissions();
- public static final IgnitionStableStatus GENERAL_IGNITIONSTABLESTATUS = IgnitionStableStatus.IGNITION_SWITCH_STABLE;
- public static final VehicleDataResultCode GENERAL_VEHICLEDATARESULTCODE = VehicleDataResultCode.IGNORED;
- public static final ComponentVolumeStatus GENERAL_COMPONENTVOLUMESTATUS = ComponentVolumeStatus.LOW;
- public static final PresetBankCapabilities GENERAL_PRESETBANKCAPABILITIES = new PresetBankCapabilities();
- public static final CapacityUnit GENERAL_CAPACITYUNIT = CapacityUnit.KILOGRAMS;
- public static final VehicleDataEventStatus GENERAL_VEHCILEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
- public static final VehicleDataEventStatus GENERAL_VEHICLEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
- public static final TouchEventCapabilities GENERAL_TOUCHEVENTCAPABILITIES = new TouchEventCapabilities();
- public static final SeatMemoryAction GENERAL_SEATMEMORYACTION = new SeatMemoryAction();
- public static final SoftButtonCapabilities GENERAL_SOFTBUTTONCAPABILITIES = new SoftButtonCapabilities();
- public static final ECallConfirmationStatus GENERAL_ECALLCONFIRMATIONSTATUS = ECallConfirmationStatus.CALL_IN_PROGRESS;
- public static final AudioPassThruCapabilities GENERAL_AUDIOPASSTHRUCAPABILITIES = new AudioPassThruCapabilities();
- public static final PowerModeQualificationStatus GENERAL_POWERMODEQUALIFICATIONSTATUS = PowerModeQualificationStatus.POWER_MODE_OK;
- public static final VehicleDataNotificationStatus GENERAL_VEHICLEDATANOTIFICATIONSTATUS = VehicleDataNotificationStatus.NORMAL;
- public static final AppInterfaceUnregisteredReason GENERAL_APPINTERFACEUNREGISTEREDREASON = AppInterfaceUnregisteredReason.BLUETOOTH_OFF;
- public static final SystemCapabilityType GENERAL_SYSTEMCAPABILITYTYPE = SystemCapabilityType.NAVIGATION;
- public static final NavigationCapability GENERAL_NAVIGATIONCAPABILITY = new NavigationCapability();
- public static final DriverDistractionCapability GENERAL_DRIVERDISTRACTIONCAPABILITY = new DriverDistractionCapability();
- public static final PhoneCapability GENERAL_PHONECAPABILITY = new PhoneCapability();
- public static final RemoteControlCapabilities GENERAL_REMOTECONTROLCAPABILITIES = new RemoteControlCapabilities();
- public static final SystemCapability GENERAL_SYSTEMCAPABILITY = new SystemCapability();
- public static final VideoStreamingProtocol GENERAL_VIDEOSTREAMINGPROTOCOL = VideoStreamingProtocol.RAW;
- public static final VideoStreamingCodec GENERAL_VIDEOSTREAMINGCODEC = VideoStreamingCodec.H264;
- public static final VideoStreamingCapability GENERAL_VIDEOSTREAMINGCAPABILITY = new VideoStreamingCapability();
- public static final VideoStreamingFormat GENERAL_VIDEOSTREAMINGFORMAT = new VideoStreamingFormat();
- public static final RGBColor GENERAL_RGBCOLOR = new RGBColor();
- public static final TemplateColorScheme GENERAL_DAYCOLORSCHEME = new TemplateColorScheme();
- public static final TemplateColorScheme GENERAL_NIGHTCOLORSCHEME = new TemplateColorScheme();
- public static final Result GENERAL_RESULT = Result.SUCCESS;
- public static final WayPointType GENERAL_WAYPOINTTYPE = WayPointType.DESTINATION;
- public static final SingleTireStatus GENERAL_SINGLETIRESTATUS = new SingleTireStatus();
- public static final DriverDistractionState GENERAL_DRIVERDISTRACTIONSTATE = DriverDistractionState.DD_ON;
- public static final List<LocationDetails> GENERAL_LOCATIONDETAILS_LIST = Arrays.asList(new LocationDetails[] { TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_LOCATIONDETAILS});
- 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;
- public static final List<Integer> GENERAL_FUNCTION_ID_LIST = Arrays.asList(FunctionID.GET_VEHICLE_DATA.getId(), FunctionID.SEND_HAPTIC_DATA.getId());
- public static final AppServiceManifest GENERAL_APPSERVICEMANIFEST = new AppServiceManifest(AppServiceType.MEDIA.name());
- public static final MediaServiceManifest GENERAL_MEDIA_SERVICE_MANIFEST = new MediaServiceManifest();
- public static final WeatherServiceManifest GENERAL_WEATHER_SERVICE_MANIFEST = new WeatherServiceManifest();
- public static final NavigationServiceManifest GENERAL_NAVIGATION_SERVICE_MANIFEST = new NavigationServiceManifest();
- public static final AppServiceRecord GENERAL_APPSERVICERECORD = new AppServiceRecord();
- public static final AppServiceCapability GENERAL_APP_SERVICE_CAPABILITY = new AppServiceCapability();
- public static final AppServicesCapabilities GENERAL_APP_SERVICE_CAPABILITIES = new AppServicesCapabilities();
- public static final ServiceUpdateReason GENERAL_SERVICE_UPDATE_REASON = ServiceUpdateReason.MANIFEST_UPDATE;
- public static final DateTime GENERAL_DATETIME = new DateTime();
- public static final WeatherData GENERAL_WEATHERDATA = new WeatherData();
- public static final WeatherAlert GENERAL_WEATHERALERT = new WeatherAlert();
- public static final MediaType GENERAL_MEDIATYPE = MediaType.MUSIC;
- public static final MediaServiceData GENERAL_MEDIASERVICEDATA = new MediaServiceData();
- public static final WeatherServiceData GENERAL_WEATHERSERVICEDATA = new WeatherServiceData();
- public static final NavigationServiceData GENERAL_NAVIGATIONSERVICEDATA = new NavigationServiceData();
- public static final AppServiceData GENERAL_APPSERVICEDATA = new AppServiceData();
- public static final NavigationAction GENERAL_NAVIGATIONACTION = NavigationAction.STAY;
- public static final NavigationJunction GENERAL_NAVIGATION_JUNCTION = NavigationJunction.BIFURCATION;
- public static final Direction GENERAL_DIRECTION = Direction.RIGHT;
- public static final NavigationInstruction GENERAL_NAVIGATION_INSTRUCTION = new NavigationInstruction();
- public static final Version GENERAL_VERSION = new Version("4.0.0");
- public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE;
- public static final Temperature GENERAL_TEMPERATURE = new Temperature();
- public static final TemperatureUnit GENERAL_TEMPERATUREUNIT = TemperatureUnit.CELSIUS;
- public static final DefrostZone GENERAL_DEFROSTZONE = DefrostZone.ALL;
- public static final VentilationMode GENERAL_VENTILATIONMODE = VentilationMode.BOTH;
- public static final LightName GENERAL_LIGHTNAME = LightName.AMBIENT_LIGHTS;
- public static final DisplayMode GENERAL_DISPLAYMODE = DisplayMode.AUTO;
- public static final DistanceUnit GENERAL_DISTANCEUNIT = DistanceUnit.KILOMETERS;
- public static final LightStatus GENERAL_LIGHTSTATUS = LightStatus.OFF;
- public static final RadioBand GENERAL_RADIOBAND = RadioBand.AM;
- public static final ClimateControlData GENERAL_CLIMATECONTROLDATA = new ClimateControlData();
- public static final SeatControlData GENERAL_SEATCONTROLDATA = new SeatControlData();
- public static final RdsData GENERAL_RDSDATA = new RdsData();
- public static final StationIDNumber GENERAL_STATIONIDNUMBER = new StationIDNumber();
- public static final SisData GENERAL_SISDATA = new SisData();
- public static final RadioState GENERAL_RADIOSTATE = RadioState.ACQUIRED;
- public static final RadioControlData GENERAL_RADIOCONTROLDATA = new RadioControlData();
- public static final ModuleData GENERAL_MODULEDATA = new ModuleData();
- public static final ClimateControlCapabilities GENERAL_CLIMATECONTROLCAPABILITIES = new ClimateControlCapabilities();
- public static final RadioControlCapabilities GENERAL_RADIOCONTROLCAPABILITIES = new RadioControlCapabilities();
- public static final SeatControlCapabilities GENERAL_SEATCONTROLCAPABILITIES = new SeatControlCapabilities();
- public static final EqualizerSettings GENERAL_EQUALIZERSETTINGS = new EqualizerSettings();
- public static final LightCapabilities GENERAL_LIGHTCAPABILITIES = new LightCapabilities();
- public static final LightState GENERAL_LIGHTSTATE = new LightState();
- public static final AudioControlCapabilities GENERAL_AUDIOCONTROLCAPABILITIES = new AudioControlCapabilities();
- public static final HMISettingsControlCapabilities GENERAL_HMISETTINGSCONTROLCAPABILITIES = new HMISettingsControlCapabilities();
- public static final LightControlCapabilities GENERAL_LIGHTCONTROLCAPABILITIES = new LightControlCapabilities();
- 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 DynamicUpdateCapabilities GENERAL_DYNAMICUPDATECAPABILITIES = new DynamicUpdateCapabilities();
-
- 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);
-
- public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities();
-
- public static final MetadataTags GENERAL_METADATASTRUCT = new MetadataTags();
- public static final Rectangle GENERAL_RECTANGLE = new Rectangle();
- 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 StabilityControlsStatus GENERAL_STABILITY_CONTROL_STATUS = new StabilityControlsStatus();
- public static final VehicleDataStatus GENERAL_ESC_SYSTEM = VehicleDataStatus.ON;
- public static final VehicleDataStatus GENERAL_S_WAY_CONTROL = VehicleDataStatus.OFF;
- public static final WindowType GENERAL_WINDOWTYPE = WindowType.MAIN;
- public static final GearStatus GENERAL_GEAR_STATUS = new GearStatus();
- public static final PRNDL GENERAL_USER_SELECTED_GEAR = PRNDL.NEUTRAL;
- public static final PRNDL GENERAL_ACTUAL_GEAR = PRNDL.DRIVE;
- public static final TransmissionType GENERAL_TRANSMISSION_TYPE = TransmissionType.AUTOMATIC;
- public static final Grid GENERAL_LOCATION_GRID = new Grid(2, 3);
- public static final WindowState GENERAL_WINDOW_STATE = new WindowState(2, 3);
- public static final Integer GENERAL_APPROX_POSITION = new Integer(3);
- public static final Integer GENERAL_DEVIATION = new Integer(2);
- 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>();
- public static final List<String> GENERAL_STRING_LIST = Arrays.asList(new String[] { "a", "b"});
- public static final List<Integer> GENERAL_INTEGER_LIST = Arrays.asList(new Integer[]{ -1, -2});
- public static final List<TTSChunk> GENERAL_TTSCHUNK_LIST = new ArrayList<TTSChunk>(2);
- public static final List<HMILevel> GENERAL_HMILEVEL_LIST = Arrays.asList(new HMILevel[]{HMILevel.HMI_FULL, HMILevel.HMI_BACKGROUND});
- public static final List<FileType> GENERAL_FILETYPE_LIST = new ArrayList<FileType>(1);
- public static final List<TextField> GENERAL_TEXTFIELD_LIST = new ArrayList<TextField>(1);
- public static final List<DIDResult> GENERAL_DIDRESULT_LIST = new ArrayList<DIDResult>(1);
- public static final List<TouchCoord> GENERAL_TOUCHCOORD_LIST = new ArrayList<TouchCoord>(1);
- public static final List<MassageModeData> GENERAL_MASSAGEMODEDATA_LIST = new ArrayList<MassageModeData>(1);
- public static final List<MassageCushionFirmness> GENERAL_MASSAGECUSHIONFIRMNESS_LIST = new ArrayList<MassageCushionFirmness>(1);
- public static final List<AppHMIType> GENERAL_APPHMITYPE_LIST = new ArrayList<AppHMIType>(2);
- public static final List<VrHelpItem> GENERAL_VRHELPITEM_LIST = new ArrayList<VrHelpItem>(2);
- public static final List<SoftButton> GENERAL_SOFTBUTTON_LIST = new ArrayList<SoftButton>(1);
- public static final List<ImageField> GENERAL_IMAGEFIELD_LIST = new ArrayList<ImageField>(1);
- public static final List<TouchEvent> GENERAL_TOUCHEVENT_LIST = new ArrayList<TouchEvent>(1);
- public static final List<PermissionItem> GENERAL_PERMISSIONITEM_LIST = new ArrayList<PermissionItem>(1);
- public static final List<GlobalProperty> GENERAL_GLOBALPROPERTY_LIST = new ArrayList<GlobalProperty>(2);
- public static final List<VrCapabilities> GENERAL_VRCAPABILITIES_LIST = new ArrayList<VrCapabilities>(1);
- public static final List<MediaClockFormat> GENERAL_MEDIACLOCKFORMAT_LIST = new ArrayList<MediaClockFormat>(2);
- public static final List<VehicleDataResult> GENERAL_VEHICLEDATARESULT_LIST = new ArrayList<VehicleDataResult>(VehicleDataType.values().length);
- public static final List<PrerecordedSpeech> GENERAL_PRERECORDEDSPEECH_LIST = new ArrayList<PrerecordedSpeech>(2);
- public static final List<SpeechCapabilities> GENERAL_SPEECHCAPABILITIES_LIST = new ArrayList<SpeechCapabilities>(2);
- public static final List<ButtonCapabilities> GENERAL_BUTTONCAPABILITIES_LIST = new ArrayList<ButtonCapabilities>(2);
- public static final List<HmiZoneCapabilities> GENERAL_HMIZONECAPABILITIES_LIST = new ArrayList<HmiZoneCapabilities>(2);
- public static final List<SoftButtonCapabilities> GENERAL_SOFTBUTTONCAPABILITIES_LIST = new ArrayList<SoftButtonCapabilities>(1);
- public static final List<AudioPassThruCapabilities> GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST = new ArrayList<AudioPassThruCapabilities>(1);
- public static final List<VideoStreamingFormat> GENERAL_VIDEOSTREAMINGFORMAT_LIST = new ArrayList<VideoStreamingFormat>(2);
- public static final List<DefrostZone> GENERAL_DEFROSTZONE_LIST = Arrays.asList(new DefrostZone[]{DefrostZone.FRONT, DefrostZone.REAR});
- public static final List<VentilationMode> GENERAL_VENTILATIONMODE_LIST = Arrays.asList(new VentilationMode[]{VentilationMode.LOWER, VentilationMode.UPPER});
- public static final List<ClimateControlCapabilities> GENERAL_CLIMATECONTROLCAPABILITIES_LIST = new ArrayList<ClimateControlCapabilities>(1);
- public static final List<RadioControlCapabilities> GENERAL_RADIOCONTROLCAPABILITIES_LIST = new ArrayList<RadioControlCapabilities>(1);
- public static final Vector<String> GENERAL_VECTOR_STRING = new Vector<>(Arrays.asList(new String[] { "a", "b"}));
- public static final Vector<TTSChunk> GENERAL_VECTOR_TTS_CHUNKS = new Vector<>(Arrays.asList(new TTSChunk("Welcome to the jungle", SpeechCapabilities.TEXT)));
- public static final List<SeatControlCapabilities> GENERAL_SEATCONTROLCAPABILITIES_LIST = new ArrayList<SeatControlCapabilities>(1);
- public static final List<EqualizerSettings> GENERAL_EQUALIZERSETTINGS_LIST = new ArrayList<EqualizerSettings>(1);
- public static final List<LightCapabilities> GENERAL_LIGHTCAPABILITIES_LIST = new ArrayList<LightCapabilities>(1);
- public static final List<LightState> GENERAL_LIGHTSTATE_LIST = new ArrayList<LightState>(1);
- public static final List<AudioControlCapabilities> GENERAL_AUDIOCONTROLCAPABILITIES_LIST = new ArrayList<AudioControlCapabilities>(1);
- public static final List<ModuleData> GENERAL_MODULEDATA_LIST = Collections.singletonList(GENERAL_MODULEDATA);
- public static final List<AppServiceType> GENERAL_APPSERVICETYPE_LIST = Arrays.asList(AppServiceType.MEDIA, AppServiceType.NAVIGATION);
- public static final List<AppServiceCapability> GENERAL_APPSERVICECAPABILITY_LIST = Arrays.asList(GENERAL_APP_SERVICE_CAPABILITY);
- 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() {
- @Override
- public void onTriggered(TriggerSource trigger) {
- //
- }
- });
- public static final ChoiceCell GENERAL_CHOICECELL = new ChoiceCell(GENERAL_STRING);
- public static final List<ChoiceCell> GENERAL_CHOICECELL_LIST = Arrays.asList(GENERAL_CHOICECELL);
- public static final List<MenuCell> GENERAL_MENUCELL_LIST = Arrays.asList(GENERAL_MENUCELL);
- public static final VoiceCommand GENERAL_VOICE_COMMAND = new VoiceCommand(GENERAL_STRING_LIST, new VoiceCommandSelectionListener() {
- @Override
- public void onVoiceCommandSelected() {
-
- }
- });
- public static final List<VoiceCommand> GENERAL_VOICE_COMMAND_LIST = Arrays.asList(GENERAL_VOICE_COMMAND);
-
- public static final JSONArray JSON_TURNS = new JSONArray();
- public static final JSONArray JSON_CHOICES = new JSONArray();
- public static final JSONArray JSON_HMILEVELS = new JSONArray();
- public static final JSONArray JSON_TTSCHUNKS = new JSONArray();
- public static final JSONArray JSON_DIDRESULTS = new JSONArray();
- public static final JSONArray JSON_TEXTFIELDS = new JSONArray();
- public static final JSONArray JSON_TOUCHCOORDS = new JSONArray();
- public static final JSONArray JSON_VRHELPITEMS = new JSONArray();
- public static final JSONArray JSON_SOFTBUTTONS = new JSONArray();
- public static final JSONArray JSON_IMAGEFIELDS = new JSONArray();
- public static final JSONArray JSON_TOUCHEVENTS = new JSONArray();
- public static final JSONArray JSON_PERMISSIONITEMS = new JSONArray();
- public static final JSONArray JSON_BUTTONCAPABILITIES = new JSONArray();
- public static final JSONArray JSON_SOFTBUTTONCAPABILITIES = new JSONArray();
- public static final JSONArray JSON_AUDIOPASSTHRUCAPABILITIES = new JSONArray();
- 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();
- public static final JSONObject JSON_DIDRESULT = new JSONObject();
- public static final JSONObject JSON_STARTTIME = new JSONObject();
- public static final JSONObject JSON_TEXTFIELD = new JSONObject();
- public static final JSONObject JSON_TOUCHCOORD = new JSONObject();
- public static final JSONObject JSON_TOUCHEVENT = new JSONObject();
- public static final JSONObject JSON_IMAGEFIELD = new JSONObject();
- public static final JSONObject JSON_SOFTBUTTON = new JSONObject();
- public static final JSONObject JSON_MENUPARAMS = new JSONObject();
- public static final JSONObject JSON_DEVICEINFO = new JSONObject();
- public static final JSONObject JSON_APPINFO = new JSONObject();
- public static final JSONObject JSON_VRHELPITEM = new JSONObject();
- public static final JSONObject JSON_SCREENPARAMS = new JSONObject();
- public static final JSONObject JSON_SDLMSGVERSION = new JSONObject();
- public static final JSONObject JSON_PERMISSIONITEM = new JSONObject();
- public static final JSONObject JSON_HMIPERMISSIONS = new JSONObject();
- public static final JSONObject JSON_IMAGERESOLUTION = new JSONObject();
- public static final JSONObject JSON_KEYBOARDPROPERTIES = new JSONObject();
- public static final JSONObject JSON_DISPLAYCAPABILITIES = new JSONObject();
- public static final JSONObject JSON_PARAMETERPERMISSIONS = new JSONObject();
- public static final JSONObject JSON_PRESETBANKCAPABILITIES = new JSONObject();
- public static final JSONObject JSON_TOUCHEVENTCAPABILITIES = new JSONObject();
- public static final JSONObject JSON_PCMSTREAMCAPABILITIES = new JSONObject();
- 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();
- public static final JSONObject JSON_DYNAMICUPDATECAPABILITIES = new JSONObject();
- static {
- GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
- GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
- GENERAL_TOUCHEVENTCAPABILITIES.setPressAvailable(GENERAL_BOOLEAN);
-
- GENERAL_SEATMEMORYACTION.setAction(GENERAL_SEATMEMORYACTIONTYPE);
- GENERAL_SEATMEMORYACTION.setLabel(GENERAL_STRING);
- GENERAL_SEATMEMORYACTION.setId(GENERAL_INT);
-
- GENERAL_IMAGERESOLUTION.setResolutionHeight(GENERAL_INT);
- GENERAL_IMAGERESOLUTION.setResolutionWidth(GENERAL_INT);
-
- GENERAL_TEMPERATURE.setUnit(GENERAL_TEMPERATUREUNIT);
- GENERAL_TEMPERATURE.setValue(GENERAL_FLOAT);
-
- GENERAL_CLIMATECONTROLDATA.setFanSpeed(GENERAL_INT);
- GENERAL_CLIMATECONTROLDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
- GENERAL_CLIMATECONTROLDATA.setDesiredTemperature(GENERAL_TEMPERATURE);
- GENERAL_CLIMATECONTROLDATA.setAcEnable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLDATA.setCirculateAirEnable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLDATA.setAutoModeEnable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLDATA.setDualModeEnable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLDATA.setAcMaxEnable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLDATA.setDefrostZone(GENERAL_DEFROSTZONE);
- GENERAL_CLIMATECONTROLDATA.setVentilationMode(GENERAL_VENTILATIONMODE);
-
- GENERAL_SEATCONTROLDATA.setMemory(GENERAL_SEATMEMORYACTION);
- GENERAL_SEATCONTROLDATA.setMassageCushionFirmness(GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
- GENERAL_SEATCONTROLDATA.setMassageMode(GENERAL_MASSAGEMODEDATA_LIST);
- GENERAL_SEATCONTROLDATA.setMassageEnabled(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLDATA.setHeadSupportHorizontalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setHeadSupportVerticalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setBackTiltAngle(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setBackVerticalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setFrontVerticalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setVerticalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setHorizontalPosition(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setCoolingLevel(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setHeatingLevel(GENERAL_INT);
- GENERAL_SEATCONTROLDATA.setHeatingEnabled(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLDATA.setCoolingEnabled(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLDATA.setId(GENERAL_SUPPORTEDSEAT);
-
- GENERAL_AUDIOCONTROLDATA.setSource(GENERAL_PRIMARYAUDIOSOURCE);
- GENERAL_AUDIOCONTROLDATA.setVolume(GENERAL_INT);
- GENERAL_AUDIOCONTROLDATA.setKeepContext(GENERAL_BOOLEAN);
- GENERAL_AUDIOCONTROLDATA.setEqualizerSettings(GENERAL_EQUALIZERSETTINGS_LIST);
-
- GENERAL_HMISETTINGSCONTROLDATA.setDistanceUnit(GENERAL_DISTANCEUNIT);
- GENERAL_HMISETTINGSCONTROLDATA.setTemperatureUnit(GENERAL_TEMPERATUREUNIT);
- GENERAL_HMISETTINGSCONTROLDATA.setDisplayMode(GENERAL_DISPLAYMODE);
-
- GENERAL_DYNAMICUPDATECAPABILITIES.setSupportsDynamicSubMenus(GENERAL_BOOLEAN);
- GENERAL_DYNAMICUPDATECAPABILITIES.setSupportedDynamicImageFieldNames(Collections.singletonList(GENERAL_IMAGEFIELDNAME));
-
- GENERAL_LIGHTCONTROLDATA.setLightState(GENERAL_LIGHTSTATE_LIST);
-
- GENERAL_STATIONIDNUMBER.setCountryCode(GENERAL_INT);
- GENERAL_STATIONIDNUMBER.setFccFacilityId(GENERAL_INT);
-
- GENERAL_SISDATA.setStationMessage(GENERAL_STRING);
- GENERAL_SISDATA.setStationLocation(VehicleDataHelper.GPS);
-
- GENERAL_SISDATA.setStationLongName(GENERAL_STRING);
- GENERAL_SISDATA.setStationIDNumber(GENERAL_STATIONIDNUMBER);
- GENERAL_SISDATA.setStationShortName(GENERAL_STRING);
-
- GENERAL_RDSDATA.setProgramService(GENERAL_STRING);
- GENERAL_RDSDATA.setRadioText(GENERAL_STRING);
- GENERAL_RDSDATA.setClockText(GENERAL_STRING);
- GENERAL_RDSDATA.setProgramIdentification(GENERAL_STRING);
- GENERAL_RDSDATA.setRegion(GENERAL_STRING);
- GENERAL_RDSDATA.setTrafficProgram(GENERAL_BOOLEAN);
- GENERAL_RDSDATA.setTrafficAnnouncement(GENERAL_BOOLEAN);
- GENERAL_RDSDATA.setProgramType(GENERAL_INT);
-
- GENERAL_RADIOCONTROLDATA.setFrequencyInteger(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setFrequencyFraction(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setBand(GENERAL_RADIOBAND);
- GENERAL_RADIOCONTROLDATA.setRdsData(GENERAL_RDSDATA);
- GENERAL_RADIOCONTROLDATA.setAvailableHDs(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setHdChannel(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setSignalStrength(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setSignalChangeThreshold(GENERAL_INT);
- GENERAL_RADIOCONTROLDATA.setRadioEnable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLDATA.setState(GENERAL_RADIOSTATE);
-
- GENERAL_MODULEDATA.setModuleType(GENERAL_MODULETYPE);
- GENERAL_MODULEDATA.setClimateControlData(GENERAL_CLIMATECONTROLDATA);
-
- GENERAL_CHOICE.setMenuName(GENERAL_STRING);
- GENERAL_CHOICE.setSecondaryText(GENERAL_STRING);
- GENERAL_CHOICE.setTertiaryText(GENERAL_STRING);
- GENERAL_CHOICE.setChoiceID(GENERAL_INT);
- GENERAL_CHOICE.setImage(GENERAL_IMAGE);
- GENERAL_CHOICE.setSecondaryImage(GENERAL_IMAGE);
- GENERAL_CHOICE.setVrCommands(GENERAL_STRING_LIST);
-
- GENERAL_MASSAGEMODEDATA.setMassageMode(GENERAL_MASSAGEMODE);
- GENERAL_MASSAGEMODEDATA.setMassageZone(GENERAL_MASSAGEZONE);
- GENERAL_MASSAGEMODEDATA_LIST.add(GENERAL_MASSAGEMODEDATA);
-
- GENERAL_MASSAGECUSHIONFIRMNESS.setCushion(GENERAL_MASSAGECUSHION);
- GENERAL_MASSAGECUSHIONFIRMNESS.setFirmness(GENERAL_INT);
- GENERAL_MASSAGECUSHIONFIRMNESS_LIST.add(GENERAL_MASSAGECUSHIONFIRMNESS);
-
- GENERAL_TOUCHCOORD.setX(GENERAL_INT);
- GENERAL_TOUCHCOORD.setY(GENERAL_INT);
- GENERAL_TOUCHCOORD_LIST.add(GENERAL_TOUCHCOORD);
-
- GENERAL_TOUCHEVENT.setId(GENERAL_INT);
- GENERAL_TOUCHEVENT.setTs(GENERAL_LONG_LIST);
- GENERAL_TOUCHEVENT.setC(GENERAL_TOUCHCOORD_LIST);
- GENERAL_TOUCHEVENT_LIST.add(GENERAL_TOUCHEVENT);
-
- GENERAL_TEXTFIELD.setName(GENERAL_TEXTFIELDNAME);
- GENERAL_TEXTFIELD.setRows(GENERAL_INT);
- GENERAL_TEXTFIELD.setWidth(GENERAL_INT);
- GENERAL_TEXTFIELD.setCharacterSet(GENERAL_CHARACTERSET);
- GENERAL_TEXTFIELD_LIST.add(GENERAL_TEXTFIELD);
-
- GENERAL_COORDINATE.setLongitudeDegrees(GENERAL_FLOAT);
- GENERAL_COORDINATE.setLatitudeDegrees(GENERAL_FLOAT);
-
- GENERAL_OASISADDRESS.setCountryName(GENERAL_STRING);
- GENERAL_OASISADDRESS.setThoroughfare(GENERAL_STRING);
- GENERAL_OASISADDRESS.setSubThoroughfare(GENERAL_STRING);
- GENERAL_OASISADDRESS.setCountryCode(GENERAL_STRING);
- GENERAL_OASISADDRESS.setPostalCode(GENERAL_STRING);
- GENERAL_OASISADDRESS.setLocality(GENERAL_STRING);
- GENERAL_OASISADDRESS.setSubLocality(GENERAL_STRING);
- GENERAL_OASISADDRESS.setAdministrativeArea(GENERAL_STRING);
- GENERAL_OASISADDRESS.setSubAdministrativeArea(GENERAL_STRING);
-
- GENERAL_LOCATIONDETAILS.setAddressLines(GENERAL_STRING_LIST);
- GENERAL_LOCATIONDETAILS.setCoordinate(GENERAL_COORDINATE);
- GENERAL_LOCATIONDETAILS.setLocationDescription(GENERAL_STRING);
- GENERAL_LOCATIONDETAILS.setLocationImage(GENERAL_IMAGE);
- GENERAL_LOCATIONDETAILS.setLocationName(GENERAL_STRING);
- GENERAL_LOCATIONDETAILS.setSearchAddress(GENERAL_OASISADDRESS);
- GENERAL_LOCATIONDETAILS.setPhoneNumber(GENERAL_STRING);
-
- GENERAL_FILETYPE_LIST.add(GENERAL_FILETYPE);
-
- GENERAL_IMAGEFIELD.setImageResolution(GENERAL_IMAGERESOLUTION);
- GENERAL_IMAGEFIELD.setName(GENERAL_IMAGEFIELDNAME);
- GENERAL_IMAGEFIELD.setImageTypeSupported(GENERAL_FILETYPE_LIST);
- GENERAL_IMAGEFIELD_LIST.add(GENERAL_IMAGEFIELD);
-
- GENERAL_WINDOW_TYPE_CAPABILITIES.setType(GENERAL_WINDOWTYPE);
- 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(TestValues.GENERAL_DAYCOLORSCHEME);
- GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
-
- GENERAL_SOFTBUTTON.setIsHighlighted(GENERAL_BOOLEAN);
- GENERAL_SOFTBUTTON.setSoftButtonID(GENERAL_INT);
- GENERAL_SOFTBUTTON.setSystemAction(SystemAction.STEAL_FOCUS);
- GENERAL_SOFTBUTTON.setText(GENERAL_STRING);
- GENERAL_SOFTBUTTON.setType(SoftButtonType.SBT_TEXT);
- GENERAL_SOFTBUTTON.setImage(GENERAL_IMAGE);
- GENERAL_SOFTBUTTON_LIST.add(GENERAL_SOFTBUTTON);
-
- GENERAL_TURN.setNavigationText(GENERAL_STRING);
- GENERAL_TURN.setTurnIcon(GENERAL_IMAGE);
- GENERAL_TURN_LIST.add(GENERAL_TURN);
-
- GENERAL_MENUPARAMS.setMenuName(GENERAL_STRING);
- GENERAL_MENUPARAMS.setParentID(GENERAL_INT);
- GENERAL_MENUPARAMS.setPosition(GENERAL_INT);
-
- GENERAL_VRHELPITEM.setText(GENERAL_STRING);
- GENERAL_VRHELPITEM.setImage(GENERAL_IMAGE);
- GENERAL_VRHELPITEM.setPosition(100);
- GENERAL_VRHELPITEM_LIST.add(GENERAL_VRHELPITEM);
-
- GENERAL_TTSCHUNK_LIST.add(new TTSChunk("Welcome to the jungle", SpeechCapabilities.TEXT));
- GENERAL_TTSCHUNK_LIST.add(new TTSChunk("Say a command", SpeechCapabilities.TEXT));
-
- GENERAL_KEYBOARDPROPERTIES.setAutoCompleteText(GENERAL_STRING);
- GENERAL_KEYBOARDPROPERTIES.setKeypressMode(KeypressMode.SINGLE_KEYPRESS);
- GENERAL_KEYBOARDPROPERTIES.setKeyboardLayout(KeyboardLayout.QWERTY);
- GENERAL_KEYBOARDPROPERTIES.setLanguage(Language.EN_US);
- GENERAL_KEYBOARDPROPERTIES.setLimitedCharacterList(TestValues.GENERAL_STRING_LIST);
-
- GENERAL_STARTTIME.setHours(GENERAL_INT);
- GENERAL_STARTTIME.setMinutes(GENERAL_INT);
- GENERAL_STARTTIME.setSeconds(GENERAL_INT);
+ //Versions
+ public static final Version MAX_RPC_VERSION_SUPPORTED = LifecycleManager.MAX_SUPPORTED_RPC_VERSION;
+ /**
+ * @see SdlProtocol
+ */
+ public static final Version MAX_PROTOCOL_VERSION_SUPPORTED = new Version(5, 2, 0);
+
+
+ // Test Failure Messages
+ public static final String NULL = "Value should be null.";
+ public static final String MATCH = "Values should match.";
+ public static final String ARRAY = "Array values should match.";
+ public static final String TRUE = "Value should be true.";
+ public static final String FALSE = "Value should be false.";
+ public static final String NOT_NULL = "Value should not be null.";
+ public static final String JSON_FAIL = "Json testing failed.";
+
+ // RPC Request/Response/Notification/Datatype Test Values
+ public static final int GENERAL_INT = 100;
+ public static final Integer GENERAL_INTEGER = 100;
+ public static final Long GENERAL_LONG = 100L;
+ public static final Turn GENERAL_TURN = new Turn();
+ public static final Float GENERAL_FLOAT = 100f;
+ public static final Image GENERAL_IMAGE = new Image();
+ public static final Choice GENERAL_CHOICE = new Choice();
+ public static final String GENERAL_STRING = "test";
+ public static final Double GENERAL_DOUBLE = 10.01;
+ public static final boolean GENERAL_BOOLEAN = true;
+ public static final byte[] GENERAL_BYTE_ARRAY = new byte[0];
+ public static final TPMS GENERAL_TPMS = TPMS.UNKNOWN;
+ public static final TBTState GENERAL_TBTSTATE = TBTState.NEXT_TURN_REQUEST;
+ public static final FileType GENERAL_FILETYPE = FileType.BINARY;
+ public static final Language GENERAL_LANGUAGE = Language.EN_US;
+ public static final HMILevel GENERAL_HMILEVEL = HMILevel.HMI_FULL;
+ public static final DIDResult GENERAL_DIDRESULT = new DIDResult();
+ public static final TextField GENERAL_TEXTFIELD = new TextField();
+ public static final OasisAddress GENERAL_OASISADDRESS = new OasisAddress();
+ public static final Coordinate GENERAL_COORDINATE = new Coordinate();
+ public static final LocationDetails GENERAL_LOCATIONDETAILS = new LocationDetails();
+ public static final Dimension GENERAL_DIMENSION = Dimension._2D;
+ public static final ImageType GENERAL_IMAGETYPE = ImageType.DYNAMIC;
+ public static final AudioType GENERAL_AUDIOTYPE = AudioType.PCM;
+ public static final StartTime GENERAL_STARTTIME = new StartTime();
+ public static final TouchType GENERAL_TOUCHTYPE = TouchType.BEGIN;
+ public static final TouchEvent GENERAL_TOUCHEVENT = new TouchEvent();
+ public static final VrHelpItem GENERAL_VRHELPITEM = new VrHelpItem();
+ public static final ImageField GENERAL_IMAGEFIELD = new ImageField();
+ public static final DeviceInfo GENERAL_DEVICEINFO = new DeviceInfo();
+ public static final AppInfo GENERAL_APPINFO = new AppInfo();
+ public static final Uri GENERAL_URI = Uri.parse("http://www.google.com");
+ ;
+ public static final LayoutMode GENERAL_LAYOUTMODE = LayoutMode.LIST_ONLY;
+ public static final MenuParams GENERAL_MENUPARAMS = new MenuParams();
+ public static final SoftButton GENERAL_SOFTBUTTON = new SoftButton();
+ public static final ButtonName GENERAL_BUTTONNAME = ButtonName.OK;
+ public static final UpdateMode GENERAL_UPDATEMODE = UpdateMode.RESUME;
+ public static final TouchCoord GENERAL_TOUCHCOORD = new TouchCoord();
+ public static final MassageModeData GENERAL_MASSAGEMODEDATA = new MassageModeData();
+ public static final MassageCushionFirmness GENERAL_MASSAGECUSHIONFIRMNESS = new MassageCushionFirmness();
+ public static final DisplayType GENERAL_DISPLAYTYPE = DisplayType.CID;
+ public static final VehicleType GENERAL_VEHICLETYPE = new VehicleType();
+ public static final RequestType GENERAL_REQUESTTYPE = RequestType.AUTH_REQUEST;
+ public static final SystemAction GENERAL_SYSTEMACTION = SystemAction.DEFAULT_ACTION;
+ public static final CharacterSet GENERAL_CHARACTERSET = CharacterSet.CID1SET;
+ public static final SamplingRate GENERAL_SAMPLINGRATE = SamplingRate._8KHZ;
+ public static final ScreenParams GENERAL_SCREENPARAMS = new ScreenParams();
+ public static final KeypressMode GENERAL_KEYPRESSMODE = KeypressMode.QUEUE_KEYPRESSES;
+ public static final SystemContext GENERAL_SYSTEMCONTEXT = SystemContext.SYSCTXT_MAIN;
+ public static final KeyboardEvent GENERAL_KEYBOARDEVENT = KeyboardEvent.ENTRY_SUBMITTED;
+ public static final CarModeStatus GENERAL_CARMODESTATUS = CarModeStatus.NORMAL;
+ public static final TextFieldName GENERAL_TEXTFIELDNAME = TextFieldName.ETA;
+ public static final TriggerSource GENERAL_TRIGGERSOURCE = TriggerSource.TS_VR;
+ public static final BitsPerSample GENERAL_BITSPERSAMPLE = BitsPerSample._8_BIT;
+ public static final TextAlignment GENERAL_TEXTALIGNMENT = TextAlignment.CENTERED;
+ public static final SdlMsgVersion GENERAL_SDLMSGVERSION = new SdlMsgVersion();
+ public static final PermissionItem GENERAL_PERMISSIONITEM = new PermissionItem();
+ public static final SoftButtonType GENERAL_SOFTBUTTONTYPE = SoftButtonType.SBT_BOTH;
+ public static final MassageZone GENERAL_MASSAGEZONE = MassageZone.LUMBAR;
+ public static final MassageMode GENERAL_MASSAGEMODE = MassageMode.HIGH;
+ public static final WindowStatus GENERAL_WINDOW_STATUS = new WindowStatus();
+ public static final MassageCushion GENERAL_MASSAGECUSHION = MassageCushion.BACK_BOLSTERS;
+ public static final SeatMemoryActionType GENERAL_SEATMEMORYACTIONTYPE = SeatMemoryActionType.SAVE;
+ public static final SupportedSeat GENERAL_SUPPORTEDSEAT = SupportedSeat.DRIVER;
+ public static final KeyboardLayout GENERAL_KEYBOARDLAYOUT = KeyboardLayout.QWERTY;
+ public static final ImageFieldName GENERAL_IMAGEFIELDNAME = ImageFieldName.graphic;
+ public static final HMIPermissions GENERAL_HMIPERMISSIONS = new HMIPermissions();
+ public static final IgnitionStatus GENERAL_IGNITIONSTATUS = IgnitionStatus.RUN;
+ public static final ButtonEventMode GENERAL_BUTTONEVENTMODE = ButtonEventMode.BUTTONUP;
+ public static final ButtonPressMode GENERAL_BUTTONPRESSMODE = ButtonPressMode.SHORT;
+ public static final PowerModeStatus GENERAL_POWERMODESTATUS = PowerModeStatus.RUNNING_2;
+ public static final VehicleDataType GENERAL_VEHICLEDATATYPE = VehicleDataType.VEHICLEDATA_BRAKING;
+ public static final InteractionMode GENERAL_INTERACTIONMODE = InteractionMode.BOTH;
+ public static final ImageResolution GENERAL_IMAGERESOLUTION = new ImageResolution();
+ public static final FuelCutoffStatus GENERAL_FUELCUTOFFSTATUS = FuelCutoffStatus.NORMAL_OPERATION;
+ public static final CompassDirection GENERAL_COMPASSDIRECTION = CompassDirection.EAST;
+ public static final LockScreenStatus GENERAL_LOCKSCREENSTATUS = LockScreenStatus.REQUIRED;
+ public static final VehicleDataStatus GENERAL_VEHICLEDATASTATUS = VehicleDataStatus.ON;
+ public static final DeviceLevelStatus GENERAL_DEVICELEVELSTATUS = DeviceLevelStatus.FOUR_LEVEL_BARS;
+ public static final ButtonCapabilities GENERAL_BUTTONCAPABILITIES = new ButtonCapabilities();
+ public static final EmergencyEventType GENERAL_EMERGENCYEVENTTYPE = EmergencyEventType.FAULT;
+ public static final AmbientLightStatus GENERAL_AMBIENTLIGHTSTATUS = AmbientLightStatus.NIGHT;
+ public static final SpeechCapabilities GENERAL_SPEECHCAPABILITIES = SpeechCapabilities.TEXT;
+ public static final WarningLightStatus GENERAL_WARNINGLIGHTSTATUS = WarningLightStatus.OFF;
+ public static final KeyboardProperties GENERAL_KEYBOARDPROPERTIES = new KeyboardProperties();
+ public static final PrimaryAudioSource GENERAL_PRIMARYAUDIOSOURCE = PrimaryAudioSource.BLUETOOTH_STEREO_BTST;
+ public static final AudioStreamingState GENERAL_AUDIOSTREAMINGSTATE = AudioStreamingState.AUDIBLE;
+ public static final VideoStreamingState GENERAL_VIDEOSTREAMINGSTATE = VideoStreamingState.STREAMABLE;
+ public static final DisplayCapabilities GENERAL_DISPLAYCAPABILITIES = new DisplayCapabilities();
+ public static final ParameterPermissions GENERAL_PARAMETERPERMISSIONS = new ParameterPermissions();
+ public static final IgnitionStableStatus GENERAL_IGNITIONSTABLESTATUS = IgnitionStableStatus.IGNITION_SWITCH_STABLE;
+ public static final VehicleDataResultCode GENERAL_VEHICLEDATARESULTCODE = VehicleDataResultCode.IGNORED;
+ public static final ComponentVolumeStatus GENERAL_COMPONENTVOLUMESTATUS = ComponentVolumeStatus.LOW;
+ public static final PresetBankCapabilities GENERAL_PRESETBANKCAPABILITIES = new PresetBankCapabilities();
+ public static final CapacityUnit GENERAL_CAPACITYUNIT = CapacityUnit.KILOGRAMS;
+ public static final VehicleDataEventStatus GENERAL_VEHCILEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
+ public static final VehicleDataEventStatus GENERAL_VEHICLEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
+ public static final TouchEventCapabilities GENERAL_TOUCHEVENTCAPABILITIES = new TouchEventCapabilities();
+ public static final SeatMemoryAction GENERAL_SEATMEMORYACTION = new SeatMemoryAction();
+ public static final SoftButtonCapabilities GENERAL_SOFTBUTTONCAPABILITIES = new SoftButtonCapabilities();
+ public static final ECallConfirmationStatus GENERAL_ECALLCONFIRMATIONSTATUS = ECallConfirmationStatus.CALL_IN_PROGRESS;
+ public static final AudioPassThruCapabilities GENERAL_AUDIOPASSTHRUCAPABILITIES = new AudioPassThruCapabilities();
+ public static final PowerModeQualificationStatus GENERAL_POWERMODEQUALIFICATIONSTATUS = PowerModeQualificationStatus.POWER_MODE_OK;
+ public static final VehicleDataNotificationStatus GENERAL_VEHICLEDATANOTIFICATIONSTATUS = VehicleDataNotificationStatus.NORMAL;
+ public static final AppInterfaceUnregisteredReason GENERAL_APPINTERFACEUNREGISTEREDREASON = AppInterfaceUnregisteredReason.BLUETOOTH_OFF;
+ public static final SystemCapabilityType GENERAL_SYSTEMCAPABILITYTYPE = SystemCapabilityType.NAVIGATION;
+ public static final NavigationCapability GENERAL_NAVIGATIONCAPABILITY = new NavigationCapability();
+ public static final DriverDistractionCapability GENERAL_DRIVERDISTRACTIONCAPABILITY = new DriverDistractionCapability();
+ public static final PhoneCapability GENERAL_PHONECAPABILITY = new PhoneCapability();
+ public static final RemoteControlCapabilities GENERAL_REMOTECONTROLCAPABILITIES = new RemoteControlCapabilities();
+ public static final SystemCapability GENERAL_SYSTEMCAPABILITY = new SystemCapability();
+ public static final VideoStreamingProtocol GENERAL_VIDEOSTREAMINGPROTOCOL = VideoStreamingProtocol.RAW;
+ public static final VideoStreamingCodec GENERAL_VIDEOSTREAMINGCODEC = VideoStreamingCodec.H264;
+ public static final VideoStreamingCapability GENERAL_VIDEOSTREAMINGCAPABILITY = new VideoStreamingCapability();
+ public static final VideoStreamingFormat GENERAL_VIDEOSTREAMINGFORMAT = new VideoStreamingFormat();
+ public static final RGBColor GENERAL_RGBCOLOR = new RGBColor();
+ public static final TemplateColorScheme GENERAL_DAYCOLORSCHEME = new TemplateColorScheme();
+ public static final TemplateColorScheme GENERAL_NIGHTCOLORSCHEME = new TemplateColorScheme();
+ public static final Result GENERAL_RESULT = Result.SUCCESS;
+ public static final WayPointType GENERAL_WAYPOINTTYPE = WayPointType.DESTINATION;
+ public static final SingleTireStatus GENERAL_SINGLETIRESTATUS = new SingleTireStatus();
+ public static final DriverDistractionState GENERAL_DRIVERDISTRACTIONSTATE = DriverDistractionState.DD_ON;
+ public static final List<LocationDetails> GENERAL_LOCATIONDETAILS_LIST = Arrays.asList(new LocationDetails[]{TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_LOCATIONDETAILS});
+ 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;
+ public static final List<Integer> GENERAL_FUNCTION_ID_LIST = Arrays.asList(FunctionID.GET_VEHICLE_DATA.getId(), FunctionID.SEND_HAPTIC_DATA.getId());
+ public static final AppServiceManifest GENERAL_APPSERVICEMANIFEST = new AppServiceManifest(AppServiceType.MEDIA.name());
+ public static final MediaServiceManifest GENERAL_MEDIA_SERVICE_MANIFEST = new MediaServiceManifest();
+ public static final WeatherServiceManifest GENERAL_WEATHER_SERVICE_MANIFEST = new WeatherServiceManifest();
+ public static final NavigationServiceManifest GENERAL_NAVIGATION_SERVICE_MANIFEST = new NavigationServiceManifest();
+ public static final AppServiceRecord GENERAL_APPSERVICERECORD = new AppServiceRecord();
+ public static final AppServiceCapability GENERAL_APP_SERVICE_CAPABILITY = new AppServiceCapability();
+ public static final AppServicesCapabilities GENERAL_APP_SERVICE_CAPABILITIES = new AppServicesCapabilities();
+ public static final ServiceUpdateReason GENERAL_SERVICE_UPDATE_REASON = ServiceUpdateReason.MANIFEST_UPDATE;
+ public static final DateTime GENERAL_DATETIME = new DateTime();
+ public static final WeatherData GENERAL_WEATHERDATA = new WeatherData();
+ public static final WeatherAlert GENERAL_WEATHERALERT = new WeatherAlert();
+ public static final MediaType GENERAL_MEDIATYPE = MediaType.MUSIC;
+ public static final MediaServiceData GENERAL_MEDIASERVICEDATA = new MediaServiceData();
+ public static final WeatherServiceData GENERAL_WEATHERSERVICEDATA = new WeatherServiceData();
+ public static final NavigationServiceData GENERAL_NAVIGATIONSERVICEDATA = new NavigationServiceData();
+ public static final AppServiceData GENERAL_APPSERVICEDATA = new AppServiceData();
+ public static final NavigationAction GENERAL_NAVIGATIONACTION = NavigationAction.STAY;
+ public static final NavigationJunction GENERAL_NAVIGATION_JUNCTION = NavigationJunction.BIFURCATION;
+ public static final Direction GENERAL_DIRECTION = Direction.RIGHT;
+ public static final NavigationInstruction GENERAL_NAVIGATION_INSTRUCTION = new NavigationInstruction();
+ public static final Version GENERAL_VERSION = new Version("4.0.0");
+ public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE;
+ public static final Temperature GENERAL_TEMPERATURE = new Temperature();
+ public static final TemperatureUnit GENERAL_TEMPERATUREUNIT = TemperatureUnit.CELSIUS;
+ public static final DefrostZone GENERAL_DEFROSTZONE = DefrostZone.ALL;
+ public static final VentilationMode GENERAL_VENTILATIONMODE = VentilationMode.BOTH;
+ public static final LightName GENERAL_LIGHTNAME = LightName.AMBIENT_LIGHTS;
+ public static final DisplayMode GENERAL_DISPLAYMODE = DisplayMode.AUTO;
+ public static final DistanceUnit GENERAL_DISTANCEUNIT = DistanceUnit.KILOMETERS;
+ public static final LightStatus GENERAL_LIGHTSTATUS = LightStatus.OFF;
+ public static final RadioBand GENERAL_RADIOBAND = RadioBand.AM;
+ public static final ClimateControlData GENERAL_CLIMATECONTROLDATA = new ClimateControlData();
+ public static final SeatControlData GENERAL_SEATCONTROLDATA = new SeatControlData();
+ public static final RdsData GENERAL_RDSDATA = new RdsData();
+ public static final StationIDNumber GENERAL_STATIONIDNUMBER = new StationIDNumber();
+ public static final SisData GENERAL_SISDATA = new SisData();
+ public static final RadioState GENERAL_RADIOSTATE = RadioState.ACQUIRED;
+ public static final RadioControlData GENERAL_RADIOCONTROLDATA = new RadioControlData();
+ public static final ModuleData GENERAL_MODULEDATA = new ModuleData();
+ public static final ClimateControlCapabilities GENERAL_CLIMATECONTROLCAPABILITIES = new ClimateControlCapabilities();
+ public static final RadioControlCapabilities GENERAL_RADIOCONTROLCAPABILITIES = new RadioControlCapabilities();
+ public static final SeatControlCapabilities GENERAL_SEATCONTROLCAPABILITIES = new SeatControlCapabilities();
+ public static final EqualizerSettings GENERAL_EQUALIZERSETTINGS = new EqualizerSettings();
+ public static final LightCapabilities GENERAL_LIGHTCAPABILITIES = new LightCapabilities();
+ public static final LightState GENERAL_LIGHTSTATE = new LightState();
+ public static final AudioControlCapabilities GENERAL_AUDIOCONTROLCAPABILITIES = new AudioControlCapabilities();
+ public static final HMISettingsControlCapabilities GENERAL_HMISETTINGSCONTROLCAPABILITIES = new HMISettingsControlCapabilities();
+ public static final LightControlCapabilities GENERAL_LIGHTCONTROLCAPABILITIES = new LightControlCapabilities();
+ 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 DynamicUpdateCapabilities GENERAL_DYNAMICUPDATECAPABILITIES = new DynamicUpdateCapabilities();
+
+ 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);
+
+ public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities();
+
+ public static final MetadataTags GENERAL_METADATASTRUCT = new MetadataTags();
+ public static final Rectangle GENERAL_RECTANGLE = new Rectangle();
+ 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 StabilityControlsStatus GENERAL_STABILITY_CONTROL_STATUS = new StabilityControlsStatus();
+ public static final VehicleDataStatus GENERAL_ESC_SYSTEM = VehicleDataStatus.ON;
+ public static final VehicleDataStatus GENERAL_S_WAY_CONTROL = VehicleDataStatus.OFF;
+ public static final WindowType GENERAL_WINDOWTYPE = WindowType.MAIN;
+ public static final GearStatus GENERAL_GEAR_STATUS = new GearStatus();
+ public static final PRNDL GENERAL_USER_SELECTED_GEAR = PRNDL.NEUTRAL;
+ public static final PRNDL GENERAL_ACTUAL_GEAR = PRNDL.DRIVE;
+ public static final TransmissionType GENERAL_TRANSMISSION_TYPE = TransmissionType.AUTOMATIC;
+ public static final Grid GENERAL_LOCATION_GRID = new Grid(2, 3);
+ public static final WindowState GENERAL_WINDOW_STATE = new WindowState(2, 3);
+ public static final Integer GENERAL_APPROX_POSITION = new Integer(3);
+ public static final Integer GENERAL_DEVIATION = new Integer(2);
+ 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>();
+ public static final List<String> GENERAL_STRING_LIST = Arrays.asList(new String[]{"a", "b"});
+ public static final List<Integer> GENERAL_INTEGER_LIST = Arrays.asList(new Integer[]{-1, -2});
+ public static final List<TTSChunk> GENERAL_TTSCHUNK_LIST = new ArrayList<TTSChunk>(2);
+ public static final List<HMILevel> GENERAL_HMILEVEL_LIST = Arrays.asList(new HMILevel[]{HMILevel.HMI_FULL, HMILevel.HMI_BACKGROUND});
+ public static final List<FileType> GENERAL_FILETYPE_LIST = new ArrayList<FileType>(1);
+ public static final List<TextField> GENERAL_TEXTFIELD_LIST = new ArrayList<TextField>(1);
+ public static final List<DIDResult> GENERAL_DIDRESULT_LIST = new ArrayList<DIDResult>(1);
+ public static final List<TouchCoord> GENERAL_TOUCHCOORD_LIST = new ArrayList<TouchCoord>(1);
+ public static final List<MassageModeData> GENERAL_MASSAGEMODEDATA_LIST = new ArrayList<MassageModeData>(1);
+ public static final List<MassageCushionFirmness> GENERAL_MASSAGECUSHIONFIRMNESS_LIST = new ArrayList<MassageCushionFirmness>(1);
+ public static final List<AppHMIType> GENERAL_APPHMITYPE_LIST = new ArrayList<AppHMIType>(2);
+ public static final List<VrHelpItem> GENERAL_VRHELPITEM_LIST = new ArrayList<VrHelpItem>(2);
+ public static final List<SoftButton> GENERAL_SOFTBUTTON_LIST = new ArrayList<SoftButton>(1);
+ public static final List<ImageField> GENERAL_IMAGEFIELD_LIST = new ArrayList<ImageField>(1);
+ public static final List<TouchEvent> GENERAL_TOUCHEVENT_LIST = new ArrayList<TouchEvent>(1);
+ public static final List<PermissionItem> GENERAL_PERMISSIONITEM_LIST = new ArrayList<PermissionItem>(1);
+ public static final List<GlobalProperty> GENERAL_GLOBALPROPERTY_LIST = new ArrayList<GlobalProperty>(2);
+ public static final List<VrCapabilities> GENERAL_VRCAPABILITIES_LIST = new ArrayList<VrCapabilities>(1);
+ public static final List<MediaClockFormat> GENERAL_MEDIACLOCKFORMAT_LIST = new ArrayList<MediaClockFormat>(2);
+ public static final List<VehicleDataResult> GENERAL_VEHICLEDATARESULT_LIST = new ArrayList<VehicleDataResult>(VehicleDataType.values().length);
+ public static final List<PrerecordedSpeech> GENERAL_PRERECORDEDSPEECH_LIST = new ArrayList<PrerecordedSpeech>(2);
+ public static final List<SpeechCapabilities> GENERAL_SPEECHCAPABILITIES_LIST = new ArrayList<SpeechCapabilities>(2);
+ public static final List<ButtonCapabilities> GENERAL_BUTTONCAPABILITIES_LIST = new ArrayList<ButtonCapabilities>(2);
+ public static final List<HmiZoneCapabilities> GENERAL_HMIZONECAPABILITIES_LIST = new ArrayList<HmiZoneCapabilities>(2);
+ public static final List<SoftButtonCapabilities> GENERAL_SOFTBUTTONCAPABILITIES_LIST = new ArrayList<SoftButtonCapabilities>(1);
+ public static final List<AudioPassThruCapabilities> GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST = new ArrayList<AudioPassThruCapabilities>(1);
+ public static final List<VideoStreamingFormat> GENERAL_VIDEOSTREAMINGFORMAT_LIST = new ArrayList<VideoStreamingFormat>(2);
+ public static final List<DefrostZone> GENERAL_DEFROSTZONE_LIST = Arrays.asList(new DefrostZone[]{DefrostZone.FRONT, DefrostZone.REAR});
+ public static final List<VentilationMode> GENERAL_VENTILATIONMODE_LIST = Arrays.asList(new VentilationMode[]{VentilationMode.LOWER, VentilationMode.UPPER});
+ public static final List<ClimateControlCapabilities> GENERAL_CLIMATECONTROLCAPABILITIES_LIST = new ArrayList<ClimateControlCapabilities>(1);
+ public static final List<RadioControlCapabilities> GENERAL_RADIOCONTROLCAPABILITIES_LIST = new ArrayList<RadioControlCapabilities>(1);
+ public static final Vector<String> GENERAL_VECTOR_STRING = new Vector<>(Arrays.asList(new String[]{"a", "b"}));
+ public static final Vector<TTSChunk> GENERAL_VECTOR_TTS_CHUNKS = new Vector<>(Arrays.asList(new TTSChunk("Welcome to the jungle", SpeechCapabilities.TEXT)));
+ public static final List<SeatControlCapabilities> GENERAL_SEATCONTROLCAPABILITIES_LIST = new ArrayList<SeatControlCapabilities>(1);
+ public static final List<EqualizerSettings> GENERAL_EQUALIZERSETTINGS_LIST = new ArrayList<EqualizerSettings>(1);
+ public static final List<LightCapabilities> GENERAL_LIGHTCAPABILITIES_LIST = new ArrayList<LightCapabilities>(1);
+ public static final List<LightState> GENERAL_LIGHTSTATE_LIST = new ArrayList<LightState>(1);
+ public static final List<AudioControlCapabilities> GENERAL_AUDIOCONTROLCAPABILITIES_LIST = new ArrayList<AudioControlCapabilities>(1);
+ public static final List<ModuleData> GENERAL_MODULEDATA_LIST = Collections.singletonList(GENERAL_MODULEDATA);
+ public static final List<AppServiceType> GENERAL_APPSERVICETYPE_LIST = Arrays.asList(AppServiceType.MEDIA, AppServiceType.NAVIGATION);
+ public static final List<AppServiceCapability> GENERAL_APPSERVICECAPABILITY_LIST = Arrays.asList(GENERAL_APP_SERVICE_CAPABILITY);
+ 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() {
+ @Override
+ public void onTriggered(TriggerSource trigger) {
+ //
+ }
+ });
+ public static final ChoiceCell GENERAL_CHOICECELL = new ChoiceCell(GENERAL_STRING);
+ public static final List<ChoiceCell> GENERAL_CHOICECELL_LIST = Arrays.asList(GENERAL_CHOICECELL);
+ public static final List<MenuCell> GENERAL_MENUCELL_LIST = Arrays.asList(GENERAL_MENUCELL);
+ public static final VoiceCommand GENERAL_VOICE_COMMAND = new VoiceCommand(GENERAL_STRING_LIST, new VoiceCommandSelectionListener() {
+ @Override
+ public void onVoiceCommandSelected() {
+
+ }
+ });
+ public static final List<VoiceCommand> GENERAL_VOICE_COMMAND_LIST = Arrays.asList(GENERAL_VOICE_COMMAND);
+
+ public static final JSONArray JSON_TURNS = new JSONArray();
+ public static final JSONArray JSON_CHOICES = new JSONArray();
+ public static final JSONArray JSON_HMILEVELS = new JSONArray();
+ public static final JSONArray JSON_TTSCHUNKS = new JSONArray();
+ public static final JSONArray JSON_DIDRESULTS = new JSONArray();
+ public static final JSONArray JSON_TEXTFIELDS = new JSONArray();
+ public static final JSONArray JSON_TOUCHCOORDS = new JSONArray();
+ public static final JSONArray JSON_VRHELPITEMS = new JSONArray();
+ public static final JSONArray JSON_SOFTBUTTONS = new JSONArray();
+ public static final JSONArray JSON_IMAGEFIELDS = new JSONArray();
+ public static final JSONArray JSON_TOUCHEVENTS = new JSONArray();
+ public static final JSONArray JSON_PERMISSIONITEMS = new JSONArray();
+ public static final JSONArray JSON_BUTTONCAPABILITIES = new JSONArray();
+ public static final JSONArray JSON_SOFTBUTTONCAPABILITIES = new JSONArray();
+ public static final JSONArray JSON_AUDIOPASSTHRUCAPABILITIES = new JSONArray();
+ 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();
+ public static final JSONObject JSON_DIDRESULT = new JSONObject();
+ public static final JSONObject JSON_STARTTIME = new JSONObject();
+ public static final JSONObject JSON_TEXTFIELD = new JSONObject();
+ public static final JSONObject JSON_TOUCHCOORD = new JSONObject();
+ public static final JSONObject JSON_TOUCHEVENT = new JSONObject();
+ public static final JSONObject JSON_IMAGEFIELD = new JSONObject();
+ public static final JSONObject JSON_SOFTBUTTON = new JSONObject();
+ public static final JSONObject JSON_MENUPARAMS = new JSONObject();
+ public static final JSONObject JSON_DEVICEINFO = new JSONObject();
+ public static final JSONObject JSON_APPINFO = new JSONObject();
+ public static final JSONObject JSON_VRHELPITEM = new JSONObject();
+ public static final JSONObject JSON_SCREENPARAMS = new JSONObject();
+ public static final JSONObject JSON_SDLMSGVERSION = new JSONObject();
+ public static final JSONObject JSON_PERMISSIONITEM = new JSONObject();
+ public static final JSONObject JSON_HMIPERMISSIONS = new JSONObject();
+ public static final JSONObject JSON_IMAGERESOLUTION = new JSONObject();
+ public static final JSONObject JSON_KEYBOARDPROPERTIES = new JSONObject();
+ public static final JSONObject JSON_DISPLAYCAPABILITIES = new JSONObject();
+ public static final JSONObject JSON_PARAMETERPERMISSIONS = new JSONObject();
+ public static final JSONObject JSON_PRESETBANKCAPABILITIES = new JSONObject();
+ public static final JSONObject JSON_TOUCHEVENTCAPABILITIES = new JSONObject();
+ public static final JSONObject JSON_PCMSTREAMCAPABILITIES = new JSONObject();
+ 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();
+ public static final JSONObject JSON_DYNAMICUPDATECAPABILITIES = new JSONObject();
+
+ static {
+ GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
+ GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
+ GENERAL_TOUCHEVENTCAPABILITIES.setPressAvailable(GENERAL_BOOLEAN);
+
+ GENERAL_SEATMEMORYACTION.setAction(GENERAL_SEATMEMORYACTIONTYPE);
+ GENERAL_SEATMEMORYACTION.setLabel(GENERAL_STRING);
+ GENERAL_SEATMEMORYACTION.setId(GENERAL_INT);
+
+ GENERAL_IMAGERESOLUTION.setResolutionHeight(GENERAL_INT);
+ GENERAL_IMAGERESOLUTION.setResolutionWidth(GENERAL_INT);
+
+ GENERAL_TEMPERATURE.setUnit(GENERAL_TEMPERATUREUNIT);
+ GENERAL_TEMPERATURE.setValue(GENERAL_FLOAT);
+
+ GENERAL_CLIMATECONTROLDATA.setFanSpeed(GENERAL_INT);
+ GENERAL_CLIMATECONTROLDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_CLIMATECONTROLDATA.setDesiredTemperature(GENERAL_TEMPERATURE);
+ GENERAL_CLIMATECONTROLDATA.setAcEnable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLDATA.setCirculateAirEnable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLDATA.setAutoModeEnable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLDATA.setDualModeEnable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLDATA.setAcMaxEnable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLDATA.setDefrostZone(GENERAL_DEFROSTZONE);
+ GENERAL_CLIMATECONTROLDATA.setVentilationMode(GENERAL_VENTILATIONMODE);
+
+ GENERAL_SEATCONTROLDATA.setMemory(GENERAL_SEATMEMORYACTION);
+ GENERAL_SEATCONTROLDATA.setMassageCushionFirmness(GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
+ GENERAL_SEATCONTROLDATA.setMassageMode(GENERAL_MASSAGEMODEDATA_LIST);
+ GENERAL_SEATCONTROLDATA.setMassageEnabled(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLDATA.setHeadSupportHorizontalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setHeadSupportVerticalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setBackTiltAngle(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setBackVerticalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setFrontVerticalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setVerticalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setHorizontalPosition(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setCoolingLevel(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setHeatingLevel(GENERAL_INT);
+ GENERAL_SEATCONTROLDATA.setHeatingEnabled(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLDATA.setCoolingEnabled(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLDATA.setId(GENERAL_SUPPORTEDSEAT);
+
+ GENERAL_AUDIOCONTROLDATA.setSource(GENERAL_PRIMARYAUDIOSOURCE);
+ GENERAL_AUDIOCONTROLDATA.setVolume(GENERAL_INT);
+ GENERAL_AUDIOCONTROLDATA.setKeepContext(GENERAL_BOOLEAN);
+ GENERAL_AUDIOCONTROLDATA.setEqualizerSettings(GENERAL_EQUALIZERSETTINGS_LIST);
+
+ GENERAL_HMISETTINGSCONTROLDATA.setDistanceUnit(GENERAL_DISTANCEUNIT);
+ GENERAL_HMISETTINGSCONTROLDATA.setTemperatureUnit(GENERAL_TEMPERATUREUNIT);
+ GENERAL_HMISETTINGSCONTROLDATA.setDisplayMode(GENERAL_DISPLAYMODE);
+
+ GENERAL_DYNAMICUPDATECAPABILITIES.setSupportsDynamicSubMenus(GENERAL_BOOLEAN);
+ GENERAL_DYNAMICUPDATECAPABILITIES.setSupportedDynamicImageFieldNames(Collections.singletonList(GENERAL_IMAGEFIELDNAME));
+
+ GENERAL_LIGHTCONTROLDATA.setLightState(GENERAL_LIGHTSTATE_LIST);
+
+ GENERAL_STATIONIDNUMBER.setCountryCode(GENERAL_INT);
+ GENERAL_STATIONIDNUMBER.setFccFacilityId(GENERAL_INT);
+
+ GENERAL_SISDATA.setStationMessage(GENERAL_STRING);
+ GENERAL_SISDATA.setStationLocation(VehicleDataHelper.GPS);
+
+ GENERAL_SISDATA.setStationLongName(GENERAL_STRING);
+ GENERAL_SISDATA.setStationIDNumber(GENERAL_STATIONIDNUMBER);
+ GENERAL_SISDATA.setStationShortName(GENERAL_STRING);
+
+ GENERAL_RDSDATA.setProgramService(GENERAL_STRING);
+ GENERAL_RDSDATA.setRadioText(GENERAL_STRING);
+ GENERAL_RDSDATA.setClockText(GENERAL_STRING);
+ GENERAL_RDSDATA.setProgramIdentification(GENERAL_STRING);
+ GENERAL_RDSDATA.setRegion(GENERAL_STRING);
+ GENERAL_RDSDATA.setTrafficProgram(GENERAL_BOOLEAN);
+ GENERAL_RDSDATA.setTrafficAnnouncement(GENERAL_BOOLEAN);
+ GENERAL_RDSDATA.setProgramType(GENERAL_INT);
+
+ GENERAL_RADIOCONTROLDATA.setFrequencyInteger(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setFrequencyFraction(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setBand(GENERAL_RADIOBAND);
+ GENERAL_RADIOCONTROLDATA.setRdsData(GENERAL_RDSDATA);
+ GENERAL_RADIOCONTROLDATA.setAvailableHDs(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setHdChannel(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setSignalStrength(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setSignalChangeThreshold(GENERAL_INT);
+ GENERAL_RADIOCONTROLDATA.setRadioEnable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLDATA.setState(GENERAL_RADIOSTATE);
+
+ GENERAL_MODULEDATA.setModuleType(GENERAL_MODULETYPE);
+ GENERAL_MODULEDATA.setClimateControlData(GENERAL_CLIMATECONTROLDATA);
+
+ GENERAL_CHOICE.setMenuName(GENERAL_STRING);
+ GENERAL_CHOICE.setSecondaryText(GENERAL_STRING);
+ GENERAL_CHOICE.setTertiaryText(GENERAL_STRING);
+ GENERAL_CHOICE.setChoiceID(GENERAL_INT);
+ GENERAL_CHOICE.setImage(GENERAL_IMAGE);
+ GENERAL_CHOICE.setSecondaryImage(GENERAL_IMAGE);
+ GENERAL_CHOICE.setVrCommands(GENERAL_STRING_LIST);
+
+ GENERAL_MASSAGEMODEDATA.setMassageMode(GENERAL_MASSAGEMODE);
+ GENERAL_MASSAGEMODEDATA.setMassageZone(GENERAL_MASSAGEZONE);
+ GENERAL_MASSAGEMODEDATA_LIST.add(GENERAL_MASSAGEMODEDATA);
+
+ GENERAL_MASSAGECUSHIONFIRMNESS.setCushion(GENERAL_MASSAGECUSHION);
+ GENERAL_MASSAGECUSHIONFIRMNESS.setFirmness(GENERAL_INT);
+ GENERAL_MASSAGECUSHIONFIRMNESS_LIST.add(GENERAL_MASSAGECUSHIONFIRMNESS);
+
+ GENERAL_TOUCHCOORD.setX(GENERAL_INT);
+ GENERAL_TOUCHCOORD.setY(GENERAL_INT);
+ GENERAL_TOUCHCOORD_LIST.add(GENERAL_TOUCHCOORD);
+
+ GENERAL_TOUCHEVENT.setId(GENERAL_INT);
+ GENERAL_TOUCHEVENT.setTs(GENERAL_LONG_LIST);
+ GENERAL_TOUCHEVENT.setC(GENERAL_TOUCHCOORD_LIST);
+ GENERAL_TOUCHEVENT_LIST.add(GENERAL_TOUCHEVENT);
+
+ GENERAL_TEXTFIELD.setName(GENERAL_TEXTFIELDNAME);
+ GENERAL_TEXTFIELD.setRows(GENERAL_INT);
+ GENERAL_TEXTFIELD.setWidth(GENERAL_INT);
+ GENERAL_TEXTFIELD.setCharacterSet(GENERAL_CHARACTERSET);
+ GENERAL_TEXTFIELD_LIST.add(GENERAL_TEXTFIELD);
+
+ GENERAL_COORDINATE.setLongitudeDegrees(GENERAL_FLOAT);
+ GENERAL_COORDINATE.setLatitudeDegrees(GENERAL_FLOAT);
+
+ GENERAL_OASISADDRESS.setCountryName(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setThoroughfare(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubThoroughfare(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setCountryCode(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setPostalCode(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setLocality(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubLocality(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setAdministrativeArea(GENERAL_STRING);
+ GENERAL_OASISADDRESS.setSubAdministrativeArea(GENERAL_STRING);
+
+ GENERAL_LOCATIONDETAILS.setAddressLines(GENERAL_STRING_LIST);
+ GENERAL_LOCATIONDETAILS.setCoordinate(GENERAL_COORDINATE);
+ GENERAL_LOCATIONDETAILS.setLocationDescription(GENERAL_STRING);
+ GENERAL_LOCATIONDETAILS.setLocationImage(GENERAL_IMAGE);
+ GENERAL_LOCATIONDETAILS.setLocationName(GENERAL_STRING);
+ GENERAL_LOCATIONDETAILS.setSearchAddress(GENERAL_OASISADDRESS);
+ GENERAL_LOCATIONDETAILS.setPhoneNumber(GENERAL_STRING);
+
+ GENERAL_FILETYPE_LIST.add(GENERAL_FILETYPE);
+
+ GENERAL_IMAGEFIELD.setImageResolution(GENERAL_IMAGERESOLUTION);
+ GENERAL_IMAGEFIELD.setName(GENERAL_IMAGEFIELDNAME);
+ GENERAL_IMAGEFIELD.setImageTypeSupported(GENERAL_FILETYPE_LIST);
+ GENERAL_IMAGEFIELD_LIST.add(GENERAL_IMAGEFIELD);
+
+ GENERAL_WINDOW_TYPE_CAPABILITIES.setType(GENERAL_WINDOWTYPE);
+ 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(TestValues.GENERAL_DAYCOLORSCHEME);
+ GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
+
+ GENERAL_SOFTBUTTON.setIsHighlighted(GENERAL_BOOLEAN);
+ GENERAL_SOFTBUTTON.setSoftButtonID(GENERAL_INT);
+ GENERAL_SOFTBUTTON.setSystemAction(SystemAction.STEAL_FOCUS);
+ GENERAL_SOFTBUTTON.setText(GENERAL_STRING);
+ GENERAL_SOFTBUTTON.setType(SoftButtonType.SBT_TEXT);
+ GENERAL_SOFTBUTTON.setImage(GENERAL_IMAGE);
+ GENERAL_SOFTBUTTON_LIST.add(GENERAL_SOFTBUTTON);
+
+ GENERAL_TURN.setNavigationText(GENERAL_STRING);
+ GENERAL_TURN.setTurnIcon(GENERAL_IMAGE);
+ GENERAL_TURN_LIST.add(GENERAL_TURN);
+
+ GENERAL_MENUPARAMS.setMenuName(GENERAL_STRING);
+ GENERAL_MENUPARAMS.setParentID(GENERAL_INT);
+ GENERAL_MENUPARAMS.setPosition(GENERAL_INT);
+
+ GENERAL_VRHELPITEM.setText(GENERAL_STRING);
+ GENERAL_VRHELPITEM.setImage(GENERAL_IMAGE);
+ GENERAL_VRHELPITEM.setPosition(100);
+ GENERAL_VRHELPITEM_LIST.add(GENERAL_VRHELPITEM);
+
+ GENERAL_TTSCHUNK_LIST.add(new TTSChunk("Welcome to the jungle", SpeechCapabilities.TEXT));
+ GENERAL_TTSCHUNK_LIST.add(new TTSChunk("Say a command", SpeechCapabilities.TEXT));
+
+ GENERAL_KEYBOARDPROPERTIES.setAutoCompleteText(GENERAL_STRING);
+ GENERAL_KEYBOARDPROPERTIES.setKeypressMode(KeypressMode.SINGLE_KEYPRESS);
+ GENERAL_KEYBOARDPROPERTIES.setKeyboardLayout(KeyboardLayout.QWERTY);
+ GENERAL_KEYBOARDPROPERTIES.setLanguage(Language.EN_US);
+ GENERAL_KEYBOARDPROPERTIES.setLimitedCharacterList(TestValues.GENERAL_STRING_LIST);
+
+ GENERAL_STARTTIME.setHours(GENERAL_INT);
+ GENERAL_STARTTIME.setMinutes(GENERAL_INT);
+ GENERAL_STARTTIME.setSeconds(GENERAL_INT);
GENERAL_CHOICE_LIST.add(GENERAL_CHOICE);
@@ -825,10 +827,10 @@ public class TestValues {
GENERAL_GLOBALPROPERTY_LIST.add(GlobalProperty.MENUICON);
for (VehicleDataType data : VehicleDataType.values()) {
- VehicleDataResult result = new VehicleDataResult();
+ VehicleDataResult result = new VehicleDataResult();
result.setResultCode(VehicleDataResultCode.SUCCESS);
result.setDataType(data);
- GENERAL_VEHICLEDATARESULT_LIST.add(result);
+ GENERAL_VEHICLEDATARESULT_LIST.add(result);
}
GENERAL_OEM_CUSTOM_VEHICLE_DATA.setResultCode(VehicleDataResultCode.SUCCESS);
@@ -896,501 +898,501 @@ public class TestValues {
GENERAL_PERMISSIONITEM.setRequireEncryption(GENERAL_BOOLEAN);
GENERAL_PERMISSIONITEM_LIST.add(GENERAL_PERMISSIONITEM);
- GENERAL_SYSTEMCAPABILITY.setSystemCapabilityType(GENERAL_SYSTEMCAPABILITYTYPE);
-
- GENERAL_NAVIGATIONCAPABILITY.setSendLocationEnabled(GENERAL_BOOLEAN);
- GENERAL_NAVIGATIONCAPABILITY.setWayPointsEnabled(GENERAL_BOOLEAN);
-
- GENERAL_PHONECAPABILITY.setDialNumberEnabled(GENERAL_BOOLEAN);
-
- GENERAL_VIDEOSTREAMINGFORMAT.setProtocol(GENERAL_VIDEOSTREAMINGPROTOCOL);
- GENERAL_VIDEOSTREAMINGFORMAT.setCodec(GENERAL_VIDEOSTREAMINGCODEC);
-
- GENERAL_VIDEOSTREAMINGFORMAT_LIST.add(GENERAL_VIDEOSTREAMINGFORMAT);
- GENERAL_VIDEOSTREAMINGFORMAT_LIST.add(GENERAL_VIDEOSTREAMINGFORMAT);
-
- GENERAL_VIDEOSTREAMINGCAPABILITY.setMaxBitrate(GENERAL_INT);
- GENERAL_VIDEOSTREAMINGCAPABILITY.setPreferredResolution(GENERAL_IMAGERESOLUTION);
- GENERAL_VIDEOSTREAMINGCAPABILITY.setSupportedFormats(GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- GENERAL_VIDEOSTREAMINGCAPABILITY.setIsHapticSpatialDataSupported(GENERAL_BOOLEAN);
-
- GENERAL_CLIMATECONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
- GENERAL_CLIMATECONTROLCAPABILITIES.setFanSpeedAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setDesiredTemperatureAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setAcEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setAcMaxEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setCirculateAirEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setAutoModeEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setDualModeEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZoneAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZone(GENERAL_DEFROSTZONE_LIST);
- GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationModeAvailable(GENERAL_BOOLEAN);
- GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationMode(GENERAL_VENTILATIONMODE_LIST);
- GENERAL_CLIMATECONTROLCAPABILITIES_LIST.add(GENERAL_CLIMATECONTROLCAPABILITIES);
-
- GENERAL_RADIOCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
- GENERAL_RADIOCONTROLCAPABILITIES.setRadioEnableAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setRadioBandAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setRadioFrequencyAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setHdChannelAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setRdsDataAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setAvailableHDsAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setStateAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setSignalStrengthAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES.setSignalChangeThresholdAvailable(GENERAL_BOOLEAN);
- GENERAL_RADIOCONTROLCAPABILITIES_LIST.add(GENERAL_RADIOCONTROLCAPABILITIES);
-
- GENERAL_SEATCONTROLCAPABILITIES.setMemoryAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setMassageCushionFirmnessAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setMassageModeAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setMassageEnabledAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setHeadSupportVerticalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setHeadSupportHorizontalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setBackTiltAngleAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setBackVerticalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setFrontVerticalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setVerticalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setHorizontalPositionAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setCoolingLevelAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setHeatingLevelAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setCoolingEnabledAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setHeatingEnabledAvailable(GENERAL_BOOLEAN);
- GENERAL_SEATCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
- GENERAL_SEATCONTROLCAPABILITIES_LIST.add(GENERAL_SEATCONTROLCAPABILITIES);
-
- GENERAL_AUDIOCONTROLCAPABILITIES.setEqualizerMaxChannelId(GENERAL_INT);
- GENERAL_AUDIOCONTROLCAPABILITIES.setEqualizerAvailable(GENERAL_BOOLEAN);
- GENERAL_AUDIOCONTROLCAPABILITIES.setVolumeAvailable(GENERAL_BOOLEAN);
- GENERAL_AUDIOCONTROLCAPABILITIES.setSourceAvailable(GENERAL_BOOLEAN);
- GENERAL_AUDIOCONTROLCAPABILITIES.setKeepContextAvailable(GENERAL_BOOLEAN);
- GENERAL_AUDIOCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
- GENERAL_AUDIOCONTROLCAPABILITIES_LIST.add(GENERAL_AUDIOCONTROLCAPABILITIES);
-
- GENERAL_HMISETTINGSCONTROLCAPABILITIES.setDisplayModeUnitAvailable(GENERAL_BOOLEAN);
- GENERAL_HMISETTINGSCONTROLCAPABILITIES.setDistanceUnitAvailable(GENERAL_BOOLEAN);
- GENERAL_HMISETTINGSCONTROLCAPABILITIES.setTemperatureUnitAvailable(GENERAL_BOOLEAN);
- GENERAL_HMISETTINGSCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
-
- GENERAL_LIGHTCONTROLCAPABILITIES.setSupportedLights(GENERAL_LIGHTCAPABILITIES_LIST);
- GENERAL_LIGHTCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
-
- GENERAL_EQUALIZERSETTINGS.setChannelSetting(GENERAL_INT);
- GENERAL_EQUALIZERSETTINGS.setChannelName(GENERAL_STRING);
- GENERAL_EQUALIZERSETTINGS.setChannelId(GENERAL_INT);
- GENERAL_EQUALIZERSETTINGS_LIST.add(GENERAL_EQUALIZERSETTINGS);
-
- GENERAL_LIGHTCAPABILITIES.setName(GENERAL_LIGHTNAME);
- GENERAL_LIGHTCAPABILITIES.setDensityAvailable(GENERAL_BOOLEAN);
- GENERAL_LIGHTCAPABILITIES.setRGBColorSpaceAvailable(GENERAL_BOOLEAN);
- GENERAL_LIGHTCAPABILITIES_LIST.add(GENERAL_LIGHTCAPABILITIES);
-
- GENERAL_LIGHTSTATE.setId(GENERAL_LIGHTNAME);
- GENERAL_LIGHTSTATE.setDensity(GENERAL_FLOAT);
- GENERAL_LIGHTSTATE.setStatus(GENERAL_LIGHTSTATUS);
- GENERAL_LIGHTSTATE.setColor(GENERAL_RGBCOLOR);
- GENERAL_LIGHTSTATE_LIST.add(GENERAL_LIGHTSTATE);
-
- GENERAL_REMOTECONTROLCAPABILITIES.setButtonCapabilities(GENERAL_BUTTONCAPABILITIES_LIST);
- GENERAL_REMOTECONTROLCAPABILITIES.setClimateControlCapabilities(GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
- GENERAL_REMOTECONTROLCAPABILITIES.setRadioControlCapabilities(GENERAL_RADIOCONTROLCAPABILITIES_LIST);
-
- GENERAL_HMICAPABILITIES.setNavigationAvilable(GENERAL_BOOLEAN);
- GENERAL_HMICAPABILITIES.setVideoStreamingAvailable(GENERAL_BOOLEAN);
- GENERAL_HMICAPABILITIES.setPhoneCallAvilable(GENERAL_BOOLEAN);
-
- List<MetadataType> exampleList = new ArrayList<>();
- exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
- exampleList.add(1, MetadataType.MEDIA_ALBUM);
- exampleList.add(2, MetadataType.MEDIA_ARTIST);
-
- GENERAL_METADATASTRUCT.setMainField1(exampleList);
- GENERAL_METADATASTRUCT.setMainField2(exampleList);
- GENERAL_METADATASTRUCT.setMainField3(exampleList);
- GENERAL_METADATASTRUCT.setMainField4(exampleList);
-
- GENERAL_RECTANGLE.setX(GENERAL_FLOAT);
- GENERAL_RECTANGLE.setY(GENERAL_FLOAT);
- GENERAL_RECTANGLE.setWidth(GENERAL_FLOAT);
- GENERAL_RECTANGLE.setHeight(GENERAL_FLOAT);
-
- GENERAL_HAPTIC_RECT.setId(GENERAL_INTEGER);
- GENERAL_HAPTIC_RECT.setRect(GENERAL_RECTANGLE);
-
- GENERAL_RGBCOLOR.setRed(GENERAL_INTEGER);
- GENERAL_RGBCOLOR.setGreen(GENERAL_INTEGER);
- GENERAL_RGBCOLOR.setBlue(GENERAL_INTEGER);
-
- GENERAL_NIGHTCOLORSCHEME.setPrimaryColor(GENERAL_RGBCOLOR);
- GENERAL_NIGHTCOLORSCHEME.setSecondaryColor(GENERAL_RGBCOLOR);
- GENERAL_NIGHTCOLORSCHEME.setBackgroundColor(GENERAL_RGBCOLOR);
-
- GENERAL_DAYCOLORSCHEME.setPrimaryColor(GENERAL_RGBCOLOR);
- GENERAL_DAYCOLORSCHEME.setSecondaryColor(GENERAL_RGBCOLOR);
- GENERAL_DAYCOLORSCHEME.setBackgroundColor(GENERAL_RGBCOLOR);
-
- GENERAL_LOCKSCREENCONFIG.setAppIcon(R.drawable.sdl_lockscreen_icon);
- GENERAL_LOCKSCREENCONFIG.setBackgroundColor(Color.BLUE);
- GENERAL_LOCKSCREENCONFIG.setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
- GENERAL_LOCKSCREENCONFIG.setCustomView(R.layout.activity_sdllock_screen);
- GENERAL_CLOUDAPPPROPERTIES.setNicknames(GENERAL_STRING_LIST);
- GENERAL_CLOUDAPPPROPERTIES.setAppID(GENERAL_STRING);
- GENERAL_CLOUDAPPPROPERTIES.setEnabled(GENERAL_BOOLEAN);
- GENERAL_CLOUDAPPPROPERTIES.setAuthToken(GENERAL_STRING);
- GENERAL_CLOUDAPPPROPERTIES.setCloudTransportType(GENERAL_STRING);
- GENERAL_CLOUDAPPPROPERTIES.setHybridAppPreference(GENERAL_HYBRID_APP_PREFERENCE);
- GENERAL_CLOUDAPPPROPERTIES.setEndpoint(GENERAL_STRING);
- GENERAL_WEATHER_SERVICE_MANIFEST.setWeatherForLocationSupported(GENERAL_BOOLEAN);
- GENERAL_WEATHER_SERVICE_MANIFEST.setCurrentForecastSupported(GENERAL_BOOLEAN);
- GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMultidayForecastAmount(GENERAL_INTEGER);
- GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMinutelyForecastAmount(GENERAL_INTEGER);
- GENERAL_WEATHER_SERVICE_MANIFEST.setMaxHourlyForecastAmount(GENERAL_INTEGER);
-
- GENERAL_APPSERVICEMANIFEST.setWeatherServiceManifest(GENERAL_WEATHER_SERVICE_MANIFEST);
- GENERAL_APPSERVICEMANIFEST.setServiceName(GENERAL_STRING);
- GENERAL_APPSERVICEMANIFEST.setServiceIcon(GENERAL_IMAGE);
- GENERAL_APPSERVICEMANIFEST.setRpcSpecVersion(GENERAL_SDLMSGVERSION);
- GENERAL_APPSERVICEMANIFEST.setMediaServiceManifest(GENERAL_MEDIA_SERVICE_MANIFEST);
- GENERAL_APPSERVICEMANIFEST.setHandledRpcs(GENERAL_FUNCTION_ID_LIST);
- GENERAL_APPSERVICEMANIFEST.setAllowAppConsumers(GENERAL_BOOLEAN);
- GENERAL_APPSERVICEMANIFEST.setServiceType(GENERAL_STRING);
-
- GENERAL_NAVIGATION_SERVICE_MANIFEST.setAcceptsWayPoints(GENERAL_BOOLEAN);
-
- GENERAL_APPSERVICERECORD.setServiceID(GENERAL_STRING);
- GENERAL_APPSERVICERECORD.setServiceManifest(GENERAL_APPSERVICEMANIFEST);
- GENERAL_APPSERVICERECORD.setServiceActive(GENERAL_BOOLEAN);
- GENERAL_APPSERVICERECORD.setServicePublished(GENERAL_BOOLEAN);
-
- GENERAL_APP_SERVICE_CAPABILITY.setUpdatedAppServiceRecord(GENERAL_APPSERVICERECORD);
- GENERAL_APP_SERVICE_CAPABILITY.setUpdateReason(GENERAL_SERVICE_UPDATE_REASON);
-
- GENERAL_APP_SERVICE_CAPABILITIES.setAppServices(GENERAL_APPSERVICECAPABILITY_LIST);
-
- GENERAL_DATETIME.setDay(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setHour(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setMilliSecond(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setMinute(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setMonth(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setSecond(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setTzHour(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setTzMinute(TestValues.GENERAL_INT);
- GENERAL_DATETIME.setYear(TestValues.GENERAL_INT);
-
- GENERAL_WEATHERDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
- GENERAL_WEATHERDATA.setTemperatureHigh(GENERAL_TEMPERATURE);
- GENERAL_WEATHERDATA.setTemperatureLow(GENERAL_TEMPERATURE);
- GENERAL_WEATHERDATA.setApparentTemperature(GENERAL_TEMPERATURE);
- GENERAL_WEATHERDATA.setWeatherSummary(GENERAL_STRING);
- GENERAL_WEATHERDATA.setTime(GENERAL_DATETIME);
- GENERAL_WEATHERDATA.setHumidity(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setCloudCover(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setMoonPhase(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setWindBearing(GENERAL_INTEGER);
- GENERAL_WEATHERDATA.setWindGust(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setWindSpeed(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setNearestStormBearing(GENERAL_INTEGER);
- GENERAL_WEATHERDATA.setNearestStormDistance(GENERAL_INTEGER);
- GENERAL_WEATHERDATA.setPrecipAccumulation(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setPrecipIntensity(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setPrecipProbability(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setPrecipType(GENERAL_STRING);
- GENERAL_WEATHERDATA.setVisibility(GENERAL_FLOAT);
- GENERAL_WEATHERDATA.setWeatherIcon(GENERAL_IMAGE);
-
- GENERAL_WEATHERALERT.setTitle(GENERAL_STRING);
- GENERAL_WEATHERALERT.setSummary(GENERAL_STRING);
- GENERAL_WEATHERALERT.setExpires(GENERAL_DATETIME);
- GENERAL_WEATHERALERT.setRegions(GENERAL_STRING_LIST);
- GENERAL_WEATHERALERT.setSeverity(GENERAL_STRING);
- GENERAL_WEATHERALERT.setTimeIssued(GENERAL_DATETIME);
-
- GENERAL_WEATHERSERVICEDATA.setLocation(GENERAL_LOCATIONDETAILS);
- GENERAL_WEATHERSERVICEDATA.setCurrentForecast(GENERAL_WEATHERDATA);
- GENERAL_WEATHERSERVICEDATA.setMinuteForecast(GENERAL_WEATHERDATA_LIST);
- GENERAL_WEATHERSERVICEDATA.setHourlyForecast(GENERAL_WEATHERDATA_LIST);
- GENERAL_WEATHERSERVICEDATA.setMultidayForecast(GENERAL_WEATHERDATA_LIST);
- GENERAL_WEATHERSERVICEDATA.setAlerts(GENERAL_WEATHERALERT_LIST);
-
- GENERAL_MEDIASERVICEDATA.setMediaType(GENERAL_MEDIATYPE);
- GENERAL_MEDIASERVICEDATA.setMediaTitle(GENERAL_STRING);
- GENERAL_MEDIASERVICEDATA.setMediaArtist(GENERAL_STRING);
- GENERAL_MEDIASERVICEDATA.setMediaAlbum(GENERAL_STRING);
- GENERAL_MEDIASERVICEDATA.setPlaylistName(GENERAL_STRING);
- GENERAL_MEDIASERVICEDATA.setIsExplicit(GENERAL_BOOLEAN);
- GENERAL_MEDIASERVICEDATA.setTrackPlaybackProgress(GENERAL_INTEGER);
- GENERAL_MEDIASERVICEDATA.setTrackPlaybackDuration(GENERAL_INTEGER);
- GENERAL_MEDIASERVICEDATA.setQueuePlaybackProgress(GENERAL_INTEGER);
- GENERAL_MEDIASERVICEDATA.setQueuePlaybackDuration(GENERAL_INTEGER);
- GENERAL_MEDIASERVICEDATA.setQueueCurrentTrackNumber(GENERAL_INTEGER);
- GENERAL_MEDIASERVICEDATA.setQueueTotalTrackCount(GENERAL_INTEGER);
-
- GENERAL_APPSERVICEDATA.setServiceType(GENERAL_STRING);
- GENERAL_APPSERVICEDATA.setServiceID(GENERAL_STRING);
- GENERAL_APPSERVICEDATA.setWeatherServiceData(GENERAL_WEATHERSERVICEDATA);
- GENERAL_APPSERVICEDATA.setMediaServiceData(GENERAL_MEDIASERVICEDATA);
-
- GENERAL_NAVIGATION_INSTRUCTION.setLocationDetails(GENERAL_LOCATIONDETAILS);
- GENERAL_NAVIGATION_INSTRUCTION.setAction(GENERAL_NAVIGATIONACTION);
- GENERAL_NAVIGATION_INSTRUCTION.setEta(GENERAL_DATETIME);
- GENERAL_NAVIGATION_INSTRUCTION.setBearing(GENERAL_INTEGER);
- GENERAL_NAVIGATION_INSTRUCTION.setJunctionType(GENERAL_NAVIGATION_JUNCTION);
- GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
- GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
- GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
- GENERAL_MODULE_INFO.setModuleId(TestValues.GENERAL_STRING);
- GENERAL_MODULE_INFO.setModuleLocation(TestValues.GENERAL_GRID);
- GENERAL_MODULE_INFO.setModuleServiceArea(TestValues.GENERAL_GRID);
- GENERAL_MODULE_INFO.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
-
- GENERAL_GEAR_STATUS.setActualGear(GENERAL_ACTUAL_GEAR);
- GENERAL_GEAR_STATUS.setTransmissionType(GENERAL_TRANSMISSION_TYPE);
- GENERAL_GEAR_STATUS.setUserSelectedGear(GENERAL_USER_SELECTED_GEAR);
-
- GENERAL_WINDOW_STATUS.setLocation(TestValues.GENERAL_GRID);
- GENERAL_WINDOW_STATUS.setState(TestValues.GENERAL_WINDOW_STATE);
- GENERAL_STABILITY_CONTROL_STATUS.setEscSystem(GENERAL_ESC_SYSTEM);
- GENERAL_STABILITY_CONTROL_STATUS.setTrailerSwayControl(GENERAL_S_WAY_CONTROL);
-
- try {
- JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
- JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, GENERAL_HMILEVEL_LIST);
-
- JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, GENERAL_AUDIOTYPE);
- JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, GENERAL_BITSPERSAMPLE);
- JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, GENERAL_SAMPLINGRATE);
-
- JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, GENERAL_BOOLEAN);
- JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, GENERAL_BOOLEAN);
- JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, GENERAL_BOOLEAN);
-
- JSON_IMAGERESOLUTION.put(ImageResolution.KEY_RESOLUTION_HEIGHT, GENERAL_INT);
- JSON_IMAGERESOLUTION.put(ImageResolution.KEY_RESOLUTION_WIDTH, GENERAL_INT);
-
- JSON_CHOICE.put(Choice.KEY_MENU_NAME, GENERAL_STRING);
- JSON_CHOICE.put(Choice.KEY_SECONDARY_TEXT, GENERAL_STRING);
- JSON_CHOICE.put(Choice.KEY_TERTIARY_TEXT, GENERAL_STRING);
- JSON_CHOICE.put(Choice.KEY_CHOICE_ID, GENERAL_INT);
- JSON_CHOICE.put(Choice.KEY_IMAGE, JSON_IMAGE);
- 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);
-
- JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, JSON_HMILEVELS);
- JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, JSON_HMILEVELS);
-
- JSON_PARAMETERPERMISSIONS.put(ParameterPermissions.KEY_ALLOWED, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
- JSON_PARAMETERPERMISSIONS.put(ParameterPermissions.KEY_USER_DISALLOWED, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
-
- JSON_PERMISSIONITEM.put(PermissionItem.KEY_HMI_PERMISSIONS, JSON_HMIPERMISSIONS);
- JSON_PERMISSIONITEM.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, JSON_PARAMETERPERMISSIONS);
- JSON_PERMISSIONITEM.put(PermissionItem.KEY_RPC_NAME, GENERAL_STRING);
- JSON_PERMISSIONITEM.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, GENERAL_BOOLEAN);
- JSON_PERMISSIONITEMS.put(JSON_PERMISSIONITEM);
-
- JSON_IMAGE.put(Image.KEY_IMAGE_TYPE, GENERAL_IMAGETYPE);
- JSON_IMAGE.put(Image.KEY_VALUE, GENERAL_STRING);
- JSON_IMAGE.put(Image.KEY_IS_TEMPLATE, GENERAL_BOOLEAN);
-
- JSON_SOFTBUTTON.put(SoftButton.KEY_IS_HIGHLIGHTED , GENERAL_BOOLEAN);
- JSON_SOFTBUTTON.put(SoftButton.KEY_SOFT_BUTTON_ID, GENERAL_INT);
- JSON_SOFTBUTTON.put(SoftButton.KEY_SYSTEM_ACTION, SystemAction.STEAL_FOCUS);
- JSON_SOFTBUTTON.put(SoftButton.KEY_TEXT, GENERAL_STRING);
- JSON_SOFTBUTTON.put(SoftButton.KEY_TYPE, SoftButtonType.SBT_TEXT);
- JSON_SOFTBUTTON.put(SoftButton.KEY_IMAGE, GENERAL_IMAGE.serializeJSON());
- JSON_SOFTBUTTONS.put(JSON_SOFTBUTTON);
-
- JSON_TURN.put(Turn.KEY_NAVIGATION_TEXT, GENERAL_STRING);
- JSON_TURN.put(Turn.KEY_TURN_IMAGE, GENERAL_IMAGE.serializeJSON());
- JSON_TURNS.put(JSON_TURN);
-
- JSON_MENUPARAMS.put(MenuParams.KEY_MENU_NAME, GENERAL_STRING);
- JSON_MENUPARAMS.put(MenuParams.KEY_PARENT_ID, GENERAL_INT);
- JSON_MENUPARAMS.put(MenuParams.KEY_POSITION, GENERAL_INT);
-
- JSON_VRHELPITEM.put(VrHelpItem.KEY_TEXT, GENERAL_STRING);
- JSON_VRHELPITEM.put(VrHelpItem.KEY_IMAGE, JSON_IMAGE);
- JSON_VRHELPITEM.put(VrHelpItem.KEY_POSITION, GENERAL_INT);
- JSON_VRHELPITEMS.put(JSON_VRHELPITEM);
-
- JSONObject jsonTtsChunk = new JSONObject();
- jsonTtsChunk.put(TTSChunk.KEY_TEXT, "Welcome to the jungle");
- jsonTtsChunk.put(TTSChunk.KEY_TYPE, SpeechCapabilities.TEXT);
- JSON_TTSCHUNKS.put(jsonTtsChunk);
- jsonTtsChunk = new JSONObject();
- jsonTtsChunk.put(TTSChunk.KEY_TEXT, "Say a command");
- jsonTtsChunk.put(TTSChunk.KEY_TYPE, SpeechCapabilities.TEXT);
- JSON_TTSCHUNKS.put(jsonTtsChunk);
-
- JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, GENERAL_STRING);
- JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_KEYPRESS_MODE, KeypressMode.SINGLE_KEYPRESS);
- JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, KeyboardLayout.QWERTY);
- JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_LANGUAGE, Language.EN_US);
- JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
-
- JSON_STARTTIME.put(StartTime.KEY_HOURS, GENERAL_STARTTIME.getHours());
- JSON_STARTTIME.put(StartTime.KEY_MINUTES, GENERAL_STARTTIME.getMinutes());
- JSON_STARTTIME.put(StartTime.KEY_SECONDS, GENERAL_STARTTIME.getSeconds());
-
- JSON_CHOICES.put(JSON_CHOICE);
-
- JSON_DEVICEINFO.put(DeviceInfo.KEY_CARRIER, GENERAL_STRING);
- JSON_DEVICEINFO.put(DeviceInfo.KEY_FIRMWARE_REV, GENERAL_STRING);
- JSON_DEVICEINFO.put(DeviceInfo.KEY_HARDWARE, GENERAL_STRING);
- JSON_DEVICEINFO.put(DeviceInfo.KEY_MAX_NUMBER_RFCOMM_PORTS, GENERAL_INT);
- JSON_DEVICEINFO.put(DeviceInfo.KEY_OS, GENERAL_STRING);
- JSON_DEVICEINFO.put(DeviceInfo.KEY_OS_VERSION, GENERAL_STRING);
-
- JSON_RGBCOLOR.put(RGBColor.KEY_RED, GENERAL_INT);
- JSON_RGBCOLOR.put(RGBColor.KEY_GREEN, GENERAL_INT);
- JSON_RGBCOLOR.put(RGBColor.KEY_BLUE, GENERAL_INT);
-
- JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_PRIMARY_COLOR, JSON_RGBCOLOR);
- JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_SECONDARY_COLOR, JSON_RGBCOLOR);
- JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, JSON_RGBCOLOR);
-
- JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_PRIMARY_COLOR, JSON_RGBCOLOR);
- JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_SECONDARY_COLOR, JSON_RGBCOLOR);
- JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, JSON_RGBCOLOR);
-
- JSON_SDLMSGVERSION.put(SdlMsgVersion.KEY_MAJOR_VERSION, GENERAL_INT);
- JSON_SDLMSGVERSION.put(SdlMsgVersion.KEY_MINOR_VERSION, GENERAL_INT);
-
- JSON_DIDRESULT.put(DIDResult.KEY_DATA, GENERAL_STRING);
- JSON_DIDRESULT.put(DIDResult.KEY_DID_LOCATION, GENERAL_INT);
- JSON_DIDRESULT.put(DIDResult.KEY_RESULT_CODE, VehicleDataResultCode.SUCCESS);
- JSON_DIDRESULTS.put(JSON_DIDRESULT);
-
- JSON_PRESETBANKCAPABILITIES.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, GENERAL_BOOLEAN);
-
- JSONObject jsonButton = new JSONObject();
- jsonButton.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, false);
- jsonButton.put(ButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, GENERAL_BOOLEAN);
- jsonButton.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, GENERAL_BOOLEAN);
- jsonButton.put(ButtonCapabilities.KEY_NAME, ButtonName.SEEKRIGHT);
- JSON_BUTTONCAPABILITIES.put(jsonButton);
-
- JSONObject jsonRadioControlCapabilities = new JSONObject();
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, GENERAL_BOOLEAN);
- jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, GENERAL_BOOLEAN);
- JSON_RADIOCONTROLCAPABILITIES.put(jsonRadioControlCapabilities);
-
- JSONObject jsonClimateControlCapabilities = new JSONObject();
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, GENERAL_DEFROSTZONE_LIST);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, GENERAL_BOOLEAN);
- jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, GENERAL_VENTILATIONMODE_LIST);
- JSON_CLIMATECONTROLCAPABILITIES.put(jsonClimateControlCapabilities);
-
- jsonButton = new JSONObject();
- jsonButton.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, GENERAL_BOOLEAN);
- jsonButton.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, GENERAL_BOOLEAN);
- jsonButton.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, GENERAL_BOOLEAN);
- jsonButton.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, GENERAL_BOOLEAN);
- JSON_SOFTBUTTONCAPABILITIES.put(jsonButton);
-
- jsonButton = new JSONObject();
- jsonButton.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, GENERAL_AUDIOTYPE);
- jsonButton.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, GENERAL_BITSPERSAMPLE);
- jsonButton.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, GENERAL_SAMPLINGRATE);
- JSON_AUDIOPASSTHRUCAPABILITIES.put(jsonButton);
-
- JSON_TEXTFIELD.put(TextField.KEY_CHARACTER_SET, CharacterSet.CID1SET);
- JSON_TEXTFIELD.put(TextField.KEY_NAME, TextFieldName.ETA);
- JSON_TEXTFIELD.put(TextField.KEY_ROWS, GENERAL_INT);
- JSON_TEXTFIELD.put(TextField.KEY_WIDTH, GENERAL_INT);
- JSON_TEXTFIELDS.put(JSON_TEXTFIELD);
-
- JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_RESOLUTION, JSON_IMAGERESOLUTION);
- JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(TestValues.GENERAL_FILETYPE_LIST));
- JSON_IMAGEFIELD.put(ImageField.KEY_NAME, ImageFieldName.graphic);
- JSON_IMAGEFIELDS.put(JSON_IMAGEFIELD);
-
- JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_TYPE, GENERAL_WINDOWTYPE);
- 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);
- jsonTEC.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, GENERAL_BOOLEAN);
-
- JSON_SCREENPARAMS.put(ScreenParams.KEY_RESOLUTION, JSON_IMAGERESOLUTION);
- JSON_SCREENPARAMS.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, jsonTEC);
-
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_DISPLAY_TYPE, GENERAL_DISPLAYTYPE);
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_DISPLAY_NAME, GENERAL_STRING);
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_GRAPHIC_SUPPORTED, GENERAL_BOOLEAN);
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_IMAGE_FIELDS, JSON_IMAGEFIELDS);
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS, JsonUtils.createJsonArray(GENERAL_MEDIACLOCKFORMAT_LIST));
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, GENERAL_INT);
- JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_SCREEN_PARAMS, JSON_SCREENPARAMS);
- 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_DYNAMICUPDATECAPABILITIES.put(DynamicUpdateCapabilities.KEY_SUPPORTS_DYNAMIC_SUB_MENUS, GENERAL_BOOLEAN);
- JSON_DYNAMICUPDATECAPABILITIES.put(DynamicUpdateCapabilities.KEY_SUPPORTED_DYNAMIC_IMAGE_FIELD_NAMES, JsonUtils.createJsonArray(Collections.singletonList(GENERAL_IMAGEFIELDNAME)));
-
- JSON_TOUCHCOORD.put(TouchCoord.KEY_X, GENERAL_INT);
- JSON_TOUCHCOORD.put(TouchCoord.KEY_Y, GENERAL_INT);
- JSON_TOUCHCOORDS.put(JSON_TOUCHCOORD);
-
- JSON_TOUCHEVENT.put(TouchEvent.KEY_C, JSON_TOUCHCOORDS);
- JSON_TOUCHEVENT.put(TouchEvent.KEY_ID, GENERAL_INT);
- JSON_TOUCHEVENT.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(GENERAL_LONG_LIST));
- JSON_TOUCHEVENTS.put(JSON_TOUCHEVENT);
-
- JSON_TEXTFIELDTYPES.put(MetadataType.CURRENT_TEMPERATURE);
- 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, TestValues.GENERAL_STRING);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, TestValues.JSON_GRID);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, TestValues.JSON_GRID);
- JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
-
-
- } catch (JSONException e) {
- Log.e("Test", "Static Json Construction Failed.", e);
- }
- }
+ GENERAL_SYSTEMCAPABILITY.setSystemCapabilityType(GENERAL_SYSTEMCAPABILITYTYPE);
+
+ GENERAL_NAVIGATIONCAPABILITY.setSendLocationEnabled(GENERAL_BOOLEAN);
+ GENERAL_NAVIGATIONCAPABILITY.setWayPointsEnabled(GENERAL_BOOLEAN);
+
+ GENERAL_PHONECAPABILITY.setDialNumberEnabled(GENERAL_BOOLEAN);
+
+ GENERAL_VIDEOSTREAMINGFORMAT.setProtocol(GENERAL_VIDEOSTREAMINGPROTOCOL);
+ GENERAL_VIDEOSTREAMINGFORMAT.setCodec(GENERAL_VIDEOSTREAMINGCODEC);
+
+ GENERAL_VIDEOSTREAMINGFORMAT_LIST.add(GENERAL_VIDEOSTREAMINGFORMAT);
+ GENERAL_VIDEOSTREAMINGFORMAT_LIST.add(GENERAL_VIDEOSTREAMINGFORMAT);
+
+ GENERAL_VIDEOSTREAMINGCAPABILITY.setMaxBitrate(GENERAL_INT);
+ GENERAL_VIDEOSTREAMINGCAPABILITY.setPreferredResolution(GENERAL_IMAGERESOLUTION);
+ GENERAL_VIDEOSTREAMINGCAPABILITY.setSupportedFormats(GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ GENERAL_VIDEOSTREAMINGCAPABILITY.setIsHapticSpatialDataSupported(GENERAL_BOOLEAN);
+
+ GENERAL_CLIMATECONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setFanSpeedAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setDesiredTemperatureAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setAcEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setAcMaxEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setCirculateAirEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setAutoModeEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setDualModeEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZoneAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setDefrostZone(GENERAL_DEFROSTZONE_LIST);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationModeAvailable(GENERAL_BOOLEAN);
+ GENERAL_CLIMATECONTROLCAPABILITIES.setVentilationMode(GENERAL_VENTILATIONMODE_LIST);
+ GENERAL_CLIMATECONTROLCAPABILITIES_LIST.add(GENERAL_CLIMATECONTROLCAPABILITIES);
+
+ GENERAL_RADIOCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+ GENERAL_RADIOCONTROLCAPABILITIES.setRadioEnableAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setRadioBandAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setRadioFrequencyAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setHdChannelAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setRdsDataAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setAvailableHDsAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setStateAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setSignalStrengthAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES.setSignalChangeThresholdAvailable(GENERAL_BOOLEAN);
+ GENERAL_RADIOCONTROLCAPABILITIES_LIST.add(GENERAL_RADIOCONTROLCAPABILITIES);
+
+ GENERAL_SEATCONTROLCAPABILITIES.setMemoryAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setMassageCushionFirmnessAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setMassageModeAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setMassageEnabledAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setHeadSupportVerticalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setHeadSupportHorizontalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setBackTiltAngleAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setBackVerticalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setFrontVerticalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setVerticalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setHorizontalPositionAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setCoolingLevelAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setHeatingLevelAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setCoolingEnabledAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setHeatingEnabledAvailable(GENERAL_BOOLEAN);
+ GENERAL_SEATCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+ GENERAL_SEATCONTROLCAPABILITIES_LIST.add(GENERAL_SEATCONTROLCAPABILITIES);
+
+ GENERAL_AUDIOCONTROLCAPABILITIES.setEqualizerMaxChannelId(GENERAL_INT);
+ GENERAL_AUDIOCONTROLCAPABILITIES.setEqualizerAvailable(GENERAL_BOOLEAN);
+ GENERAL_AUDIOCONTROLCAPABILITIES.setVolumeAvailable(GENERAL_BOOLEAN);
+ GENERAL_AUDIOCONTROLCAPABILITIES.setSourceAvailable(GENERAL_BOOLEAN);
+ GENERAL_AUDIOCONTROLCAPABILITIES.setKeepContextAvailable(GENERAL_BOOLEAN);
+ GENERAL_AUDIOCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+ GENERAL_AUDIOCONTROLCAPABILITIES_LIST.add(GENERAL_AUDIOCONTROLCAPABILITIES);
+
+ GENERAL_HMISETTINGSCONTROLCAPABILITIES.setDisplayModeUnitAvailable(GENERAL_BOOLEAN);
+ GENERAL_HMISETTINGSCONTROLCAPABILITIES.setDistanceUnitAvailable(GENERAL_BOOLEAN);
+ GENERAL_HMISETTINGSCONTROLCAPABILITIES.setTemperatureUnitAvailable(GENERAL_BOOLEAN);
+ GENERAL_HMISETTINGSCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+
+ GENERAL_LIGHTCONTROLCAPABILITIES.setSupportedLights(GENERAL_LIGHTCAPABILITIES_LIST);
+ GENERAL_LIGHTCONTROLCAPABILITIES.setModuleName(GENERAL_STRING);
+
+ GENERAL_EQUALIZERSETTINGS.setChannelSetting(GENERAL_INT);
+ GENERAL_EQUALIZERSETTINGS.setChannelName(GENERAL_STRING);
+ GENERAL_EQUALIZERSETTINGS.setChannelId(GENERAL_INT);
+ GENERAL_EQUALIZERSETTINGS_LIST.add(GENERAL_EQUALIZERSETTINGS);
+
+ GENERAL_LIGHTCAPABILITIES.setName(GENERAL_LIGHTNAME);
+ GENERAL_LIGHTCAPABILITIES.setDensityAvailable(GENERAL_BOOLEAN);
+ GENERAL_LIGHTCAPABILITIES.setRGBColorSpaceAvailable(GENERAL_BOOLEAN);
+ GENERAL_LIGHTCAPABILITIES_LIST.add(GENERAL_LIGHTCAPABILITIES);
+
+ GENERAL_LIGHTSTATE.setId(GENERAL_LIGHTNAME);
+ GENERAL_LIGHTSTATE.setDensity(GENERAL_FLOAT);
+ GENERAL_LIGHTSTATE.setStatus(GENERAL_LIGHTSTATUS);
+ GENERAL_LIGHTSTATE.setColor(GENERAL_RGBCOLOR);
+ GENERAL_LIGHTSTATE_LIST.add(GENERAL_LIGHTSTATE);
+
+ GENERAL_REMOTECONTROLCAPABILITIES.setButtonCapabilities(GENERAL_BUTTONCAPABILITIES_LIST);
+ GENERAL_REMOTECONTROLCAPABILITIES.setClimateControlCapabilities(GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
+ GENERAL_REMOTECONTROLCAPABILITIES.setRadioControlCapabilities(GENERAL_RADIOCONTROLCAPABILITIES_LIST);
+
+ GENERAL_HMICAPABILITIES.setNavigationAvilable(GENERAL_BOOLEAN);
+ GENERAL_HMICAPABILITIES.setVideoStreamingAvailable(GENERAL_BOOLEAN);
+ GENERAL_HMICAPABILITIES.setPhoneCallAvilable(GENERAL_BOOLEAN);
+
+ List<MetadataType> exampleList = new ArrayList<>();
+ exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
+ exampleList.add(1, MetadataType.MEDIA_ALBUM);
+ exampleList.add(2, MetadataType.MEDIA_ARTIST);
+
+ GENERAL_METADATASTRUCT.setMainField1(exampleList);
+ GENERAL_METADATASTRUCT.setMainField2(exampleList);
+ GENERAL_METADATASTRUCT.setMainField3(exampleList);
+ GENERAL_METADATASTRUCT.setMainField4(exampleList);
+
+ GENERAL_RECTANGLE.setX(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setY(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setWidth(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setHeight(GENERAL_FLOAT);
+
+ GENERAL_HAPTIC_RECT.setId(GENERAL_INTEGER);
+ GENERAL_HAPTIC_RECT.setRect(GENERAL_RECTANGLE);
+
+ GENERAL_RGBCOLOR.setRed(GENERAL_INTEGER);
+ GENERAL_RGBCOLOR.setGreen(GENERAL_INTEGER);
+ GENERAL_RGBCOLOR.setBlue(GENERAL_INTEGER);
+
+ GENERAL_NIGHTCOLORSCHEME.setPrimaryColor(GENERAL_RGBCOLOR);
+ GENERAL_NIGHTCOLORSCHEME.setSecondaryColor(GENERAL_RGBCOLOR);
+ GENERAL_NIGHTCOLORSCHEME.setBackgroundColor(GENERAL_RGBCOLOR);
+
+ GENERAL_DAYCOLORSCHEME.setPrimaryColor(GENERAL_RGBCOLOR);
+ GENERAL_DAYCOLORSCHEME.setSecondaryColor(GENERAL_RGBCOLOR);
+ GENERAL_DAYCOLORSCHEME.setBackgroundColor(GENERAL_RGBCOLOR);
+
+ GENERAL_LOCKSCREENCONFIG.setAppIcon(R.drawable.sdl_lockscreen_icon);
+ GENERAL_LOCKSCREENCONFIG.setBackgroundColor(Color.BLUE);
+ GENERAL_LOCKSCREENCONFIG.setDisplayMode(LockScreenConfig.DISPLAY_MODE_ALWAYS);
+ GENERAL_LOCKSCREENCONFIG.setCustomView(R.layout.activity_sdllock_screen);
+ GENERAL_CLOUDAPPPROPERTIES.setNicknames(GENERAL_STRING_LIST);
+ GENERAL_CLOUDAPPPROPERTIES.setAppID(GENERAL_STRING);
+ GENERAL_CLOUDAPPPROPERTIES.setEnabled(GENERAL_BOOLEAN);
+ GENERAL_CLOUDAPPPROPERTIES.setAuthToken(GENERAL_STRING);
+ GENERAL_CLOUDAPPPROPERTIES.setCloudTransportType(GENERAL_STRING);
+ GENERAL_CLOUDAPPPROPERTIES.setHybridAppPreference(GENERAL_HYBRID_APP_PREFERENCE);
+ GENERAL_CLOUDAPPPROPERTIES.setEndpoint(GENERAL_STRING);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setWeatherForLocationSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setCurrentForecastSupported(GENERAL_BOOLEAN);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMultidayForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxMinutelyForecastAmount(GENERAL_INTEGER);
+ GENERAL_WEATHER_SERVICE_MANIFEST.setMaxHourlyForecastAmount(GENERAL_INTEGER);
+
+ GENERAL_APPSERVICEMANIFEST.setWeatherServiceManifest(GENERAL_WEATHER_SERVICE_MANIFEST);
+ GENERAL_APPSERVICEMANIFEST.setServiceName(GENERAL_STRING);
+ GENERAL_APPSERVICEMANIFEST.setServiceIcon(GENERAL_IMAGE);
+ GENERAL_APPSERVICEMANIFEST.setRpcSpecVersion(GENERAL_SDLMSGVERSION);
+ GENERAL_APPSERVICEMANIFEST.setMediaServiceManifest(GENERAL_MEDIA_SERVICE_MANIFEST);
+ GENERAL_APPSERVICEMANIFEST.setHandledRpcs(GENERAL_FUNCTION_ID_LIST);
+ GENERAL_APPSERVICEMANIFEST.setAllowAppConsumers(GENERAL_BOOLEAN);
+ GENERAL_APPSERVICEMANIFEST.setServiceType(GENERAL_STRING);
+
+ GENERAL_NAVIGATION_SERVICE_MANIFEST.setAcceptsWayPoints(GENERAL_BOOLEAN);
+
+ GENERAL_APPSERVICERECORD.setServiceID(GENERAL_STRING);
+ GENERAL_APPSERVICERECORD.setServiceManifest(GENERAL_APPSERVICEMANIFEST);
+ GENERAL_APPSERVICERECORD.setServiceActive(GENERAL_BOOLEAN);
+ GENERAL_APPSERVICERECORD.setServicePublished(GENERAL_BOOLEAN);
+
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdatedAppServiceRecord(GENERAL_APPSERVICERECORD);
+ GENERAL_APP_SERVICE_CAPABILITY.setUpdateReason(GENERAL_SERVICE_UPDATE_REASON);
+
+ GENERAL_APP_SERVICE_CAPABILITIES.setAppServices(GENERAL_APPSERVICECAPABILITY_LIST);
+
+ GENERAL_DATETIME.setDay(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setHour(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMilliSecond(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMinute(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setMonth(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setSecond(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setTzHour(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setTzMinute(TestValues.GENERAL_INT);
+ GENERAL_DATETIME.setYear(TestValues.GENERAL_INT);
+
+ GENERAL_WEATHERDATA.setCurrentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureHigh(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setTemperatureLow(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setApparentTemperature(GENERAL_TEMPERATURE);
+ GENERAL_WEATHERDATA.setWeatherSummary(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setTime(GENERAL_DATETIME);
+ GENERAL_WEATHERDATA.setHumidity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setCloudCover(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setMoonPhase(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setWindGust(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWindSpeed(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setNearestStormBearing(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setNearestStormDistance(GENERAL_INTEGER);
+ GENERAL_WEATHERDATA.setPrecipAccumulation(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipIntensity(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipProbability(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setPrecipType(GENERAL_STRING);
+ GENERAL_WEATHERDATA.setVisibility(GENERAL_FLOAT);
+ GENERAL_WEATHERDATA.setWeatherIcon(GENERAL_IMAGE);
+
+ GENERAL_WEATHERALERT.setTitle(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setSummary(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setExpires(GENERAL_DATETIME);
+ GENERAL_WEATHERALERT.setRegions(GENERAL_STRING_LIST);
+ GENERAL_WEATHERALERT.setSeverity(GENERAL_STRING);
+ GENERAL_WEATHERALERT.setTimeIssued(GENERAL_DATETIME);
+
+ GENERAL_WEATHERSERVICEDATA.setLocation(GENERAL_LOCATIONDETAILS);
+ GENERAL_WEATHERSERVICEDATA.setCurrentForecast(GENERAL_WEATHERDATA);
+ GENERAL_WEATHERSERVICEDATA.setMinuteForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICEDATA.setHourlyForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICEDATA.setMultidayForecast(GENERAL_WEATHERDATA_LIST);
+ GENERAL_WEATHERSERVICEDATA.setAlerts(GENERAL_WEATHERALERT_LIST);
+
+ GENERAL_MEDIASERVICEDATA.setMediaType(GENERAL_MEDIATYPE);
+ GENERAL_MEDIASERVICEDATA.setMediaTitle(GENERAL_STRING);
+ GENERAL_MEDIASERVICEDATA.setMediaArtist(GENERAL_STRING);
+ GENERAL_MEDIASERVICEDATA.setMediaAlbum(GENERAL_STRING);
+ GENERAL_MEDIASERVICEDATA.setPlaylistName(GENERAL_STRING);
+ GENERAL_MEDIASERVICEDATA.setIsExplicit(GENERAL_BOOLEAN);
+ GENERAL_MEDIASERVICEDATA.setTrackPlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICEDATA.setTrackPlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICEDATA.setQueuePlaybackProgress(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICEDATA.setQueuePlaybackDuration(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICEDATA.setQueueCurrentTrackNumber(GENERAL_INTEGER);
+ GENERAL_MEDIASERVICEDATA.setQueueTotalTrackCount(GENERAL_INTEGER);
+
+ GENERAL_APPSERVICEDATA.setServiceType(GENERAL_STRING);
+ GENERAL_APPSERVICEDATA.setServiceID(GENERAL_STRING);
+ GENERAL_APPSERVICEDATA.setWeatherServiceData(GENERAL_WEATHERSERVICEDATA);
+ GENERAL_APPSERVICEDATA.setMediaServiceData(GENERAL_MEDIASERVICEDATA);
+
+ GENERAL_NAVIGATION_INSTRUCTION.setLocationDetails(GENERAL_LOCATIONDETAILS);
+ GENERAL_NAVIGATION_INSTRUCTION.setAction(GENERAL_NAVIGATIONACTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setEta(GENERAL_DATETIME);
+ GENERAL_NAVIGATION_INSTRUCTION.setBearing(GENERAL_INTEGER);
+ GENERAL_NAVIGATION_INSTRUCTION.setJunctionType(GENERAL_NAVIGATION_JUNCTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
+ GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
+ GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
+ GENERAL_MODULE_INFO.setModuleId(TestValues.GENERAL_STRING);
+ GENERAL_MODULE_INFO.setModuleLocation(TestValues.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setModuleServiceArea(TestValues.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
+
+ GENERAL_GEAR_STATUS.setActualGear(GENERAL_ACTUAL_GEAR);
+ GENERAL_GEAR_STATUS.setTransmissionType(GENERAL_TRANSMISSION_TYPE);
+ GENERAL_GEAR_STATUS.setUserSelectedGear(GENERAL_USER_SELECTED_GEAR);
+
+ GENERAL_WINDOW_STATUS.setLocation(TestValues.GENERAL_GRID);
+ GENERAL_WINDOW_STATUS.setState(TestValues.GENERAL_WINDOW_STATE);
+ GENERAL_STABILITY_CONTROL_STATUS.setEscSystem(GENERAL_ESC_SYSTEM);
+ GENERAL_STABILITY_CONTROL_STATUS.setTrailerSwayControl(GENERAL_S_WAY_CONTROL);
+
+ try {
+ JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
+ JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, GENERAL_HMILEVEL_LIST);
+
+ JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, GENERAL_AUDIOTYPE);
+ JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, GENERAL_BITSPERSAMPLE);
+ JSON_PCMSTREAMCAPABILITIES.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, GENERAL_SAMPLINGRATE);
+
+ JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+ JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, GENERAL_BOOLEAN);
+ JSON_TOUCHEVENTCAPABILITIES.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+
+ JSON_IMAGERESOLUTION.put(ImageResolution.KEY_RESOLUTION_HEIGHT, GENERAL_INT);
+ JSON_IMAGERESOLUTION.put(ImageResolution.KEY_RESOLUTION_WIDTH, GENERAL_INT);
+
+ JSON_CHOICE.put(Choice.KEY_MENU_NAME, GENERAL_STRING);
+ JSON_CHOICE.put(Choice.KEY_SECONDARY_TEXT, GENERAL_STRING);
+ JSON_CHOICE.put(Choice.KEY_TERTIARY_TEXT, GENERAL_STRING);
+ JSON_CHOICE.put(Choice.KEY_CHOICE_ID, GENERAL_INT);
+ JSON_CHOICE.put(Choice.KEY_IMAGE, JSON_IMAGE);
+ 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);
+
+ JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, JSON_HMILEVELS);
+ JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, JSON_HMILEVELS);
+
+ JSON_PARAMETERPERMISSIONS.put(ParameterPermissions.KEY_ALLOWED, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+ JSON_PARAMETERPERMISSIONS.put(ParameterPermissions.KEY_USER_DISALLOWED, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+
+ JSON_PERMISSIONITEM.put(PermissionItem.KEY_HMI_PERMISSIONS, JSON_HMIPERMISSIONS);
+ JSON_PERMISSIONITEM.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, JSON_PARAMETERPERMISSIONS);
+ JSON_PERMISSIONITEM.put(PermissionItem.KEY_RPC_NAME, GENERAL_STRING);
+ JSON_PERMISSIONITEM.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, GENERAL_BOOLEAN);
+ JSON_PERMISSIONITEMS.put(JSON_PERMISSIONITEM);
+
+ JSON_IMAGE.put(Image.KEY_IMAGE_TYPE, GENERAL_IMAGETYPE);
+ JSON_IMAGE.put(Image.KEY_VALUE, GENERAL_STRING);
+ JSON_IMAGE.put(Image.KEY_IS_TEMPLATE, GENERAL_BOOLEAN);
+
+ JSON_SOFTBUTTON.put(SoftButton.KEY_IS_HIGHLIGHTED, GENERAL_BOOLEAN);
+ JSON_SOFTBUTTON.put(SoftButton.KEY_SOFT_BUTTON_ID, GENERAL_INT);
+ JSON_SOFTBUTTON.put(SoftButton.KEY_SYSTEM_ACTION, SystemAction.STEAL_FOCUS);
+ JSON_SOFTBUTTON.put(SoftButton.KEY_TEXT, GENERAL_STRING);
+ JSON_SOFTBUTTON.put(SoftButton.KEY_TYPE, SoftButtonType.SBT_TEXT);
+ JSON_SOFTBUTTON.put(SoftButton.KEY_IMAGE, GENERAL_IMAGE.serializeJSON());
+ JSON_SOFTBUTTONS.put(JSON_SOFTBUTTON);
+
+ JSON_TURN.put(Turn.KEY_NAVIGATION_TEXT, GENERAL_STRING);
+ JSON_TURN.put(Turn.KEY_TURN_IMAGE, GENERAL_IMAGE.serializeJSON());
+ JSON_TURNS.put(JSON_TURN);
+
+ JSON_MENUPARAMS.put(MenuParams.KEY_MENU_NAME, GENERAL_STRING);
+ JSON_MENUPARAMS.put(MenuParams.KEY_PARENT_ID, GENERAL_INT);
+ JSON_MENUPARAMS.put(MenuParams.KEY_POSITION, GENERAL_INT);
+
+ JSON_VRHELPITEM.put(VrHelpItem.KEY_TEXT, GENERAL_STRING);
+ JSON_VRHELPITEM.put(VrHelpItem.KEY_IMAGE, JSON_IMAGE);
+ JSON_VRHELPITEM.put(VrHelpItem.KEY_POSITION, GENERAL_INT);
+ JSON_VRHELPITEMS.put(JSON_VRHELPITEM);
+
+ JSONObject jsonTtsChunk = new JSONObject();
+ jsonTtsChunk.put(TTSChunk.KEY_TEXT, "Welcome to the jungle");
+ jsonTtsChunk.put(TTSChunk.KEY_TYPE, SpeechCapabilities.TEXT);
+ JSON_TTSCHUNKS.put(jsonTtsChunk);
+ jsonTtsChunk = new JSONObject();
+ jsonTtsChunk.put(TTSChunk.KEY_TEXT, "Say a command");
+ jsonTtsChunk.put(TTSChunk.KEY_TYPE, SpeechCapabilities.TEXT);
+ JSON_TTSCHUNKS.put(jsonTtsChunk);
+
+ JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, GENERAL_STRING);
+ JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_KEYPRESS_MODE, KeypressMode.SINGLE_KEYPRESS);
+ JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, KeyboardLayout.QWERTY);
+ JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_LANGUAGE, Language.EN_US);
+ JSON_KEYBOARDPROPERTIES.put(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+
+ JSON_STARTTIME.put(StartTime.KEY_HOURS, GENERAL_STARTTIME.getHours());
+ JSON_STARTTIME.put(StartTime.KEY_MINUTES, GENERAL_STARTTIME.getMinutes());
+ JSON_STARTTIME.put(StartTime.KEY_SECONDS, GENERAL_STARTTIME.getSeconds());
+
+ JSON_CHOICES.put(JSON_CHOICE);
+
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_CARRIER, GENERAL_STRING);
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_FIRMWARE_REV, GENERAL_STRING);
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_HARDWARE, GENERAL_STRING);
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_MAX_NUMBER_RFCOMM_PORTS, GENERAL_INT);
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_OS, GENERAL_STRING);
+ JSON_DEVICEINFO.put(DeviceInfo.KEY_OS_VERSION, GENERAL_STRING);
+
+ JSON_RGBCOLOR.put(RGBColor.KEY_RED, GENERAL_INT);
+ JSON_RGBCOLOR.put(RGBColor.KEY_GREEN, GENERAL_INT);
+ JSON_RGBCOLOR.put(RGBColor.KEY_BLUE, GENERAL_INT);
+
+ JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_PRIMARY_COLOR, JSON_RGBCOLOR);
+ JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_SECONDARY_COLOR, JSON_RGBCOLOR);
+ JSON_DAYCOLORSCHEME.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, JSON_RGBCOLOR);
+
+ JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_PRIMARY_COLOR, JSON_RGBCOLOR);
+ JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_SECONDARY_COLOR, JSON_RGBCOLOR);
+ JSON_NIGHTCOLORSCHEME.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, JSON_RGBCOLOR);
+
+ JSON_SDLMSGVERSION.put(SdlMsgVersion.KEY_MAJOR_VERSION, GENERAL_INT);
+ JSON_SDLMSGVERSION.put(SdlMsgVersion.KEY_MINOR_VERSION, GENERAL_INT);
+
+ JSON_DIDRESULT.put(DIDResult.KEY_DATA, GENERAL_STRING);
+ JSON_DIDRESULT.put(DIDResult.KEY_DID_LOCATION, GENERAL_INT);
+ JSON_DIDRESULT.put(DIDResult.KEY_RESULT_CODE, VehicleDataResultCode.SUCCESS);
+ JSON_DIDRESULTS.put(JSON_DIDRESULT);
+
+ JSON_PRESETBANKCAPABILITIES.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, GENERAL_BOOLEAN);
+
+ JSONObject jsonButton = new JSONObject();
+ jsonButton.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, false);
+ jsonButton.put(ButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+ jsonButton.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, GENERAL_BOOLEAN);
+ jsonButton.put(ButtonCapabilities.KEY_NAME, ButtonName.SEEKRIGHT);
+ JSON_BUTTONCAPABILITIES.put(jsonButton);
+
+ JSONObject jsonRadioControlCapabilities = new JSONObject();
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, GENERAL_BOOLEAN);
+ jsonRadioControlCapabilities.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, GENERAL_BOOLEAN);
+ JSON_RADIOCONTROLCAPABILITIES.put(jsonRadioControlCapabilities);
+
+ JSONObject jsonClimateControlCapabilities = new JSONObject();
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_MODULE_NAME, GENERAL_STRING);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, GENERAL_DEFROSTZONE_LIST);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, GENERAL_BOOLEAN);
+ jsonClimateControlCapabilities.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, GENERAL_VENTILATIONMODE_LIST);
+ JSON_CLIMATECONTROLCAPABILITIES.put(jsonClimateControlCapabilities);
+
+ jsonButton = new JSONObject();
+ jsonButton.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+ jsonButton.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+ jsonButton.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, GENERAL_BOOLEAN);
+ jsonButton.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, GENERAL_BOOLEAN);
+ JSON_SOFTBUTTONCAPABILITIES.put(jsonButton);
+
+ jsonButton = new JSONObject();
+ jsonButton.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, GENERAL_AUDIOTYPE);
+ jsonButton.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, GENERAL_BITSPERSAMPLE);
+ jsonButton.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, GENERAL_SAMPLINGRATE);
+ JSON_AUDIOPASSTHRUCAPABILITIES.put(jsonButton);
+
+ JSON_TEXTFIELD.put(TextField.KEY_CHARACTER_SET, CharacterSet.CID1SET);
+ JSON_TEXTFIELD.put(TextField.KEY_NAME, TextFieldName.ETA);
+ JSON_TEXTFIELD.put(TextField.KEY_ROWS, GENERAL_INT);
+ JSON_TEXTFIELD.put(TextField.KEY_WIDTH, GENERAL_INT);
+ JSON_TEXTFIELDS.put(JSON_TEXTFIELD);
+
+ JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_RESOLUTION, JSON_IMAGERESOLUTION);
+ JSON_IMAGEFIELD.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(TestValues.GENERAL_FILETYPE_LIST));
+ JSON_IMAGEFIELD.put(ImageField.KEY_NAME, ImageFieldName.graphic);
+ JSON_IMAGEFIELDS.put(JSON_IMAGEFIELD);
+
+ JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_TYPE, GENERAL_WINDOWTYPE);
+ 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);
+ jsonTEC.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, GENERAL_BOOLEAN);
+
+ JSON_SCREENPARAMS.put(ScreenParams.KEY_RESOLUTION, JSON_IMAGERESOLUTION);
+ JSON_SCREENPARAMS.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, jsonTEC);
+
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_DISPLAY_TYPE, GENERAL_DISPLAYTYPE);
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_DISPLAY_NAME, GENERAL_STRING);
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_GRAPHIC_SUPPORTED, GENERAL_BOOLEAN);
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_IMAGE_FIELDS, JSON_IMAGEFIELDS);
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS, JsonUtils.createJsonArray(GENERAL_MEDIACLOCKFORMAT_LIST));
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, GENERAL_INT);
+ JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_SCREEN_PARAMS, JSON_SCREENPARAMS);
+ 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_DYNAMICUPDATECAPABILITIES.put(DynamicUpdateCapabilities.KEY_SUPPORTS_DYNAMIC_SUB_MENUS, GENERAL_BOOLEAN);
+ JSON_DYNAMICUPDATECAPABILITIES.put(DynamicUpdateCapabilities.KEY_SUPPORTED_DYNAMIC_IMAGE_FIELD_NAMES, JsonUtils.createJsonArray(Collections.singletonList(GENERAL_IMAGEFIELDNAME)));
+
+ JSON_TOUCHCOORD.put(TouchCoord.KEY_X, GENERAL_INT);
+ JSON_TOUCHCOORD.put(TouchCoord.KEY_Y, GENERAL_INT);
+ JSON_TOUCHCOORDS.put(JSON_TOUCHCOORD);
+
+ JSON_TOUCHEVENT.put(TouchEvent.KEY_C, JSON_TOUCHCOORDS);
+ JSON_TOUCHEVENT.put(TouchEvent.KEY_ID, GENERAL_INT);
+ JSON_TOUCHEVENT.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(GENERAL_LONG_LIST));
+ JSON_TOUCHEVENTS.put(JSON_TOUCHEVENT);
+
+ JSON_TEXTFIELDTYPES.put(MetadataType.CURRENT_TEMPERATURE);
+ 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, TestValues.GENERAL_STRING);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, TestValues.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, TestValues.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.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 da99ac3fd..97a67ed94 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
@@ -19,149 +19,150 @@ import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import java.util.Iterator;
import java.util.List;
-public class Validator{
+public class Validator {
// TODO: This class could be (mostly) eliminated if all RPC classes implement their own .equals() and .hashCode() methods.
- // Some special methods do exist for pseudo-enums (FrameType, SessionType, FrameData, FrameDataControlFrame)
-
- private Validator(){}
+ // Some special methods do exist for pseudo-enums (FrameType, SessionType, FrameData, FrameDataControlFrame)
- public static boolean validateMenuParams(MenuParams menuParams1, MenuParams menuParams2){
- if(menuParams1 == null){
- return ( menuParams2 == null );
+ private Validator() {
+ }
+
+ public static boolean validateMenuParams(MenuParams menuParams1, MenuParams menuParams2) {
+ if (menuParams1 == null) {
+ return (menuParams2 == null);
}
- if(menuParams2 == null){
- return ( menuParams1 == null );
+ if (menuParams2 == null) {
+ return (menuParams1 == null);
}
- return ( menuParams1.getMenuName().equals(menuParams2.getMenuName())
+ return (menuParams1.getMenuName().equals(menuParams2.getMenuName())
&& menuParams1.getParentID() == menuParams2.getParentID() && menuParams1.getPosition() == menuParams2
- .getPosition() );
+ .getPosition());
}
-
- public static boolean validateVehicleDataResult(VehicleDataResult result1, VehicleDataResult result2){
- if(result1 == null){
- return ( result2 == null );
+
+ public static boolean validateVehicleDataResult(VehicleDataResult result1, VehicleDataResult result2) {
+ if (result1 == null) {
+ return (result2 == null);
}
- if(result2 == null){
- return ( result1 == null );
+ if (result2 == null) {
+ return (result1 == null);
}
- if(result1.getDataType() != null && result2.getDataType() != 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){
- if(array1 == null){
- return ( array2 == null );
- }
- if(array2 == null){
- return ( array1 == null );
- }
-
- if(array1.length != array2.length){
- return false;
- }
-
- for(int i = 0; i < array1.length; i++){
- if(array1[i] != array2[i]){
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateFrameTypeArray (FrameType[] array1, FrameType[] array2) {
-
- if (array1 == null) {
- return (array2 == null);
- }
-
- if (array2 == null) {
- return (array1 == null);
- }
-
- if (array1.length != array2.length) {
- return false;
- }
-
- for (int i = 0; i < array1.length; i++) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateSessionTypeArray (SessionType[] array1, SessionType[] array2) {
-
- if (array1 == null) {
- return (array2 == null);
- }
-
- if (array2 == null) {
- return (array1 == null);
- }
-
- if (array1.length != array2.length) {
- return false;
- }
-
- for (int i = 0; i < array1.length; i++) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateFrameDataControlFrameTypeArray (FrameDataControlFrameType[] array1, FrameDataControlFrameType[] array2) {
-
- if (array1 == null) {
- return (array2 == null);
- }
-
- if (array2 == null) {
- return (array1 == null);
- }
-
- if (array1.length != array2.length) {
- return false;
- }
-
- for (int i = 0; i < array1.length; i++) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
-
- return true;
- }
-
-
- public static boolean validateImage(Image image1, Image image2){
- if(image1 == null){
- return ( image2 == null );
- }
- if(image2 == null){
- return ( image1 == null );
- }
-
- if(!( image1.getValue().equals(image2.getValue()) )){
+ return (result1.getOEMCustomVehicleDataType().equals(result2.getOEMCustomVehicleDataType())
+ && result1.getResultCode().equals(result2.getResultCode()));
+ }
+ }
+
+ public static boolean validateBulkData(byte[] array1, byte[] array2) {
+ if (array1 == null) {
+ return (array2 == null);
+ }
+ if (array2 == null) {
+ return (array1 == null);
+ }
+
+ if (array1.length != array2.length) {
+ return false;
+ }
+
+ for (int i = 0; i < array1.length; i++) {
+ if (array1[i] != array2[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateFrameTypeArray(FrameType[] array1, FrameType[] array2) {
+
+ if (array1 == null) {
+ return (array2 == null);
+ }
+
+ if (array2 == null) {
+ return (array1 == null);
+ }
+
+ if (array1.length != array2.length) {
+ return false;
+ }
+
+ for (int i = 0; i < array1.length; i++) {
+ if (array1[i] != array2[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateSessionTypeArray(SessionType[] array1, SessionType[] array2) {
+
+ if (array1 == null) {
+ return (array2 == null);
+ }
+
+ if (array2 == null) {
+ return (array1 == null);
+ }
+
+ if (array1.length != array2.length) {
+ return false;
+ }
+
+ for (int i = 0; i < array1.length; i++) {
+ if (array1[i] != array2[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateFrameDataControlFrameTypeArray(FrameDataControlFrameType[] array1, FrameDataControlFrameType[] array2) {
+
+ if (array1 == null) {
+ return (array2 == null);
+ }
+
+ if (array2 == null) {
+ return (array1 == null);
+ }
+
+ if (array1.length != array2.length) {
+ return false;
+ }
+
+ for (int i = 0; i < array1.length; i++) {
+ if (array1[i] != array2[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+ public static boolean validateImage(Image image1, Image image2) {
+ if (image1 == null) {
+ return (image2 == null);
+ }
+ if (image2 == null) {
+ return (image1 == null);
+ }
+
+ if (!(image1.getValue().equals(image2.getValue()))) {
log("validateImage",
"image1 name \"" + image1.getValue() + "\" didn't match image2 name \"" + image2.getValue() + "\".");
return false;
}
- if(image1.getImageType() != image2.getImageType()){
+ if (image1.getImageType() != image2.getImageType()) {
log("validateImage",
"image1 type \"" + image1.getImageType() + "\" didn't match image2 type \"" + image2.getImageType()
+ "\".");
@@ -171,33 +172,33 @@ public class Validator{
return true;
}
- public static boolean validateSdlFile(SdlFile sdlFile1, SdlFile sdlFile2){
- if(sdlFile1 == null){
- return ( sdlFile2 == null );
+ public static boolean validateSdlFile(SdlFile sdlFile1, SdlFile sdlFile2) {
+ if (sdlFile1 == null) {
+ return (sdlFile2 == null);
}
- if(sdlFile2 == null){
- return ( sdlFile1 == null );
+ if (sdlFile2 == null) {
+ return (sdlFile1 == null);
}
- if(!( sdlFile1.getName().equals(sdlFile2.getName()) )){
+ if (!(sdlFile1.getName().equals(sdlFile2.getName()))) {
log("validateSdlFile",
"sdlFile1 name \"" + sdlFile1.getName() + "\" didn't match sdlFile2 name \"" + sdlFile2.getName() + "\".");
return false;
}
- if(sdlFile1.getResourceId() != sdlFile2.getResourceId() ){
+ if (sdlFile1.getResourceId() != sdlFile2.getResourceId()) {
log("validateSdlFile",
"sdlFile1 resourceId \"" + sdlFile1.getName() + "\" didn't match sdlFile2 resourceId \"" + sdlFile2.getName() + "\".");
return false;
}
- if((sdlFile1.getType()!= null && sdlFile2.getType() != null) && !( sdlFile1.getType().equals(sdlFile2.getType()) )){
+ if ((sdlFile1.getType() != null && sdlFile2.getType() != null) && !(sdlFile1.getType().equals(sdlFile2.getType()))) {
log("validateSdlFile",
"sdlFile1 type \"" + sdlFile1.getType() + "\" didn't match sdlFile2 type \"" + sdlFile2.getType() + "\".");
return false;
}
- if( (sdlFile1.getUri() != sdlFile2.getUri()) && !( sdlFile1.getUri().equals(sdlFile2.getUri()) )){
+ if ((sdlFile1.getUri() != sdlFile2.getUri()) && !(sdlFile1.getUri().equals(sdlFile2.getUri()))) {
log("validateSdlFile",
"sdlFile1 uri \"" + sdlFile1.getUri() + "\" didn't match sdlFile2 uri \"" + sdlFile2.getUri() + "\".");
return false;
@@ -207,50 +208,50 @@ public class Validator{
return true;
}
- public static boolean validateStringList(List<String> vrCommands1, List<String> vrCommands2){
- if(vrCommands1 == null){
- return ( vrCommands2 == null );
+ public static boolean validateStringList(List<String> vrCommands1, List<String> vrCommands2) {
+ if (vrCommands1 == null) {
+ return (vrCommands2 == null);
}
- if(vrCommands2 == null){
- return ( vrCommands1 == null );
+ if (vrCommands2 == null) {
+ return (vrCommands1 == null);
}
- for(int i = 0; i < vrCommands1.size(); i++){
- if(!vrCommands1.get(i).equals(vrCommands2.get(i))){
+ for (int i = 0; i < vrCommands1.size(); i++) {
+ if (!vrCommands1.get(i).equals(vrCommands2.get(i))) {
return false;
}
}
return true;
}
-
- public static boolean validateIntegerList(List<Integer> intList1, List<Integer> intList2){
- if(intList1 == null){
- return ( intList2 == null );
+
+ public static boolean validateIntegerList(List<Integer> intList1, List<Integer> intList2) {
+ if (intList1 == null) {
+ return (intList2 == null);
}
- if(intList2 == null){
- return ( intList1 == null );
+ if (intList2 == null) {
+ return (intList1 == null);
}
- for(int i = 0; i < intList1.size(); i++){
- if(!intList1.get(i).equals(intList2.get(i))){
+ for (int i = 0; i < intList1.size(); i++) {
+ if (!intList1.get(i).equals(intList2.get(i))) {
return false;
}
}
return true;
}
-
- public static boolean validateLongList(List<Long> intList1, List<Long> intList2){
- if(intList1 == null){
- return ( intList2 == null );
+
+ public static boolean validateLongList(List<Long> intList1, List<Long> intList2) {
+ if (intList1 == null) {
+ return (intList2 == null);
}
- if(intList2 == null){
- return ( intList1 == null );
+ if (intList2 == null) {
+ return (intList1 == null);
}
- for(int i = 0; i < intList1.size(); i++){
- if(!intList1.get(i).equals(intList2.get(i))){
+ for (int i = 0; i < intList1.size(); i++) {
+ if (!intList1.get(i).equals(intList2.get(i))) {
return false;
}
}
@@ -258,31 +259,31 @@ public class Validator{
return true;
}
- public static boolean validateSoftButton(SoftButton button1, SoftButton button2){
+ public static boolean validateSoftButton(SoftButton button1, SoftButton button2) {
return validateImage(button1.getImage(), button2.getImage())
&& validateText(button1.getText(), button2.getText())
&& button1.getIsHighlighted() == button2.getIsHighlighted()
- && ( (button1 .getSoftButtonID() == null && button2.getSoftButtonID() == null) || button1.getSoftButtonID().equals(button2.getSoftButtonID()))
+ && ((button1.getSoftButtonID() == null && button2.getSoftButtonID() == null) || button1.getSoftButtonID().equals(button2.getSoftButtonID()))
&& button1.getSystemAction() == button2.getSystemAction()
&& button1.getType() == button2.getType();
}
- public static boolean validateSoftButtons(List<SoftButton> list1, List<SoftButton> list2){
- if(list1 == null){
- return ( list2 == null );
+ public static boolean validateSoftButtons(List<SoftButton> list1, List<SoftButton> list2) {
+ if (list1 == null) {
+ return (list2 == null);
}
- if(list2 == null){
- return ( list1 == null );
+ if (list2 == null) {
+ return (list1 == null);
}
Iterator<SoftButton> iterator1 = list1.iterator();
Iterator<SoftButton> iterator2 = list2.iterator();
- while(iterator1.hasNext() && iterator2.hasNext()){
+ while (iterator1.hasNext() && iterator2.hasNext()) {
SoftButton button1 = iterator1.next();
SoftButton button2 = iterator2.next();
- if(!validateSoftButton(button1, button2)){
+ if (!validateSoftButton(button1, button2)) {
return false;
}
}
@@ -290,115 +291,115 @@ public class Validator{
return true;
}
- public static boolean validateCoordinate(Coordinate c1, Coordinate c2){
- if(c1 == null){
- return ( c2 == null );
+ public static boolean validateCoordinate(Coordinate c1, Coordinate c2) {
+ if (c1 == null) {
+ return (c2 == null);
}
- if(c2 == null){
- return ( c1 == null );
+ if (c2 == null) {
+ return (c1 == null);
}
- if(c1.getLatitudeDegrees() != c2.getLatitudeDegrees()){
+ if (c1.getLatitudeDegrees() != c2.getLatitudeDegrees()) {
return false;
}
- if(c1.getLongitudeDegrees() != c2.getLongitudeDegrees()){
+ if (c1.getLongitudeDegrees() != c2.getLongitudeDegrees()) {
return false;
}
return true;
}
- public static boolean validateRectangle(Rectangle c1, Rectangle c2){
- if(c1 == null){
- return ( c2 == null );
- }
- if(c2 == null){
- return ( c1 == null );
- }
+ public static boolean validateRectangle(Rectangle c1, Rectangle c2) {
+ if (c1 == null) {
+ return (c2 == null);
+ }
+ if (c2 == null) {
+ return (c1 == null);
+ }
- if(c1.getX() != c2.getX()){
- return false;
- }
+ if (c1.getX() != c2.getX()) {
+ return false;
+ }
- if(c1.getY() != c2.getY()){
- return false;
- }
+ if (c1.getY() != c2.getY()) {
+ return false;
+ }
- if(c1.getWidth() != c2.getWidth()){
- return false;
- }
+ if (c1.getWidth() != c2.getWidth()) {
+ return false;
+ }
- if(c1.getHeight() != c2.getHeight()){
- return false;
- }
+ if (c1.getHeight() != c2.getHeight()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateOasisAddress(OasisAddress a1, OasisAddress a2){
- if(a1 == null){
- return ( a2 == null );
+ public static boolean validateOasisAddress(OasisAddress a1, OasisAddress a2) {
+ if (a1 == null) {
+ return (a2 == null);
}
- if(a2 == null){
- return ( a1 == null );
+ if (a2 == null) {
+ return (a1 == null);
}
- if(!a1.getAdministrativeArea().equals(a2.getAdministrativeArea())){
+ if (!a1.getAdministrativeArea().equals(a2.getAdministrativeArea())) {
return false;
}
- if(!a1.getCountryCode().equals(a2.getCountryCode())){
+ if (!a1.getCountryCode().equals(a2.getCountryCode())) {
return false;
}
- if(!a1.getCountryName().equals(a2.getCountryName())){
+ if (!a1.getCountryName().equals(a2.getCountryName())) {
return false;
}
- if(!a1.getLocality().equals(a2.getLocality())){
+ if (!a1.getLocality().equals(a2.getLocality())) {
return false;
}
- if(!a1.getSubLocality().equals(a2.getSubLocality())){
+ if (!a1.getSubLocality().equals(a2.getSubLocality())) {
return false;
}
- if(!a1.getSubAdministrativeArea().equals(a2.getSubAdministrativeArea())){
+ if (!a1.getSubAdministrativeArea().equals(a2.getSubAdministrativeArea())) {
return false;
}
- if(!a1.getPostalCode().equals(a2.getPostalCode())){
+ if (!a1.getPostalCode().equals(a2.getPostalCode())) {
return false;
}
- if(!a1.getThoroughfare().equals(a2.getThoroughfare())){
+ if (!a1.getThoroughfare().equals(a2.getThoroughfare())) {
return false;
}
- if(!a1.getSubThoroughfare().equals(a2.getSubThoroughfare())){
+ if (!a1.getSubThoroughfare().equals(a2.getSubThoroughfare())) {
return false;
}
return true;
}
- public static boolean validateTtsChunks(List<TTSChunk> list1, List<TTSChunk> list2){
- if(list1 == null){
- return ( list2 == null );
+ public static boolean validateTtsChunks(List<TTSChunk> list1, List<TTSChunk> list2) {
+ if (list1 == null) {
+ return (list2 == null);
}
- if(list2 == null){
- return ( list1 == null );
+ if (list2 == null) {
+ return (list1 == null);
}
Iterator<TTSChunk> iterator1 = list1.iterator();
Iterator<TTSChunk> iterator2 = list2.iterator();
- while(iterator1.hasNext() && iterator2.hasNext()){
+ while (iterator1.hasNext() && iterator2.hasNext()) {
TTSChunk chunk1 = iterator1.next();
TTSChunk chunk2 = iterator2.next();
- if(!validateText(chunk1.getText(), chunk2.getText()) || chunk1.getType() != chunk2.getType()){
+ if (!validateText(chunk1.getText(), chunk2.getText()) || chunk1.getType() != chunk2.getType()) {
return false;
}
}
@@ -406,43 +407,43 @@ public class Validator{
return true;
}
- public static boolean validateAppServiceTypeList(List<AppServiceType> list1, List<AppServiceType> list2){
- if(list1 == null){
- return ( list2 == null );
- }
- if(list2 == null){
- return ( list1 == null );
- }
+ public static boolean validateAppServiceTypeList(List<AppServiceType> list1, List<AppServiceType> list2) {
+ if (list1 == null) {
+ return (list2 == null);
+ }
+ if (list2 == null) {
+ return (list1 == null);
+ }
- Iterator<AppServiceType> iterator1 = list1.iterator();
- Iterator<AppServiceType> iterator2 = list2.iterator();
+ Iterator<AppServiceType> iterator1 = list1.iterator();
+ Iterator<AppServiceType> iterator2 = list2.iterator();
- while(iterator1.hasNext() && iterator2.hasNext()){
- AppServiceType chunk1 = iterator1.next();
- AppServiceType chunk2 = iterator2.next();
+ while (iterator1.hasNext() && iterator2.hasNext()) {
+ AppServiceType chunk1 = iterator1.next();
+ AppServiceType chunk2 = iterator2.next();
- if(chunk1 != chunk2){
- return false;
- }
- }
+ if (chunk1 != chunk2) {
+ return false;
+ }
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateAppServiceCapabilities(AppServicesCapabilities params1, AppServicesCapabilities params2) {
- if (params1 == null) {
- return (params2 == null);
- }
- if (params2 == null) {
- return (params1 == null);
- }
+ public static boolean validateAppServiceCapabilities(AppServicesCapabilities params1, AppServicesCapabilities params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
- if (!validateAppServiceCapabilityList(params1.getAppServices(), params2.getAppServices())){
- return false;
- }
+ if (!validateAppServiceCapabilityList(params1.getAppServices(), params2.getAppServices())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
public static boolean validateTemplateConfiguration(TemplateConfiguration params1, TemplateConfiguration params2) {
if (params1 == null) {
@@ -467,238 +468,238 @@ public class Validator{
return true;
}
- public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2){
- if(list1 == null){
- return ( list2 == null );
- }
- if(list2 == null){
- return ( list1 == null );
- }
+ public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2) {
+ if (list1 == null) {
+ return (list2 == null);
+ }
+ if (list2 == null) {
+ return (list1 == null);
+ }
+
+ Iterator<AppServiceCapability> iterator1 = list1.iterator();
+ Iterator<AppServiceCapability> iterator2 = list2.iterator();
+
+ while (iterator1.hasNext() && iterator2.hasNext()) {
+ AppServiceCapability chunk1 = iterator1.next();
+ AppServiceCapability chunk2 = iterator2.next();
+
+ if (!validateAppServiceRecord(chunk1.getUpdatedAppServiceRecord(), chunk2.getUpdatedAppServiceRecord())) {
+ return false;
+ }
+
+ if (!chunk1.getUpdateReason().equals(chunk2.getUpdateReason())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateMediaServiceManifest(MediaServiceManifest params1, MediaServiceManifest params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationServiceManifest(NavigationServiceManifest params1, NavigationServiceManifest params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getAcceptsWayPoints().equals(params2.getAcceptsWayPoints())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceRecord(AppServiceRecord params1, AppServiceRecord params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getServiceActive().equals(params2.getServiceActive())) {
+ return false;
+ }
+
+ if (!params1.getServicePublished().equals(params2.getServicePublished())) {
+ return false;
+ }
+
+ if (!params1.getServiceID().equals(params2.getServiceID())) {
+ return false;
+ }
+
+ if (!validateAppServiceManifest(params1.getServiceManifest(), params2.getServiceManifest())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAppServiceManifest(AppServiceManifest params1, AppServiceManifest params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getAllowAppConsumers().equals(params2.getAllowAppConsumers())) {
+ return false;
+ }
+
+ if (!validateImage(params1.getServiceIcon(), params2.getServiceIcon())) {
+ return false;
+ }
+
+ if (!params1.getServiceName().equals(params2.getServiceName())) {
+ return false;
+ }
+
+ if (!params1.getServiceType().equals(params2.getServiceType())) {
+ return false;
+ }
+
+ if (!validateSdlMsgVersion(params1.getRpcSpecVersion(), params2.getRpcSpecVersion())) {
+ return false;
+ }
+
+ if (!validateMediaServiceManifest(params1.getMediaServiceManifest(), params2.getMediaServiceManifest())) {
+ return false;
+ }
+
+ if (!validateWeatherServiceManifest(params1.getWeatherServiceManifest(), params2.getWeatherServiceManifest())) {
+ return false;
+ }
+
+ if (!validateIntegerList(params1.getHandledRpcs(), params2.getHandledRpcs())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherServiceManifest(WeatherServiceManifest params1, WeatherServiceManifest params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
- Iterator<AppServiceCapability> iterator1 = list1.iterator();
- Iterator<AppServiceCapability> iterator2 = list2.iterator();
+ if (!params1.getMaxHourlyForecastAmount().equals(params2.getMaxHourlyForecastAmount())) {
+ return false;
+ }
+
+ if (!params1.getMaxMinutelyForecastAmount().equals(params2.getMaxMinutelyForecastAmount())) {
+ return false;
+ }
- while(iterator1.hasNext() && iterator2.hasNext()){
- AppServiceCapability chunk1 = iterator1.next();
- AppServiceCapability chunk2 = iterator2.next();
+ if (!params1.getMaxMultidayForecastAmount().equals(params2.getMaxMultidayForecastAmount())) {
+ return false;
+ }
- if(!validateAppServiceRecord(chunk1.getUpdatedAppServiceRecord(), chunk2.getUpdatedAppServiceRecord())){
- return false;
- }
+ if (params1.getCurrentForecastSupported() != params2.getCurrentForecastSupported()) {
+ return false;
+ }
- if (!chunk1.getUpdateReason().equals(chunk2.getUpdateReason())){
- return false;
- }
- }
+ if (params1.getWeatherForLocationSupported() != params2.getWeatherForLocationSupported()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateMediaServiceManifest(MediaServiceManifest params1, MediaServiceManifest params2){
- if(params1 == null){
- return ( params2 == null );
- }
- if(params2 == null){
- return ( params1 == null );
- }
+ public static boolean validateLocationDetails(LocationDetails params1, LocationDetails params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
- return true;
- }
-
- public static boolean validateNavigationServiceManifest(NavigationServiceManifest params1, NavigationServiceManifest params2){
- if(params1 == null){
- return ( params2 == null );
- }
- if(params2 == null){
- return ( params1 == null );
- }
-
- if (!params1.getAcceptsWayPoints().equals(params2.getAcceptsWayPoints())){
- return false;
- }
-
- return true;
- }
+ if (!params1.getAddressLines().equals(params2.getAddressLines())) {
+ return false;
+ }
- public static boolean validateAppServiceRecord(AppServiceRecord params1, AppServiceRecord params2) {
- if (params1 == null) {
- return (params2 == null);
- }
- if (params2 == null) {
- return (params1 == null);
- }
-
- if (!params1.getServiceActive().equals(params2.getServiceActive())){
- return false;
- }
-
- if (!params1.getServicePublished().equals(params2.getServicePublished())){
- return false;
- }
-
- if (!params1.getServiceID().equals(params2.getServiceID())){
- return false;
- }
-
- if (!validateAppServiceManifest(params1.getServiceManifest(), params2.getServiceManifest())){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateAppServiceManifest(AppServiceManifest params1, AppServiceManifest params2){
- if(params1 == null){
- return ( params2 == null );
- }
- if(params2 == null){
- return ( params1 == null );
- }
-
- if (!params1.getAllowAppConsumers().equals(params2.getAllowAppConsumers())){
- return false;
- }
-
- if (!validateImage(params1.getServiceIcon(), params2.getServiceIcon())){
- return false;
- }
-
- if (!params1.getServiceName().equals(params2.getServiceName())){
- return false;
- }
-
- if (!params1.getServiceType().equals(params2.getServiceType())){
- return false;
- }
-
- if (!validateSdlMsgVersion(params1.getRpcSpecVersion(),params2.getRpcSpecVersion())){
- return false;
- }
-
- if (!validateMediaServiceManifest(params1.getMediaServiceManifest(), params2.getMediaServiceManifest())) {
- return false;
- }
-
- if (!validateWeatherServiceManifest(params1.getWeatherServiceManifest(), params2.getWeatherServiceManifest())){
- return false;
- }
-
- if (!validateIntegerList(params1.getHandledRpcs(), params2.getHandledRpcs())){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateWeatherServiceManifest(WeatherServiceManifest params1, WeatherServiceManifest params2){
- if(params1 == null){
- return ( params2 == null );
- }
- if(params2 == null){
- return ( params1 == null );
- }
-
- if (!params1.getMaxHourlyForecastAmount().equals(params2.getMaxHourlyForecastAmount())){
- return false;
- }
-
- if (!params1.getMaxMinutelyForecastAmount().equals(params2.getMaxMinutelyForecastAmount())){
- return false;
- }
-
- if (!params1.getMaxMultidayForecastAmount().equals(params2.getMaxMultidayForecastAmount())){
- return false;
- }
-
- if (params1.getCurrentForecastSupported()!=params2.getCurrentForecastSupported()){
- return false;
- }
-
- if (params1.getWeatherForLocationSupported()!=params2.getWeatherForLocationSupported()){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateLocationDetails(LocationDetails params1, LocationDetails params2) {
- if (params1 == null) {
- return (params2 == null);
- }
- if (params2 == null) {
- return (params1 == null);
- }
-
- if (!params1.getAddressLines().equals(params2.getAddressLines())) {
- return false;
- }
-
- if (!validateCoordinate(params1.getCoordinate(), params2.getCoordinate())) {
- return false;
- }
-
- if (!params1.getLocationDescription().equals(params2.getLocationDescription())) {
- return false;
- }
-
- if (!params1.getPhoneNumber().equals(params2.getPhoneNumber())) {
- return false;
- }
-
- if (!validateImage(params1.getLocationImage(), params2.getLocationImage())) {
- return false;
- }
-
- if (!params1.getLocationName().equals(params2.getLocationName())) {
- return false;
- }
-
- if (!validateOasisAddress(params1.getSearchAddress(), params2.getSearchAddress())) {
- return false;
- }
- return true;
- }
+ if (!validateCoordinate(params1.getCoordinate(), params2.getCoordinate())) {
+ return false;
+ }
- public static boolean validateChoice(Choice choice1, Choice choice2){
- if(choice1 == null){
- return ( choice2 == null );
+ if (!params1.getLocationDescription().equals(params2.getLocationDescription())) {
+ return false;
}
- if(choice2 == null){
- return ( choice1 == null );
+
+ if (!params1.getPhoneNumber().equals(params2.getPhoneNumber())) {
+ return false;
}
- if(!( validateImage(choice1.getImage(), choice2.getImage()) )){
+ if (!validateImage(params1.getLocationImage(), params2.getLocationImage())) {
+ return false;
+ }
+
+ if (!params1.getLocationName().equals(params2.getLocationName())) {
+ return false;
+ }
+
+ if (!validateOasisAddress(params1.getSearchAddress(), params2.getSearchAddress())) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean validateChoice(Choice choice1, Choice choice2) {
+ if (choice1 == null) {
+ return (choice2 == null);
+ }
+ if (choice2 == null) {
+ return (choice1 == null);
+ }
+
+ if (!(validateImage(choice1.getImage(), choice2.getImage()))) {
log("validateChoice", "choice1 image \"" + choice1.getImage() + "\" didn't match choice2 image \""
+ choice2.getImage() + "\"");
return false;
}
- if(!( validateImage(choice1.getSecondaryImage(), choice2.getSecondaryImage()) )){
+ if (!(validateImage(choice1.getSecondaryImage(), choice2.getSecondaryImage()))) {
log("validateChoice", "choice1 secondary image \"" + choice1.getSecondaryImage()
+ "\" didn't match choice2 image \"" + choice2.getSecondaryImage() + "\"");
return false;
}
- if(choice1.getChoiceID() != choice2.getChoiceID()){
+ if (choice1.getChoiceID() != choice2.getChoiceID()) {
log("validateChoice",
"choice1 ID \"" + choice1.getChoiceID() + "\" didn't match choice2 ID \"" + choice2.getChoiceID()
+ "\"");
return false;
}
- if(!( validateText(choice1.getMenuName(), choice2.getMenuName()) )){
+ if (!(validateText(choice1.getMenuName(), choice2.getMenuName()))) {
log("validateChoice", "choice1 menu name \"" + choice1.getMenuName()
+ "\" didn't match choice2 menu name \"" + choice2.getMenuName() + "\"");
return false;
}
- if(!( validateText(choice1.getSecondaryText(), choice2.getSecondaryText()) )){
+ if (!(validateText(choice1.getSecondaryText(), choice2.getSecondaryText()))) {
log("validateChoice", "choice1 secondary text \"" + choice1.getSecondaryText()
+ "\" didn't match choice2 secondary text \"" + choice2.getSecondaryText() + "\"");
return false;
}
- if(!( validateText(choice1.getTertiaryText(), choice2.getTertiaryText()) )){
+ if (!(validateText(choice1.getTertiaryText(), choice2.getTertiaryText()))) {
log("validateChoice", "choice1 tertiary text \"" + choice1.getTertiaryText()
+ "\" didn't match choice2 tertiary text \"" + choice2.getTertiaryText() + "\"");
return false;
}
- if(!( validateStringList(choice1.getVrCommands(), choice2.getVrCommands()) )){
+ if (!(validateStringList(choice1.getVrCommands(), choice2.getVrCommands()))) {
log("validateChoice", "choice1 VR commands \"" + choice1.getVrCommands()
+ "\" didn't match choice2 VR commands \"" + choice2.getVrCommands() + "\"");
return false;
@@ -707,54 +708,54 @@ public class Validator{
return true;
}
- public static boolean validateText(String text1, String text2){
- if(text1 == null){
- return ( text2 == null );
+ public static boolean validateText(String text1, String text2) {
+ if (text1 == null) {
+ return (text2 == null);
}
- if(text2 == null){
- return ( text1 == null );
+ if (text2 == null) {
+ return (text1 == null);
}
return text1.equals(text2);
}
- public static boolean validateScreenParams(ScreenParams params1, ScreenParams params2){
- if(params1 == null){
- return ( params2 == null );
+ public static boolean validateScreenParams(ScreenParams params1, ScreenParams params2) {
+ if (params1 == null) {
+ return (params2 == null);
}
- if(params2 == null){
- return ( params1 == null );
+ if (params2 == null) {
+ return (params1 == null);
}
- if(!( validateImageResolution(params1.getImageResolution(), params2.getImageResolution()) )){
+ if (!(validateImageResolution(params1.getImageResolution(), params2.getImageResolution()))) {
log("validateScreenParams", "Image resolutions didn't match!");
return false;
}
- if(!( validateTouchEventCapabilities(params1.getTouchEventAvailable(), params2.getTouchEventAvailable()) )){
+ if (!(validateTouchEventCapabilities(params1.getTouchEventAvailable(), params2.getTouchEventAvailable()))) {
log("validateScreenParams", "Touch event capabilities didn't match!");
return false;
}
return true;
}
-
- public static boolean validateImageResolution(ImageResolution image1, ImageResolution image2){
- if(image1 == null){
- return ( image2 == null );
+
+ public static boolean validateImageResolution(ImageResolution image1, ImageResolution image2) {
+ if (image1 == null) {
+ return (image2 == null);
}
- if(image2 == null){
- return ( image1 == null );
+ if (image2 == null) {
+ return (image1 == null);
}
- if((int) image1.getResolutionHeight() != (int) image2.getResolutionHeight()){
+ if ((int) image1.getResolutionHeight() != (int) image2.getResolutionHeight()) {
log("validateImageResolution",
"Height " + image1.getResolutionHeight() + " didn't match height " + image2.getResolutionHeight()
+ ".");
return false;
}
- if((int) image1.getResolutionWidth() != (int) image2.getResolutionWidth()){
+ if ((int) image1.getResolutionWidth() != (int) image2.getResolutionWidth()) {
log("validateImageResolution",
"Width " + image1.getResolutionWidth() + " didn't match width " + image2.getResolutionWidth() + ".");
return false;
@@ -763,22 +764,22 @@ public class Validator{
return true;
}
- public static boolean validateTemperature(Temperature temperature1, Temperature temperature2){
- if(temperature1 == null){
- return ( temperature2 == null );
+ public static boolean validateTemperature(Temperature temperature1, Temperature temperature2) {
+ if (temperature1 == null) {
+ return (temperature2 == null);
}
- if(temperature2 == null){
- return ( temperature1 == null );
+ if (temperature2 == null) {
+ return (temperature1 == null);
}
- if((float) temperature1.getValue() != (float) temperature2.getValue()){
+ if ((float) temperature1.getValue() != (float) temperature2.getValue()) {
log("validateTemperature",
"Value " + temperature1.getValue() + " didn't match value " + temperature2.getValue()
+ ".");
return false;
}
- if(temperature1.getUnit() != temperature2.getUnit()){
+ if (temperature1.getUnit() != temperature2.getUnit()) {
log("validateTemperature",
"Unit " + temperature1.getUnit() + " didn't match unit " + temperature2.getUnit() + ".");
return false;
@@ -787,64 +788,64 @@ public class Validator{
return true;
}
- public static boolean validateRdsData(RdsData rdsData1, RdsData rdsData2){
- if(rdsData1 == null){
- return ( rdsData2 == null );
+ public static boolean validateRdsData(RdsData rdsData1, RdsData rdsData2) {
+ if (rdsData1 == null) {
+ return (rdsData2 == null);
}
- if(rdsData2 == null){
- return ( rdsData1 == null );
+ if (rdsData2 == null) {
+ return (rdsData1 == null);
}
- if(rdsData1.getProgramService() != rdsData2.getProgramService()){
+ if (rdsData1.getProgramService() != rdsData2.getProgramService()) {
log("validateRdsData",
"Ps " + rdsData1.getProgramService() + " didn't match Ps " + rdsData2.getProgramService()
+ ".");
return false;
}
- if(rdsData1.getRadioText() != rdsData2.getRadioText()){
+ if (rdsData1.getRadioText() != rdsData2.getRadioText()) {
log("validateRdsData",
"Rt " + rdsData1.getRadioText() + " didn't match Rt " + rdsData2.getRadioText()
+ ".");
return false;
}
- if(rdsData1.getClockText() != rdsData2.getClockText()){
+ if (rdsData1.getClockText() != rdsData2.getClockText()) {
log("validateRdsData",
"Ct " + rdsData1.getClockText() + " didn't match Ct " + rdsData2.getClockText()
+ ".");
return false;
}
- if(rdsData1.getProgramIdentification() != rdsData2.getProgramIdentification()){
+ if (rdsData1.getProgramIdentification() != rdsData2.getProgramIdentification()) {
log("validateRdsData",
"Pi " + rdsData1.getProgramIdentification() + " didn't match Pi " + rdsData2.getProgramIdentification()
+ ".");
return false;
}
- if(rdsData1.getRegion() != rdsData2.getRegion()){
+ if (rdsData1.getRegion() != rdsData2.getRegion()) {
log("validateRdsData",
"Reg " + rdsData1.getRegion() + " didn't match Reg " + rdsData2.getRegion()
+ ".");
return false;
}
- if(rdsData1.getTrafficProgram() != rdsData2.getTrafficProgram()){
+ if (rdsData1.getTrafficProgram() != rdsData2.getTrafficProgram()) {
log("validateRdsData",
"Tp " + rdsData1.getTrafficProgram() + " didn't match Tp " + rdsData2.getTrafficProgram()
+ ".");
return false;
}
- if(rdsData1.getTrafficAnnouncement() != rdsData2.getTrafficAnnouncement()){
+ if (rdsData1.getTrafficAnnouncement() != rdsData2.getTrafficAnnouncement()) {
log("validateRdsData",
"Ta " + rdsData1.getTrafficAnnouncement() + " didn't match Ta " + rdsData2.getTrafficAnnouncement()
+ ".");
return false;
}
- if(rdsData1.getProgramType() != rdsData2.getProgramType()){
+ if (rdsData1.getProgramType() != rdsData2.getProgramType()) {
log("validateRdsData",
"Pty " + rdsData1.getProgramType() + " didn't match Pty " + rdsData2.getProgramType()
+ ".");
@@ -854,118 +855,118 @@ public class Validator{
return true;
}
- public static boolean validateHMISettingsControlCapabilities(HMISettingsControlCapabilities hmiSettingsControlCapabilities1, HMISettingsControlCapabilities hmiSettingsControlCapabilities2){
- if(hmiSettingsControlCapabilities1 == null){
- return ( hmiSettingsControlCapabilities2 == null );
+ public static boolean validateHMISettingsControlCapabilities(HMISettingsControlCapabilities hmiSettingsControlCapabilities1, HMISettingsControlCapabilities hmiSettingsControlCapabilities2) {
+ if (hmiSettingsControlCapabilities1 == null) {
+ return (hmiSettingsControlCapabilities2 == null);
}
- if(hmiSettingsControlCapabilities2 == null){
- return ( hmiSettingsControlCapabilities1 == null );
+ if (hmiSettingsControlCapabilities2 == null) {
+ return (hmiSettingsControlCapabilities1 == null);
}
- if(hmiSettingsControlCapabilities1.getModuleName() != hmiSettingsControlCapabilities2.getModuleName()){
+ if (hmiSettingsControlCapabilities1.getModuleName() != hmiSettingsControlCapabilities2.getModuleName()) {
return false;
}
- if(hmiSettingsControlCapabilities1.getDisplayModeUnitAvailable() != hmiSettingsControlCapabilities2.getDisplayModeUnitAvailable()){
+ if (hmiSettingsControlCapabilities1.getDisplayModeUnitAvailable() != hmiSettingsControlCapabilities2.getDisplayModeUnitAvailable()) {
return false;
}
- if(hmiSettingsControlCapabilities1.getDistanceUnitAvailable() != hmiSettingsControlCapabilities2.getDistanceUnitAvailable()){
+ if (hmiSettingsControlCapabilities1.getDistanceUnitAvailable() != hmiSettingsControlCapabilities2.getDistanceUnitAvailable()) {
return false;
}
- if(hmiSettingsControlCapabilities1.getTemperatureUnitAvailable() != hmiSettingsControlCapabilities2.getTemperatureUnitAvailable()){
+ if (hmiSettingsControlCapabilities1.getTemperatureUnitAvailable() != hmiSettingsControlCapabilities2.getTemperatureUnitAvailable()) {
return false;
}
return true;
}
- public static boolean validateLightControlCapabilities(LightControlCapabilities lightControlCapabilities1, LightControlCapabilities lightControlCapabilities2){
- if(lightControlCapabilities1 == null){
- return ( lightControlCapabilities2 == null );
+ public static boolean validateLightControlCapabilities(LightControlCapabilities lightControlCapabilities1, LightControlCapabilities lightControlCapabilities2) {
+ if (lightControlCapabilities1 == null) {
+ return (lightControlCapabilities2 == null);
}
- if(lightControlCapabilities2 == null){
- return ( lightControlCapabilities1 == null );
+ if (lightControlCapabilities2 == null) {
+ return (lightControlCapabilities1 == null);
}
- if(lightControlCapabilities1.getModuleName() != lightControlCapabilities2.getModuleName()){
+ if (lightControlCapabilities1.getModuleName() != lightControlCapabilities2.getModuleName()) {
return false;
}
- if(!( validateLightCapabilitiesList(lightControlCapabilities1.getSupportedLights(), lightControlCapabilities2.getSupportedLights()) )){
+ if (!(validateLightCapabilitiesList(lightControlCapabilities1.getSupportedLights(), lightControlCapabilities2.getSupportedLights()))) {
return false;
}
return true;
}
- public static boolean validateClimateControlData(ClimateControlData climateControlData1, ClimateControlData climateControlData2){
- if(climateControlData1 == null){
- return ( climateControlData2 == null );
+ public static boolean validateClimateControlData(ClimateControlData climateControlData1, ClimateControlData climateControlData2) {
+ if (climateControlData1 == null) {
+ return (climateControlData2 == null);
}
- if(climateControlData2 == null){
- return ( climateControlData1 == null );
+ if (climateControlData2 == null) {
+ return (climateControlData1 == null);
}
- if(climateControlData1.getFanSpeed() != climateControlData2.getFanSpeed()){
+ if (climateControlData1.getFanSpeed() != climateControlData2.getFanSpeed()) {
log("validateClimateControlData",
"FanSpeed " + climateControlData1.getFanSpeed() + " didn't match fanSpeed " + climateControlData2.getFanSpeed()
+ ".");
return false;
}
- if(!( validateTemperature(climateControlData1.getCurrentTemperature(), climateControlData2.getCurrentTemperature()) )){
+ if (!(validateTemperature(climateControlData1.getCurrentTemperature(), climateControlData2.getCurrentTemperature()))) {
return false;
}
- if(!( validateTemperature(climateControlData1.getDesiredTemperature(), climateControlData2.getDesiredTemperature()) )){
+ if (!(validateTemperature(climateControlData1.getDesiredTemperature(), climateControlData2.getDesiredTemperature()))) {
return false;
}
- if(climateControlData1.getAcEnable() != climateControlData2.getAcEnable()){
+ if (climateControlData1.getAcEnable() != climateControlData2.getAcEnable()) {
log("validateClimateControlData",
"AcEnable " + climateControlData1.getAcEnable() + " didn't match AcEnable " + climateControlData2.getAcEnable()
+ ".");
return false;
}
- if(climateControlData1.getCirculateAirEnable() != climateControlData2.getCirculateAirEnable()){
+ if (climateControlData1.getCirculateAirEnable() != climateControlData2.getCirculateAirEnable()) {
log("validateClimateControlData",
"CirculateAirEnable " + climateControlData1.getCirculateAirEnable() + " didn't match CirculateAirEnable " + climateControlData2.getCirculateAirEnable()
+ ".");
return false;
}
- if(climateControlData1.getAutoModeEnable() != climateControlData2.getAutoModeEnable()){
+ if (climateControlData1.getAutoModeEnable() != climateControlData2.getAutoModeEnable()) {
log("validateClimateControlData",
"AutoModeEnable " + climateControlData1.getAutoModeEnable() + " didn't match AutoModeEnable " + climateControlData2.getAutoModeEnable()
+ ".");
return false;
}
- if(climateControlData1.getDefrostZone() != climateControlData2.getDefrostZone()){
+ if (climateControlData1.getDefrostZone() != climateControlData2.getDefrostZone()) {
log("validateClimateControlData",
"DefrostZone " + climateControlData1.getDefrostZone() + " didn't match DefrostZone " + climateControlData2.getDefrostZone()
+ ".");
return false;
}
- if(climateControlData1.getDualModeEnable() != climateControlData2.getDualModeEnable()){
+ if (climateControlData1.getDualModeEnable() != climateControlData2.getDualModeEnable()) {
log("validateClimateControlData",
"DualModeEnable " + climateControlData1.getDualModeEnable() + " didn't match DualModeEnable " + climateControlData2.getDualModeEnable()
+ ".");
return false;
}
- if(climateControlData1.getAcMaxEnable() != climateControlData2.getAcMaxEnable()){
+ if (climateControlData1.getAcMaxEnable() != climateControlData2.getAcMaxEnable()) {
log("validateClimateControlData",
"AcMaxEnable " + climateControlData1.getAcMaxEnable() + " didn't match AcMaxEnable " + climateControlData2.getAcMaxEnable()
+ ".");
return false;
}
- if(climateControlData1.getVentilationMode() != climateControlData2.getVentilationMode()){
+ if (climateControlData1.getVentilationMode() != climateControlData2.getVentilationMode()) {
log("validateClimateControlData",
"VentilationMode " + climateControlData1.getVentilationMode() + " didn't match VentilationMode " + climateControlData2.getVentilationMode()
+ ".");
@@ -976,296 +977,296 @@ public class Validator{
return true;
}
- public static boolean validateSeatControlData(SeatControlData seatControlData1, SeatControlData seatControlData2) {
- if (seatControlData1 == null) {
- return (seatControlData2 == null);
- }
- if (seatControlData2 == null) {
- return (seatControlData1 == null);
- }
-
- if (seatControlData1.getCoolingEnabled() != seatControlData2.getCoolingEnabled()) {
- return false;
- }
- if (seatControlData1.getHeatingEnabled() != seatControlData2.getHeatingEnabled()) {
- return false;
- }
- if (seatControlData1.getMassageEnabled() != seatControlData2.getMassageEnabled()) {
- return false;
- }
- if (seatControlData1.getBackTiltAngle() != seatControlData2.getBackTiltAngle()) {
- return false;
- }
- if (seatControlData1.getBackVerticalPosition() != seatControlData2.getBackVerticalPosition()) {
- return false;
- }
- if (seatControlData1.getCoolingLevel() != seatControlData2.getCoolingLevel()) {
- return false;
- }
- if (seatControlData1.getFrontVerticalPosition() != seatControlData2.getFrontVerticalPosition()) {
- return false;
- }
- if (seatControlData1.getHeadSupportHorizontalPosition() != seatControlData2.getHeadSupportHorizontalPosition()) {
- return false;
- }
- if (seatControlData1.getHeadSupportVerticalPosition() != seatControlData2.getHeadSupportVerticalPosition()) {
- return false;
- }
- if (seatControlData1.getHeatingLevel() != seatControlData2.getHeatingLevel()) {
- return false;
- }
- if (seatControlData1.getHorizontalPosition() != seatControlData2.getHorizontalPosition()) {
- return false;
- }
- if (seatControlData1.getId() != seatControlData2.getId()) {
- return false;
- }
-
- if (!(validateSeatMemoryAction(seatControlData1.getMemory(), seatControlData2.getMemory()))) {
- return false;
- }
-
- if (!(validateSeatMemoryAction(seatControlData1.getMemory(), seatControlData2.getMemory()))) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateAudioControlData(AudioControlData audioControlData1, AudioControlData audioControlData2) {
- if (audioControlData1 == null) {
- return (audioControlData2 == null);
- }
- if (audioControlData2 == null) {
- return (audioControlData1 == null);
- }
-
- if (audioControlData1.getKeepContext() != audioControlData2.getKeepContext()) {
- return false;
- }
-
- if (audioControlData1.getSource() != audioControlData2.getSource()) {
- return false;
- }
-
- if (audioControlData1.getVolume() != audioControlData2.getVolume()) {
- return false;
- }
-
- if (!(validateEqualizerSettingsList(audioControlData1.getEqualizerSettings(), audioControlData2.getEqualizerSettings()))) {
- return false;
- }
-
-
- return true;
- }
-
- public static boolean validateHMISettingsControlData(HMISettingsControlData hmiSettingsControlData1, HMISettingsControlData hmiSettingsControlData2) {
- if (hmiSettingsControlData1 == null) {
- return (hmiSettingsControlData2 == null);
- }
- if (hmiSettingsControlData2 == null) {
- return (hmiSettingsControlData1 == null);
- }
-
- if (hmiSettingsControlData1.getDisplayMode() != hmiSettingsControlData2.getDisplayMode()) {
- return false;
- }
-
- if (hmiSettingsControlData1.getDistanceUnit() != hmiSettingsControlData2.getDistanceUnit()) {
- return false;
- }
-
- if (hmiSettingsControlData1.getTemperatureUnit() != hmiSettingsControlData2.getTemperatureUnit()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateLightControlData(LightControlData lightControlData1, LightControlData lightControlData2) {
- if (lightControlData1 == null) {
- return (lightControlData2 == null);
- }
- if (lightControlData2 == null) {
- return (lightControlData1 == null);
- }
-
- if (!(validateLightStateList(lightControlData1.getLightState(), lightControlData2.getLightState()))) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateModuleData(ModuleData moduleData1, ModuleData moduleData2){
- if(moduleData1 == null){
- return ( moduleData2 == null );
- }
- if(moduleData2 == null){
- return ( moduleData1 == null );
- }
-
- if(moduleData1.getModuleType() != moduleData2.getModuleType()){
+ public static boolean validateSeatControlData(SeatControlData seatControlData1, SeatControlData seatControlData2) {
+ if (seatControlData1 == null) {
+ return (seatControlData2 == null);
+ }
+ if (seatControlData2 == null) {
+ return (seatControlData1 == null);
+ }
+
+ if (seatControlData1.getCoolingEnabled() != seatControlData2.getCoolingEnabled()) {
+ return false;
+ }
+ if (seatControlData1.getHeatingEnabled() != seatControlData2.getHeatingEnabled()) {
+ return false;
+ }
+ if (seatControlData1.getMassageEnabled() != seatControlData2.getMassageEnabled()) {
+ return false;
+ }
+ if (seatControlData1.getBackTiltAngle() != seatControlData2.getBackTiltAngle()) {
+ return false;
+ }
+ if (seatControlData1.getBackVerticalPosition() != seatControlData2.getBackVerticalPosition()) {
+ return false;
+ }
+ if (seatControlData1.getCoolingLevel() != seatControlData2.getCoolingLevel()) {
+ return false;
+ }
+ if (seatControlData1.getFrontVerticalPosition() != seatControlData2.getFrontVerticalPosition()) {
+ return false;
+ }
+ if (seatControlData1.getHeadSupportHorizontalPosition() != seatControlData2.getHeadSupportHorizontalPosition()) {
+ return false;
+ }
+ if (seatControlData1.getHeadSupportVerticalPosition() != seatControlData2.getHeadSupportVerticalPosition()) {
+ return false;
+ }
+ if (seatControlData1.getHeatingLevel() != seatControlData2.getHeatingLevel()) {
+ return false;
+ }
+ if (seatControlData1.getHorizontalPosition() != seatControlData2.getHorizontalPosition()) {
+ return false;
+ }
+ if (seatControlData1.getId() != seatControlData2.getId()) {
+ return false;
+ }
+
+ if (!(validateSeatMemoryAction(seatControlData1.getMemory(), seatControlData2.getMemory()))) {
+ return false;
+ }
+
+ if (!(validateSeatMemoryAction(seatControlData1.getMemory(), seatControlData2.getMemory()))) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAudioControlData(AudioControlData audioControlData1, AudioControlData audioControlData2) {
+ if (audioControlData1 == null) {
+ return (audioControlData2 == null);
+ }
+ if (audioControlData2 == null) {
+ return (audioControlData1 == null);
+ }
+
+ if (audioControlData1.getKeepContext() != audioControlData2.getKeepContext()) {
+ return false;
+ }
+
+ if (audioControlData1.getSource() != audioControlData2.getSource()) {
+ return false;
+ }
+
+ if (audioControlData1.getVolume() != audioControlData2.getVolume()) {
+ return false;
+ }
+
+ if (!(validateEqualizerSettingsList(audioControlData1.getEqualizerSettings(), audioControlData2.getEqualizerSettings()))) {
+ return false;
+ }
+
+
+ return true;
+ }
+
+ public static boolean validateHMISettingsControlData(HMISettingsControlData hmiSettingsControlData1, HMISettingsControlData hmiSettingsControlData2) {
+ if (hmiSettingsControlData1 == null) {
+ return (hmiSettingsControlData2 == null);
+ }
+ if (hmiSettingsControlData2 == null) {
+ return (hmiSettingsControlData1 == null);
+ }
+
+ if (hmiSettingsControlData1.getDisplayMode() != hmiSettingsControlData2.getDisplayMode()) {
+ return false;
+ }
+
+ if (hmiSettingsControlData1.getDistanceUnit() != hmiSettingsControlData2.getDistanceUnit()) {
+ return false;
+ }
+
+ if (hmiSettingsControlData1.getTemperatureUnit() != hmiSettingsControlData2.getTemperatureUnit()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateLightControlData(LightControlData lightControlData1, LightControlData lightControlData2) {
+ if (lightControlData1 == null) {
+ return (lightControlData2 == null);
+ }
+ if (lightControlData2 == null) {
+ return (lightControlData1 == null);
+ }
+
+ if (!(validateLightStateList(lightControlData1.getLightState(), lightControlData2.getLightState()))) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateModuleData(ModuleData moduleData1, ModuleData moduleData2) {
+ if (moduleData1 == null) {
+ return (moduleData2 == null);
+ }
+ if (moduleData2 == null) {
+ return (moduleData1 == null);
+ }
+
+ if (moduleData1.getModuleType() != moduleData2.getModuleType()) {
log("validateModuleData",
"ModuleType " + moduleData1.getModuleType() + " didn't match ModuleType " + moduleData2.getModuleType()
+ ".");
return false;
}
- if(!( validateRadioControlData(moduleData1.getRadioControlData(), moduleData2.getRadioControlData()) )){
+ if (!(validateRadioControlData(moduleData1.getRadioControlData(), moduleData2.getRadioControlData()))) {
return false;
}
- if(!( validateClimateControlData(moduleData1.getClimateControlData(), moduleData2.getClimateControlData()) )){
+ if (!(validateClimateControlData(moduleData1.getClimateControlData(), moduleData2.getClimateControlData()))) {
return false;
}
return true;
}
- public static boolean validateSisData(SisData sisData1, SisData sisData2) {
- if (sisData1 == null) {
- return (sisData2 == null);
- }
- if (sisData2 == null) {
- return (sisData1 == null);
- }
+ public static boolean validateSisData(SisData sisData1, SisData sisData2) {
+ if (sisData1 == null) {
+ return (sisData2 == null);
+ }
+ if (sisData2 == null) {
+ return (sisData1 == null);
+ }
- if (sisData1.getStationShortName() != sisData2.getStationShortName()) {
- return false;
- }
+ if (sisData1.getStationShortName() != sisData2.getStationShortName()) {
+ return false;
+ }
- if (!(validateStationIDNumber(sisData1.getStationIDNumber(), sisData2.getStationIDNumber()))) {
- return false;
- }
+ if (!(validateStationIDNumber(sisData1.getStationIDNumber(), sisData2.getStationIDNumber()))) {
+ return false;
+ }
- if (sisData1.getStationLongName() != sisData2.getStationLongName()) {
- return false;
- }
+ if (sisData1.getStationLongName() != sisData2.getStationLongName()) {
+ return false;
+ }
- if (!(validateGpsData(sisData1.getStationLocation(), sisData2.getStationLocation()))) {
- return false;
- }
+ if (!(validateGpsData(sisData1.getStationLocation(), sisData2.getStationLocation()))) {
+ return false;
+ }
- if (sisData1.getStationMessage() != sisData2.getStationMessage()) {
- return false;
- }
+ if (sisData1.getStationMessage() != sisData2.getStationMessage()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateStationIDNumber(StationIDNumber stationIDNumber1, StationIDNumber stationIDNumber2){
- if(stationIDNumber1 == null){
- return ( stationIDNumber2 == null );
+ public static boolean validateStationIDNumber(StationIDNumber stationIDNumber1, StationIDNumber stationIDNumber2) {
+ if (stationIDNumber1 == null) {
+ return (stationIDNumber2 == null);
}
- if(stationIDNumber2 == null){
- return ( stationIDNumber1 == null );
+ if (stationIDNumber2 == null) {
+ return (stationIDNumber1 == null);
}
- if(stationIDNumber1.getCountryCode() != stationIDNumber2.getCountryCode()){
+ if (stationIDNumber1.getCountryCode() != stationIDNumber2.getCountryCode()) {
return false;
}
- if(stationIDNumber1.getFccFacilityId() != stationIDNumber2.getFccFacilityId()){
+ if (stationIDNumber1.getFccFacilityId() != stationIDNumber2.getFccFacilityId()) {
return false;
}
return true;
}
- public static boolean validateRemoteControlCapabilities(RemoteControlCapabilities remoteControlCapabilities1, RemoteControlCapabilities remoteControlCapabilities2){
- if(remoteControlCapabilities1 == null){
- return ( remoteControlCapabilities2 == null );
+ public static boolean validateRemoteControlCapabilities(RemoteControlCapabilities remoteControlCapabilities1, RemoteControlCapabilities remoteControlCapabilities2) {
+ if (remoteControlCapabilities1 == null) {
+ return (remoteControlCapabilities2 == null);
}
- if(remoteControlCapabilities2 == null){
- return ( remoteControlCapabilities1 == null );
+ if (remoteControlCapabilities2 == null) {
+ return (remoteControlCapabilities1 == null);
}
- if(!( validateButtonCapabilities(remoteControlCapabilities1.getButtonCapabilities(), remoteControlCapabilities2.getButtonCapabilities()) )){
+ if (!(validateButtonCapabilities(remoteControlCapabilities1.getButtonCapabilities(), remoteControlCapabilities2.getButtonCapabilities()))) {
return false;
}
- if(!( validateRadioControlCapabilities(remoteControlCapabilities1.getRadioControlCapabilities(), remoteControlCapabilities2.getRadioControlCapabilities()) )){
+ if (!(validateRadioControlCapabilities(remoteControlCapabilities1.getRadioControlCapabilities(), remoteControlCapabilities2.getRadioControlCapabilities()))) {
return false;
}
- if(!( validateClimateControlCapabilities(remoteControlCapabilities1.getClimateControlCapabilities(), remoteControlCapabilities2.getClimateControlCapabilities()) )){
+ if (!(validateClimateControlCapabilities(remoteControlCapabilities1.getClimateControlCapabilities(), remoteControlCapabilities2.getClimateControlCapabilities()))) {
return false;
}
return true;
}
- public static boolean validateRadioControlData(RadioControlData radioControlData1, RadioControlData radioControlData2){
- if(radioControlData1 == null){
- return ( radioControlData2 == null );
+ public static boolean validateRadioControlData(RadioControlData radioControlData1, RadioControlData radioControlData2) {
+ if (radioControlData1 == null) {
+ return (radioControlData2 == null);
}
- if(radioControlData2 == null){
- return ( radioControlData1 == null );
+ if (radioControlData2 == null) {
+ return (radioControlData1 == null);
}
- if(radioControlData1.getFrequencyInteger() != radioControlData2.getFrequencyInteger()){
+ if (radioControlData1.getFrequencyInteger() != radioControlData2.getFrequencyInteger()) {
log("validateRadioControlData",
"FrequencyInteger " + radioControlData1.getFrequencyInteger() + " didn't match FrequencyInteger " + radioControlData2.getFrequencyInteger()
+ ".");
return false;
}
- if(radioControlData1.getFrequencyFraction() != radioControlData2.getFrequencyFraction()){
+ if (radioControlData1.getFrequencyFraction() != radioControlData2.getFrequencyFraction()) {
log("validateRadioControlData",
"FrequencyFraction " + radioControlData1.getFrequencyFraction() + " didn't match FrequencyFraction " + radioControlData2.getFrequencyFraction()
+ ".");
return false;
}
- if(radioControlData1.getBand() != radioControlData2.getBand()){
+ if (radioControlData1.getBand() != radioControlData2.getBand()) {
log("validateRadioControlData",
"Band " + radioControlData1.getBand() + " didn't match Band " + radioControlData2.getBand()
+ ".");
return false;
}
- if(!( validateRdsData(radioControlData1.getRdsData(), radioControlData2.getRdsData()) )){
+ if (!(validateRdsData(radioControlData1.getRdsData(), radioControlData2.getRdsData()))) {
return false;
}
- if(radioControlData1.getAvailableHDs() != radioControlData2.getAvailableHDs()){
+ if (radioControlData1.getAvailableHDs() != radioControlData2.getAvailableHDs()) {
log("validateRadioControlData",
"AvailableHDs " + radioControlData1.getAvailableHDs() + " didn't match AvailableHDs " + radioControlData2.getAvailableHDs()
+ ".");
return false;
}
- if(radioControlData1.getHdChannel() != radioControlData2.getHdChannel()){
+ if (radioControlData1.getHdChannel() != radioControlData2.getHdChannel()) {
log("validateRadioControlData",
"HdChannel " + radioControlData1.getHdChannel() + " didn't match HdChannel " + radioControlData2.getHdChannel()
+ ".");
return false;
}
- if(radioControlData1.getSignalStrength() != radioControlData2.getSignalStrength()){
+ if (radioControlData1.getSignalStrength() != radioControlData2.getSignalStrength()) {
log("validateRadioControlData",
"SignalStrength " + radioControlData1.getSignalStrength() + " didn't match SignalStrength " + radioControlData2.getSignalStrength()
+ ".");
return false;
}
- if(radioControlData1.getSignalChangeThreshold() != radioControlData2.getSignalChangeThreshold()){
+ if (radioControlData1.getSignalChangeThreshold() != radioControlData2.getSignalChangeThreshold()) {
log("validateRadioControlData",
"SignalChangeThreshold " + radioControlData1.getSignalChangeThreshold() + " didn't match SignalChangeThreshold " + radioControlData2.getSignalChangeThreshold()
+ ".");
return false;
}
- if(radioControlData1.getRadioEnable() != radioControlData2.getRadioEnable()){
+ if (radioControlData1.getRadioEnable() != radioControlData2.getRadioEnable()) {
log("validateRadioControlData",
"RadioEnable " + radioControlData1.getRadioEnable() + " didn't match RadioEnable " + radioControlData2.getRadioEnable()
+ ".");
return false;
}
- if(radioControlData1.getState() != radioControlData2.getState()){
+ if (radioControlData1.getState() != radioControlData2.getState()) {
log("validateRadioControlData",
"State " + radioControlData1.getState() + " didn't match State " + radioControlData2.getState()
+ ".");
@@ -1275,22 +1276,22 @@ public class Validator{
return true;
}
- public static boolean validateNavigationCapability(NavigationCapability navigationCapability1, NavigationCapability navigationCapability2){
- if(navigationCapability1 == null){
- return ( navigationCapability2 == null );
+ public static boolean validateNavigationCapability(NavigationCapability navigationCapability1, NavigationCapability navigationCapability2) {
+ if (navigationCapability1 == null) {
+ return (navigationCapability2 == null);
}
- if(navigationCapability2 == null){
- return ( navigationCapability1 == null );
+ if (navigationCapability2 == null) {
+ return (navigationCapability1 == null);
}
- if(navigationCapability1.getSendLocationEnabled() != navigationCapability2.getSendLocationEnabled()){
+ if (navigationCapability1.getSendLocationEnabled() != navigationCapability2.getSendLocationEnabled()) {
log("validateNavigationCapability",
"SendLocationEnabled " + navigationCapability1.getSendLocationEnabled() + " didn't match SendLocationEnabled " + navigationCapability2.getSendLocationEnabled()
+ ".");
return false;
}
- if(navigationCapability1.getWayPointsEnabled() != navigationCapability2.getWayPointsEnabled()){
+ if (navigationCapability1.getWayPointsEnabled() != navigationCapability2.getWayPointsEnabled()) {
log("validateNavigationCapability",
"WayPointsEnabled " + navigationCapability1.getWayPointsEnabled() + " didn't match WayPointsEnabled " + navigationCapability2.getWayPointsEnabled() + ".");
return false;
@@ -1324,15 +1325,15 @@ public class Validator{
return true;
}
- public static boolean validatePhoneCapability(PhoneCapability phoneCapability1, PhoneCapability phoneCapability2){
- if(phoneCapability1 == null){
- return ( phoneCapability2 == null );
+ public static boolean validatePhoneCapability(PhoneCapability phoneCapability1, PhoneCapability phoneCapability2) {
+ if (phoneCapability1 == null) {
+ return (phoneCapability2 == null);
}
- if(phoneCapability2 == null){
- return ( phoneCapability1 == null );
+ if (phoneCapability2 == null) {
+ return (phoneCapability1 == null);
}
- if(phoneCapability1.getDialNumberEnabled() != phoneCapability2.getDialNumberEnabled()){
+ if (phoneCapability1.getDialNumberEnabled() != phoneCapability2.getDialNumberEnabled()) {
log("validatePhoneCapability",
"DialNumberEnabled " + phoneCapability1.getDialNumberEnabled() + " didn't match DialNumberEnabled " + phoneCapability1.getDialNumberEnabled()
+ ".");
@@ -1342,27 +1343,27 @@ public class Validator{
return true;
}
- public static boolean validateTouchEventCapabilities(TouchEventCapabilities item1, TouchEventCapabilities item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateTouchEventCapabilities(TouchEventCapabilities item1, TouchEventCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getPressAvailable() != item2.getPressAvailable()){
+ if (item1.getPressAvailable() != item2.getPressAvailable()) {
log("validateTouchEventCapabilities", "Press available \"" + item1.getPressAvailable()
+ "\" didn't match press available \"" + item1.getPressAvailable() + "\".");
return false;
}
- if(item1.getDoublePressAvailable() != item2.getDoublePressAvailable()){
+ if (item1.getDoublePressAvailable() != item2.getDoublePressAvailable()) {
log("validateTouchEventCapabilities", "Double press available \"" + item1.getDoublePressAvailable()
+ "\" didn't match double press available \"" + item1.getDoublePressAvailable() + "\".");
return false;
}
- if(item1.getMultiTouchAvailable() != item2.getMultiTouchAvailable()){
+ if (item1.getMultiTouchAvailable() != item2.getMultiTouchAvailable()) {
log("validateTouchEventCapabilities", "Multi-touch available \"" + item1.getMultiTouchAvailable()
+ "\" didn't match multi-touch available \"" + item1.getMultiTouchAvailable() + "\".");
return false;
@@ -1371,72 +1372,72 @@ public class Validator{
return true;
}
- public static boolean validateSeatMemoryAction(SeatMemoryAction item1, SeatMemoryAction item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
+ public static boolean validateSeatMemoryAction(SeatMemoryAction item1, SeatMemoryAction item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (item1.getAction() == null) {
- return (item2.getAction() == null);
- }
+ if (item1.getAction() == null) {
+ return (item2.getAction() == null);
+ }
- if (item1.getAction() != item2.getAction()) {
- return false;
- }
+ if (item1.getAction() != item2.getAction()) {
+ return false;
+ }
- if (item1.getId() != item2.getId()) {
- return false;
- }
+ if (item1.getId() != item2.getId()) {
+ return false;
+ }
- if (item1.getLabel() != item2.getLabel()) {
- return false;
- }
+ if (item1.getLabel() != item2.getLabel()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateTextFields(TextField item1, TextField item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateTextFields(TextField item1, TextField item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getCharacterSet() != item2.getCharacterSet()){
+ if (item1.getCharacterSet() != item2.getCharacterSet()) {
return false;
}
- if(item1.getName() != item2.getName()){
+ if (item1.getName() != item2.getName()) {
return false;
}
- if(item1.getRows() != item2.getRows()){
+ if (item1.getRows() != item2.getRows()) {
return false;
}
- if(item1.getWidth() != item2.getWidth()){
+ if (item1.getWidth() != item2.getWidth()) {
return false;
}
return true;
}
- public static boolean validateImageFields(ImageField item1, ImageField item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateImageFields(ImageField item1, ImageField item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(! (validateFileTypes(item1.getImageTypeSupported(), item2.getImageTypeSupported()) )){
+ if (!(validateFileTypes(item1.getImageTypeSupported(), item2.getImageTypeSupported()))) {
return false;
}
- if(item1.getName() != item2.getName()){
+ if (item1.getName() != item2.getName()) {
return false;
}
- if(!( validateImageResolution(item1.getImageResolution(), item2.getImageResolution()) )){
+ if (!(validateImageResolution(item1.getImageResolution(), item2.getImageResolution()))) {
return false;
}
@@ -1465,314 +1466,314 @@ public class Validator{
return true;
}
-
- public static boolean validateFileTypes (List<FileType> item1, List<FileType> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (item1.get(i) != item2.get(i)) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateWeatherDataList(List<WeatherData> item1Array, List<WeatherData> item2Array) {
- if(item1Array.size() != item2Array.size()){
- return false;
- }
-
- for(int i = 0; i < item1Array.size(); i++){
- if(!validateWeatherData(item1Array.get(i), item2Array.get(i))){
- return false;
- }
- }
- return true;
- }
-
- public static boolean validateWeatherData(WeatherData item1, WeatherData item2) {
- if (item1 == null) {
- return (item2 == null);
- }
-
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (!validateTemperature(item1.getCurrentTemperature(), item2.getCurrentTemperature())) {
- return false;
- }
-
- if (!validateTemperature(item1.getTemperatureHigh(), item2.getTemperatureHigh())) {
- return false;
- }
-
- if (!validateTemperature(item1.getTemperatureLow(), item2.getTemperatureLow())) {
- return false;
- }
-
- if (!validateTemperature(item1.getApparentTemperature(), item2.getApparentTemperature())) {
- return false;
- }
-
- if (!validateTemperature(item1.getApparentTemperatureHigh(), item2.getApparentTemperatureHigh())) {
- return false;
- }
-
- if (!validateTemperature(item1.getApparentTemperatureLow(), item2.getApparentTemperatureLow())) {
- return false;
- }
-
- if (!item1.getWeatherSummary().equals(item2.getWeatherSummary())) {
- return false;
- }
-
- if (!validateDateTime(item1.getTime(), item2.getTime())) {
- return false;
- }
-
- if (!item1.getHumidity().equals(item2.getHumidity())) {
- return false;
- }
-
- if (!item1.getCloudCover().equals(item2.getCloudCover())) {
- return false;
- }
-
- if (!item1.getMoonPhase().equals(item2.getMoonPhase())) {
- return false;
- }
-
- if (!item1.getWindBearing().equals(item2.getWindBearing())) {
- return false;
- }
-
- if (!item1.getWindGust().equals(item2.getWindGust())) {
- return false;
- }
-
- if (!item1.getWindSpeed().equals(item2.getWindSpeed())) {
- return false;
- }
-
- if (!item1.getNearestStormBearing().equals(item2.getNearestStormBearing())) {
- return false;
- }
-
- if (!item1.getNearestStormDistance().equals(item2.getNearestStormDistance())) {
- return false;
- }
-
- if (!item1.getPrecipAccumulation().equals(item2.getPrecipAccumulation())) {
- return false;
- }
-
- if (!item1.getPrecipIntensity().equals(item2.getPrecipIntensity())) {
- return false;
- }
-
- if (!item1.getPrecipProbability().equals(item2.getPrecipProbability())) {
- return false;
- }
-
- if (!item1.getPrecipType().equals(item2.getPrecipType())) {
- return false;
- }
-
- if (!item1.getVisibility().equals(item2.getVisibility())) {
- return false;
- }
-
- if (!validateImage(item1.getWeatherIcon(), item2.getWeatherIcon())) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateWeatherAlertList(List<WeatherAlert> item1Array, List<WeatherAlert> item2Array) {
- if(item1Array.size() != item2Array.size()){
- return false;
- }
- for(int i = 0; i < item1Array.size(); i++){
- if(!validateWeatherAlert(item1Array.get(i), item2Array.get(i))){
- return false;
- }
- }
- return true;
- }
+ public static boolean validateFileTypes(List<FileType> item1, List<FileType> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i) != item2.get(i)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherDataList(List<WeatherData> item1Array, List<WeatherData> item2Array) {
+ if (item1Array.size() != item2Array.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1Array.size(); i++) {
+ if (!validateWeatherData(item1Array.get(i), item2Array.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateWeatherData(WeatherData item1, WeatherData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- public static boolean validateNavigationInstructionList(List<NavigationInstruction> item1Array, List<NavigationInstruction> item2Array) {
- if (item1Array == null && item2Array == null){
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!validateTemperature(item1.getCurrentTemperature(), item2.getCurrentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureHigh(), item2.getTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getTemperatureLow(), item2.getTemperatureLow())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperature(), item2.getApparentTemperature())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureHigh(), item2.getApparentTemperatureHigh())) {
+ return false;
+ }
+
+ if (!validateTemperature(item1.getApparentTemperatureLow(), item2.getApparentTemperatureLow())) {
+ return false;
+ }
+
+ if (!item1.getWeatherSummary().equals(item2.getWeatherSummary())) {
+ return false;
+ }
+
+ if (!validateDateTime(item1.getTime(), item2.getTime())) {
+ return false;
+ }
+
+ if (!item1.getHumidity().equals(item2.getHumidity())) {
+ return false;
+ }
+
+ if (!item1.getCloudCover().equals(item2.getCloudCover())) {
+ return false;
+ }
+
+ if (!item1.getMoonPhase().equals(item2.getMoonPhase())) {
+ return false;
+ }
+
+ if (!item1.getWindBearing().equals(item2.getWindBearing())) {
+ return false;
+ }
+
+ if (!item1.getWindGust().equals(item2.getWindGust())) {
+ return false;
+ }
+
+ if (!item1.getWindSpeed().equals(item2.getWindSpeed())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormBearing().equals(item2.getNearestStormBearing())) {
+ return false;
+ }
+
+ if (!item1.getNearestStormDistance().equals(item2.getNearestStormDistance())) {
+ return false;
+ }
+
+ if (!item1.getPrecipAccumulation().equals(item2.getPrecipAccumulation())) {
+ return false;
+ }
+
+ if (!item1.getPrecipIntensity().equals(item2.getPrecipIntensity())) {
+ return false;
+ }
+
+ if (!item1.getPrecipProbability().equals(item2.getPrecipProbability())) {
+ return false;
+ }
+
+ if (!item1.getPrecipType().equals(item2.getPrecipType())) {
+ return false;
+ }
+
+ if (!item1.getVisibility().equals(item2.getVisibility())) {
+ return false;
+ }
+
+ if (!validateImage(item1.getWeatherIcon(), item2.getWeatherIcon())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateWeatherAlertList(List<WeatherAlert> item1Array, List<WeatherAlert> item2Array) {
+ if (item1Array.size() != item2Array.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1Array.size(); i++) {
+ if (!validateWeatherAlert(item1Array.get(i), item2Array.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateNavigationInstructionList(List<NavigationInstruction> item1Array, List<NavigationInstruction> item2Array) {
+ if (item1Array == null && item2Array == null) {
return true;
}
- if (item1Array == null || item2Array == null){
+ if (item1Array == null || item2Array == null) {
return false;
}
- if(item1Array.size() != item2Array.size()){
- return false;
- }
+ if (item1Array.size() != item2Array.size()) {
+ return false;
+ }
- for(int i = 0; i < item1Array.size(); i++){
- if(!validateNavigationInstruction(item1Array.get(i), item2Array.get(i))){
- return false;
- }
- }
- return true;
- }
+ for (int i = 0; i < item1Array.size(); i++) {
+ if (!validateNavigationInstruction(item1Array.get(i), item2Array.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
- public static boolean validateNavigationInstruction(NavigationInstruction item1, NavigationInstruction item2) {
- if (item1 == null) {
- return (item2 == null);
- }
+ public static boolean validateNavigationInstruction(NavigationInstruction item1, NavigationInstruction item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- if (item2 == null) {
- return (item1 == null);
- }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (!validateLocationDetails(item1.getLocationDetails(),item2.getLocationDetails())) {
- return false;
- }
+ if (!validateLocationDetails(item1.getLocationDetails(), item2.getLocationDetails())) {
+ return false;
+ }
- if (!item1.getAction().equals(item2.getAction())) {
- return false;
- }
+ if (!item1.getAction().equals(item2.getAction())) {
+ return false;
+ }
- if (!validateDateTime(item1.getEta(),item2.getEta())) {
- return false;
- }
+ if (!validateDateTime(item1.getEta(), item2.getEta())) {
+ return false;
+ }
- if (!item1.getBearing().equals(item2.getBearing())) {
- return false;
- }
+ if (!item1.getBearing().equals(item2.getBearing())) {
+ return false;
+ }
- if (!item1.getJunctionType().equals(item2.getJunctionType())) {
- return false;
- }
+ if (!item1.getJunctionType().equals(item2.getJunctionType())) {
+ return false;
+ }
- if (!item1.getDrivingSide().equals(item2.getDrivingSide())) {
- return false;
- }
+ if (!item1.getDrivingSide().equals(item2.getDrivingSide())) {
+ return false;
+ }
- if (!item1.getDetails().equals(item2.getDetails())) {
- return false;
- }
+ if (!item1.getDetails().equals(item2.getDetails())) {
+ return false;
+ }
- if (!validateImage(item1.getImage(),item2.getImage())) {
- return false;
- }
+ if (!validateImage(item1.getImage(), item2.getImage())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateMediaServiceData(MediaServiceData item1, MediaServiceData item2) {
- if (item1 == null) {
- return (item2 == null);
- }
+ public static boolean validateMediaServiceData(MediaServiceData item1, MediaServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- if (item2 == null) {
- return (item1 == null);
- }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (!item1.getMediaType().equals(item2.getMediaType())) {
- return false;
- }
+ if (!item1.getMediaType().equals(item2.getMediaType())) {
+ return false;
+ }
- if (!item1.getMediaTitle().equals(item2.getMediaTitle())) {
- return false;
- }
+ if (!item1.getMediaTitle().equals(item2.getMediaTitle())) {
+ return false;
+ }
- if (!item1.getMediaArtist().equals(item2.getMediaArtist())) {
- return false;
- }
+ if (!item1.getMediaArtist().equals(item2.getMediaArtist())) {
+ return false;
+ }
- if (!item1.getMediaAlbum().equals(item2.getMediaAlbum())) {
- return false;
- }
+ if (!item1.getMediaAlbum().equals(item2.getMediaAlbum())) {
+ return false;
+ }
- if (!item1.getPlaylistName().equals(item2.getPlaylistName())) {
- return false;
- }
+ if (!item1.getPlaylistName().equals(item2.getPlaylistName())) {
+ return false;
+ }
- if (!item1.getIsExplicit().equals(item2.getIsExplicit())) {
- return false;
- }
+ if (!item1.getIsExplicit().equals(item2.getIsExplicit())) {
+ return false;
+ }
- if (!item1.getTrackPlaybackProgress().equals(item2.getTrackPlaybackProgress())) {
- return false;
- }
+ if (!item1.getTrackPlaybackProgress().equals(item2.getTrackPlaybackProgress())) {
+ return false;
+ }
- if (!item1.getTrackPlaybackDuration().equals(item2.getTrackPlaybackDuration())) {
- return false;
- }
+ if (!item1.getTrackPlaybackDuration().equals(item2.getTrackPlaybackDuration())) {
+ return false;
+ }
- if (!item1.getQueuePlaybackProgress().equals(item2.getQueuePlaybackProgress())) {
- return false;
- }
-
- if (!item1.getQueueCurrentTrackNumber().equals(item2.getQueueCurrentTrackNumber())) {
- return false;
- }
-
- if (!item1.getQueuePlaybackDuration().equals(item2.getQueuePlaybackDuration())) {
- return false;
- }
+ if (!item1.getQueuePlaybackProgress().equals(item2.getQueuePlaybackProgress())) {
+ return false;
+ }
- if (!item1.getQueueTotalTrackCount().equals(item2.getQueueTotalTrackCount())) {
- return false;
- }
+ if (!item1.getQueueCurrentTrackNumber().equals(item2.getQueueCurrentTrackNumber())) {
+ return false;
+ }
- return true;
- }
+ if (!item1.getQueuePlaybackDuration().equals(item2.getQueuePlaybackDuration())) {
+ return false;
+ }
- public static boolean validateWeatherServiceData(WeatherServiceData item1, WeatherServiceData item2) {
- if (item1 == null) {
- return (item2 == null);
- }
+ if (!item1.getQueueTotalTrackCount().equals(item2.getQueueTotalTrackCount())) {
+ return false;
+ }
- if (item2 == null) {
- return (item1 == null);
- }
+ return true;
+ }
- if (!validateLocationDetails(item1.getLocation(), item2.getLocation())) {
- return false;
- }
+ public static boolean validateWeatherServiceData(WeatherServiceData item1, WeatherServiceData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- if (!validateWeatherData(item1.getCurrentForecast(), item2.getCurrentForecast())) {
- return false;
- }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (!validateWeatherDataList(item1.getHourlyForecast(), item2.getHourlyForecast())) {
- return false;
- }
+ if (!validateLocationDetails(item1.getLocation(), item2.getLocation())) {
+ return false;
+ }
- if (!validateWeatherDataList(item1.getMinuteForecast(), item2.getMinuteForecast())) {
- return false;
- }
+ if (!validateWeatherData(item1.getCurrentForecast(), item2.getCurrentForecast())) {
+ return false;
+ }
- if (!validateWeatherDataList(item1.getMultidayForecast(), item2.getMultidayForecast())) {
- return false;
- }
+ if (!validateWeatherDataList(item1.getHourlyForecast(), item2.getHourlyForecast())) {
+ return false;
+ }
- if (!validateWeatherAlertList(item1.getAlerts(), item2.getAlerts())) {
- return false;
- }
+ if (!validateWeatherDataList(item1.getMinuteForecast(), item2.getMinuteForecast())) {
+ return false;
+ }
- return true;
- }
+ if (!validateWeatherDataList(item1.getMultidayForecast(), item2.getMultidayForecast())) {
+ return false;
+ }
+
+ if (!validateWeatherAlertList(item1.getAlerts(), item2.getAlerts())) {
+ return false;
+ }
+
+ return true;
+ }
public static boolean validateNavigationServiceData(NavigationServiceData item1, NavigationServiceData item2) {
if (item1 == null) {
@@ -1811,7 +1812,7 @@ public class Validator{
return false;
}
- if (item1.getNextInstructionDistanceScale() != null && item2.getNextInstructionDistanceScale() != null && !item1.getNextInstructionDistanceScale().equals(item2.getNextInstructionDistanceScale())) {
+ if (item1.getNextInstructionDistanceScale() != null && item2.getNextInstructionDistanceScale() != null && !item1.getNextInstructionDistanceScale().equals(item2.getNextInstructionDistanceScale())) {
return false;
}
@@ -1822,495 +1823,495 @@ public class Validator{
return true;
}
- public static boolean validateWeatherAlert(WeatherAlert item1, WeatherAlert item2) {
- if (item1 == null) {
- return (item2 == null);
- }
+ public static boolean validateWeatherAlert(WeatherAlert item1, WeatherAlert item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- if (item2 == null) {
- return (item1 == null);
- }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (!validateDateTime(item1.getExpires(), item2.getExpires())) {
- return false;
- }
+ if (!validateDateTime(item1.getExpires(), item2.getExpires())) {
+ return false;
+ }
- if (!validateDateTime(item1.getTimeIssued(), item2.getTimeIssued())) {
- return false;
- }
+ if (!validateDateTime(item1.getTimeIssued(), item2.getTimeIssued())) {
+ return false;
+ }
- if (!item1.getTitle().equals(item2.getTitle())) {
- return false;
- }
+ if (!item1.getTitle().equals(item2.getTitle())) {
+ return false;
+ }
- if (!item1.getSummary().equals(item2.getSummary())) {
- return false;
- }
+ if (!item1.getSummary().equals(item2.getSummary())) {
+ return false;
+ }
- if (!item1.getSeverity().equals(item2.getSeverity())) {
- return false;
- }
+ if (!item1.getSeverity().equals(item2.getSeverity())) {
+ return false;
+ }
- if (!validateStringList(item1.getRegions(), item2.getRegions())) {
- return false;
- }
+ if (!validateStringList(item1.getRegions(), item2.getRegions())) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateDateTime(DateTime item1, DateTime item2) {
- if (item1 == null) {
- return (item2 == null);
- }
+ public static boolean validateDateTime(DateTime item1, DateTime item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
- if (item2 == null) {
- return (item1 == null);
- }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if(item1.getDay() != item2.getDay()){
- return false;
- }
+ if (item1.getDay() != item2.getDay()) {
+ return false;
+ }
- if(item1.getHour() != item2.getHour()){
- return false;
- }
+ if (item1.getHour() != item2.getHour()) {
+ return false;
+ }
- if(item1.getMilliSecond() != item2.getMilliSecond()){
- return false;
- }
+ if (item1.getMilliSecond() != item2.getMilliSecond()) {
+ return false;
+ }
- if(item1.getMinute() != item2.getMinute()){
- return false;
- }
+ if (item1.getMinute() != item2.getMinute()) {
+ return false;
+ }
- if(item1.getMonth() != item2.getMonth()){
- return false;
- }
+ if (item1.getMonth() != item2.getMonth()) {
+ return false;
+ }
- if(item1.getSecond() != item2.getSecond()){
- return false;
- }
+ if (item1.getSecond() != item2.getSecond()) {
+ return false;
+ }
- if(item1.getTzHour() != item2.getTzHour()){
- return false;
- }
+ if (item1.getTzHour() != item2.getTzHour()) {
+ return false;
+ }
- if(item1.getTzMinute() != item2.getTzMinute()){
- return false;
- }
+ if (item1.getTzMinute() != item2.getTzMinute()) {
+ return false;
+ }
- if(item1.getYear() != item2.getYear()){
- return false;
- }
+ if (item1.getYear() != item2.getYear()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateGpsData(GPSData item1, GPSData item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateGpsData(GPSData item1, GPSData item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getActual() != item2.getActual()){
+ if (item1.getActual() != item2.getActual()) {
return false;
}
- if(item1.getAltitude() != item2.getAltitude()){
+ if (item1.getAltitude() != item2.getAltitude()) {
return false;
}
- if(item1.getCompassDirection() != item2.getCompassDirection()){
+ if (item1.getCompassDirection() != item2.getCompassDirection()) {
return false;
}
- if(item1.getDimension() != item2.getDimension()){
+ if (item1.getDimension() != item2.getDimension()) {
return false;
}
- if(item1.getHdop() != item2.getHdop()){
+ if (item1.getHdop() != item2.getHdop()) {
return false;
}
- if(item1.getHeading() != item2.getHeading()){
+ if (item1.getHeading() != item2.getHeading()) {
return false;
}
- if(item1.getLatitudeDegrees() != item2.getLatitudeDegrees()){
+ if (item1.getLatitudeDegrees() != item2.getLatitudeDegrees()) {
return false;
}
- if(item1.getLongitudeDegrees() != item2.getLongitudeDegrees()){
+ if (item1.getLongitudeDegrees() != item2.getLongitudeDegrees()) {
return false;
}
- if(item1.getPdop() != item2.getPdop()){
+ if (item1.getPdop() != item2.getPdop()) {
return false;
}
- if(item1.getSatellites() != item2.getSatellites()){
+ if (item1.getSatellites() != item2.getSatellites()) {
return false;
}
- if(item1.getSpeed() != item2.getSpeed()){
+ if (item1.getSpeed() != item2.getSpeed()) {
return false;
}
- if(item1.getUtcDay() != item2.getUtcDay()){
+ if (item1.getUtcDay() != item2.getUtcDay()) {
return false;
}
- if(item1.getUtcHours() != item2.getUtcHours()){
+ if (item1.getUtcHours() != item2.getUtcHours()) {
return false;
}
- if(item1.getUtcMinutes() != item1.getUtcMinutes()){
+ if (item1.getUtcMinutes() != item1.getUtcMinutes()) {
return false;
}
- if(item1.getUtcMonth() != item2.getUtcMonth()){
+ if (item1.getUtcMonth() != item2.getUtcMonth()) {
return false;
}
- if(item1.getUtcSeconds() != item2.getUtcSeconds()){
+ if (item1.getUtcSeconds() != item2.getUtcSeconds()) {
return false;
}
- if(item1.getUtcYear() != item2.getUtcYear()){
+ if (item1.getUtcYear() != item2.getUtcYear()) {
return false;
}
- if(item1.getVdop() != item2.getVdop()){
+ if (item1.getVdop() != item2.getVdop()) {
return false;
}
- if(item1.getShifted() != item2.getShifted()){
+ if (item1.getShifted() != item2.getShifted()) {
return false;
}
return true;
}
- public static boolean validateTireStatus(TireStatus item1, TireStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateTireStatus(TireStatus item1, TireStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getPressureTellTale() != item2.getPressureTellTale()){
+ if (item1.getPressureTellTale() != item2.getPressureTellTale()) {
return false;
}
-
+
SingleTireStatus item1Status = item1.getLeftFront();
SingleTireStatus item2Status = item2.getLeftFront();
boolean isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
+ if (!isEqual) return false;
item1Status = item1.getRightFront();
item2Status = item2.getRightFront();
isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
+ if (!isEqual) return false;
item1Status = item1.getLeftRear();
item2Status = item2.getLeftRear();
isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
+ if (!isEqual) return false;
item1Status = item1.getRightRear();
item2Status = item2.getRightRear();
isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
+ if (!isEqual) return false;
item1Status = item1.getInnerLeftRear();
item2Status = item2.getInnerLeftRear();
isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
+ if (!isEqual) return false;
item1Status = item1.getInnerRightRear();
item2Status = item2.getInnerRightRear();
isEqual = validateSingleTireStatus(item1Status, item2Status);
- if(!isEqual) return false;
-
+ if (!isEqual) return false;
+
return true;
}
- public static boolean validateSingleTireStatus(SingleTireStatus item1, SingleTireStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateSingleTireStatus(SingleTireStatus item1, SingleTireStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getStatus() != item2.getStatus()){
+ if (item1.getStatus() != item2.getStatus()) {
return false;
}
return true;
}
- public static boolean validateBeltStatus(BeltStatus item1, BeltStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateBeltStatus(BeltStatus item1, BeltStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getLeftRearInflatableBelted() != item2.getLeftRearInflatableBelted()){
+ if (item1.getLeftRearInflatableBelted() != item2.getLeftRearInflatableBelted()) {
return false;
}
- if(item1.getRightRearInflatableBelted() != item2.getRightRearInflatableBelted()){
+ if (item1.getRightRearInflatableBelted() != item2.getRightRearInflatableBelted()) {
return false;
}
- if(item1.getPassengerChildDetected() != item2.getPassengerChildDetected()){
+ if (item1.getPassengerChildDetected() != item2.getPassengerChildDetected()) {
return false;
}
- if(item1.getDriverBuckleBelted() != item2.getDriverBuckleBelted()){
+ if (item1.getDriverBuckleBelted() != item2.getDriverBuckleBelted()) {
return false;
}
- if(item1.getPassengerBuckleBelted() != item2.getPassengerBuckleBelted()){
+ if (item1.getPassengerBuckleBelted() != item2.getPassengerBuckleBelted()) {
return false;
}
- if(item1.getRightRow2BuckleBelted() != item2.getRightRow2BuckleBelted()){
+ if (item1.getRightRow2BuckleBelted() != item2.getRightRow2BuckleBelted()) {
return false;
}
- if(item1.getMiddleRow1BuckleBelted() != item2.getMiddleRow1BuckleBelted()){
+ if (item1.getMiddleRow1BuckleBelted() != item2.getMiddleRow1BuckleBelted()) {
return false;
}
- if(item1.getLeftRow2BuckleBelted() != item2.getLeftRow2BuckleBelted()){
+ if (item1.getLeftRow2BuckleBelted() != item2.getLeftRow2BuckleBelted()) {
return false;
}
- if(item1.getMiddleRow2BuckleBelted() != item2.getMiddleRow2BuckleBelted()){
+ if (item1.getMiddleRow2BuckleBelted() != item2.getMiddleRow2BuckleBelted()) {
return false;
}
- if(item1.getMiddleRow3BuckleBelted() != item2.getMiddleRow3BuckleBelted()){
+ if (item1.getMiddleRow3BuckleBelted() != item2.getMiddleRow3BuckleBelted()) {
return false;
}
- if(item1.getLeftRow3BuckleBelted() != item2.getLeftRow3BuckleBelted()){
+ if (item1.getLeftRow3BuckleBelted() != item2.getLeftRow3BuckleBelted()) {
return false;
}
- if(item1.getRightRow3BuckleBelted() != item2.getRightRow3BuckleBelted()){
+ if (item1.getRightRow3BuckleBelted() != item2.getRightRow3BuckleBelted()) {
return false;
}
- if(item1.getPassengerBeltDeployed() != item2.getPassengerBeltDeployed()){
+ if (item1.getPassengerBeltDeployed() != item2.getPassengerBeltDeployed()) {
return false;
}
- if(item1.getMiddleRow1BeltDeployed() != item2.getMiddleRow1BeltDeployed()){
+ if (item1.getMiddleRow1BeltDeployed() != item2.getMiddleRow1BeltDeployed()) {
return false;
}
return true;
}
- public static boolean validateBodyInformation(BodyInformation item1, BodyInformation item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateBodyInformation(BodyInformation item1, BodyInformation item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getIgnitionStatus() != item2.getIgnitionStatus()){
+ if (item1.getIgnitionStatus() != item2.getIgnitionStatus()) {
return false;
}
- if(item1.getIgnitionStableStatus() != item2.getIgnitionStableStatus()){
+ if (item1.getIgnitionStableStatus() != item2.getIgnitionStableStatus()) {
return false;
}
- if(item1.getParkBrakeActive() != item2.getParkBrakeActive()){
+ if (item1.getParkBrakeActive() != item2.getParkBrakeActive()) {
return false;
}
- if(item1.getDriverDoorAjar() != item2.getDriverDoorAjar()){
+ if (item1.getDriverDoorAjar() != item2.getDriverDoorAjar()) {
return false;
}
- if(item1.getPassengerDoorAjar() != item2.getPassengerDoorAjar()){
+ if (item1.getPassengerDoorAjar() != item2.getPassengerDoorAjar()) {
return false;
}
- if(item1.getRearLeftDoorAjar() != item2.getRearLeftDoorAjar()){
+ if (item1.getRearLeftDoorAjar() != item2.getRearLeftDoorAjar()) {
return false;
}
- if(item1.getRearRightDoorAjar() != item2.getRearRightDoorAjar()){
+ if (item1.getRearRightDoorAjar() != item2.getRearRightDoorAjar()) {
return false;
}
return true;
}
- public static boolean validateDeviceStatus(DeviceStatus item1, DeviceStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateDeviceStatus(DeviceStatus item1, DeviceStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getBtIconOn() != item2.getBtIconOn()){
+ if (item1.getBtIconOn() != item2.getBtIconOn()) {
return false;
}
- if(item1.getCallActive() != item2.getCallActive()){
+ if (item1.getCallActive() != item2.getCallActive()) {
return false;
}
- if(item1.getECallEventActive() != item2.getECallEventActive()){
+ if (item1.getECallEventActive() != item2.getECallEventActive()) {
return false;
}
- if(item1.getMonoAudioOutputMuted() != item2.getMonoAudioOutputMuted()){
+ if (item1.getMonoAudioOutputMuted() != item2.getMonoAudioOutputMuted()) {
return false;
}
- if(item1.getPhoneRoaming() != item2.getPhoneRoaming()){
+ if (item1.getPhoneRoaming() != item2.getPhoneRoaming()) {
return false;
}
- if(item1.getStereoAudioOutputMuted() != item2.getStereoAudioOutputMuted()){
+ if (item1.getStereoAudioOutputMuted() != item2.getStereoAudioOutputMuted()) {
return false;
}
- if(item1.getTextMsgAvailable() != item2.getTextMsgAvailable()){
+ if (item1.getTextMsgAvailable() != item2.getTextMsgAvailable()) {
return false;
}
- if(item1.getVoiceRecOn() != item2.getVoiceRecOn()){
+ if (item1.getVoiceRecOn() != item2.getVoiceRecOn()) {
return false;
}
- if(item1.getBattLevelStatus() != item2.getBattLevelStatus()){
+ if (item1.getBattLevelStatus() != item2.getBattLevelStatus()) {
return false;
}
- if(item1.getPrimaryAudioSource() != item2.getPrimaryAudioSource()){
+ if (item1.getPrimaryAudioSource() != item2.getPrimaryAudioSource()) {
return false;
}
- if(item1.getSignalLevelStatus() != item2.getSignalLevelStatus()){
+ if (item1.getSignalLevelStatus() != item2.getSignalLevelStatus()) {
return false;
}
return true;
}
- public static boolean validateHeadLampStatus(HeadLampStatus item1, HeadLampStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateHeadLampStatus(HeadLampStatus item1, HeadLampStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getHighBeamsOn() != item2.getHighBeamsOn()){
+ if (item1.getHighBeamsOn() != item2.getHighBeamsOn()) {
return false;
}
- if(item1.getLowBeamsOn() != item2.getLowBeamsOn()){
+ if (item1.getLowBeamsOn() != item2.getLowBeamsOn()) {
return false;
}
- if(item1.getAmbientLightStatus() != item2.getAmbientLightStatus()){
+ if (item1.getAmbientLightStatus() != item2.getAmbientLightStatus()) {
return false;
}
return true;
}
- public static boolean validateECallInfo(ECallInfo item1, ECallInfo item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateECallInfo(ECallInfo item1, ECallInfo item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getAuxECallNotificationStatus() != item2.getAuxECallNotificationStatus()){
+ if (item1.getAuxECallNotificationStatus() != item2.getAuxECallNotificationStatus()) {
return false;
}
- if(item1.getECallConfirmationStatus() != item2.getECallConfirmationStatus()){
+ if (item1.getECallConfirmationStatus() != item2.getECallConfirmationStatus()) {
return false;
}
- if(item1.getECallNotificationStatus() != item2.getECallNotificationStatus()){
+ if (item1.getECallNotificationStatus() != item2.getECallNotificationStatus()) {
return false;
}
return true;
}
- public static boolean validateAirbagStatus(AirbagStatus item1, AirbagStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateAirbagStatus(AirbagStatus item1, AirbagStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getDriverAirbagDeployed() != item2.getDriverAirbagDeployed()){
+ if (item1.getDriverAirbagDeployed() != item2.getDriverAirbagDeployed()) {
return false;
}
- if(item1.getDriverSideAirbagDeployed() != item2.getDriverSideAirbagDeployed()){
+ if (item1.getDriverSideAirbagDeployed() != item2.getDriverSideAirbagDeployed()) {
return false;
}
- if(item1.getDriverCurtainAirbagDeployed() != item2.getDriverCurtainAirbagDeployed()){
+ if (item1.getDriverCurtainAirbagDeployed() != item2.getDriverCurtainAirbagDeployed()) {
return false;
}
- if(item1.getPassengerAirbagDeployed() != item2.getPassengerAirbagDeployed()){
+ if (item1.getPassengerAirbagDeployed() != item2.getPassengerAirbagDeployed()) {
return false;
}
- if(item1.getPassengerCurtainAirbagDeployed() != item2.getPassengerCurtainAirbagDeployed()){
+ if (item1.getPassengerCurtainAirbagDeployed() != item2.getPassengerCurtainAirbagDeployed()) {
return false;
}
- if(item1.getDriverKneeAirbagDeployed() != item2.getDriverKneeAirbagDeployed()){
+ if (item1.getDriverKneeAirbagDeployed() != item2.getDriverKneeAirbagDeployed()) {
return false;
}
- if(item1.getPassengerSideAirbagDeployed() != item2.getPassengerSideAirbagDeployed()){
+ if (item1.getPassengerSideAirbagDeployed() != item2.getPassengerSideAirbagDeployed()) {
return false;
}
- if(item1.getPassengerKneeAirbagDeployed() != item2.getPassengerKneeAirbagDeployed()){
+ if (item1.getPassengerKneeAirbagDeployed() != item2.getPassengerKneeAirbagDeployed()) {
return false;
}
return true;
}
- public static boolean validateEmergencyEvent(EmergencyEvent item1, EmergencyEvent item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateEmergencyEvent(EmergencyEvent item1, EmergencyEvent item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getEmergencyEventType() != item2.getEmergencyEventType()){
+ if (item1.getEmergencyEventType() != item2.getEmergencyEventType()) {
return false;
}
- if(item1.getFuelCutoffStatus() != item2.getFuelCutoffStatus()){
+ if (item1.getFuelCutoffStatus() != item2.getFuelCutoffStatus()) {
return false;
}
- if(item1.getMaximumChangeVelocity() != item2.getMaximumChangeVelocity()){
+ if (item1.getMaximumChangeVelocity() != item2.getMaximumChangeVelocity()) {
return false;
}
- if(item1.getMultipleEvents() != item2.getMultipleEvents()){
+ if (item1.getMultipleEvents() != item2.getMultipleEvents()) {
return false;
}
- if(item1.getRolloverEvent() != item2.getRolloverEvent()){
+ if (item1.getRolloverEvent() != item2.getRolloverEvent()) {
return false;
}
return true;
}
- public static boolean validateClusterModeStatus(ClusterModeStatus item1, ClusterModeStatus item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateClusterModeStatus(ClusterModeStatus item1, ClusterModeStatus item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getPowerModeActive() != item2.getPowerModeActive()){
+ if (item1.getPowerModeActive() != item2.getPowerModeActive()) {
return false;
}
- if(item1.getPowerModeQualificationStatus() != item2.getPowerModeQualificationStatus()){
+ if (item1.getPowerModeQualificationStatus() != item2.getPowerModeQualificationStatus()) {
return false;
}
- if(item1.getPowerModeStatus() != item2.getPowerModeStatus()){
+ if (item1.getPowerModeStatus() != item2.getPowerModeStatus()) {
return false;
}
- if(item1.getCarModeStatus() != item2.getCarModeStatus()){
+ if (item1.getCarModeStatus() != item2.getCarModeStatus()) {
return false;
}
return true;
}
- public static boolean validateMyKey(MyKey item1, MyKey item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateMyKey(MyKey item1, MyKey item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
- if(item1.getE911Override() != item2.getE911Override()){
+ if (item1.getE911Override() != item2.getE911Override()) {
return false;
}
return true;
}
- public static boolean validateFuelRange (List<FuelRange> item1, List<FuelRange> item2) {
+ public static boolean validateFuelRange(List<FuelRange> item1, List<FuelRange> item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -2345,12 +2346,12 @@ public class Validator{
return true;
}
- public static boolean validatePermissionItem(PermissionItem item1, PermissionItem item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validatePermissionItem(PermissionItem item1, PermissionItem item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
/*
if(item1 == item2){
@@ -2358,31 +2359,31 @@ public class Validator{
return false;
}
*/
- if(!item1.getRpcName().equals(item2.getRpcName())){
+ if (!item1.getRpcName().equals(item2.getRpcName())) {
return false;
}
- if(!validateHmiPermissions(item1.getHMIPermissions(), item2.getHMIPermissions())){
+ if (!validateHmiPermissions(item1.getHMIPermissions(), item2.getHMIPermissions())) {
return false;
}
- if(!validateParameterPermissions(item1.getParameterPermissions(), item2.getParameterPermissions())){
+ if (!validateParameterPermissions(item1.getParameterPermissions(), item2.getParameterPermissions())) {
return false;
}
- if(item1.getRequireEncryption() != item2.getRequireEncryption()) {
+ if (item1.getRequireEncryption() != item2.getRequireEncryption()) {
return false;
}
return true;
}
- public static boolean validateHmiPermissions(HMIPermissions item1, HMIPermissions item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateHmiPermissions(HMIPermissions item1, HMIPermissions item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
/*
if(item1 == item2){
@@ -2390,45 +2391,45 @@ public class Validator{
return false;
}
*/
- if(!validateHmiLevelLists(item1.getAllowed(), item2.getAllowed())){
+ if (!validateHmiLevelLists(item1.getAllowed(), item2.getAllowed())) {
return false;
}
List<HMILevel> item1Array = item1.getUserDisallowed();
List<HMILevel> item2Array = item2.getUserDisallowed();
- if(item1Array.size() != item2Array.size()){
+ if (item1Array.size() != item2Array.size()) {
return false;
}
- for(int i = 0; i < item1Array.size(); i++){
- if(item1Array.get(i) != item2Array.get(i)){
+ for (int i = 0; i < item1Array.size(); i++) {
+ if (item1Array.get(i) != item2Array.get(i)) {
return false;
}
}
return true;
}
-
+
public static boolean validateHmiLevelLists(List<HMILevel> item1Array, List<HMILevel> item2Array) {
- if(item1Array.size() != item2Array.size()){
+ if (item1Array.size() != item2Array.size()) {
return false;
}
- for(int i = 0; i < item1Array.size(); i++){
- if(item1Array.get(i) != item2Array.get(i)){
+ for (int i = 0; i < item1Array.size(); i++) {
+ if (item1Array.get(i) != item2Array.get(i)) {
return false;
}
}
return true;
}
- public static boolean validateParameterPermissions(ParameterPermissions item1, ParameterPermissions item2){
- if(item1 == null){
- return ( item2 == null );
+ public static boolean validateParameterPermissions(ParameterPermissions item1, ParameterPermissions item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
/*
if(item1 == item2){
@@ -2436,182 +2437,182 @@ public class Validator{
return false;
}
*/
- if(!validateStringList(item1.getAllowed(), item2.getAllowed())){
+ if (!validateStringList(item1.getAllowed(), item2.getAllowed())) {
return false;
}
- if(!validateStringList(item1.getUserDisallowed(), item2.getUserDisallowed())){
+ if (!validateStringList(item1.getUserDisallowed(), item2.getUserDisallowed())) {
return false;
}
return true;
}
-
- public static boolean validateTouchEvent(TouchEvent item1, TouchEvent item2){
- if(item1 == null){
- return ( item2 == null );
+
+ public static boolean validateTouchEvent(TouchEvent item1, TouchEvent item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
-
- if(item1 == item2){
+
+ if (item1 == item2) {
return true;
}
-
+
List<TouchCoord> tc1 = item1.getC();
List<TouchCoord> tc2 = item2.getC();
List<Long> ts1 = item1.getTs();
List<Long> ts2 = item2.getTs();
-
- for(int i=0; i<tc1.size(); i++){
- if( ! validateTouchCoord(tc1.get(i), tc2.get(i)) ){
+
+ for (int i = 0; i < tc1.size(); i++) {
+ if (!validateTouchCoord(tc1.get(i), tc2.get(i))) {
return false;
}
- if(ts1.get(i) != ts2.get(i)){
+ if (ts1.get(i) != ts2.get(i)) {
return false;
}
}
-
- if(item1.getId() != item2.getId()){
+
+ if (item1.getId() != item2.getId()) {
return false;
}
-
-
+
+
return true;
}
-
- public static boolean validateTouchCoord(TouchCoord item1, TouchCoord item2){
- if(item1 == null){
- return ( item2 == null );
+
+ public static boolean validateTouchCoord(TouchCoord item1, TouchCoord item2) {
+ if (item1 == null) {
+ return (item2 == null);
}
- if(item2 == null){
- return ( item1 == null );
+ if (item2 == null) {
+ return (item1 == null);
}
-
- if(item1.getX() != item2.getX()){
+
+ if (item1.getX() != item2.getX()) {
return false;
}
- if(item1.getY() != item2.getY()){
+ if (item1.getY() != item2.getY()) {
return false;
}
-
+
return true;
}
- public static boolean validateMassageModeData(MassageModeData item1, MassageModeData item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
+ public static boolean validateMassageModeData(MassageModeData item1, MassageModeData item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (item1.getMassageMode() != item2.getMassageMode()) {
- return false;
- }
+ if (item1.getMassageMode() != item2.getMassageMode()) {
+ return false;
+ }
- if (item1.getMassageZone() != item2.getMassageZone()) {
- return false;
- }
+ if (item1.getMassageZone() != item2.getMassageZone()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateMassageModeDataList(List<MassageModeData> item1, List<MassageModeData> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
+ public static boolean validateMassageModeDataList(List<MassageModeData> item1, List<MassageModeData> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (item1.size() != item2.size()) {
- return false;
- }
+ if (item1.size() != item2.size()) {
+ return false;
+ }
- for (int i = 0; i < item1.size(); i++) {
- if (!validateMassageModeData(item1.get(i), item2.get(i))) {
- return false;
- }
- }
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateMassageModeData(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateMassageCushionFirmness(MassageCushionFirmness item1, MassageCushionFirmness item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
+ public static boolean validateMassageCushionFirmness(MassageCushionFirmness item1, MassageCushionFirmness item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (item1.getCushion() != item2.getCushion()) {
- return false;
- }
+ if (item1.getCushion() != item2.getCushion()) {
+ return false;
+ }
- if (item1.getFirmness() != item2.getFirmness()) {
- return false;
- }
+ if (item1.getFirmness() != item2.getFirmness()) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public static boolean validateMassageCushionFirmnessList(List<MassageCushionFirmness> item1, List<MassageCushionFirmness> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
+ public static boolean validateMassageCushionFirmnessList(List<MassageCushionFirmness> item1, List<MassageCushionFirmness> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
- if (item1.size() != item2.size()) {
- return false;
- }
+ if (item1.size() != item2.size()) {
+ return false;
+ }
- for (int i = 0; i < item1.size(); i++) {
- if (!validateMassageCushionFirmness(item1.get(i), item2.get(i))) {
- return false;
- }
- }
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateMassageCushionFirmness(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
- return true;
- }
+ return true;
+ }
- public static void log(String tag, String msg){
+ public static void log(String tag, String msg) {
Logger.log(tag, msg);
}
-
- public static boolean validateSdlMsgVersion (SdlMsgVersion item1, SdlMsgVersion item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.getMajorVersion() != item2.getMajorVersion() ||
- item1.getMinorVersion() != item2.getMinorVersion()) {
- return false;
- }
-
- return true;
+
+ public static boolean validateSdlMsgVersion(SdlMsgVersion item1, SdlMsgVersion item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getMajorVersion() != item2.getMajorVersion() ||
+ item1.getMinorVersion() != item2.getMinorVersion()) {
+ return false;
+ }
+
+ return true;
}
- public static boolean validateDeviceInfo (DeviceInfo item1, DeviceInfo item2) {
+ public static boolean validateDeviceInfo(DeviceInfo item1, DeviceInfo item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
- if (item1.getOs() != item2.getOs() ||
- item1.getCarrier() != item2.getCarrier() ||
- item1.getHardware() != item2.getHardware() ||
- item1.getOsVersion() != item2.getOsVersion() ||
- item1.getFirmwareRev() != item2.getFirmwareRev() ||
+ if (item1.getOs() != item2.getOs() ||
+ item1.getCarrier() != item2.getCarrier() ||
+ item1.getHardware() != item2.getHardware() ||
+ item1.getOsVersion() != item2.getOsVersion() ||
+ item1.getFirmwareRev() != item2.getFirmwareRev() ||
item1.getMaxNumberRFCOMMPorts() != item2.getMaxNumberRFCOMMPorts()) {
return false;
}
@@ -2619,30 +2620,30 @@ public class Validator{
return true;
}
- public static boolean validateAppInfo (AppInfo item1, AppInfo item2) {
+ public static boolean validateAppInfo(AppInfo item1, AppInfo item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.getAppDisplayName() != item1.getAppDisplayName()
- || item1.getAppBundleID() != item2.getAppBundleID()
- || item1.getAppVersion() != item2.getAppVersion()
- || item1.getAppIcon() != item2.getAppIcon()) {
+ || item1.getAppBundleID() != item2.getAppBundleID()
+ || item1.getAppVersion() != item2.getAppVersion()
+ || item1.getAppIcon() != item2.getAppIcon()) {
return false;
}
return true;
}
- public static boolean validateTemplateColorScheme (TemplateColorScheme item1, TemplateColorScheme item2) {
+ public static boolean validateTemplateColorScheme(TemplateColorScheme item1, TemplateColorScheme item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.getPrimaryColor().getRed() != item2.getPrimaryColor().getRed()
@@ -2655,7 +2656,7 @@ public class Validator{
|| item1.getBackgroundColor().getGreen() != item2.getBackgroundColor().getGreen()
|| item1.getBackgroundColor().getBlue() != item2.getBackgroundColor().getBlue()
- ) {
+ ) {
return false;
}
@@ -2664,127 +2665,127 @@ public class Validator{
public static boolean validateRGBColor(RGBColor item1, RGBColor item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.getRed() != item2.getRed()
|| item1.getGreen() != item2.getGreen()
- || item1.getBlue() != item2.getBlue() ) {
+ || item1.getBlue() != item2.getBlue()) {
return false;
}
return true;
}
- public static boolean validateSupportedFormats (VideoStreamingFormat vsf1, VideoStreamingFormat vsf2) {
- if(vsf1.getProtocol() != vsf2.getProtocol()){
- return false;
- }
+ public static boolean validateSupportedFormats(VideoStreamingFormat vsf1, VideoStreamingFormat vsf2) {
+ if (vsf1.getProtocol() != vsf2.getProtocol()) {
+ return false;
+ }
- if(vsf1.getCodec() != vsf2.getCodec()){
- return false;
- }
+ if (vsf1.getCodec() != vsf2.getCodec()) {
+ return false;
+ }
- return true;
+ return true;
}
- public static boolean validateDisplayCapabilities (DisplayCapabilities item1, DisplayCapabilities item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.getDisplayType() == null) {
- return ( item2.getDisplayType() == null );
- }
-
- if (item1.getDisplayType() != item2.getDisplayType()) {
- return false;
- }
+ public static boolean validateDisplayCapabilities(DisplayCapabilities item1, DisplayCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getDisplayType() == null) {
+ return (item2.getDisplayType() == null);
+ }
+
+ if (item1.getDisplayType() != item2.getDisplayType()) {
+ return false;
+ }
if (!item1.getDisplayName().equals(item2.getDisplayName())) {
return false;
}
-
- if (item1.getGraphicSupported() != item2.getGraphicSupported()) {
- return false;
- }
- // Failing past here:
- // log("GS", item1.getGraphicSupported() + " : " + item2.getGraphicSupported());
-
- if (!validateStringList(item1.getTemplatesAvailable(),item2.getTemplatesAvailable())) {
- log("TA", item1.getTemplatesAvailable() + " | " + item2.getTemplatesAvailable());
- return false;
- }
-
- if (item1.getNumCustomPresetsAvailable() != item2.getNumCustomPresetsAvailable()) {
- return false;
- }
-
- if (item1.getMediaClockFormats() == null) {
- return ( item2.getMediaClockFormats() == null );
- }
-
- if (item1.getMediaClockFormats().size() != item2.getMediaClockFormats().size()) {
- return false;
- }
-
- for (int i = 0; i < item1.getMediaClockFormats().size(); i++) {
- if (item1.getMediaClockFormats().get(i) == null && item2.getMediaClockFormats().get(i) != null) {
- return false;
- }
-
- if (item1.getMediaClockFormats().get(i) != item2.getMediaClockFormats().get(i)) {
- 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 (!validateScreenParams(item1.getScreenParams(), item2.getScreenParams())) {
- return false;
- }
-
- return true;
+
+ if (item1.getGraphicSupported() != item2.getGraphicSupported()) {
+ return false;
+ }
+ // Failing past here:
+ // log("GS", item1.getGraphicSupported() + " : " + item2.getGraphicSupported());
+
+ if (!validateStringList(item1.getTemplatesAvailable(), item2.getTemplatesAvailable())) {
+ log("TA", item1.getTemplatesAvailable() + " | " + item2.getTemplatesAvailable());
+ return false;
+ }
+
+ if (item1.getNumCustomPresetsAvailable() != item2.getNumCustomPresetsAvailable()) {
+ return false;
+ }
+
+ if (item1.getMediaClockFormats() == null) {
+ return (item2.getMediaClockFormats() == null);
+ }
+
+ if (item1.getMediaClockFormats().size() != item2.getMediaClockFormats().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getMediaClockFormats().size(); i++) {
+ if (item1.getMediaClockFormats().get(i) == null && item2.getMediaClockFormats().get(i) != null) {
+ return false;
+ }
+
+ if (item1.getMediaClockFormats().get(i) != item2.getMediaClockFormats().get(i)) {
+ 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 (!validateScreenParams(item1.getScreenParams(), item2.getScreenParams())) {
+ return false;
+ }
+
+ return true;
}
public static boolean validateDisplayCapabilityList(List<DisplayCapability> list1, List<DisplayCapability> list2) {
@@ -2942,72 +2943,72 @@ public class Validator{
return true;
}
- public static boolean validateButtonCapabilities (List<ButtonCapabilities> item1, List<ButtonCapabilities> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (item1.get(i).getName() != item2.get(i).getName()) {
- return false;
- }
- if (item1.get(i).getUpDownAvailable() != item2.get(i).getUpDownAvailable()) {
- return false;
- }
- if (item1.get(i).getLongPressAvailable() != item2.get(i).getLongPressAvailable()) {
- return false;
- }
- if (item1.get(i).getShortPressAvailable() != item2.get(i).getShortPressAvailable()) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateSoftButtonCapabilities (List<SoftButtonCapabilities> item1, List<SoftButtonCapabilities> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (item1.get(i).getImageSupported() != item2.get(i).getImageSupported()) {
- return false;
- }
- if (item1.get(i).getUpDownAvailable() != item2.get(i).getUpDownAvailable()) {
- return false;
- }
- if (item1.get(i).getLongPressAvailable() != item2.get(i).getLongPressAvailable()) {
- return false;
- }
- if (item1.get(i).getShortPressAvailable() != item2.get(i).getShortPressAvailable()) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateRadioControlCapabilities (List<RadioControlCapabilities> item1, List<RadioControlCapabilities> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
+ public static boolean validateButtonCapabilities(List<ButtonCapabilities> item1, List<ButtonCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i).getName() != item2.get(i).getName()) {
+ return false;
+ }
+ if (item1.get(i).getUpDownAvailable() != item2.get(i).getUpDownAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getLongPressAvailable() != item2.get(i).getLongPressAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getShortPressAvailable() != item2.get(i).getShortPressAvailable()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateSoftButtonCapabilities(List<SoftButtonCapabilities> item1, List<SoftButtonCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i).getImageSupported() != item2.get(i).getImageSupported()) {
+ return false;
+ }
+ if (item1.get(i).getUpDownAvailable() != item2.get(i).getUpDownAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getLongPressAvailable() != item2.get(i).getLongPressAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getShortPressAvailable() != item2.get(i).getShortPressAvailable()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateRadioControlCapabilities(List<RadioControlCapabilities> item1, List<RadioControlCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -3050,12 +3051,12 @@ public class Validator{
return true;
}
- public static boolean validateClimateControlCapabilities (List<ClimateControlCapabilities> item1, List<ClimateControlCapabilities> item2) {
+ public static boolean validateClimateControlCapabilities(List<ClimateControlCapabilities> item1, List<ClimateControlCapabilities> item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -3091,7 +3092,7 @@ public class Validator{
return false;
}
- if(! (validateDefrostZones(item1.get(i).getDefrostZone(), item2.get(i).getDefrostZone()) )){
+ if (!(validateDefrostZones(item1.get(i).getDefrostZone(), item2.get(i).getDefrostZone()))) {
return false;
}
@@ -3099,288 +3100,288 @@ public class Validator{
return false;
}
- if(! (validateVentilationModes(item1.get(i).getVentilationMode(), item2.get(i).getVentilationMode()) )){
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateSeatControlCapabilities(SeatControlCapabilities item1, SeatControlCapabilities item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.getModuleName() != item2.getModuleName()) {
- return false;
- }
- if (item1.getHeatingEnabledAvailable() != item2.getHeatingEnabledAvailable()) {
- return false;
- }
- if (item1.getCoolingEnabledAvailable() != item2.getCoolingEnabledAvailable()) {
- return false;
- }
- if (item1.getHeatingLevelAvailable() != item2.getHeatingLevelAvailable()) {
- return false;
- }
- if (item1.getCoolingLevelAvailable() != item2.getCoolingLevelAvailable()) {
- return false;
- }
- if (item1.getHorizontalPositionAvailable() != item2.getHorizontalPositionAvailable()) {
- return false;
- }
- if (item1.getVerticalPositionAvailable() != item2.getVerticalPositionAvailable()) {
- return false;
- }
- if (item1.getFrontVerticalPositionAvailable() != item2.getFrontVerticalPositionAvailable()) {
- return false;
- }
- if (item1.getBackVerticalPositionAvailable() != item2.getBackVerticalPositionAvailable()) {
- return false;
- }
- if (item1.getBackTiltAngleAvailable() != item2.getBackTiltAngleAvailable()) {
- return false;
- }
- if (item1.getHeadSupportVerticalPositionAvailable() != item2.getHeadSupportVerticalPositionAvailable()) {
- return false;
- }
- if (item1.getHeadSupportHorizontalPositionAvailable() != item2.getHeadSupportHorizontalPositionAvailable()) {
- return false;
- }
- if (item1.getMassageEnabledAvailable() != item2.getMassageEnabledAvailable()) {
- return false;
- }
- if (item1.getMassageModeAvailable() != item2.getMassageModeAvailable()) {
- return false;
- }
- if (item1.getMassageCushionFirmnessAvailable() != item2.getMassageCushionFirmnessAvailable()) {
- return false;
- }
- if (item1.getMemoryAvailable() != item2.getMemoryAvailable()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateSeatControlCapabilitiesList(List<SeatControlCapabilities> item1, List<SeatControlCapabilities> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!validateSeatControlCapabilities(item1.get(i), item2.get(i))) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateAudioControlCapabilities(AudioControlCapabilities item1, AudioControlCapabilities item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.getModuleName() != item2.getModuleName()) {
- return false;
- }
- if (item1.getSourceAvailable() != item2.getSourceAvailable()) {
- return false;
- }
- if (item1.getKeepContextAvailable() != item2.getKeepContextAvailable()) {
- return false;
- }
- if (item1.getVolumeAvailable() != item2.getVolumeAvailable()) {
- return false;
- }
- if (item1.getEqualizerAvailable() != item2.getEqualizerAvailable()) {
- return false;
- }
- if (item1.getEqualizerMaxChannelId() != item2.getEqualizerMaxChannelId()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateEqualizerSettingsList(List<EqualizerSettings> item1, List<EqualizerSettings> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!validateEqualizerSettings(item1.get(i), item2.get(i))) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateEqualizerSettings(EqualizerSettings item1, EqualizerSettings item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.getChannelId() != item2.getChannelId()) {
- return false;
- }
-
- if (item1.getChannelName() != item2.getChannelName()) {
- return false;
- }
-
- if (item1.getChannelSetting() != item2.getChannelSetting()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateLightStateList(List<LightState> item1, List<LightState> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!validateLightState(item1.get(i), item2.get(i))) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateLightState(LightState item1, LightState item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.getId() != item2.getId()) {
- return false;
- }
-
- if (item1.getStatus() != item2.getStatus()) {
- return false;
- }
-
- if (item1.getDensity() != item2.getDensity()) {
- return false;
- }
-
- if (!(validateRGBColor(item1.getColor(), item2.getColor()))) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateLightCapabilitiesList(List<LightCapabilities> item1, List<LightCapabilities> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!validateLightCapabilities(item1.get(i), item2.get(i))) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateLightCapabilities(LightCapabilities item1, LightCapabilities item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.getName() != item2.getName()) {
- return false;
- }
-
- if (item1.getDensityAvailable() != item2.getDensityAvailable()) {
- return false;
- }
-
- if (item1.getRGBColorSpaceAvailable() != item2.getRGBColorSpaceAvailable()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateAudioControlCapabilitiesList(List<AudioControlCapabilities> item1, List<AudioControlCapabilities> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!validateAudioControlCapabilities(item1.get(i), item2.get(i))) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateDefrostZones (List<DefrostZone> item1, List<DefrostZone> item2) {
+ if (!(validateVentilationModes(item1.get(i).getVentilationMode(), item2.get(i).getVentilationMode()))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateSeatControlCapabilities(SeatControlCapabilities item1, SeatControlCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getModuleName() != item2.getModuleName()) {
+ return false;
+ }
+ if (item1.getHeatingEnabledAvailable() != item2.getHeatingEnabledAvailable()) {
+ return false;
+ }
+ if (item1.getCoolingEnabledAvailable() != item2.getCoolingEnabledAvailable()) {
+ return false;
+ }
+ if (item1.getHeatingLevelAvailable() != item2.getHeatingLevelAvailable()) {
+ return false;
+ }
+ if (item1.getCoolingLevelAvailable() != item2.getCoolingLevelAvailable()) {
+ return false;
+ }
+ if (item1.getHorizontalPositionAvailable() != item2.getHorizontalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getVerticalPositionAvailable() != item2.getVerticalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getFrontVerticalPositionAvailable() != item2.getFrontVerticalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getBackVerticalPositionAvailable() != item2.getBackVerticalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getBackTiltAngleAvailable() != item2.getBackTiltAngleAvailable()) {
+ return false;
+ }
+ if (item1.getHeadSupportVerticalPositionAvailable() != item2.getHeadSupportVerticalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getHeadSupportHorizontalPositionAvailable() != item2.getHeadSupportHorizontalPositionAvailable()) {
+ return false;
+ }
+ if (item1.getMassageEnabledAvailable() != item2.getMassageEnabledAvailable()) {
+ return false;
+ }
+ if (item1.getMassageModeAvailable() != item2.getMassageModeAvailable()) {
+ return false;
+ }
+ if (item1.getMassageCushionFirmnessAvailable() != item2.getMassageCushionFirmnessAvailable()) {
+ return false;
+ }
+ if (item1.getMemoryAvailable() != item2.getMemoryAvailable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateSeatControlCapabilitiesList(List<SeatControlCapabilities> item1, List<SeatControlCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateSeatControlCapabilities(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateAudioControlCapabilities(AudioControlCapabilities item1, AudioControlCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getModuleName() != item2.getModuleName()) {
+ return false;
+ }
+ if (item1.getSourceAvailable() != item2.getSourceAvailable()) {
+ return false;
+ }
+ if (item1.getKeepContextAvailable() != item2.getKeepContextAvailable()) {
+ return false;
+ }
+ if (item1.getVolumeAvailable() != item2.getVolumeAvailable()) {
+ return false;
+ }
+ if (item1.getEqualizerAvailable() != item2.getEqualizerAvailable()) {
+ return false;
+ }
+ if (item1.getEqualizerMaxChannelId() != item2.getEqualizerMaxChannelId()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateEqualizerSettingsList(List<EqualizerSettings> item1, List<EqualizerSettings> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateEqualizerSettings(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateEqualizerSettings(EqualizerSettings item1, EqualizerSettings item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getChannelId() != item2.getChannelId()) {
+ return false;
+ }
+
+ if (item1.getChannelName() != item2.getChannelName()) {
+ return false;
+ }
+
+ if (item1.getChannelSetting() != item2.getChannelSetting()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateLightStateList(List<LightState> item1, List<LightState> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateLightState(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateLightState(LightState item1, LightState item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getId() != item2.getId()) {
+ return false;
+ }
+
+ if (item1.getStatus() != item2.getStatus()) {
+ return false;
+ }
+
+ if (item1.getDensity() != item2.getDensity()) {
+ return false;
+ }
+
+ if (!(validateRGBColor(item1.getColor(), item2.getColor()))) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateLightCapabilitiesList(List<LightCapabilities> item1, List<LightCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateLightCapabilities(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateLightCapabilities(LightCapabilities item1, LightCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getName() != item2.getName()) {
+ return false;
+ }
+
+ if (item1.getDensityAvailable() != item2.getDensityAvailable()) {
+ return false;
+ }
+
+ if (item1.getRGBColorSpaceAvailable() != item2.getRGBColorSpaceAvailable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateAudioControlCapabilitiesList(List<AudioControlCapabilities> item1, List<AudioControlCapabilities> item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!validateAudioControlCapabilities(item1.get(i), item2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateDefrostZones(List<DefrostZone> item1, List<DefrostZone> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -3396,12 +3397,12 @@ public class Validator{
return true;
}
- public static boolean validateVentilationModes (List<VentilationMode> item1, List<VentilationMode> item2) {
+ public static boolean validateVentilationModes(List<VentilationMode> item1, List<VentilationMode> item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -3417,411 +3418,411 @@ public class Validator{
return true;
}
- public static boolean validateTurnList (List<Turn> item1, List<Turn> item2) {
- if (item1 == null) {
- return (item2 == null);
- }
- if (item2 == null) {
- return (item1 == null);
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!item1.get(i).getNavigationText().equals(item2.get(i).getNavigationText())) {
- return false;
- }
- if (!validateImage(item1.get(i).getTurnIcon(), item2.get(i).getTurnIcon())) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateAudioPassThruCapabilities (List<AudioPassThruCapabilities> item1, List<AudioPassThruCapabilities> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (item1.get(i).getAudioType() != item2.get(i).getAudioType()) {
- return false;
- }
- if (item1.get(i).getBitsPerSample() != item2.get(i).getBitsPerSample()) {
- return false;
- }
- if (item1.get(i).getSamplingRate() != item2.get(i).getSamplingRate()) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validatePcmStreamCapabilities (AudioPassThruCapabilities item1, AudioPassThruCapabilities item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.getAudioType() != item2.getAudioType()) {
- return false;
- }
-
- if (item1.getBitsPerSample() != item2.getBitsPerSample()) {
- return false;
- }
-
- if (item1.getSamplingRate() != item2.getSamplingRate()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validatePresetBankCapabilities (PresetBankCapabilities item1, PresetBankCapabilities item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.onScreenPresetsAvailable() != item2.onScreenPresetsAvailable()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateVehicleType (VehicleType item1, VehicleType item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.getMake() != item2.getMake() ||
- item1.getModel() != item2.getModel() ||
- item1.getTrim() != item2.getTrim() ||
- item1.getModelYear() != item2.getModelYear()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateKeyboardProperties (KeyboardProperties item1, KeyboardProperties item2) {
- if (item1 == null) {
- log("1", item2.toString());
- return ( item2 == null );
- }
- if (item2 == null) {
- log("2", item1.toString());
- return ( item1 == null );
- }
-
- if (!item1.getAutoCompleteText().equals(item2.getAutoCompleteText())) {
- log("ACT", item1.getAutoCompleteText().toString() + " | " + item2.getAutoCompleteText().toString());
- return false;
- }
- if (item1.getKeyboardLayout() != item2.getKeyboardLayout()) {
- log("KL", item1.getKeyboardLayout().toString() + " | " + item2.getKeyboardLayout().toString());
- return false;
- }
- if (item1.getKeypressMode() != item2.getKeypressMode()) {
- log("KM", item1.getKeypressMode() + " | " + item2.getKeypressMode());
- return false;
- }
- if (item1.getLanguage() != item2.getLanguage()) {
- log("L", item1.getLanguage().toString() + " | " + item2.getLanguage().toString());
- return false;
- }
- if (!validateStringList(item1.getLimitedCharacterList(), item2.getLimitedCharacterList())) {
- log("List",item1.getLimitedCharacterList().toString() + " | " + item2.getLimitedCharacterList().toString());
- return false;
- }
-
- return true;
- }
-
- public static boolean validateStartTime (StartTime item1, StartTime item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.getHours() != item2.getHours()) {
- return false;
- }
- if (item1.getMinutes() != item2.getMinutes()) {
- return false;
- }
- if (item1.getSeconds() != item2.getSeconds()) {
- return false;
- }
-
- return true;
- }
-
- public static boolean validateVrHelpItems (List<VrHelpItem> item1, List<VrHelpItem> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!item1.get(i).getText().equals(item2.get(i).getText())) {
- return false;
- }
- if (!validateImage(item1.get(i).getImage(), item2.get(i).getImage())) {
- return false;
- }
- if ((int) item1.get(i).getPosition() != (int) item2.get(i).getPosition()) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateDIDResults (List<DIDResult> item1, List<DIDResult> item2) {
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if (item1.size() != item2.size()) {
- return false;
- }
-
- for (int i = 0; i < item1.size(); i++) {
- if (!item1.get(i).getData().equals(item2.get(i).getData())) {
- return false;
- }
- if (item1.get(i).getResultCode() != item2.get(i).getResultCode()) {
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean validateHeaders(Headers item1, Headers item2){
- if (item1 == null) {
- return ( item2 == null );
- }
- if (item2 == null) {
- return ( item1 == null );
- }
-
- if( ! item1.getDoInput().equals(item2.getDoInput()) ){
- return false;
- }
-
- if( ! item1.getDoOutput().equals(item2.getDoOutput()) ){
- return false;
- }
-
- if( ! item1.getInstanceFollowRedirects().equals(item2.getInstanceFollowRedirects()) ){
- return false;
- }
-
- if( ! item1.getUseCaches().equals(item2.getUseCaches()) ){
- return false;
- }
-
- if( ! item1.getCharset().equals(item2.getCharset()) ){
- return false;
- }
-
- if( ! item1.getConnectTimeout().equals(item2.getConnectTimeout()) ){
- return false;
- }
-
- if( ! item1.getContentLength().equals(item2.getContentLength()) ){
- return false;
- }
-
- if( ! item1.getContentType().equals(item2.getContentType()) ){
- return false;
- }
-
- if( ! item1.getReadTimeout().equals(item2.getReadTimeout()) ){
- return false;
- }
-
- if( ! item1.getRequestMethod().equals(item2.getRequestMethod()) ){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateHMICapabilities(HMICapabilities hmiA, HMICapabilities hmiB){
- if(hmiA.isPhoneCallAvailable() != hmiB.isPhoneCallAvailable()){
- return false;
- }
-
- if(hmiA.isVideoStreamingAvailable() != hmiB.isVideoStreamingAvailable()){
- return false;
- }
-
- if(hmiA.isNavigationAvailable() != hmiB.isNavigationAvailable()){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateHMIZoneCapabilities(List<HmiZoneCapabilities> hmizA, List<HmiZoneCapabilities> hmizB){
- for(int i = 0; i < hmizA.size(); i++){
- if(!hmizA.get(i).equals(hmizB.get(i))){
- return false;
- }
- }
- return true;
- }
-
- public static boolean validateSpeechCapabilities(List<SpeechCapabilities> spA, List<SpeechCapabilities> spB){
- for(int i = 0; i < spA.size(); i++){
- if(!spA.get(i).equals(spB.get(i))){
- return false;
- }
- }
- return true;
- }
-
- public static boolean validatePreRecordedSpeechCapabilities(List<PrerecordedSpeech> spA, List<PrerecordedSpeech> spB){
- for(int i = 0; i < spA.size(); i++){
- if(!spA.get(i).equals(spB.get(i))){
- return false;
- }
- }
- return true;
- }
-
- public static boolean validateVideoStreamingFormat(VideoStreamingFormat a, VideoStreamingFormat b){
- if(!a.getCodec().equals(b.getCodec())){
- return false;
- }
-
- if(!a.getProtocol().equals(b.getProtocol())){
- return false;
- }
-
- return true;
- }
-
- public static boolean validateVideoStreamingCapability(VideoStreamingCapability a, VideoStreamingCapability b){
- if(!validateImageResolution(a.getPreferredResolution(), b.getPreferredResolution())){
- return false;
- }
-
- if(!a.getMaxBitrate().equals(b.getMaxBitrate())){
- return false;
- }
-
- for(int i = 0; i < a.getSupportedFormats().size(); i++){
- if(!validateVideoStreamingFormat(a.getSupportedFormats().get(i), b.getSupportedFormats().get(i))){
- return false;
- }
- }
-
- 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.getCol() != g2.getCol()) {
- 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.getColSpan() != g2.getColSpan()) {
- 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());
- }
+ public static boolean validateTurnList(List<Turn> item1, List<Turn> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!item1.get(i).getNavigationText().equals(item2.get(i).getNavigationText())) {
+ return false;
+ }
+ if (!validateImage(item1.get(i).getTurnIcon(), item2.get(i).getTurnIcon())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateAudioPassThruCapabilities(List<AudioPassThruCapabilities> item1, List<AudioPassThruCapabilities> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i).getAudioType() != item2.get(i).getAudioType()) {
+ return false;
+ }
+ if (item1.get(i).getBitsPerSample() != item2.get(i).getBitsPerSample()) {
+ return false;
+ }
+ if (item1.get(i).getSamplingRate() != item2.get(i).getSamplingRate()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validatePcmStreamCapabilities(AudioPassThruCapabilities item1, AudioPassThruCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getAudioType() != item2.getAudioType()) {
+ return false;
+ }
+
+ if (item1.getBitsPerSample() != item2.getBitsPerSample()) {
+ return false;
+ }
+
+ if (item1.getSamplingRate() != item2.getSamplingRate()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validatePresetBankCapabilities(PresetBankCapabilities item1, PresetBankCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.onScreenPresetsAvailable() != item2.onScreenPresetsAvailable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateVehicleType(VehicleType item1, VehicleType item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getMake() != item2.getMake() ||
+ item1.getModel() != item2.getModel() ||
+ item1.getTrim() != item2.getTrim() ||
+ item1.getModelYear() != item2.getModelYear()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateKeyboardProperties(KeyboardProperties item1, KeyboardProperties item2) {
+ if (item1 == null) {
+ log("1", item2.toString());
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ log("2", item1.toString());
+ return (item1 == null);
+ }
+
+ if (!item1.getAutoCompleteText().equals(item2.getAutoCompleteText())) {
+ log("ACT", item1.getAutoCompleteText().toString() + " | " + item2.getAutoCompleteText().toString());
+ return false;
+ }
+ if (item1.getKeyboardLayout() != item2.getKeyboardLayout()) {
+ log("KL", item1.getKeyboardLayout().toString() + " | " + item2.getKeyboardLayout().toString());
+ return false;
+ }
+ if (item1.getKeypressMode() != item2.getKeypressMode()) {
+ log("KM", item1.getKeypressMode() + " | " + item2.getKeypressMode());
+ return false;
+ }
+ if (item1.getLanguage() != item2.getLanguage()) {
+ log("L", item1.getLanguage().toString() + " | " + item2.getLanguage().toString());
+ return false;
+ }
+ if (!validateStringList(item1.getLimitedCharacterList(), item2.getLimitedCharacterList())) {
+ log("List", item1.getLimitedCharacterList().toString() + " | " + item2.getLimitedCharacterList().toString());
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateStartTime(StartTime item1, StartTime item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getHours() != item2.getHours()) {
+ return false;
+ }
+ if (item1.getMinutes() != item2.getMinutes()) {
+ return false;
+ }
+ if (item1.getSeconds() != item2.getSeconds()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateVrHelpItems(List<VrHelpItem> item1, List<VrHelpItem> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!item1.get(i).getText().equals(item2.get(i).getText())) {
+ return false;
+ }
+ if (!validateImage(item1.get(i).getImage(), item2.get(i).getImage())) {
+ return false;
+ }
+ if ((int) item1.get(i).getPosition() != (int) item2.get(i).getPosition()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateDIDResults(List<DIDResult> item1, List<DIDResult> item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.size() != item2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (!item1.get(i).getData().equals(item2.get(i).getData())) {
+ return false;
+ }
+ if (item1.get(i).getResultCode() != item2.get(i).getResultCode()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateHeaders(Headers item1, Headers item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!item1.getDoInput().equals(item2.getDoInput())) {
+ return false;
+ }
+
+ if (!item1.getDoOutput().equals(item2.getDoOutput())) {
+ return false;
+ }
+
+ if (!item1.getInstanceFollowRedirects().equals(item2.getInstanceFollowRedirects())) {
+ return false;
+ }
+
+ if (!item1.getUseCaches().equals(item2.getUseCaches())) {
+ return false;
+ }
+
+ if (!item1.getCharset().equals(item2.getCharset())) {
+ return false;
+ }
+
+ if (!item1.getConnectTimeout().equals(item2.getConnectTimeout())) {
+ return false;
+ }
+
+ if (!item1.getContentLength().equals(item2.getContentLength())) {
+ return false;
+ }
+
+ if (!item1.getContentType().equals(item2.getContentType())) {
+ return false;
+ }
+
+ if (!item1.getReadTimeout().equals(item2.getReadTimeout())) {
+ return false;
+ }
+
+ if (!item1.getRequestMethod().equals(item2.getRequestMethod())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateHMICapabilities(HMICapabilities hmiA, HMICapabilities hmiB) {
+ if (hmiA.isPhoneCallAvailable() != hmiB.isPhoneCallAvailable()) {
+ return false;
+ }
+
+ if (hmiA.isVideoStreamingAvailable() != hmiB.isVideoStreamingAvailable()) {
+ return false;
+ }
+
+ if (hmiA.isNavigationAvailable() != hmiB.isNavigationAvailable()) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateHMIZoneCapabilities(List<HmiZoneCapabilities> hmizA, List<HmiZoneCapabilities> hmizB) {
+ for (int i = 0; i < hmizA.size(); i++) {
+ if (!hmizA.get(i).equals(hmizB.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateSpeechCapabilities(List<SpeechCapabilities> spA, List<SpeechCapabilities> spB) {
+ for (int i = 0; i < spA.size(); i++) {
+ if (!spA.get(i).equals(spB.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validatePreRecordedSpeechCapabilities(List<PrerecordedSpeech> spA, List<PrerecordedSpeech> spB) {
+ for (int i = 0; i < spA.size(); i++) {
+ if (!spA.get(i).equals(spB.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean validateVideoStreamingFormat(VideoStreamingFormat a, VideoStreamingFormat b) {
+ if (!a.getCodec().equals(b.getCodec())) {
+ return false;
+ }
+
+ if (!a.getProtocol().equals(b.getProtocol())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateVideoStreamingCapability(VideoStreamingCapability a, VideoStreamingCapability b) {
+ if (!validateImageResolution(a.getPreferredResolution(), b.getPreferredResolution())) {
+ return false;
+ }
+
+ if (!a.getMaxBitrate().equals(b.getMaxBitrate())) {
+ return false;
+ }
+
+ for (int i = 0; i < a.getSupportedFormats().size(); i++) {
+ if (!validateVideoStreamingFormat(a.getSupportedFormats().get(i), b.getSupportedFormats().get(i))) {
+ return false;
+ }
+ }
+
+ 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.getCol() != g2.getCol()) {
+ 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.getColSpan() != g2.getColSpan()) {
+ 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());
+ }
public static boolean validateGearStatuses(GearStatus status1, GearStatus status2) {
if (status1 == null) {
@@ -3847,10 +3848,10 @@ public class Validator{
public static boolean validateWindowStatuses(List<WindowStatus> item1, List<WindowStatus> item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (item1.size() != item2.size()) {
@@ -3860,11 +3861,11 @@ public class Validator{
Iterator<WindowStatus> iterator1 = item1.iterator();
Iterator<WindowStatus> iterator2 = item2.iterator();
- while(iterator1.hasNext() && iterator2.hasNext()){
+ while (iterator1.hasNext() && iterator2.hasNext()) {
WindowStatus windowStatus1 = iterator1.next();
WindowStatus windowStatus2 = iterator2.next();
- if(!validateWindowStatus(windowStatus1, windowStatus2)){
+ if (!validateWindowStatus(windowStatus1, windowStatus2)) {
return false;
}
}
@@ -3874,10 +3875,10 @@ public class Validator{
public static boolean validateWindowStatus(WindowStatus item1, WindowStatus item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
if (!validateWindowStates(item1.getState(), item2.getState())) {
@@ -3890,12 +3891,12 @@ public class Validator{
return true;
}
- public static boolean validateWindowStates (WindowState item1, WindowState item2) {
+ public static boolean validateWindowStates(WindowState item1, WindowState item2) {
if (item1 == null) {
- return ( item2 == null );
+ return (item2 == null);
}
if (item2 == null) {
- return ( item1 == null );
+ return (item1 == null);
}
Integer approxPosition1 = item1.getApproximatePosition();
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 569b13b13..a13486983 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
@@ -52,399 +52,400 @@ import org.json.JSONException;
import java.util.ArrayList;
import java.util.List;
-public class VehicleDataHelper{
- //top level variables for OnVehicleData
+public class VehicleDataHelper {
+ //top level variables for OnVehicleData
public static final double SPEED = 35.6;
- public static final int RPM = 2500;
- public static final double EXTERNAL_TEMPERATURE = 140.1;
- public static final double FUEL_LEVEL = 3.7;
- public static final String VIN = "FIUE4WHR3984579THIRU";
- public static final PRNDL PRNDL_FINAL = PRNDL.SECOND;
- public static final TireStatus TIRE_PRESSURE = new TireStatus();
- public static final double ENGINE_TORQUE = 518.3;
- public static final float ENGINE_OIL_LIFE = 19.3f;
- public static final int ODOMETER = 140000;
- public static final GPSData GPS = new GPSData();
- public static final ComponentVolumeStatus FUEL_LEVEL_STATE = ComponentVolumeStatus.ALERT;
- public static final double INSTANT_FUEL_CONSUMPTION = 2.76;
- public static final BeltStatus BELT_STATUS = new BeltStatus();
- public static final BodyInformation BODY_INFORMATION = new BodyInformation();
- public static final DeviceStatus DEVICE_STATUS = new DeviceStatus();
- public static final VehicleDataEventStatus DRIVER_BRAKING = VehicleDataEventStatus.NO;
- public static final WiperStatus WIPER_STATUS = WiperStatus.COURTESYWIPE;
- public static final HeadLampStatus HEAD_LAMP_STATUS = new HeadLampStatus();
- public static final double ACC_PEDAL_POSITION = 28.29;
- public static final double STEERING_WHEEL_ANGLE = 70.5;
- public static final ECallInfo E_CALL_INFO = new ECallInfo();
- public static final AirbagStatus AIRBAG_STATUS = new AirbagStatus();
- public static final EmergencyEvent EMERGENCY_EVENT = new EmergencyEvent();
- public static final ClusterModeStatus CLUSTER_MODE_STATUS = new ClusterModeStatus();
- public static final WindowStatus WINDOW_STATUS = new WindowStatus();
- public static final List<WindowStatus> WINDOW_STATUS_LIST = new ArrayList<>(1);
- public static final MyKey MY_KEY = new MyKey();
- public static final FuelRange FUEL_RANGE = new FuelRange();
- 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 StabilityControlsStatus STABILITY_CONTROLS_STATUS = new StabilityControlsStatus();
- public static final String OEM_CUSTOM_VEHICLE_DATA_STATE = "oemCustomVehicleDataState";
- public static final Boolean HANDS_OFF_STEERING = Boolean.TRUE;
-
- //other variables inside some of the above objects
+ public static final int RPM = 2500;
+ public static final double EXTERNAL_TEMPERATURE = 140.1;
+ public static final double FUEL_LEVEL = 3.7;
+ public static final String VIN = "FIUE4WHR3984579THIRU";
+ public static final PRNDL PRNDL_FINAL = PRNDL.SECOND;
+ public static final TireStatus TIRE_PRESSURE = new TireStatus();
+ public static final double ENGINE_TORQUE = 518.3;
+ public static final float ENGINE_OIL_LIFE = 19.3f;
+ public static final int ODOMETER = 140000;
+ public static final GPSData GPS = new GPSData();
+ public static final ComponentVolumeStatus FUEL_LEVEL_STATE = ComponentVolumeStatus.ALERT;
+ public static final double INSTANT_FUEL_CONSUMPTION = 2.76;
+ public static final BeltStatus BELT_STATUS = new BeltStatus();
+ public static final BodyInformation BODY_INFORMATION = new BodyInformation();
+ public static final DeviceStatus DEVICE_STATUS = new DeviceStatus();
+ public static final VehicleDataEventStatus DRIVER_BRAKING = VehicleDataEventStatus.NO;
+ public static final WiperStatus WIPER_STATUS = WiperStatus.COURTESYWIPE;
+ public static final HeadLampStatus HEAD_LAMP_STATUS = new HeadLampStatus();
+ public static final double ACC_PEDAL_POSITION = 28.29;
+ public static final double STEERING_WHEEL_ANGLE = 70.5;
+ public static final ECallInfo E_CALL_INFO = new ECallInfo();
+ public static final AirbagStatus AIRBAG_STATUS = new AirbagStatus();
+ public static final EmergencyEvent EMERGENCY_EVENT = new EmergencyEvent();
+ public static final ClusterModeStatus CLUSTER_MODE_STATUS = new ClusterModeStatus();
+ public static final WindowStatus WINDOW_STATUS = new WindowStatus();
+ public static final List<WindowStatus> WINDOW_STATUS_LIST = new ArrayList<>(1);
+ public static final MyKey MY_KEY = new MyKey();
+ public static final FuelRange FUEL_RANGE = new FuelRange();
+ 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 StabilityControlsStatus STABILITY_CONTROLS_STATUS = new StabilityControlsStatus();
+ public static final String OEM_CUSTOM_VEHICLE_DATA_STATE = "oemCustomVehicleDataState";
+ public static final Boolean HANDS_OFF_STEERING = Boolean.TRUE;
+
+ //other variables inside some of the above objects
// tire status
- public static final WarningLightStatus TIRE_PRESSURE_TELL_TALE = WarningLightStatus.ON;
- public static final ComponentVolumeStatus TIRE_PRESSURE_LEFT_FRONT = ComponentVolumeStatus.NORMAL;
- public static final ComponentVolumeStatus TIRE_PRESSURE_RIGHT_FRONT = ComponentVolumeStatus.FAULT;
- public static final ComponentVolumeStatus TIRE_PRESSURE_LEFT_REAR = ComponentVolumeStatus.LOW;
- public static final ComponentVolumeStatus TIRE_PRESSURE_RIGHT_REAR = ComponentVolumeStatus.NORMAL;
- public static final ComponentVolumeStatus TIRE_PRESSURE_INNER_LEFT_REAR = ComponentVolumeStatus.LOW;
- public static final ComponentVolumeStatus TIRE_PRESSURE_INNER_RIGHT_REAR = ComponentVolumeStatus.ALERT;
-
+ public static final WarningLightStatus TIRE_PRESSURE_TELL_TALE = WarningLightStatus.ON;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_LEFT_FRONT = ComponentVolumeStatus.NORMAL;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_RIGHT_FRONT = ComponentVolumeStatus.FAULT;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_LEFT_REAR = ComponentVolumeStatus.LOW;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_RIGHT_REAR = ComponentVolumeStatus.NORMAL;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_INNER_LEFT_REAR = ComponentVolumeStatus.LOW;
+ public static final ComponentVolumeStatus TIRE_PRESSURE_INNER_RIGHT_REAR = ComponentVolumeStatus.ALERT;
+
// GPS data
- public static final Double GPS_LONGITUDE = 104.2;
- public static final Double GPS_LATITUDE = 56.3;
- public static final Integer GPS_YEAR = 2015;
- public static final Integer GPS_MONTH = 7;
- public static final Integer GPS_DAY = 14;
- public static final Integer GPS_HOURS = 11;
- public static final Integer GPS_MINUTES = 38;
- public static final Integer GPS_SECONDS = 12;
- public static final CompassDirection GPS_DIRECTION = CompassDirection.NORTHWEST;
- public static final Double GPS_PDOP = 4.1;
- public static final Double GPS_HDOP = 2.4;
- public static final Double GPS_VDOP = 5.5;
- public static final Boolean GPS_ACTUAL = true;
- public static final Integer GPS_SATELLITES = 3;
- public static final Dimension GPS_DIMENSION = Dimension._2D;
- public static final Double GPS_ALTITUDE = 768.5;
- public static final Double GPS_HEADING = 315.0;
- public static final Double GPS_SPEED = 30.5;
- public static final Boolean GPS_SHIFTED = true;
-
+ public static final Double GPS_LONGITUDE = 104.2;
+ public static final Double GPS_LATITUDE = 56.3;
+ public static final Integer GPS_YEAR = 2015;
+ public static final Integer GPS_MONTH = 7;
+ public static final Integer GPS_DAY = 14;
+ public static final Integer GPS_HOURS = 11;
+ public static final Integer GPS_MINUTES = 38;
+ public static final Integer GPS_SECONDS = 12;
+ public static final CompassDirection GPS_DIRECTION = CompassDirection.NORTHWEST;
+ public static final Double GPS_PDOP = 4.1;
+ public static final Double GPS_HDOP = 2.4;
+ public static final Double GPS_VDOP = 5.5;
+ public static final Boolean GPS_ACTUAL = true;
+ public static final Integer GPS_SATELLITES = 3;
+ public static final Dimension GPS_DIMENSION = Dimension._2D;
+ public static final Double GPS_ALTITUDE = 768.5;
+ public static final Double GPS_HEADING = 315.0;
+ public static final Double GPS_SPEED = 30.5;
+ public static final Boolean GPS_SHIFTED = true;
+
// belt status
- public static final VehicleDataEventStatus BELT_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_DEPLOYED = VehicleDataEventStatus.YES;
- public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_BELTED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_DRIVER_BELTED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_LEFT_ROW_2_BELTED = VehicleDataEventStatus.NO_EVENT;
- public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_CHILD = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_RIGHT_ROW_2_BELTED = VehicleDataEventStatus.NO_EVENT;
- public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_2_BELTED = VehicleDataEventStatus.YES;
- public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_3_BELTED = VehicleDataEventStatus.NO_EVENT;
- public static final VehicleDataEventStatus BELT_STATUS_LEFT_ROW_3_BELTED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_RIGHT_ROW_3_BELTED = VehicleDataEventStatus.NO_EVENT;
- public static final VehicleDataEventStatus BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED = VehicleDataEventStatus.NO_EVENT;
- public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_1_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_1_BELTED = VehicleDataEventStatus.YES;
-
+ public static final VehicleDataEventStatus BELT_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_DEPLOYED = VehicleDataEventStatus.YES;
+ public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_BELTED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_DRIVER_BELTED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_LEFT_ROW_2_BELTED = VehicleDataEventStatus.NO_EVENT;
+ public static final VehicleDataEventStatus BELT_STATUS_PASSENGER_CHILD = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_RIGHT_ROW_2_BELTED = VehicleDataEventStatus.NO_EVENT;
+ public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_2_BELTED = VehicleDataEventStatus.YES;
+ public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_3_BELTED = VehicleDataEventStatus.NO_EVENT;
+ public static final VehicleDataEventStatus BELT_STATUS_LEFT_ROW_3_BELTED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_RIGHT_ROW_3_BELTED = VehicleDataEventStatus.NO_EVENT;
+ public static final VehicleDataEventStatus BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED = VehicleDataEventStatus.NO_EVENT;
+ public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_1_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus BELT_STATUS_MIDDLE_ROW_1_BELTED = VehicleDataEventStatus.YES;
+
// body information
- public static final Boolean BODY_INFORMATION_PARK_BRAKE = false;
- public static final IgnitionStableStatus BODY_INFORMATION_IGNITION_STATUS = IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE;
- public static final IgnitionStatus BODY_INFORMATION_IGNITION_STABLE_STATUS = IgnitionStatus.ACCESSORY;
- public static final Boolean BODY_INFORMATION_DRIVER_AJAR = true;
- public static final Boolean BODY_INFORMATION_PASSENGER_AJAR = true;
- public static final Boolean BODY_INFORMATION_REAR_LEFT_AJAR = false;
- public static final Boolean BODY_INFORMATION_REAR_RIGHT_AJAR = true;
+ public static final Boolean BODY_INFORMATION_PARK_BRAKE = false;
+ public static final IgnitionStableStatus BODY_INFORMATION_IGNITION_STATUS = IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE;
+ public static final IgnitionStatus BODY_INFORMATION_IGNITION_STABLE_STATUS = IgnitionStatus.ACCESSORY;
+ public static final Boolean BODY_INFORMATION_DRIVER_AJAR = true;
+ public static final Boolean BODY_INFORMATION_PASSENGER_AJAR = true;
+ public static final Boolean BODY_INFORMATION_REAR_LEFT_AJAR = false;
+ public static final Boolean BODY_INFORMATION_REAR_RIGHT_AJAR = true;
// device status
- public static final Boolean DEVICE_STATUS_VOICE_REC = true;
- public static final Boolean DEVICE_STATUS_BT_ICON = true;
- public static final Boolean DEVICE_STATUS_CALL_ACTIVE = true;
- public static final Boolean DEVICE_STATUS_PHONE_ROAMING = false;
- public static final Boolean DEVICE_STATUS_TEXT_MSG_AVAILABLE = false;
- public static final DeviceLevelStatus DEVICE_STATUS_BATT_LEVEL_STATUS = DeviceLevelStatus.TWO_LEVEL_BARS;
- public static final Boolean DEVICE_STATUS_STEREO_MUTED = false;
- public static final Boolean DEVICE_STATUS_MONO_MUTED = true;
- public static final DeviceLevelStatus DEVICE_STATUS_SIGNAL_LEVEL_STATUS = DeviceLevelStatus.ONE_LEVEL_BARS;
- public static final PrimaryAudioSource DEVICE_STATUS_PRIMARY_AUDIO = PrimaryAudioSource.BLUETOOTH_STEREO_BTST;
- public static final Boolean DEVICE_STATUS_E_CALL_ACTIVE = false;
-
- // head lamp status
- public static final AmbientLightStatus HEAD_LAMP_STATUS_AMBIENT_STATUS = AmbientLightStatus.TWILIGHT_3;
- public static final Boolean HEAD_LAMP_HIGH_BEAMS = true;
- public static final Boolean HEAD_LAMP_LOW_BEAMS = false;
-
- // e call info
- public static final VehicleDataNotificationStatus E_CALL_INFO_E_CALL_NOTIFICATION_STATUS = VehicleDataNotificationStatus.NOT_SUPPORTED;
- public static final VehicleDataNotificationStatus E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS = VehicleDataNotificationStatus.NOT_USED;
- public static final ECallConfirmationStatus E_CALL_INFO_CONFIRMATION_STATUS = ECallConfirmationStatus.ECALL_CONFIGURED_OFF;
-
- // airbag status
- public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED = VehicleDataEventStatus.YES;
- public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED = VehicleDataEventStatus.NO;
- public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED = VehicleDataEventStatus.YES;
- public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED = VehicleDataEventStatus.NO;
-
- // emergency event
- public static final EmergencyEventType EMERGENCY_EVENT_TYPE = EmergencyEventType.FRONTAL;
- public static final FuelCutoffStatus EMERGENCY_EVENT_FUEL_CUTOFF_STATUS = FuelCutoffStatus.TERMINATE_FUEL;
- public static final VehicleDataEventStatus EMERGENCY_EVENT_ROLLOVER_EVENT = VehicleDataEventStatus.YES;
- public static final Integer EMERGENCY_EVENT_MAX_CHANGE_VELOCITY = 5;
- public static final VehicleDataEventStatus EMERGENCY_EVENT_MULTIPLE_EVENTS = VehicleDataEventStatus.NO;
-
- // cluster mode status
- public static final Boolean CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE = true;
- public static final PowerModeQualificationStatus CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS =
- PowerModeQualificationStatus.POWER_MODE_EVALUATION_IN_PROGRESS;
- public static final CarModeStatus CLUSTER_MODE_STATUS_CAR_MODE_STATUS = CarModeStatus.TRANSPORT;
- public static final PowerModeStatus CLUSTER_MODE_STATUS_POWER_MODE_STATUS = PowerModeStatus.POST_ACCESORY_0;
-
- // my key
- public static final VehicleDataStatus MY_KEY_E_911_OVERRIDE = VehicleDataStatus.NO_DATA_EXISTS;
-
- // fuel range
- public static final FuelType FUEL_RANGE_TYPE = FuelType.GASOLINE;
- public static final Float FUEL_RANGE_RANGE = TestValues.GENERAL_FLOAT;
- public static final Float FUEL_RANGE_CAPACITY = TestValues.GENERAL_FLOAT;
- public static final CapacityUnit FUEL_RANGE_CAPACITY_UNIT = TestValues.GENERAL_CAPACITYUNIT;
- public static final Float FUEL_RANGE_LEVEL = TestValues.GENERAL_FLOAT;
- public static final ComponentVolumeStatus FUEL_RANGE_LEVEL_STATE = TestValues.GENERAL_COMPONENTVOLUMESTATUS;
-
- // Gear status
- public static final GearStatus GEAR_STATUS = new GearStatus();
- public static final PRNDL USER_SELECTED_GEAR = PRNDL.FIRST;
- public static final PRNDL ACTUAL_GEAR = PRNDL.SECOND;
- public static final TransmissionType TRANSMISSION_TYPE = TransmissionType.ELECTRIC_VARIABLE;
-
- // WindowStatus
- public static final Grid LOCATION_GRID = TestValues.GENERAL_LOCATION_GRID;
- public static final WindowState WINDOW_STATE = TestValues.GENERAL_WINDOW_STATE;
-
- // stability control status
- public static final VehicleDataStatus ESC_SYSTEM = VehicleDataStatus.ON;
- public static final VehicleDataStatus S_WAY_TRAILER = VehicleDataStatus.OFF;
-
- public static final JSONArray JSON_FUEL_RANGE = new JSONArray();
-
- //the OnVehicleData which stores all the information above
- public static final OnVehicleData VEHICLE_DATA = new OnVehicleData();
- //GetVehicleDataResponse data which stores the same things
- public static final GetVehicleDataResponse VEHICLE_DATA_RESPONSE = new GetVehicleDataResponse();
-
- static {
- //TIRE_PRESSURE set up
- TIRE_PRESSURE.setPressureTellTale(TIRE_PRESSURE_TELL_TALE);
- SingleTireStatus tireLeftFront = new SingleTireStatus();
- tireLeftFront.setStatus(TIRE_PRESSURE_LEFT_FRONT);
- TIRE_PRESSURE.setLeftFront(tireLeftFront);
- SingleTireStatus tireRightFront = new SingleTireStatus();
- tireRightFront.setStatus(TIRE_PRESSURE_RIGHT_FRONT);
- TIRE_PRESSURE.setRightFront(tireRightFront);
- SingleTireStatus tireLeftRear = new SingleTireStatus();
- tireLeftRear.setStatus(TIRE_PRESSURE_LEFT_REAR);
- TIRE_PRESSURE.setLeftRear(tireLeftRear);
- SingleTireStatus tireRightRear = new SingleTireStatus();
- tireRightRear.setStatus(TIRE_PRESSURE_RIGHT_REAR);
- TIRE_PRESSURE.setRightRear(tireRightRear);
- SingleTireStatus tireInnerLeftRear = new SingleTireStatus();
- tireInnerLeftRear.setStatus(TIRE_PRESSURE_INNER_LEFT_REAR);
- TIRE_PRESSURE.setInnerLeftRear(tireInnerLeftRear);
- SingleTireStatus tireInnerRightRear = new SingleTireStatus();
- tireInnerRightRear.setStatus(TIRE_PRESSURE_INNER_RIGHT_REAR);
- TIRE_PRESSURE.setInnerRightRear(tireInnerRightRear);
-
- //GPS set up
- GPS.setLongitudeDegrees(GPS_LONGITUDE);
- GPS.setLatitudeDegrees(GPS_LATITUDE);
- GPS.setUtcYear(GPS_YEAR);
- GPS.setUtcMonth(GPS_MONTH);
- GPS.setUtcDay(GPS_DAY);
- GPS.setUtcHours(GPS_HOURS);
- GPS.setUtcMinutes(GPS_MINUTES);
- GPS.setUtcSeconds(GPS_SECONDS);
- GPS.setCompassDirection(GPS_DIRECTION);
- GPS.setPdop(GPS_PDOP);
- GPS.setHdop(GPS_HDOP);
- GPS.setVdop(GPS_VDOP);
- GPS.setActual(GPS_ACTUAL);
- GPS.setSatellites(GPS_SATELLITES);
- GPS.setDimension(GPS_DIMENSION);
- GPS.setAltitude(GPS_ALTITUDE);
- GPS.setHeading(GPS_HEADING);
- GPS.setSpeed(GPS_SPEED);
- GPS.setShifted(GPS_SHIFTED);
-
- //BELT_STATUS set up
- BELT_STATUS.setDriverBeltDeployed(BELT_STATUS_DRIVER_DEPLOYED);
- BELT_STATUS.setPassengerBeltDeployed(BELT_STATUS_PASSENGER_DEPLOYED);
- BELT_STATUS.setPassengerBuckleBelted(BELT_STATUS_PASSENGER_BELTED);
- BELT_STATUS.setDriverBuckleBelted(BELT_STATUS_DRIVER_BELTED);
- BELT_STATUS.setLeftRow2BuckleBelted(BELT_STATUS_LEFT_ROW_2_BELTED);
- BELT_STATUS.setPassengerChildDetected(BELT_STATUS_PASSENGER_CHILD);
- BELT_STATUS.setRightRow2BuckleBelted(BELT_STATUS_RIGHT_ROW_2_BELTED);
- BELT_STATUS.setMiddleRow2BuckleBelted(BELT_STATUS_MIDDLE_ROW_2_BELTED);
- BELT_STATUS.setMiddleRow3BuckleBelted(BELT_STATUS_MIDDLE_ROW_3_BELTED);
- BELT_STATUS.setLeftRow3BuckleBelted(BELT_STATUS_LEFT_ROW_3_BELTED);
- BELT_STATUS.setRightRow3BuckleBelted(BELT_STATUS_RIGHT_ROW_3_BELTED);
- BELT_STATUS.setLeftRearInflatableBelted(BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
- BELT_STATUS.setRightRearInflatableBelted(BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
- BELT_STATUS.setMiddleRow1BeltDeployed(BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
- BELT_STATUS.setMiddleRow1BuckleBelted(BELT_STATUS_MIDDLE_ROW_1_BELTED);
-
- //BODY_INFORMATION set up
- BODY_INFORMATION.setParkBrakeActive(BODY_INFORMATION_PARK_BRAKE);
- BODY_INFORMATION.setIgnitionStableStatus(BODY_INFORMATION_IGNITION_STATUS);
- BODY_INFORMATION.setIgnitionStatus(BODY_INFORMATION_IGNITION_STABLE_STATUS);
- BODY_INFORMATION.setDriverDoorAjar(BODY_INFORMATION_DRIVER_AJAR);
- BODY_INFORMATION.setPassengerDoorAjar(BODY_INFORMATION_PASSENGER_AJAR);
- BODY_INFORMATION.setRearLeftDoorAjar(BODY_INFORMATION_REAR_LEFT_AJAR);
- BODY_INFORMATION.setRearRightDoorAjar(BODY_INFORMATION_REAR_RIGHT_AJAR);
-
- //DEVICE_STATUS set up
- DEVICE_STATUS.setVoiceRecOn(DEVICE_STATUS_VOICE_REC);
- DEVICE_STATUS.setBtIconOn(DEVICE_STATUS_BT_ICON);
- DEVICE_STATUS.setCallActive(DEVICE_STATUS_CALL_ACTIVE);
- DEVICE_STATUS.setPhoneRoaming(DEVICE_STATUS_PHONE_ROAMING);
- DEVICE_STATUS.setTextMsgAvailable(DEVICE_STATUS_TEXT_MSG_AVAILABLE);
- DEVICE_STATUS.setBattLevelStatus(DEVICE_STATUS_BATT_LEVEL_STATUS);
- DEVICE_STATUS.setStereoAudioOutputMuted(DEVICE_STATUS_STEREO_MUTED);
- DEVICE_STATUS.setMonoAudioOutputMuted(DEVICE_STATUS_MONO_MUTED);
- DEVICE_STATUS.setSignalLevelStatus(DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
- DEVICE_STATUS.setPrimaryAudioSource(DEVICE_STATUS_PRIMARY_AUDIO);
- DEVICE_STATUS.setECallEventActive(DEVICE_STATUS_E_CALL_ACTIVE);
-
- //HEAD_LAMP_STATUS set up
- HEAD_LAMP_STATUS.setAmbientLightStatus(HEAD_LAMP_STATUS_AMBIENT_STATUS);
- HEAD_LAMP_STATUS.setHighBeamsOn(HEAD_LAMP_HIGH_BEAMS);
- HEAD_LAMP_STATUS.setLowBeamsOn(HEAD_LAMP_LOW_BEAMS);
-
- //E_CALL_INFO set up
- E_CALL_INFO.setECallNotificationStatus(E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
- E_CALL_INFO.setAuxECallNotificationStatus(E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
- E_CALL_INFO.setECallConfirmationStatus(E_CALL_INFO_CONFIRMATION_STATUS);
-
- //AIRBAG_STATUS set up
- AIRBAG_STATUS.setDriverAirbagDeployed(AIRBAG_STATUS_DRIVER_DEPLOYED);
- AIRBAG_STATUS.setDriverSideAirbagDeployed(AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
- AIRBAG_STATUS.setDriverCurtainAirbagDeployed(AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
- AIRBAG_STATUS.setPassengerAirbagDeployed(AIRBAG_STATUS_PASSENGER_DEPLOYED);
- AIRBAG_STATUS.setPassengerCurtainAirbagDeployed(AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
- AIRBAG_STATUS.setDriverKneeAirbagDeployed(AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
- AIRBAG_STATUS.setPassengerSideAirbagDeployed(AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
- AIRBAG_STATUS.setPassengerKneeAirbagDeployed(AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
-
- //EMERGENCY_EVENT set up
- EMERGENCY_EVENT.setEmergencyEventType(EMERGENCY_EVENT_TYPE);
- EMERGENCY_EVENT.setFuelCutoffStatus(EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
- EMERGENCY_EVENT.setRolloverEvent(EMERGENCY_EVENT_ROLLOVER_EVENT);
- EMERGENCY_EVENT.setMaximumChangeVelocity(EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
- EMERGENCY_EVENT.setMultipleEvents(EMERGENCY_EVENT_MULTIPLE_EVENTS);
-
- //CLUSTER_MODE_STATUS set up
- CLUSTER_MODE_STATUS.setPowerModeActive(CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
- CLUSTER_MODE_STATUS.setPowerModeQualificationStatus(CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
- CLUSTER_MODE_STATUS.setCarModeStatus(CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
- CLUSTER_MODE_STATUS.setPowerModeStatus(CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
-
- //MY_KEY set up
- MY_KEY.setE911Override(MY_KEY_E_911_OVERRIDE);
-
- // FUEL_RANGE and FUEL_RANGE_LIST set up
- FUEL_RANGE.setType(FUEL_RANGE_TYPE);
- FUEL_RANGE.setRange(FUEL_RANGE_RANGE);
- FUEL_RANGE.setCapacity(FUEL_RANGE_CAPACITY);
- FUEL_RANGE.setCapacityUnit(FUEL_RANGE_CAPACITY_UNIT);
- FUEL_RANGE.setLevel(FUEL_RANGE_LEVEL);
- FUEL_RANGE.setLevelState(FUEL_RANGE_LEVEL_STATE);
- FUEL_RANGE_LIST.add(FUEL_RANGE);
-
- //WINDOW_STATUS and WINDOW_STATUS_LIST set up
- WINDOW_STATUS.setLocation(LOCATION_GRID);
- WINDOW_STATUS.setState(WINDOW_STATE);
- WINDOW_STATUS_LIST.add(WINDOW_STATUS);
- // FUEL_RANGE json array set up
- try {
- JSON_FUEL_RANGE.put(FUEL_RANGE.serializeJSON());
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- // STABILITY_CONTROLS_STATUS
- STABILITY_CONTROLS_STATUS.setEscSystem(VehicleDataStatus.ON);
- STABILITY_CONTROLS_STATUS.setTrailerSwayControl(VehicleDataStatus.OFF);
-
- // GEAR_STATUS
- GEAR_STATUS.setTransmissionType(TRANSMISSION_TYPE);
- GEAR_STATUS.setUserSelectedGear(USER_SELECTED_GEAR);
- GEAR_STATUS.setActualGear(ACTUAL_GEAR);
-
- //set up the OnVehicleData object
- VEHICLE_DATA.setSpeed(SPEED);
- VEHICLE_DATA.setRpm(RPM);
- VEHICLE_DATA.setExternalTemperature(EXTERNAL_TEMPERATURE);
- VEHICLE_DATA.setFuelLevel(FUEL_LEVEL);
- VEHICLE_DATA.setVin(VIN);
- VEHICLE_DATA.setPrndl(PRNDL_FINAL);
- VEHICLE_DATA.setTirePressure(TIRE_PRESSURE);
- VEHICLE_DATA.setEngineTorque(ENGINE_TORQUE);
- VEHICLE_DATA.setEngineOilLife(ENGINE_OIL_LIFE);
- VEHICLE_DATA.setOdometer(ODOMETER);
- VEHICLE_DATA.setGps(GPS);
- VEHICLE_DATA.setFuelLevelState(FUEL_LEVEL_STATE);
- VEHICLE_DATA.setInstantFuelConsumption(INSTANT_FUEL_CONSUMPTION);
- VEHICLE_DATA.setBeltStatus(BELT_STATUS);
- VEHICLE_DATA.setBodyInformation(BODY_INFORMATION);
- VEHICLE_DATA.setDeviceStatus(DEVICE_STATUS);
- VEHICLE_DATA.setDriverBraking(DRIVER_BRAKING);
- VEHICLE_DATA.setWiperStatus(WIPER_STATUS);
- VEHICLE_DATA.setHeadLampStatus(HEAD_LAMP_STATUS);
- VEHICLE_DATA.setAccPedalPosition(ACC_PEDAL_POSITION);
- VEHICLE_DATA.setSteeringWheelAngle(STEERING_WHEEL_ANGLE);
- VEHICLE_DATA.setECallInfo(E_CALL_INFO);
- VEHICLE_DATA.setAirbagStatus(AIRBAG_STATUS);
- VEHICLE_DATA.setEmergencyEvent(EMERGENCY_EVENT);
- VEHICLE_DATA.setClusterModeStatus(CLUSTER_MODE_STATUS);
- VEHICLE_DATA.setMyKey(MY_KEY);
- VEHICLE_DATA.setFuelRange(FUEL_RANGE_LIST);
- VEHICLE_DATA.setTurnSignal(TURN_SIGNAL);
- VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
- VEHICLE_DATA.setGearStatus(GEAR_STATUS);
- VEHICLE_DATA.setWindowStatus(WINDOW_STATUS_LIST);
- VEHICLE_DATA.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
- VEHICLE_DATA.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
- VEHICLE_DATA.setHandsOffSteering(HANDS_OFF_STEERING);
- //set up the GetVehicleDataResponse object
- VEHICLE_DATA_RESPONSE.setSpeed(SPEED);
- VEHICLE_DATA_RESPONSE.setRpm(RPM);
- VEHICLE_DATA_RESPONSE.setExternalTemperature(EXTERNAL_TEMPERATURE);
- VEHICLE_DATA_RESPONSE.setFuelLevel(FUEL_LEVEL);
- VEHICLE_DATA_RESPONSE.setVin(VIN);
- VEHICLE_DATA_RESPONSE.setPrndl(PRNDL_FINAL);
- VEHICLE_DATA_RESPONSE.setTirePressure(TIRE_PRESSURE);
- VEHICLE_DATA_RESPONSE.setEngineTorque(ENGINE_TORQUE);
- VEHICLE_DATA_RESPONSE.setEngineOilLife(ENGINE_OIL_LIFE);
- VEHICLE_DATA_RESPONSE.setOdometer(ODOMETER);
- VEHICLE_DATA_RESPONSE.setGps(GPS);
- VEHICLE_DATA_RESPONSE.setFuelLevelState(FUEL_LEVEL_STATE);
- VEHICLE_DATA_RESPONSE.setInstantFuelConsumption(INSTANT_FUEL_CONSUMPTION);
- VEHICLE_DATA_RESPONSE.setBeltStatus(BELT_STATUS);
- VEHICLE_DATA_RESPONSE.setBodyInformation(BODY_INFORMATION);
- VEHICLE_DATA_RESPONSE.setDeviceStatus(DEVICE_STATUS);
- VEHICLE_DATA_RESPONSE.setDriverBraking(DRIVER_BRAKING);
- VEHICLE_DATA_RESPONSE.setWiperStatus(WIPER_STATUS);
- VEHICLE_DATA_RESPONSE.setHeadLampStatus(HEAD_LAMP_STATUS);
- VEHICLE_DATA_RESPONSE.setAccPedalPosition(ACC_PEDAL_POSITION);
- VEHICLE_DATA_RESPONSE.setSteeringWheelAngle(STEERING_WHEEL_ANGLE);
- VEHICLE_DATA_RESPONSE.setECallInfo(E_CALL_INFO);
- VEHICLE_DATA_RESPONSE.setAirbagStatus(AIRBAG_STATUS);
- VEHICLE_DATA_RESPONSE.setEmergencyEvent(EMERGENCY_EVENT);
- VEHICLE_DATA_RESPONSE.setClusterModeStatus(CLUSTER_MODE_STATUS);
- VEHICLE_DATA_RESPONSE.setMyKey(MY_KEY);
- VEHICLE_DATA_RESPONSE.setFuelRange(FUEL_RANGE_LIST);
- VEHICLE_DATA_RESPONSE.setTurnSignal(TURN_SIGNAL);
- VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
- VEHICLE_DATA_RESPONSE.setGearStatus(GEAR_STATUS);
- VEHICLE_DATA_RESPONSE.setWindowStatus(WINDOW_STATUS_LIST);
- VEHICLE_DATA_RESPONSE.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
- VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
- VEHICLE_DATA_RESPONSE.setHandsOffSteering(HANDS_OFF_STEERING);
- }
-
- private VehicleDataHelper(){}
-
+ public static final Boolean DEVICE_STATUS_VOICE_REC = true;
+ public static final Boolean DEVICE_STATUS_BT_ICON = true;
+ public static final Boolean DEVICE_STATUS_CALL_ACTIVE = true;
+ public static final Boolean DEVICE_STATUS_PHONE_ROAMING = false;
+ public static final Boolean DEVICE_STATUS_TEXT_MSG_AVAILABLE = false;
+ public static final DeviceLevelStatus DEVICE_STATUS_BATT_LEVEL_STATUS = DeviceLevelStatus.TWO_LEVEL_BARS;
+ public static final Boolean DEVICE_STATUS_STEREO_MUTED = false;
+ public static final Boolean DEVICE_STATUS_MONO_MUTED = true;
+ public static final DeviceLevelStatus DEVICE_STATUS_SIGNAL_LEVEL_STATUS = DeviceLevelStatus.ONE_LEVEL_BARS;
+ public static final PrimaryAudioSource DEVICE_STATUS_PRIMARY_AUDIO = PrimaryAudioSource.BLUETOOTH_STEREO_BTST;
+ public static final Boolean DEVICE_STATUS_E_CALL_ACTIVE = false;
+
+ // head lamp status
+ public static final AmbientLightStatus HEAD_LAMP_STATUS_AMBIENT_STATUS = AmbientLightStatus.TWILIGHT_3;
+ public static final Boolean HEAD_LAMP_HIGH_BEAMS = true;
+ public static final Boolean HEAD_LAMP_LOW_BEAMS = false;
+
+ // e call info
+ public static final VehicleDataNotificationStatus E_CALL_INFO_E_CALL_NOTIFICATION_STATUS = VehicleDataNotificationStatus.NOT_SUPPORTED;
+ public static final VehicleDataNotificationStatus E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS = VehicleDataNotificationStatus.NOT_USED;
+ public static final ECallConfirmationStatus E_CALL_INFO_CONFIRMATION_STATUS = ECallConfirmationStatus.ECALL_CONFIGURED_OFF;
+
+ // airbag status
+ public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED = VehicleDataEventStatus.YES;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED = VehicleDataEventStatus.NO;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED = VehicleDataEventStatus.YES;
+ public static final VehicleDataEventStatus AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED = VehicleDataEventStatus.NO;
+
+ // emergency event
+ public static final EmergencyEventType EMERGENCY_EVENT_TYPE = EmergencyEventType.FRONTAL;
+ public static final FuelCutoffStatus EMERGENCY_EVENT_FUEL_CUTOFF_STATUS = FuelCutoffStatus.TERMINATE_FUEL;
+ public static final VehicleDataEventStatus EMERGENCY_EVENT_ROLLOVER_EVENT = VehicleDataEventStatus.YES;
+ public static final Integer EMERGENCY_EVENT_MAX_CHANGE_VELOCITY = 5;
+ public static final VehicleDataEventStatus EMERGENCY_EVENT_MULTIPLE_EVENTS = VehicleDataEventStatus.NO;
+
+ // cluster mode status
+ public static final Boolean CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE = true;
+ public static final PowerModeQualificationStatus CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS =
+ PowerModeQualificationStatus.POWER_MODE_EVALUATION_IN_PROGRESS;
+ public static final CarModeStatus CLUSTER_MODE_STATUS_CAR_MODE_STATUS = CarModeStatus.TRANSPORT;
+ public static final PowerModeStatus CLUSTER_MODE_STATUS_POWER_MODE_STATUS = PowerModeStatus.POST_ACCESORY_0;
+
+ // my key
+ public static final VehicleDataStatus MY_KEY_E_911_OVERRIDE = VehicleDataStatus.NO_DATA_EXISTS;
+
+ // fuel range
+ public static final FuelType FUEL_RANGE_TYPE = FuelType.GASOLINE;
+ public static final Float FUEL_RANGE_RANGE = TestValues.GENERAL_FLOAT;
+ public static final Float FUEL_RANGE_CAPACITY = TestValues.GENERAL_FLOAT;
+ public static final CapacityUnit FUEL_RANGE_CAPACITY_UNIT = TestValues.GENERAL_CAPACITYUNIT;
+ public static final Float FUEL_RANGE_LEVEL = TestValues.GENERAL_FLOAT;
+ public static final ComponentVolumeStatus FUEL_RANGE_LEVEL_STATE = TestValues.GENERAL_COMPONENTVOLUMESTATUS;
+
+ // Gear status
+ public static final GearStatus GEAR_STATUS = new GearStatus();
+ public static final PRNDL USER_SELECTED_GEAR = PRNDL.FIRST;
+ public static final PRNDL ACTUAL_GEAR = PRNDL.SECOND;
+ public static final TransmissionType TRANSMISSION_TYPE = TransmissionType.ELECTRIC_VARIABLE;
+
+ // WindowStatus
+ public static final Grid LOCATION_GRID = TestValues.GENERAL_LOCATION_GRID;
+ public static final WindowState WINDOW_STATE = TestValues.GENERAL_WINDOW_STATE;
+
+ // stability control status
+ public static final VehicleDataStatus ESC_SYSTEM = VehicleDataStatus.ON;
+ public static final VehicleDataStatus S_WAY_TRAILER = VehicleDataStatus.OFF;
+
+ public static final JSONArray JSON_FUEL_RANGE = new JSONArray();
+
+ //the OnVehicleData which stores all the information above
+ public static final OnVehicleData VEHICLE_DATA = new OnVehicleData();
+ //GetVehicleDataResponse data which stores the same things
+ public static final GetVehicleDataResponse VEHICLE_DATA_RESPONSE = new GetVehicleDataResponse();
+
+ static {
+ //TIRE_PRESSURE set up
+ TIRE_PRESSURE.setPressureTellTale(TIRE_PRESSURE_TELL_TALE);
+ SingleTireStatus tireLeftFront = new SingleTireStatus();
+ tireLeftFront.setStatus(TIRE_PRESSURE_LEFT_FRONT);
+ TIRE_PRESSURE.setLeftFront(tireLeftFront);
+ SingleTireStatus tireRightFront = new SingleTireStatus();
+ tireRightFront.setStatus(TIRE_PRESSURE_RIGHT_FRONT);
+ TIRE_PRESSURE.setRightFront(tireRightFront);
+ SingleTireStatus tireLeftRear = new SingleTireStatus();
+ tireLeftRear.setStatus(TIRE_PRESSURE_LEFT_REAR);
+ TIRE_PRESSURE.setLeftRear(tireLeftRear);
+ SingleTireStatus tireRightRear = new SingleTireStatus();
+ tireRightRear.setStatus(TIRE_PRESSURE_RIGHT_REAR);
+ TIRE_PRESSURE.setRightRear(tireRightRear);
+ SingleTireStatus tireInnerLeftRear = new SingleTireStatus();
+ tireInnerLeftRear.setStatus(TIRE_PRESSURE_INNER_LEFT_REAR);
+ TIRE_PRESSURE.setInnerLeftRear(tireInnerLeftRear);
+ SingleTireStatus tireInnerRightRear = new SingleTireStatus();
+ tireInnerRightRear.setStatus(TIRE_PRESSURE_INNER_RIGHT_REAR);
+ TIRE_PRESSURE.setInnerRightRear(tireInnerRightRear);
+
+ //GPS set up
+ GPS.setLongitudeDegrees(GPS_LONGITUDE);
+ GPS.setLatitudeDegrees(GPS_LATITUDE);
+ GPS.setUtcYear(GPS_YEAR);
+ GPS.setUtcMonth(GPS_MONTH);
+ GPS.setUtcDay(GPS_DAY);
+ GPS.setUtcHours(GPS_HOURS);
+ GPS.setUtcMinutes(GPS_MINUTES);
+ GPS.setUtcSeconds(GPS_SECONDS);
+ GPS.setCompassDirection(GPS_DIRECTION);
+ GPS.setPdop(GPS_PDOP);
+ GPS.setHdop(GPS_HDOP);
+ GPS.setVdop(GPS_VDOP);
+ GPS.setActual(GPS_ACTUAL);
+ GPS.setSatellites(GPS_SATELLITES);
+ GPS.setDimension(GPS_DIMENSION);
+ GPS.setAltitude(GPS_ALTITUDE);
+ GPS.setHeading(GPS_HEADING);
+ GPS.setSpeed(GPS_SPEED);
+ GPS.setShifted(GPS_SHIFTED);
+
+ //BELT_STATUS set up
+ BELT_STATUS.setDriverBeltDeployed(BELT_STATUS_DRIVER_DEPLOYED);
+ BELT_STATUS.setPassengerBeltDeployed(BELT_STATUS_PASSENGER_DEPLOYED);
+ BELT_STATUS.setPassengerBuckleBelted(BELT_STATUS_PASSENGER_BELTED);
+ BELT_STATUS.setDriverBuckleBelted(BELT_STATUS_DRIVER_BELTED);
+ BELT_STATUS.setLeftRow2BuckleBelted(BELT_STATUS_LEFT_ROW_2_BELTED);
+ BELT_STATUS.setPassengerChildDetected(BELT_STATUS_PASSENGER_CHILD);
+ BELT_STATUS.setRightRow2BuckleBelted(BELT_STATUS_RIGHT_ROW_2_BELTED);
+ BELT_STATUS.setMiddleRow2BuckleBelted(BELT_STATUS_MIDDLE_ROW_2_BELTED);
+ BELT_STATUS.setMiddleRow3BuckleBelted(BELT_STATUS_MIDDLE_ROW_3_BELTED);
+ BELT_STATUS.setLeftRow3BuckleBelted(BELT_STATUS_LEFT_ROW_3_BELTED);
+ BELT_STATUS.setRightRow3BuckleBelted(BELT_STATUS_RIGHT_ROW_3_BELTED);
+ BELT_STATUS.setLeftRearInflatableBelted(BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
+ BELT_STATUS.setRightRearInflatableBelted(BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
+ BELT_STATUS.setMiddleRow1BeltDeployed(BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
+ BELT_STATUS.setMiddleRow1BuckleBelted(BELT_STATUS_MIDDLE_ROW_1_BELTED);
+
+ //BODY_INFORMATION set up
+ BODY_INFORMATION.setParkBrakeActive(BODY_INFORMATION_PARK_BRAKE);
+ BODY_INFORMATION.setIgnitionStableStatus(BODY_INFORMATION_IGNITION_STATUS);
+ BODY_INFORMATION.setIgnitionStatus(BODY_INFORMATION_IGNITION_STABLE_STATUS);
+ BODY_INFORMATION.setDriverDoorAjar(BODY_INFORMATION_DRIVER_AJAR);
+ BODY_INFORMATION.setPassengerDoorAjar(BODY_INFORMATION_PASSENGER_AJAR);
+ BODY_INFORMATION.setRearLeftDoorAjar(BODY_INFORMATION_REAR_LEFT_AJAR);
+ BODY_INFORMATION.setRearRightDoorAjar(BODY_INFORMATION_REAR_RIGHT_AJAR);
+
+ //DEVICE_STATUS set up
+ DEVICE_STATUS.setVoiceRecOn(DEVICE_STATUS_VOICE_REC);
+ DEVICE_STATUS.setBtIconOn(DEVICE_STATUS_BT_ICON);
+ DEVICE_STATUS.setCallActive(DEVICE_STATUS_CALL_ACTIVE);
+ DEVICE_STATUS.setPhoneRoaming(DEVICE_STATUS_PHONE_ROAMING);
+ DEVICE_STATUS.setTextMsgAvailable(DEVICE_STATUS_TEXT_MSG_AVAILABLE);
+ DEVICE_STATUS.setBattLevelStatus(DEVICE_STATUS_BATT_LEVEL_STATUS);
+ DEVICE_STATUS.setStereoAudioOutputMuted(DEVICE_STATUS_STEREO_MUTED);
+ DEVICE_STATUS.setMonoAudioOutputMuted(DEVICE_STATUS_MONO_MUTED);
+ DEVICE_STATUS.setSignalLevelStatus(DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
+ DEVICE_STATUS.setPrimaryAudioSource(DEVICE_STATUS_PRIMARY_AUDIO);
+ DEVICE_STATUS.setECallEventActive(DEVICE_STATUS_E_CALL_ACTIVE);
+
+ //HEAD_LAMP_STATUS set up
+ HEAD_LAMP_STATUS.setAmbientLightStatus(HEAD_LAMP_STATUS_AMBIENT_STATUS);
+ HEAD_LAMP_STATUS.setHighBeamsOn(HEAD_LAMP_HIGH_BEAMS);
+ HEAD_LAMP_STATUS.setLowBeamsOn(HEAD_LAMP_LOW_BEAMS);
+
+ //E_CALL_INFO set up
+ E_CALL_INFO.setECallNotificationStatus(E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
+ E_CALL_INFO.setAuxECallNotificationStatus(E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
+ E_CALL_INFO.setECallConfirmationStatus(E_CALL_INFO_CONFIRMATION_STATUS);
+
+ //AIRBAG_STATUS set up
+ AIRBAG_STATUS.setDriverAirbagDeployed(AIRBAG_STATUS_DRIVER_DEPLOYED);
+ AIRBAG_STATUS.setDriverSideAirbagDeployed(AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
+ AIRBAG_STATUS.setDriverCurtainAirbagDeployed(AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
+ AIRBAG_STATUS.setPassengerAirbagDeployed(AIRBAG_STATUS_PASSENGER_DEPLOYED);
+ AIRBAG_STATUS.setPassengerCurtainAirbagDeployed(AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
+ AIRBAG_STATUS.setDriverKneeAirbagDeployed(AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
+ AIRBAG_STATUS.setPassengerSideAirbagDeployed(AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
+ AIRBAG_STATUS.setPassengerKneeAirbagDeployed(AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
+
+ //EMERGENCY_EVENT set up
+ EMERGENCY_EVENT.setEmergencyEventType(EMERGENCY_EVENT_TYPE);
+ EMERGENCY_EVENT.setFuelCutoffStatus(EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
+ EMERGENCY_EVENT.setRolloverEvent(EMERGENCY_EVENT_ROLLOVER_EVENT);
+ EMERGENCY_EVENT.setMaximumChangeVelocity(EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
+ EMERGENCY_EVENT.setMultipleEvents(EMERGENCY_EVENT_MULTIPLE_EVENTS);
+
+ //CLUSTER_MODE_STATUS set up
+ CLUSTER_MODE_STATUS.setPowerModeActive(CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
+ CLUSTER_MODE_STATUS.setPowerModeQualificationStatus(CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
+ CLUSTER_MODE_STATUS.setCarModeStatus(CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
+ CLUSTER_MODE_STATUS.setPowerModeStatus(CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
+
+ //MY_KEY set up
+ MY_KEY.setE911Override(MY_KEY_E_911_OVERRIDE);
+
+ // FUEL_RANGE and FUEL_RANGE_LIST set up
+ FUEL_RANGE.setType(FUEL_RANGE_TYPE);
+ FUEL_RANGE.setRange(FUEL_RANGE_RANGE);
+ FUEL_RANGE.setCapacity(FUEL_RANGE_CAPACITY);
+ FUEL_RANGE.setCapacityUnit(FUEL_RANGE_CAPACITY_UNIT);
+ FUEL_RANGE.setLevel(FUEL_RANGE_LEVEL);
+ FUEL_RANGE.setLevelState(FUEL_RANGE_LEVEL_STATE);
+ FUEL_RANGE_LIST.add(FUEL_RANGE);
+
+ //WINDOW_STATUS and WINDOW_STATUS_LIST set up
+ WINDOW_STATUS.setLocation(LOCATION_GRID);
+ WINDOW_STATUS.setState(WINDOW_STATE);
+ WINDOW_STATUS_LIST.add(WINDOW_STATUS);
+ // FUEL_RANGE json array set up
+ try {
+ JSON_FUEL_RANGE.put(FUEL_RANGE.serializeJSON());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ // STABILITY_CONTROLS_STATUS
+ STABILITY_CONTROLS_STATUS.setEscSystem(VehicleDataStatus.ON);
+ STABILITY_CONTROLS_STATUS.setTrailerSwayControl(VehicleDataStatus.OFF);
+
+ // GEAR_STATUS
+ GEAR_STATUS.setTransmissionType(TRANSMISSION_TYPE);
+ GEAR_STATUS.setUserSelectedGear(USER_SELECTED_GEAR);
+ GEAR_STATUS.setActualGear(ACTUAL_GEAR);
+
+ //set up the OnVehicleData object
+ VEHICLE_DATA.setSpeed(SPEED);
+ VEHICLE_DATA.setRpm(RPM);
+ VEHICLE_DATA.setExternalTemperature(EXTERNAL_TEMPERATURE);
+ VEHICLE_DATA.setFuelLevel(FUEL_LEVEL);
+ VEHICLE_DATA.setVin(VIN);
+ VEHICLE_DATA.setPrndl(PRNDL_FINAL);
+ VEHICLE_DATA.setTirePressure(TIRE_PRESSURE);
+ VEHICLE_DATA.setEngineTorque(ENGINE_TORQUE);
+ VEHICLE_DATA.setEngineOilLife(ENGINE_OIL_LIFE);
+ VEHICLE_DATA.setOdometer(ODOMETER);
+ VEHICLE_DATA.setGps(GPS);
+ VEHICLE_DATA.setFuelLevelState(FUEL_LEVEL_STATE);
+ VEHICLE_DATA.setInstantFuelConsumption(INSTANT_FUEL_CONSUMPTION);
+ VEHICLE_DATA.setBeltStatus(BELT_STATUS);
+ VEHICLE_DATA.setBodyInformation(BODY_INFORMATION);
+ VEHICLE_DATA.setDeviceStatus(DEVICE_STATUS);
+ VEHICLE_DATA.setDriverBraking(DRIVER_BRAKING);
+ VEHICLE_DATA.setWiperStatus(WIPER_STATUS);
+ VEHICLE_DATA.setHeadLampStatus(HEAD_LAMP_STATUS);
+ VEHICLE_DATA.setAccPedalPosition(ACC_PEDAL_POSITION);
+ VEHICLE_DATA.setSteeringWheelAngle(STEERING_WHEEL_ANGLE);
+ VEHICLE_DATA.setECallInfo(E_CALL_INFO);
+ VEHICLE_DATA.setAirbagStatus(AIRBAG_STATUS);
+ VEHICLE_DATA.setEmergencyEvent(EMERGENCY_EVENT);
+ VEHICLE_DATA.setClusterModeStatus(CLUSTER_MODE_STATUS);
+ VEHICLE_DATA.setMyKey(MY_KEY);
+ VEHICLE_DATA.setFuelRange(FUEL_RANGE_LIST);
+ VEHICLE_DATA.setTurnSignal(TURN_SIGNAL);
+ VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA.setGearStatus(GEAR_STATUS);
+ VEHICLE_DATA.setWindowStatus(WINDOW_STATUS_LIST);
+ VEHICLE_DATA.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
+ VEHICLE_DATA.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
+ VEHICLE_DATA.setHandsOffSteering(HANDS_OFF_STEERING);
+ //set up the GetVehicleDataResponse object
+ VEHICLE_DATA_RESPONSE.setSpeed(SPEED);
+ VEHICLE_DATA_RESPONSE.setRpm(RPM);
+ VEHICLE_DATA_RESPONSE.setExternalTemperature(EXTERNAL_TEMPERATURE);
+ VEHICLE_DATA_RESPONSE.setFuelLevel(FUEL_LEVEL);
+ VEHICLE_DATA_RESPONSE.setVin(VIN);
+ VEHICLE_DATA_RESPONSE.setPrndl(PRNDL_FINAL);
+ VEHICLE_DATA_RESPONSE.setTirePressure(TIRE_PRESSURE);
+ VEHICLE_DATA_RESPONSE.setEngineTorque(ENGINE_TORQUE);
+ VEHICLE_DATA_RESPONSE.setEngineOilLife(ENGINE_OIL_LIFE);
+ VEHICLE_DATA_RESPONSE.setOdometer(ODOMETER);
+ VEHICLE_DATA_RESPONSE.setGps(GPS);
+ VEHICLE_DATA_RESPONSE.setFuelLevelState(FUEL_LEVEL_STATE);
+ VEHICLE_DATA_RESPONSE.setInstantFuelConsumption(INSTANT_FUEL_CONSUMPTION);
+ VEHICLE_DATA_RESPONSE.setBeltStatus(BELT_STATUS);
+ VEHICLE_DATA_RESPONSE.setBodyInformation(BODY_INFORMATION);
+ VEHICLE_DATA_RESPONSE.setDeviceStatus(DEVICE_STATUS);
+ VEHICLE_DATA_RESPONSE.setDriverBraking(DRIVER_BRAKING);
+ VEHICLE_DATA_RESPONSE.setWiperStatus(WIPER_STATUS);
+ VEHICLE_DATA_RESPONSE.setHeadLampStatus(HEAD_LAMP_STATUS);
+ VEHICLE_DATA_RESPONSE.setAccPedalPosition(ACC_PEDAL_POSITION);
+ VEHICLE_DATA_RESPONSE.setSteeringWheelAngle(STEERING_WHEEL_ANGLE);
+ VEHICLE_DATA_RESPONSE.setECallInfo(E_CALL_INFO);
+ VEHICLE_DATA_RESPONSE.setAirbagStatus(AIRBAG_STATUS);
+ VEHICLE_DATA_RESPONSE.setEmergencyEvent(EMERGENCY_EVENT);
+ VEHICLE_DATA_RESPONSE.setClusterModeStatus(CLUSTER_MODE_STATUS);
+ VEHICLE_DATA_RESPONSE.setMyKey(MY_KEY);
+ VEHICLE_DATA_RESPONSE.setFuelRange(FUEL_RANGE_LIST);
+ VEHICLE_DATA_RESPONSE.setTurnSignal(TURN_SIGNAL);
+ VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA_RESPONSE.setGearStatus(GEAR_STATUS);
+ VEHICLE_DATA_RESPONSE.setWindowStatus(WINDOW_STATUS_LIST);
+ VEHICLE_DATA_RESPONSE.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
+ VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
+ VEHICLE_DATA_RESPONSE.setHandsOffSteering(HANDS_OFF_STEERING);
+ }
+
+ private VehicleDataHelper() {
+ }
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java
index 083a5dd3f..86a6452da 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java
@@ -54,16 +54,16 @@ public class EncoderUtilsTest extends TestCase {
public void testGetCodecSpecificDataForAVC() {
// example of SPS NAL unit with 4-byte start code
- byte[] sps = new byte[] {
+ byte[] sps = new byte[]{
0x00, 0x00, 0x00, 0x01,
- 0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60
+ 0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60
};
// example of PPS NAL unit with 4-byte start code
- byte[] pps = new byte[] {
+ byte[] pps = new byte[]{
0x00, 0x00, 0x00, 0x01,
- 0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20
+ 0x68, (byte) 0xC8, 0x42, 0x0F, 0x13, 0x20
};
ByteBuffer spsByteBuffer = ByteBuffer.allocate(sps.length);
@@ -89,11 +89,11 @@ public class EncoderUtilsTest extends TestCase {
public void testGetCodecSpecificDataWithInvalidAVCData() {
// testing an error case when the encoder emits SPS only (which should not happen)
- byte[] sps = new byte[] {
+ byte[] sps = new byte[]{
0x00, 0x00, 0x00, 0x01,
- 0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60
+ 0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60
};
ByteBuffer spsByteBuffer = ByteBuffer.allocate(sps.length);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/json/rpc/JsonFileReader.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/json/rpc/JsonFileReader.java
index 7284114ab..dd7a8e876 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/json/rpc/JsonFileReader.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/json/rpc/JsonFileReader.java
@@ -13,45 +13,42 @@ import java.io.IOException;
import java.io.InputStream;
public class JsonFileReader {
- private static final String PATH = "json/";
- private static final String EXT = ".json";
-
- public static JSONObject readId (Context context, String id, String type) {
- if(context == null){
- return null;
- }
- String fileName = PATH + id + EXT;
-
- JSONObject commandJsonWithType = null;
-
- try {
- JSONObject commandJson = null;
- //get the file which holds the desired object
- InputStream fileStream = context.getAssets().open(fileName);
- BufferedInputStream bufferStream = new BufferedInputStream(fileStream);
- byte[] buffer = new byte[(int)fileStream.available()];
- bufferStream.read(buffer);
- fileStream.close();
- commandJson = JsonUtils.createJsonObject(buffer);
-
- //now use the type parameter to get the specific message type
- //it also makes sure to return it with the message type in the top level because that's needed to eventually make this into a class object
- commandJson = JsonUtils.readJsonObjectFromJsonObject(commandJson, type);
- commandJsonWithType = new JSONObject();
- commandJsonWithType = commandJsonWithType.put(type, commandJson);
- }
- catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- catch (JSONException e) {
- e.printStackTrace();
- }
-
- return commandJsonWithType;
-
- }
+ private static final String PATH = "json/";
+ private static final String EXT = ".json";
+
+ public static JSONObject readId(Context context, String id, String type) {
+ if (context == null) {
+ return null;
+ }
+ String fileName = PATH + id + EXT;
+
+ JSONObject commandJsonWithType = null;
+
+ try {
+ JSONObject commandJson = null;
+ //get the file which holds the desired object
+ InputStream fileStream = context.getAssets().open(fileName);
+ BufferedInputStream bufferStream = new BufferedInputStream(fileStream);
+ byte[] buffer = new byte[(int) fileStream.available()];
+ bufferStream.read(buffer);
+ fileStream.close();
+ commandJson = JsonUtils.createJsonObject(buffer);
+
+ //now use the type parameter to get the specific message type
+ //it also makes sure to return it with the message type in the top level because that's needed to eventually make this into a class object
+ commandJson = JsonUtils.readJsonObjectFromJsonObject(commandJson, type);
+ commandJsonWithType = new JSONObject();
+ commandJsonWithType = commandJsonWithType.put(type, commandJson);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return commandJsonWithType;
+
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
index 50f949e3d..a5177c68b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/BinaryFrameHeaderTests.java
@@ -19,102 +19,102 @@ import static junit.framework.TestCase.assertTrue;
@RunWith(AndroidJUnit4.class)
public class BinaryFrameHeaderTests {
-
- public static final byte RPC_TYPE_REQUEST = 0x00;
- public static final byte RPC_TYPE_RESPONSE = 0x01;
- public static final byte RPC_TYPE_NOTIFICAITON = 0x02;
-
-
- public static BinaryFrameHeader createDummyBfh(){
- BinaryFrameHeader bfh = new BinaryFrameHeader();
- bfh.setCorrID(123);
- bfh.setFunctionID(FunctionID.ON_HMI_STATUS.getId());
- bfh.setRPCType(RPC_TYPE_NOTIFICAITON);
- bfh.setBulkData(null);
- //There is no check for null bfh.setJsonData(null);
- bfh.setJsonSize(0);
- return bfh;
- }
-
- public BinaryFrameHeader safeParse(byte[] array){
- try{
- return BinaryFrameHeader.parseBinaryHeader(array);
- }catch(Exception e){
- return null;
- }
- }
-
- @Test
- public void testAssemblyAndParse(){
- BinaryFrameHeader bfh = createDummyBfh();
-
- byte[] bfhBytes = bfh.assembleHeaderBytes();
- assertNotNull(bfhBytes);
-
- BinaryFrameHeader parsedBfh = BinaryFrameHeader.parseBinaryHeader(bfhBytes);
- assertNotNull(parsedBfh);
-
- assertTrue(bfh.getCorrID() == parsedBfh.getCorrID());
-
- assertTrue(bfh.getFunctionID() == parsedBfh.getFunctionID());
-
- assertTrue(bfh.getRPCType() == parsedBfh.getRPCType());
-
- assertTrue(bfh.getBulkData() == parsedBfh.getBulkData());
-
- assertTrue(bfh.getJsonData() == parsedBfh.getJsonData());
-
- assertTrue(bfh.getJsonSize() == parsedBfh.getJsonSize());
-
- }
-
- @Test
- public void testCorruptHeader(){
- BinaryFrameHeader bfh = createDummyBfh();
- bfh.setJsonSize(5);
- bfh.setJsonData(new byte[5]);
- bfh.setJsonSize(Integer.MAX_VALUE);
-
- assertFalse(bfh.getJsonData().length == bfh.getJsonSize());
-
- byte[] bfhBytes = bfh.assembleHeaderBytes();
-
- assertNull(safeParse(bfhBytes));
-
- //Change bytes in the array manually
- int size = bfhBytes.length;
- for(int i =0; i<size;i++){
- bfhBytes[i] = (byte) 0x99;
- }
-
- assertNull(safeParse(bfhBytes));
- BinaryFrameHeader head = BinaryFrameHeader.parseBinaryHeader(bfhBytes);
- assertNull(head);
- }
-
- @Test
- public void testJsonSetException(){
- try{
- BinaryFrameHeader bfh = createDummyBfh();
- bfh.setJsonData(null);
- Assert.fail("Setting JSON data to null should have thrown an exception.");
- }catch(Exception e){
- //Pass
- }
- }
-
- @Test
- public void testAlteredDataInSampleRpc(){
- SampleRpc sampleRpc = new SampleRpc(4);
- //Create a corrupted header
- BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
- header.setJsonSize(Integer.MAX_VALUE);
- assertEquals(Integer.MAX_VALUE, header.getJsonSize());
- sampleRpc.setBinaryFrameHeader(header);
-
- assertEquals(Integer.MAX_VALUE,sampleRpc.getBinaryFrameHeader(false).getJsonSize());
-
-
- }
-
+
+ public static final byte RPC_TYPE_REQUEST = 0x00;
+ public static final byte RPC_TYPE_RESPONSE = 0x01;
+ public static final byte RPC_TYPE_NOTIFICAITON = 0x02;
+
+
+ public static BinaryFrameHeader createDummyBfh() {
+ BinaryFrameHeader bfh = new BinaryFrameHeader();
+ bfh.setCorrID(123);
+ bfh.setFunctionID(FunctionID.ON_HMI_STATUS.getId());
+ bfh.setRPCType(RPC_TYPE_NOTIFICAITON);
+ bfh.setBulkData(null);
+ //There is no check for null bfh.setJsonData(null);
+ bfh.setJsonSize(0);
+ return bfh;
+ }
+
+ public BinaryFrameHeader safeParse(byte[] array) {
+ try {
+ return BinaryFrameHeader.parseBinaryHeader(array);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ @Test
+ public void testAssemblyAndParse() {
+ BinaryFrameHeader bfh = createDummyBfh();
+
+ byte[] bfhBytes = bfh.assembleHeaderBytes();
+ assertNotNull(bfhBytes);
+
+ BinaryFrameHeader parsedBfh = BinaryFrameHeader.parseBinaryHeader(bfhBytes);
+ assertNotNull(parsedBfh);
+
+ assertTrue(bfh.getCorrID() == parsedBfh.getCorrID());
+
+ assertTrue(bfh.getFunctionID() == parsedBfh.getFunctionID());
+
+ assertTrue(bfh.getRPCType() == parsedBfh.getRPCType());
+
+ assertTrue(bfh.getBulkData() == parsedBfh.getBulkData());
+
+ assertTrue(bfh.getJsonData() == parsedBfh.getJsonData());
+
+ assertTrue(bfh.getJsonSize() == parsedBfh.getJsonSize());
+
+ }
+
+ @Test
+ public void testCorruptHeader() {
+ BinaryFrameHeader bfh = createDummyBfh();
+ bfh.setJsonSize(5);
+ bfh.setJsonData(new byte[5]);
+ bfh.setJsonSize(Integer.MAX_VALUE);
+
+ assertFalse(bfh.getJsonData().length == bfh.getJsonSize());
+
+ byte[] bfhBytes = bfh.assembleHeaderBytes();
+
+ assertNull(safeParse(bfhBytes));
+
+ //Change bytes in the array manually
+ int size = bfhBytes.length;
+ for (int i = 0; i < size; i++) {
+ bfhBytes[i] = (byte) 0x99;
+ }
+
+ assertNull(safeParse(bfhBytes));
+ BinaryFrameHeader head = BinaryFrameHeader.parseBinaryHeader(bfhBytes);
+ assertNull(head);
+ }
+
+ @Test
+ public void testJsonSetException() {
+ try {
+ BinaryFrameHeader bfh = createDummyBfh();
+ bfh.setJsonData(null);
+ Assert.fail("Setting JSON data to null should have thrown an exception.");
+ } catch (Exception e) {
+ //Pass
+ }
+ }
+
+ @Test
+ public void testAlteredDataInSampleRpc() {
+ SampleRpc sampleRpc = new SampleRpc(4);
+ //Create a corrupted header
+ BinaryFrameHeader header = sampleRpc.getBinaryFrameHeader(true);
+ header.setJsonSize(Integer.MAX_VALUE);
+ assertEquals(Integer.MAX_VALUE, header.getJsonSize());
+ sampleRpc.setBinaryFrameHeader(header);
+
+ assertEquals(Integer.MAX_VALUE, sampleRpc.getBinaryFrameHeader(false).getJsonSize());
+
+
+ }
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataControlFrameTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataControlFrameTypeTests.java
index d51bb6430..297748bcc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataControlFrameTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataControlFrameTypeTests.java
@@ -9,154 +9,154 @@ import java.util.Vector;
public class FrameDataControlFrameTypeTests extends TestCase {
-
- private Vector<FrameDataControlFrameType> list = FrameDataControlFrameType.getList();
-
- // Verifies the values are not null upon valid assignment.
- // These are not actual enums for packeting reasons so testing is different.
- public void testValidEnums () {
-
- final byte START_SESSION_BYTE = (byte) 0x01;
- final String START_SESSION_STRING = "StartSession";
-
- final byte START_SESSION_ACK_BYTE = (byte) 0x02;
- final String START_SESSION_ACK_STRING = "StartSessionACK";
-
- final byte START_SESSION_NACK_BYTE = (byte) 0x03;
- final String START_SESSION_NACK_STRING = "StartSessionNACK";
-
- final byte END_SESSION_BYTE = (byte) 0x04;
- final String END_SESSION_STRING = "EndSession";
-
- final byte END_SESSION_ACK_BYTE = (byte) 0x05;
- final String END_SESSION_ACK_STRING = "EndSessionACK";
-
- final byte END_SESSION_NACK_BYTE = (byte) 0x06;
- final String END_SESSION_NACK_STRING = "EndSessionNACK";
-
- final byte HEARTBEAT_BYTE = (byte) 0x00;
- final String HEARTBEAT_STRING = "Heartbeat";
-
- final byte HEARTBEAT_ACK_BYTE = (byte) 0xFF;
- final String HEARTBEAT_ACK_STRING = "HeartbeatACK";
-
- try {
-
- assertNotNull("FrameDataControlFrameType list returned null", list);
-
- // Check the byte values
- FrameDataControlFrameType enumSS = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_BYTE);
- FrameDataControlFrameType enumSSACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_ACK_BYTE);
- FrameDataControlFrameType enumSSNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_NACK_BYTE);
- FrameDataControlFrameType enumES = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_BYTE);
- FrameDataControlFrameType enumESACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_ACK_BYTE);
- FrameDataControlFrameType enumESNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_NACK_BYTE);
- FrameDataControlFrameType enumH = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_BYTE);
- FrameDataControlFrameType enumHACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_ACK_BYTE);
-
- assertNotNull("Start session byte match returned null", enumSS);
- assertNotNull("Start session ack byte match returned null", enumSSACK);
- assertNotNull("Start session nack byte match returned null", enumSSNACK);
- assertNotNull("End session byte match returned null", enumES);
- assertNotNull("End session ack byte match returned null", enumESACK);
- assertNotNull("End session nack byte match returned null", enumESNACK);
- assertNotNull("Heartbeat byte match returned null", enumH);
- assertNotNull("Heartbeat ack byte match returned null", enumHACK);
-
- // Check the string values
- enumSS = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_STRING);
- enumSSACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_ACK_STRING);
- enumSSNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_NACK_STRING);
- enumES = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_STRING);
- enumESACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_ACK_STRING);
- enumESNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_NACK_STRING);
- enumH = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_STRING);
- enumHACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_ACK_STRING);
-
- assertNotNull("Start session string match returned null", enumSS);
- assertNotNull("Start session ack string match returned null", enumSSACK);
- assertNotNull("Start session nack string match returned null", enumSSNACK);
- assertNotNull("End session string match returned null", enumES);
- assertNotNull("End session ack string match returned null", enumESACK);
- assertNotNull("End session nack string match returned null", enumESNACK);
- assertNotNull("Heartbeat string match returned null", enumH);
- assertNotNull("Heartbeat ack string match returned null", enumHACK);
-
- } catch (NullPointerException exception) {
+
+ private Vector<FrameDataControlFrameType> list = FrameDataControlFrameType.getList();
+
+ // Verifies the values are not null upon valid assignment.
+ // These are not actual enums for packeting reasons so testing is different.
+ public void testValidEnums() {
+
+ final byte START_SESSION_BYTE = (byte) 0x01;
+ final String START_SESSION_STRING = "StartSession";
+
+ final byte START_SESSION_ACK_BYTE = (byte) 0x02;
+ final String START_SESSION_ACK_STRING = "StartSessionACK";
+
+ final byte START_SESSION_NACK_BYTE = (byte) 0x03;
+ final String START_SESSION_NACK_STRING = "StartSessionNACK";
+
+ final byte END_SESSION_BYTE = (byte) 0x04;
+ final String END_SESSION_STRING = "EndSession";
+
+ final byte END_SESSION_ACK_BYTE = (byte) 0x05;
+ final String END_SESSION_ACK_STRING = "EndSessionACK";
+
+ final byte END_SESSION_NACK_BYTE = (byte) 0x06;
+ final String END_SESSION_NACK_STRING = "EndSessionNACK";
+
+ final byte HEARTBEAT_BYTE = (byte) 0x00;
+ final String HEARTBEAT_STRING = "Heartbeat";
+
+ final byte HEARTBEAT_ACK_BYTE = (byte) 0xFF;
+ final String HEARTBEAT_ACK_STRING = "HeartbeatACK";
+
+ try {
+
+ assertNotNull("FrameDataControlFrameType list returned null", list);
+
+ // Check the byte values
+ FrameDataControlFrameType enumSS = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_BYTE);
+ FrameDataControlFrameType enumSSACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_ACK_BYTE);
+ FrameDataControlFrameType enumSSNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_NACK_BYTE);
+ FrameDataControlFrameType enumES = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_BYTE);
+ FrameDataControlFrameType enumESACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_ACK_BYTE);
+ FrameDataControlFrameType enumESNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_NACK_BYTE);
+ FrameDataControlFrameType enumH = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_BYTE);
+ FrameDataControlFrameType enumHACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_ACK_BYTE);
+
+ assertNotNull("Start session byte match returned null", enumSS);
+ assertNotNull("Start session ack byte match returned null", enumSSACK);
+ assertNotNull("Start session nack byte match returned null", enumSSNACK);
+ assertNotNull("End session byte match returned null", enumES);
+ assertNotNull("End session ack byte match returned null", enumESACK);
+ assertNotNull("End session nack byte match returned null", enumESNACK);
+ assertNotNull("Heartbeat byte match returned null", enumH);
+ assertNotNull("Heartbeat ack byte match returned null", enumHACK);
+
+ // Check the string values
+ enumSS = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_STRING);
+ enumSSACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_ACK_STRING);
+ enumSSNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, START_SESSION_NACK_STRING);
+ enumES = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_STRING);
+ enumESACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_ACK_STRING);
+ enumESNACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, END_SESSION_NACK_STRING);
+ enumH = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_STRING);
+ enumHACK = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, HEARTBEAT_ACK_STRING);
+
+ assertNotNull("Start session string match returned null", enumSS);
+ assertNotNull("Start session ack string match returned null", enumSSACK);
+ assertNotNull("Start session nack string match returned null", enumSSNACK);
+ assertNotNull("End session string match returned null", enumES);
+ assertNotNull("End session ack string match returned null", enumESACK);
+ assertNotNull("End session nack string match returned null", enumESNACK);
+ assertNotNull("Heartbeat string match returned null", enumH);
+ assertNotNull("Heartbeat ack string match returned null", enumHACK);
+
+ } catch (NullPointerException exception) {
fail("Null enum list throws NullPointerException.");
- }
- }
-
- // Verifies that an invalid assignment is null.
- public void testInvalidEnum () {
-
- final byte INVALID_BYTE = (byte) 0xAB;
- final String INVALID_STRING = "Invalid";
-
- try {
-
- // Check the byte value
- FrameDataControlFrameType enumInvalid = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, INVALID_BYTE);
- assertNull("Invalid byte match didn't return null", enumInvalid);
-
- // Check the string value
- enumInvalid = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, INVALID_STRING);
- assertNull("Invalid string match didn't return null", enumInvalid);
-
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- // Verifies that a null assignment is invalid.
- public void testNullEnum () {
- try {
-
- // Check null string lookup
- FrameDataControlFrameType enumNull = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, null);
- assertNull("Null lookup returns a value", enumNull);
-
- } catch (NullPointerException exception) {
+ }
+ }
+
+ // Verifies that an invalid assignment is null.
+ public void testInvalidEnum() {
+
+ final byte INVALID_BYTE = (byte) 0xAB;
+ final String INVALID_STRING = "Invalid";
+
+ try {
+
+ // Check the byte value
+ FrameDataControlFrameType enumInvalid = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, INVALID_BYTE);
+ assertNull("Invalid byte match didn't return null", enumInvalid);
+
+ // Check the string value
+ enumInvalid = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, INVALID_STRING);
+ assertNull("Invalid string match didn't return null", enumInvalid);
+
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ // Verifies that a null assignment is invalid.
+ public void testNullEnum() {
+ try {
+
+ // Check null string lookup
+ FrameDataControlFrameType enumNull = (FrameDataControlFrameType) FrameDataControlFrameType.get(list, null);
+ assertNull("Null lookup returns a value", enumNull);
+
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- // Verifies the possible enum values of FrameType.
- public void testListEnum () {
- // Test Vector
- Vector<FrameDataControlFrameType> enumTestList = new Vector<FrameDataControlFrameType>();
- enumTestList.add(FrameDataControlFrameType.Heartbeat);
- enumTestList.add(FrameDataControlFrameType.StartSession);
- enumTestList.add(FrameDataControlFrameType.StartSessionACK);
- enumTestList.add(FrameDataControlFrameType.StartSessionNACK);
- enumTestList.add(FrameDataControlFrameType.EndSession);
- enumTestList.add(FrameDataControlFrameType.EndSessionACK);
- enumTestList.add(FrameDataControlFrameType.EndSessionNACK);
- enumTestList.add(FrameDataControlFrameType.ServiceDataACK);
- enumTestList.add(FrameDataControlFrameType.HeartbeatACK);
- enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransport);
- enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransportACK);
- enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransportNACK);
- enumTestList.add(FrameDataControlFrameType.TransportEventUpdate);
-
- assertTrue("List does not match enum test list.",
- list.containsAll(enumTestList) &&
- enumTestList.containsAll(list));
-
- // Test Array
- FrameDataControlFrameType[] enumValueArray = FrameDataControlFrameType.values();
- FrameDataControlFrameType[] enumTestArray = {
- FrameDataControlFrameType.Heartbeat, FrameDataControlFrameType.StartSession,
- FrameDataControlFrameType.StartSessionACK, FrameDataControlFrameType.StartSessionNACK,
- FrameDataControlFrameType.EndSession, FrameDataControlFrameType.EndSessionACK,
- FrameDataControlFrameType.EndSessionNACK, FrameDataControlFrameType.RegisterSecondaryTransport,
- FrameDataControlFrameType.RegisterSecondaryTransportACK, FrameDataControlFrameType.RegisterSecondaryTransportNACK,
- FrameDataControlFrameType.TransportEventUpdate, FrameDataControlFrameType.ServiceDataACK,
- FrameDataControlFrameType.HeartbeatACK,
- };
-
- assertTrue("Array does not match enum values array.",
- Validator.validateFrameDataControlFrameTypeArray(enumValueArray, enumTestArray));
- }
+ }
+ }
+
+ // Verifies the possible enum values of FrameType.
+ public void testListEnum() {
+ // Test Vector
+ Vector<FrameDataControlFrameType> enumTestList = new Vector<FrameDataControlFrameType>();
+ enumTestList.add(FrameDataControlFrameType.Heartbeat);
+ enumTestList.add(FrameDataControlFrameType.StartSession);
+ enumTestList.add(FrameDataControlFrameType.StartSessionACK);
+ enumTestList.add(FrameDataControlFrameType.StartSessionNACK);
+ enumTestList.add(FrameDataControlFrameType.EndSession);
+ enumTestList.add(FrameDataControlFrameType.EndSessionACK);
+ enumTestList.add(FrameDataControlFrameType.EndSessionNACK);
+ enumTestList.add(FrameDataControlFrameType.ServiceDataACK);
+ enumTestList.add(FrameDataControlFrameType.HeartbeatACK);
+ enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransport);
+ enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransportACK);
+ enumTestList.add(FrameDataControlFrameType.RegisterSecondaryTransportNACK);
+ enumTestList.add(FrameDataControlFrameType.TransportEventUpdate);
+
+ assertTrue("List does not match enum test list.",
+ list.containsAll(enumTestList) &&
+ enumTestList.containsAll(list));
+
+ // Test Array
+ FrameDataControlFrameType[] enumValueArray = FrameDataControlFrameType.values();
+ FrameDataControlFrameType[] enumTestArray = {
+ FrameDataControlFrameType.Heartbeat, FrameDataControlFrameType.StartSession,
+ FrameDataControlFrameType.StartSessionACK, FrameDataControlFrameType.StartSessionNACK,
+ FrameDataControlFrameType.EndSession, FrameDataControlFrameType.EndSessionACK,
+ FrameDataControlFrameType.EndSessionNACK, FrameDataControlFrameType.RegisterSecondaryTransport,
+ FrameDataControlFrameType.RegisterSecondaryTransportACK, FrameDataControlFrameType.RegisterSecondaryTransportNACK,
+ FrameDataControlFrameType.TransportEventUpdate, FrameDataControlFrameType.ServiceDataACK,
+ FrameDataControlFrameType.HeartbeatACK,
+ };
+
+ assertTrue("Array does not match enum values array.",
+ Validator.validateFrameDataControlFrameTypeArray(enumValueArray, enumTestArray));
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameTypeTests.java
index 182287a39..2fe851bd5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameTypeTests.java
@@ -8,110 +8,110 @@ import junit.framework.TestCase;
import java.util.Vector;
public class FrameTypeTests extends TestCase {
-
- private Vector<FrameType> list = FrameType.getList();
-
- // Verifies the values are not null upon valid assignment.
- // These are not actual enums for packeting reasons so testing is different.
- public void testValidEnums () {
-
- final byte CONTROL_BYTE = (byte) 0x00;
- final String CONTROL_STRING = "Control";
-
- final byte SINGLE_BYTE = (byte) 0x01;
- final String SINGLE_STRING = "Single";
-
- final byte FIRST_BYTE = (byte) 0x02;
- final String FIRST_STRING = "First";
-
- final byte CONSECUTIVE_BYTE = (byte) 0x03;
- final String CONSECUTIVE_STRING = "Consecutive";
-
- try {
-
- assertNotNull("FrameType list returned null", list);
-
- // Check the byte values
- FrameType enumControl = (FrameType) FrameType.get(list, CONTROL_BYTE);
- FrameType enumSingle = (FrameType) FrameType.get(list, SINGLE_BYTE);
- FrameType enumFirst = (FrameType) FrameType.get(list, FIRST_BYTE);
- FrameType enumConsecutive = (FrameType) FrameType.get(list, CONSECUTIVE_BYTE);
-
- assertNotNull("Control byte match returned null", enumControl);
- assertNotNull("Single byte match returned null", enumSingle);
- assertNotNull("First byte match returned null", enumFirst);
- assertNotNull("Consecutive byte match returned null", enumConsecutive);
-
- // Check the string values
- enumControl = (FrameType) FrameType.get(list, CONTROL_STRING);
- enumSingle = (FrameType) FrameType.get(list, SINGLE_STRING);
- enumFirst = (FrameType) FrameType.get(list, FIRST_STRING);
- enumConsecutive = (FrameType) FrameType.get(list, CONSECUTIVE_STRING);
-
- assertNotNull("Control string match returned null", enumControl);
- assertNotNull("Single string match returned null", enumSingle);
- assertNotNull("First string match returned null", enumFirst);
- assertNotNull("Consecutive string match returned null", enumConsecutive);
-
- } catch (NullPointerException exception) {
+
+ private Vector<FrameType> list = FrameType.getList();
+
+ // Verifies the values are not null upon valid assignment.
+ // These are not actual enums for packeting reasons so testing is different.
+ public void testValidEnums() {
+
+ final byte CONTROL_BYTE = (byte) 0x00;
+ final String CONTROL_STRING = "Control";
+
+ final byte SINGLE_BYTE = (byte) 0x01;
+ final String SINGLE_STRING = "Single";
+
+ final byte FIRST_BYTE = (byte) 0x02;
+ final String FIRST_STRING = "First";
+
+ final byte CONSECUTIVE_BYTE = (byte) 0x03;
+ final String CONSECUTIVE_STRING = "Consecutive";
+
+ try {
+
+ assertNotNull("FrameType list returned null", list);
+
+ // Check the byte values
+ FrameType enumControl = (FrameType) FrameType.get(list, CONTROL_BYTE);
+ FrameType enumSingle = (FrameType) FrameType.get(list, SINGLE_BYTE);
+ FrameType enumFirst = (FrameType) FrameType.get(list, FIRST_BYTE);
+ FrameType enumConsecutive = (FrameType) FrameType.get(list, CONSECUTIVE_BYTE);
+
+ assertNotNull("Control byte match returned null", enumControl);
+ assertNotNull("Single byte match returned null", enumSingle);
+ assertNotNull("First byte match returned null", enumFirst);
+ assertNotNull("Consecutive byte match returned null", enumConsecutive);
+
+ // Check the string values
+ enumControl = (FrameType) FrameType.get(list, CONTROL_STRING);
+ enumSingle = (FrameType) FrameType.get(list, SINGLE_STRING);
+ enumFirst = (FrameType) FrameType.get(list, FIRST_STRING);
+ enumConsecutive = (FrameType) FrameType.get(list, CONSECUTIVE_STRING);
+
+ assertNotNull("Control string match returned null", enumControl);
+ assertNotNull("Single string match returned null", enumSingle);
+ assertNotNull("First string match returned null", enumFirst);
+ assertNotNull("Consecutive string match returned null", enumConsecutive);
+
+ } catch (NullPointerException exception) {
fail("Null enum list throws NullPointerException.");
- }
- }
-
- // Verifies that an invalid assignment is null.
- public void testInvalidEnum () {
-
- final byte INVALID_BYTE = (byte) 0xAB;
- final String INVALID_STRING = "Invalid";
-
- try {
-
- // Check the byte value
- FrameType enumInvalid = (FrameType) FrameType.get(list, INVALID_BYTE);
- assertNull("Invalid byte match didn't return null", enumInvalid);
-
- // Check the string value
- enumInvalid = (FrameType) FrameType.get(list, INVALID_STRING);
- assertNull("Invalid string match didn't return null", enumInvalid);
-
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- // Verifies that a null assignment is invalid.
- public void testNullEnum () {
- try {
-
- // Check null string lookup
- FrameType enumNull = (FrameType) FrameType.get(list, null);
- assertNull("Null lookup returns a value", enumNull);
-
- } catch (NullPointerException exception) {
+ }
+ }
+
+ // Verifies that an invalid assignment is null.
+ public void testInvalidEnum() {
+
+ final byte INVALID_BYTE = (byte) 0xAB;
+ final String INVALID_STRING = "Invalid";
+
+ try {
+
+ // Check the byte value
+ FrameType enumInvalid = (FrameType) FrameType.get(list, INVALID_BYTE);
+ assertNull("Invalid byte match didn't return null", enumInvalid);
+
+ // Check the string value
+ enumInvalid = (FrameType) FrameType.get(list, INVALID_STRING);
+ assertNull("Invalid string match didn't return null", enumInvalid);
+
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ // Verifies that a null assignment is invalid.
+ public void testNullEnum() {
+ try {
+
+ // Check null string lookup
+ FrameType enumNull = (FrameType) FrameType.get(list, null);
+ assertNull("Null lookup returns a value", enumNull);
+
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- // Verifies the possible enum values of FrameType.
- public void testListEnum () {
-
- // Test Vector
- Vector<FrameType> enumTestList = new Vector<FrameType>();
- enumTestList.add(FrameType.Control);
- enumTestList.add(FrameType.Single);
- enumTestList.add(FrameType.First);
- enumTestList.add(FrameType.Consecutive);
-
- assertTrue("List does not match enum test list.",
- list.containsAll(enumTestList) &&
- enumTestList.containsAll(list));
-
- // Test Array
- FrameType[] enumValueArray = FrameType.values();
- FrameType[] enumTestArray = { FrameType.Control, FrameType.Single,
- FrameType.First, FrameType.Consecutive };
-
- assertTrue("Array does not match enum values array.",
- Validator.validateFrameTypeArray(enumValueArray, enumTestArray));
- }
+ }
+ }
+
+ // Verifies the possible enum values of FrameType.
+ public void testListEnum() {
+
+ // Test Vector
+ Vector<FrameType> enumTestList = new Vector<FrameType>();
+ enumTestList.add(FrameType.Control);
+ enumTestList.add(FrameType.Single);
+ enumTestList.add(FrameType.First);
+ enumTestList.add(FrameType.Consecutive);
+
+ assertTrue("List does not match enum test list.",
+ list.containsAll(enumTestList) &&
+ enumTestList.containsAll(list));
+
+ // Test Array
+ FrameType[] enumValueArray = FrameType.values();
+ FrameType[] enumTestArray = {FrameType.Control, FrameType.Single,
+ FrameType.First, FrameType.Consecutive};
+
+ assertTrue("Array does not match enum values array.",
+ Validator.validateFrameTypeArray(enumValueArray, enumTestArray));
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/MessageTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/MessageTypeTests.java
index 1a09a5b05..d8e7a80d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/MessageTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/MessageTypeTests.java
@@ -8,54 +8,53 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public class MessageTypeTests extends TestCase {
-
- public void testValidEnums () {
- String example = "UNDEFINED";
- MessageType enumUndefined = MessageType.valueForString(example);
- example = "BULK";
- MessageType enumBulk = MessageType.valueForString(example);
- example = "RPC";
- MessageType enumRpc = MessageType.valueForString(example);
-
- assertNotNull("UNDEFINED returned null", enumUndefined);
- assertNotNull("BULK returned null", enumBulk);
- assertNotNull("RPC returned null", enumRpc);
- }
-
- public void testInvalidEnum () {
- String example = "RpC";
-
- try {
- MessageType temp = MessageType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException");
- }
- }
-
- public void testNullEnum () {
- String example = null;
-
- try {
- MessageType temp = MessageType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+public class MessageTypeTests extends TestCase {
+
+ public void testValidEnums() {
+ String example = "UNDEFINED";
+ MessageType enumUndefined = MessageType.valueForString(example);
+ example = "BULK";
+ MessageType enumBulk = MessageType.valueForString(example);
+ example = "RPC";
+ MessageType enumRpc = MessageType.valueForString(example);
+
+ assertNotNull("UNDEFINED returned null", enumUndefined);
+ assertNotNull("BULK returned null", enumBulk);
+ assertNotNull("RPC returned null", enumRpc);
+ }
+
+ public void testInvalidEnum() {
+ String example = "RpC";
+
+ try {
+ MessageType temp = MessageType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException");
+ }
+ }
+
+ public void testNullEnum() {
+ String example = null;
+
+ try {
+ MessageType temp = MessageType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- public void testListEnum() {
- List<MessageType> enumValueList = Arrays.asList(MessageType.values());
-
- List<MessageType> enumTestList = new ArrayList<MessageType>();
- enumTestList.add(MessageType.UNDEFINED);
- enumTestList.add(MessageType.BULK);
- enumTestList.add(MessageType.RPC);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) &&
- enumTestList.containsAll(enumValueList));
- }
+ }
+ }
+
+ public void testListEnum() {
+ List<MessageType> enumValueList = Arrays.asList(MessageType.values());
+
+ List<MessageType> enumTestList = new ArrayList<MessageType>();
+ enumTestList.add(MessageType.UNDEFINED);
+ enumTestList.add(MessageType.BULK);
+ enumTestList.add(MessageType.RPC);
+
+ 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/protocol/enums/SessionTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/SessionTypeTests.java
index e96b6a5b5..051f158a9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/SessionTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/SessionTypeTests.java
@@ -8,118 +8,118 @@ import junit.framework.TestCase;
import java.util.Vector;
public class SessionTypeTests extends TestCase {
-
- private Vector<SessionType> list = SessionType.getList();
-
- // Verifies the values are not null upon valid assignment.
- // These are not actual enums for packeting reasons so testing is different.
- public void testValidEnums () {
-
- final byte HEARTBEAT_BYTE = (byte) 0x00;
- final String HEARTBEAT_STRING = "CONTROL";
-
- final byte RPC_BYTE = (byte) 0x07;
- final String RPC_STRING = "RPC";
-
- final byte PCM_BYTE = (byte) 0x0A;
- final String PCM_STRING = "PCM";
-
- final byte NAV_BYTE = (byte) 0x0B;
- final String NAV_STRING = "NAV";
-
- final byte BULK_DATA_BYTE = (byte) 0x0F;
- final String BULK_DATA_STRING = "BULK_DATA";
-
- try {
-
- assertNotNull("SessionType list returned null", list);
-
- // Check the byte values
- SessionType enumHeartbeat = (SessionType) SessionType.get(list, HEARTBEAT_BYTE);
- SessionType enumRPC = (SessionType) SessionType.get(list, RPC_BYTE);
- SessionType enumPCM = (SessionType) SessionType.get(list, PCM_BYTE);
- SessionType enumNAV = (SessionType) SessionType.get(list, NAV_BYTE);
- SessionType enumBulkData = (SessionType) SessionType.get(list, BULK_DATA_BYTE);
-
- assertNotNull("Start session byte match returned null", enumHeartbeat);
- assertNotNull("Single byte match returned null", enumRPC);
- assertNotNull("First byte match returned null", enumPCM);
- assertNotNull("Consecutive byte match returned null", enumNAV);
- assertNotNull("Consecutive byte match returned null", enumBulkData);
-
- // Check the string values
- enumHeartbeat = (SessionType) SessionType.get(list, HEARTBEAT_STRING);
- enumRPC = (SessionType) SessionType.get(list, RPC_STRING);
- enumPCM = (SessionType) SessionType.get(list, PCM_STRING);
- enumNAV = (SessionType) SessionType.get(list, NAV_STRING);
- enumBulkData = (SessionType) SessionType.get(list, BULK_DATA_STRING);
-
- assertNotNull("Start session string match returned null", enumHeartbeat);
- assertNotNull("Single string match returned null", enumRPC);
- assertNotNull("First string match returned null", enumPCM);
- assertNotNull("Consecutive string match returned null", enumNAV);
- assertNotNull("Consecutive string match returned null", enumBulkData);
-
- } catch (NullPointerException exception) {
+
+ private Vector<SessionType> list = SessionType.getList();
+
+ // Verifies the values are not null upon valid assignment.
+ // These are not actual enums for packeting reasons so testing is different.
+ public void testValidEnums() {
+
+ final byte HEARTBEAT_BYTE = (byte) 0x00;
+ final String HEARTBEAT_STRING = "CONTROL";
+
+ final byte RPC_BYTE = (byte) 0x07;
+ final String RPC_STRING = "RPC";
+
+ final byte PCM_BYTE = (byte) 0x0A;
+ final String PCM_STRING = "PCM";
+
+ final byte NAV_BYTE = (byte) 0x0B;
+ final String NAV_STRING = "NAV";
+
+ final byte BULK_DATA_BYTE = (byte) 0x0F;
+ final String BULK_DATA_STRING = "BULK_DATA";
+
+ try {
+
+ assertNotNull("SessionType list returned null", list);
+
+ // Check the byte values
+ SessionType enumHeartbeat = (SessionType) SessionType.get(list, HEARTBEAT_BYTE);
+ SessionType enumRPC = (SessionType) SessionType.get(list, RPC_BYTE);
+ SessionType enumPCM = (SessionType) SessionType.get(list, PCM_BYTE);
+ SessionType enumNAV = (SessionType) SessionType.get(list, NAV_BYTE);
+ SessionType enumBulkData = (SessionType) SessionType.get(list, BULK_DATA_BYTE);
+
+ assertNotNull("Start session byte match returned null", enumHeartbeat);
+ assertNotNull("Single byte match returned null", enumRPC);
+ assertNotNull("First byte match returned null", enumPCM);
+ assertNotNull("Consecutive byte match returned null", enumNAV);
+ assertNotNull("Consecutive byte match returned null", enumBulkData);
+
+ // Check the string values
+ enumHeartbeat = (SessionType) SessionType.get(list, HEARTBEAT_STRING);
+ enumRPC = (SessionType) SessionType.get(list, RPC_STRING);
+ enumPCM = (SessionType) SessionType.get(list, PCM_STRING);
+ enumNAV = (SessionType) SessionType.get(list, NAV_STRING);
+ enumBulkData = (SessionType) SessionType.get(list, BULK_DATA_STRING);
+
+ assertNotNull("Start session string match returned null", enumHeartbeat);
+ assertNotNull("Single string match returned null", enumRPC);
+ assertNotNull("First string match returned null", enumPCM);
+ assertNotNull("Consecutive string match returned null", enumNAV);
+ assertNotNull("Consecutive string match returned null", enumBulkData);
+
+ } catch (NullPointerException exception) {
fail("Null enum list throws NullPointerException.");
- }
- }
-
- // Verifies that an invalid assignment is null.
- public void testInvalidEnum () {
-
- final byte INVALID_BYTE = (byte) 0xAB;
- final String INVALID_STRING = "Invalid";
-
- try {
-
- // Check the byte value
- SessionType enumInvalid = (SessionType) SessionType.get(list, INVALID_BYTE);
- assertNull("Invalid byte match didn't return null", enumInvalid);
-
- // Check the string value
- enumInvalid = (SessionType) SessionType.get(list, INVALID_STRING);
- assertNull("Invalid string match didn't return null", enumInvalid);
-
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- // Verifies that a null assignment is invalid.
- public void testNullEnum () {
- try {
-
- // Check null string lookup
- SessionType enumNull = (SessionType) SessionType.get(list, null);
- assertNull("Null lookup returns a value", enumNull);
-
- } catch (NullPointerException exception) {
+ }
+ }
+
+ // Verifies that an invalid assignment is null.
+ public void testInvalidEnum() {
+
+ final byte INVALID_BYTE = (byte) 0xAB;
+ final String INVALID_STRING = "Invalid";
+
+ try {
+
+ // Check the byte value
+ SessionType enumInvalid = (SessionType) SessionType.get(list, INVALID_BYTE);
+ assertNull("Invalid byte match didn't return null", enumInvalid);
+
+ // Check the string value
+ enumInvalid = (SessionType) SessionType.get(list, INVALID_STRING);
+ assertNull("Invalid string match didn't return null", enumInvalid);
+
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ // Verifies that a null assignment is invalid.
+ public void testNullEnum() {
+ try {
+
+ // Check null string lookup
+ SessionType enumNull = (SessionType) SessionType.get(list, null);
+ assertNull("Null lookup returns a value", enumNull);
+
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- // Verifies the possible enum values of SessionType.
- public void testListEnum () {
- // Test Vector
- Vector<SessionType> enumTestList = new Vector<SessionType>();
- enumTestList.add(SessionType.RPC);
- enumTestList.add(SessionType.PCM);
- enumTestList.add(SessionType.NAV);
- enumTestList.add(SessionType.BULK_DATA);
- enumTestList.add(SessionType.CONTROL);
-
- assertTrue("List does not match enum test list.",
- list.containsAll(enumTestList) &&
- enumTestList.containsAll(list));
-
- // Test Array
- SessionType[] enumValueArray = SessionType.values();
- SessionType[] enumTestArray = { SessionType.RPC, SessionType.PCM,
- SessionType.NAV, SessionType.BULK_DATA,
- SessionType.CONTROL };
-
- assertTrue("Array does not match enum values array.",
- Validator.validateSessionTypeArray(enumValueArray, enumTestArray));
- }
+ }
+ }
+
+ // Verifies the possible enum values of SessionType.
+ public void testListEnum() {
+ // Test Vector
+ Vector<SessionType> enumTestList = new Vector<SessionType>();
+ enumTestList.add(SessionType.RPC);
+ enumTestList.add(SessionType.PCM);
+ enumTestList.add(SessionType.NAV);
+ enumTestList.add(SessionType.BULK_DATA);
+ enumTestList.add(SessionType.CONTROL);
+
+ assertTrue("List does not match enum test list.",
+ list.containsAll(enumTestList) &&
+ enumTestList.containsAll(list));
+
+ // Test Array
+ SessionType[] enumValueArray = SessionType.values();
+ SessionType[] enumTestArray = {SessionType.RPC, SessionType.PCM,
+ SessionType.NAV, SessionType.BULK_DATA,
+ SessionType.CONTROL};
+
+ assertTrue("Array does not match enum values array.",
+ Validator.validateSessionTypeArray(enumValueArray, enumTestArray));
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
index de9d0a5fb..7f8a85c97 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/heartbeat/HeartbeatMonitorTests.java
@@ -10,58 +10,58 @@ import java.util.Timer;
import java.util.TimerTask;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.protocol.heartbeat.HeartbeatMonitor}
*/
public class HeartbeatMonitorTests extends TestCase {
- private HeartbeatMonitor monitor = new HeartbeatMonitor();
- private Runnable testRunnable;
- private Timer timer;
-
- public void testValues () {
- assertNotNull(TestValues.NOT_NULL, monitor);
-
- testRunnable = monitor.getHeartbeatRunnable();
- assertNotNull(TestValues.NOT_NULL, testRunnable);
-
- int testInterval = 100;
- monitor.setInterval(testInterval);
- assertEquals("Interval did not match expected value", monitor.getInterval(), testInterval);
- }
-
- public void testThread () {
- try {
- Thread testThread = new Thread(testRunnable);
- assertNotNull(TestValues.NOT_NULL, testThread);
- setTimeout(5000, testThread); // Cannot leave thread hanging
-
- testThread.start();
- testThread.join();
- } catch (Exception e) {
- fail("Thread exception was thrown");
- }
- }
-
- private void setTimeout(int duration, final Thread thread) {
- timer = new Timer();
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- thread.interrupt();
- }
- }, duration);
- }
-
- public void testNull () {
- // Testing a null value for listener instead of implementing and overriding
- // IHeartbeatMonitorListener methods to test the getter/setter methods of HeartbeatMonitor.
- monitor.setListener(null);
- IHeartbeatMonitorListener testListener = monitor.getListener();
- assertNull("Listener returned a value", testListener);
-
- // Interface testing issue >>
- // monitor.heartbeatACKReceived(); // Sets the ack boolean flag
- // assertTrue("ACK value was not true", monitor.getACKReceived());
- }
+ private HeartbeatMonitor monitor = new HeartbeatMonitor();
+ private Runnable testRunnable;
+ private Timer timer;
+
+ public void testValues() {
+ assertNotNull(TestValues.NOT_NULL, monitor);
+
+ testRunnable = monitor.getHeartbeatRunnable();
+ assertNotNull(TestValues.NOT_NULL, testRunnable);
+
+ int testInterval = 100;
+ monitor.setInterval(testInterval);
+ assertEquals("Interval did not match expected value", monitor.getInterval(), testInterval);
+ }
+
+ public void testThread() {
+ try {
+ Thread testThread = new Thread(testRunnable);
+ assertNotNull(TestValues.NOT_NULL, testThread);
+ setTimeout(5000, testThread); // Cannot leave thread hanging
+
+ testThread.start();
+ testThread.join();
+ } catch (Exception e) {
+ fail("Thread exception was thrown");
+ }
+ }
+
+ private void setTimeout(int duration, final Thread thread) {
+ timer = new Timer();
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ thread.interrupt();
+ }
+ }, duration);
+ }
+
+ public void testNull() {
+ // Testing a null value for listener instead of implementing and overriding
+ // IHeartbeatMonitorListener methods to test the getter/setter methods of HeartbeatMonitor.
+ monitor.setListener(null);
+ IHeartbeatMonitorListener testListener = monitor.getListener();
+ assertNull("Listener returned a value", testListener);
+
+ // Interface testing issue >>
+ // monitor.heartbeatACKReceived(); // Sets the ack boolean flag
+ // assertTrue("ACK value was not true", monitor.getACKReceived());
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
index 6bc3011b8..b3fe0cb62 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCMessageTests.java
@@ -38,7 +38,7 @@ public class RPCMessageTests extends TestCase {
super.tearDown();
}
- public void testGeneralGettersAndSetters(){
+ public void testGeneralGettersAndSetters() {
String testKey = TestValues.GENERAL_STRING;
Integer testInt = TestValues.GENERAL_INT;
@@ -49,7 +49,7 @@ public class RPCMessageTests extends TestCase {
assertNull(testMessage.getParameters(testKey));
}
- public void testCommonObjectGetters(){
+ public void testCommonObjectGetters() {
String stringKey = "String";
String testString = TestValues.GENERAL_STRING;
testMessage.setParameters(stringKey, testString);
@@ -88,7 +88,7 @@ public class RPCMessageTests extends TestCase {
assertNull(testMessage.getLong(longKey));
}
- public void testGetObject(){
+ public void testGetObject() {
String keyIsEmpty = "EMPTY";
assertNull(testMessage.getObject(Integer.class, keyIsEmpty));
@@ -117,7 +117,7 @@ public class RPCMessageTests extends TestCase {
assertEquals(TestValues.MATCH, testTTSchunks, testMessage.getObject(TTSChunk.class, keyTTSchunks));
List<Hashtable<String, Object>> testListTTSchunks = new ArrayList<>();
- for(TTSChunk ttsChunk : testTTSchunks){
+ for (TTSChunk ttsChunk : testTTSchunks) {
testListTTSchunks.add(ttsChunk.getStore());
}
testMessage.setParameters(keyTTSchunks, testListTTSchunks);
@@ -130,7 +130,7 @@ public class RPCMessageTests extends TestCase {
assertEquals(TestValues.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
List<String> testListMediaClockFormats = new ArrayList<>();
- for(MediaClockFormat mcFormat : testMediaClockFormats){
+ for (MediaClockFormat mcFormat : testMediaClockFormats) {
testListMediaClockFormats.add(mcFormat.toString());
}
testMessage.setParameters(keyMediaClockFormats, testListMediaClockFormats);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
index 5972dc829..ee7896f86 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
@@ -17,34 +17,34 @@ import static junit.framework.TestCase.assertNotNull;
@RunWith(AndroidJUnit4.class)
public class RPCRequestTest {
- public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
+ public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
private static final int CORR_ID = 402;
protected RPCRequest msg;
@Before
- public void setUp(){
+ public void setUp() {
this.msg = new GetSystemCapability();
}
@Test
- public void testCreation(){
+ public void testCreation() {
assertNotNull("Object creation failed.", msg);
}
@Test
- public void testGetCorrelationId(){
+ public void testGetCorrelationId() {
assertNotNull(this.msg.getCorrelationID());
}
@Test
- public void testSettingCorrelationId(){
+ public void testSettingCorrelationId() {
assertNotNull(this.msg.getCorrelationID());
msg.setCorrelationID(CORR_ID);
- assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, (int)msg.getCorrelationID());
-
+ assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, (int) msg.getCorrelationID());
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
index 5542719ba..3cb7a1f3c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCStructTests.java
@@ -37,7 +37,7 @@ public class RPCStructTests extends TestCase {
super.tearDown();
}
- public void testGeneralGettersAndSetters(){
+ public void testGeneralGettersAndSetters() {
String testKey = TestValues.GENERAL_STRING;
Integer testInt = TestValues.GENERAL_INT;
@@ -48,7 +48,7 @@ public class RPCStructTests extends TestCase {
assertNull(testStruct.getValue(testKey));
}
- public void testCommonObjectGetters(){
+ public void testCommonObjectGetters() {
String stringKey = "String";
String testString = TestValues.GENERAL_STRING;
testStruct.setValue(stringKey, testString);
@@ -88,7 +88,7 @@ public class RPCStructTests extends TestCase {
assertNull(testStruct.getLong(longKey));
}
- public void testGetObject(){
+ public void testGetObject() {
String keyIsEmpty = "EMPTY";
assertNull(testStruct.getObject(Integer.class, keyIsEmpty));
@@ -117,13 +117,13 @@ public class RPCStructTests extends TestCase {
assertEquals(TestValues.MATCH, testImageFields, testStruct.getObject(ImageField.class, keyImageFields));
List<Hashtable<String, Object>> testListImageFields = new ArrayList<>();
- for(ImageField imgField : testImageFields){
+ for (ImageField imgField : testImageFields) {
testListImageFields.add(imgField.getStore());
}
testStruct.setValue(keyImageFields, testListImageFields);
List<ImageField> underTest = (List<ImageField>) testStruct.getObject(ImageField.class, keyImageFields);
int index = 0;
- for(ImageField imgField : testImageFields){
+ for (ImageField imgField : testImageFields) {
assertTrue(Validator.validateImageFields(imgField, underTest.get(index++)));
}
@@ -133,7 +133,7 @@ public class RPCStructTests extends TestCase {
assertEquals(TestValues.MATCH, testMediaClockFormats, testStruct.getObject(MediaClockFormat.class, keyMediaClockFormats));
List<String> testListMediaClockFormats = new ArrayList<>();
- for(MediaClockFormat mcFormat : testMediaClockFormats){
+ for (MediaClockFormat mcFormat : testMediaClockFormats) {
testListMediaClockFormats.add(mcFormat.toString());
}
testStruct.setValue(keyMediaClockFormats, testListMediaClockFormats);
@@ -142,7 +142,7 @@ public class RPCStructTests extends TestCase {
assertNull(testStruct.getObject(Image.class, keyAirbag)); // Test incorrect class
}
- public void testGetObjectExceptions(){
+ public void testGetObjectExceptions() {
String invalidKey = "invalid";
testStruct.setValue(invalidKey, new Hashtable<>());
assertNull(testStruct.getObject(Integer.class, invalidKey));
@@ -157,7 +157,7 @@ public class RPCStructTests extends TestCase {
}
public void testGetFloat() {
- Hashtable <String, Object> map = new Hashtable<>();
+ Hashtable<String, Object> map = new Hashtable<>();
String key = "test";
Double value = 42.00;
map.put(key, value);
@@ -171,7 +171,7 @@ public class RPCStructTests extends TestCase {
}
public void testGetDouble() {
- Hashtable <String, Object> map = new Hashtable<>();
+ Hashtable<String, Object> map = new Hashtable<>();
String key = "test";
Integer value = 42;
map.put(key, value);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java
index 06d0aeef0..04c12850b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCGenericTests.java
@@ -108,7 +108,7 @@ public class RPCGenericTests {
}
@Before
- public void setUp(){
+ public void setUp() {
// Map that has keys correspond to the RPC names and values correspond to the params for that RPC.
rpcMandatoryParamsMapFromXml = getRPCParamsMap(XML_FILE_NAME, true);
rpcAllParamsMapFromXml = getRPCParamsMap(XML_FILE_NAME, false);
@@ -131,30 +131,30 @@ public class RPCGenericTests {
String getterMethodName2;
Class<?> javaParamType;
boolean skipParam;
- while (event != XmlPullParser.END_DOCUMENT) {
+ while (event != XmlPullParser.END_DOCUMENT) {
String name = myParser.getName();
- switch (event){
+ switch (event) {
case XmlPullParser.START_TAG:
// Store the RPC name in the map
- if(name.equals("function") || name.equals("struct")){
- rpcName = myParser.getAttributeValue(null,"name");
+ if (name.equals("function") || name.equals("struct")) {
+ rpcName = myParser.getAttributeValue(null, "name");
ignoreRPC = false;
- if (name.equals("function") && myParser.getAttributeValue(null, "messagetype").equals("response") && !rpcName.contains("Response")){
+ if (name.equals("function") && myParser.getAttributeValue(null, "messagetype").equals("response") && !rpcName.contains("Response")) {
rpcName += "Response";
}
// -------------- Exceptional cases because of mismatch between the RPC spec and the Android code --------------
- if(rpcName.equals("SyncMsgVersion")){
- rpcName = "SdlMsgVersion";
- } else if(rpcName.equals("ShowConstantTBTResponse")){
- rpcName = "ShowConstantTbtResponse";
- } else if(rpcName.equals("OASISAddress")) {
- rpcName = "OasisAddress";
- } else if(rpcName.equals("ShowConstantTBT")) {
- rpcName = "ShowConstantTbt";
- } else if (rpcName.equals("EncodedSyncPData") || rpcName.equals("OnEncodedSyncPData") || rpcName.equals("EncodedSyncPDataResponse")){
- ignoreRPC = true;
- }
+ if (rpcName.equals("SyncMsgVersion")) {
+ rpcName = "SdlMsgVersion";
+ } else if (rpcName.equals("ShowConstantTBTResponse")) {
+ rpcName = "ShowConstantTbtResponse";
+ } else if (rpcName.equals("OASISAddress")) {
+ rpcName = "OasisAddress";
+ } else if (rpcName.equals("ShowConstantTBT")) {
+ rpcName = "ShowConstantTbt";
+ } else if (rpcName.equals("EncodedSyncPData") || rpcName.equals("OnEncodedSyncPData") || rpcName.equals("EncodedSyncPDataResponse")) {
+ ignoreRPC = true;
+ }
// -------------------------------------------------------------------------------------------------------------
if (!ignoreRPC) {
@@ -162,38 +162,38 @@ public class RPCGenericTests {
}
}
// Store the params for the current RPC in the map
- if(name.equals("param") && myParser.getAttributeValue(null, "until") == null && !ignoreRPC){
+ if (name.equals("param") && myParser.getAttributeValue(null, "until") == null && !ignoreRPC) {
setterMethodName = null;
getterMethodName1 = null;
getterMethodName2 = null;
javaParamType = null;
skipParam = false;
- boolean isMandatory = Boolean.valueOf(myParser.getAttributeValue(null,"mandatory"));
+ boolean isMandatory = Boolean.valueOf(myParser.getAttributeValue(null, "mandatory"));
if (isMandatory || !includeMandatoryOnly) {
String paramName = myParser.getAttributeValue(null, "name");
String paramType = myParser.getAttributeValue(null, "type");
boolean isArray = Boolean.valueOf(myParser.getAttributeValue(null, "array"));
// -------------- Exceptional cases because of mismatch between the RPC spec and the Android code --------------
- if (paramName.equals("syncFileName")){
+ if (paramName.equals("syncFileName")) {
paramName = "sdlFileName";
- } else if (paramName.equals("syncMsgVersion")){
+ } else if (paramName.equals("syncMsgVersion")) {
paramName = "sdlMsgVersion";
- } else if (paramName.equals("hmiPermissions")){
+ } else if (paramName.equals("hmiPermissions")) {
paramName = "HMIPermissions";
- } else if (paramName.equals("resolution")){
+ } else if (paramName.equals("resolution")) {
paramName = "imageResolution";
}
setterMethodName = "set" + paramName.substring(0, 1).toUpperCase() + paramName.substring(1);
- if (paramType.equals("SyncMsgVersion")){
+ if (paramType.equals("SyncMsgVersion")) {
paramType = "SdlMsgVersion";
} else if (paramType.equals("OASISAddress")) {
paramType = "OasisAddress";
- } else if (rpcName.equals("TouchEvent") && paramType.equals("Integer") && isArray){
+ } else if (rpcName.equals("TouchEvent") && paramType.equals("Integer") && isArray) {
paramType = "Long";
- } else if (Arrays.asList("GPSData", "VideoStreamingCapability").contains(rpcName) && paramType.equals("Float")){
+ } else if (Arrays.asList("GPSData", "VideoStreamingCapability").contains(rpcName) && paramType.equals("Float")) {
paramType = "Double";
} else if (Arrays.asList("GetVehicleDataResponse", "OnVehicleData").contains(rpcName) && Arrays.asList("setInstantFuelConsumption", "setFuelLevel", "setSpeed", "setExternalTemperature", "setEngineTorque", "setAccPedalPosition", "setSteeringWheelAngle").contains(setterMethodName)) {
paramType = "Double";
@@ -310,8 +310,7 @@ public class RPCGenericTests {
.setSkip(skipParam)
.setSetterName(setterMethodName)
.setGetterName1(getterMethodName1)
- .setGetterName2(getterMethodName2)
- ;
+ .setGetterName2(getterMethodName2);
rpcParamsMap.get(rpcName).add(param);
}
@@ -353,16 +352,16 @@ public class RPCGenericTests {
for (Parameter param : rpcMandatoryParamsMapFromXml.get(rpcName)) {
String type = param.type;
// If the param is a list of objects, the type should be like "List<Object>"
- if (param.isArray){
+ if (param.isArray) {
type = String.format("List<%s>", type);
}
mandatoryParamsListFromXML.add(type);
}
List<String> mandatoryParamsListFromCode = new ArrayList<>();
boolean rpcHasValidConstructor = false;
- for (Constructor constructor : aClass.getConstructors()){
+ for (Constructor constructor : aClass.getConstructors()) {
mandatoryParamsListFromCode.clear();
- for (Type paramType : constructor.getGenericParameterTypes()){
+ for (Type paramType : constructor.getGenericParameterTypes()) {
String paramFullType = paramType.toString();
String paramSimpleType;
@@ -371,20 +370,19 @@ public class RPCGenericTests {
paramSimpleType = String.format("List<%s>", paramFullType.substring(paramFullType.lastIndexOf('.') + 1, paramFullType.length() - 1));
}
// If the param is a simple object for example "java.lang.String", the type should be the last part "String"
- else if (!paramFullType.contains(">")){
+ else if (!paramFullType.contains(">")) {
paramSimpleType = paramFullType.substring(paramFullType.lastIndexOf('.') + 1, paramFullType.length());
- }
- else {
+ } else {
paramSimpleType = paramFullType;
}
mandatoryParamsListFromCode.add(paramSimpleType);
}
- if (mandatoryParamsListFromCode.containsAll(mandatoryParamsListFromXML) && mandatoryParamsListFromXML.containsAll(mandatoryParamsListFromCode)){
+ if (mandatoryParamsListFromCode.containsAll(mandatoryParamsListFromXML) && mandatoryParamsListFromXML.containsAll(mandatoryParamsListFromCode)) {
rpcHasValidConstructor = true;
break;
}
}
- if (!rpcHasValidConstructor){
+ if (!rpcHasValidConstructor) {
rpcsWithInvalidConstructor.add(rpcName);
}
}
@@ -496,14 +494,14 @@ public class RPCGenericTests {
try {
// --------------------------------------------- Exceptional cases ---------------------------------------------
// This case is exceptional because the setter changes the input if it is not all digits
- if (rpcName.equals("DialNumber") && param.type.equals("String")){
+ if (rpcName.equals("DialNumber") && param.type.equals("String")) {
value = "5558675309";
}
// -------------------------------------------------------------------------------------------------------------
if (value == null) {
valueString = "GENERAL_" + param.type.toUpperCase();
- if (param.isArray){
+ if (param.isArray) {
valueString += "_LIST";
}
value = Class.forName(TEST_VALUES_CLASS).getDeclaredField(valueString).get(null);
@@ -524,7 +522,7 @@ public class RPCGenericTests {
try {
Constructor constructor = aClass.getConstructor(mandatoryParamsTypes.toArray(new Class<?>[mandatoryParamsTypes.size()]));
instance = constructor.newInstance(mandatoryParamsValues.toArray(new Object[mandatoryParamsValues.size()]));
- } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
+ } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
e.printStackTrace();
fail("Constructor for RPC " + rpcName + " cannot be invoked. Make sure that the constructor parameters order and types are identical to the RPC specs");
}
@@ -568,7 +566,7 @@ public class RPCGenericTests {
aClass = Class.forName(RPC_PACKAGE_PREFIX + rpcName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
- errors.add("Class not found for rpc: "+ rpcName + ". \n");
+ errors.add("Class not found for rpc: " + rpcName + ". \n");
continue;
}
@@ -603,7 +601,7 @@ public class RPCGenericTests {
getterMethod = getMethod(aClass, parameter, parameter.getterName2, true);
} catch (NoSuchMethodException ex) {
ex.printStackTrace();
- String errMsg = String.format(rpcName + "." + parameter.getterName1 + "()" + "%s" + " cannot be found. Make sure that the method exists. \n", parameter.type.equalsIgnoreCase("boolean")? "/" + parameter.getterName2 + "()" : "");
+ String errMsg = String.format(rpcName + "." + parameter.getterName1 + "()" + "%s" + " cannot be found. Make sure that the method exists. \n", parameter.type.equalsIgnoreCase("boolean") ? "/" + parameter.getterName2 + "()" : "");
errors.add(errMsg);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
index 2eff1f828..d82bed010 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AirbagStatusTests.java
@@ -13,18 +13,18 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AirbagStatus}
*/
-public class AirbagStatusTests extends TestCase{
+public class AirbagStatusTests extends TestCase {
private AirbagStatus msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new AirbagStatus();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
msg.setDriverAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setDriverCurtainAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setDriverKneeAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
@@ -33,14 +33,14 @@ public class AirbagStatusTests extends TestCase{
msg.setPassengerCurtainAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setPassengerKneeAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setPassengerSideAirbagDeployed(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
-
+
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
VehicleDataEventStatus airbagStatus = msg.getDriverAirbagDeployed();
VehicleDataEventStatus curtainStatus = msg.getDriverCurtainAirbagDeployed();
VehicleDataEventStatus kneeStatus = msg.getDriverKneeAirbagDeployed();
@@ -49,7 +49,7 @@ public class AirbagStatusTests extends TestCase{
VehicleDataEventStatus passengerCurtainStatus = msg.getPassengerCurtainAirbagDeployed();
VehicleDataEventStatus passengerKneeStatus = msg.getPassengerKneeAirbagDeployed();
VehicleDataEventStatus passengerSideStatus = msg.getPassengerSideAirbagDeployed();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, airbagStatus);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, curtainStatus);
@@ -59,11 +59,11 @@ public class AirbagStatusTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerCurtainStatus);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerKneeStatus);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerSideStatus);
-
+
// Invalid/Null Tests
AirbagStatus msg = new AirbagStatus();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
assertNull(TestValues.NULL, msg.getDriverAirbagDeployed());
assertNull(TestValues.NULL, msg.getDriverSideAirbagDeployed());
assertNull(TestValues.NULL, msg.getDriverCurtainAirbagDeployed());
@@ -74,10 +74,10 @@ public class AirbagStatusTests extends TestCase{
assertNull(TestValues.NULL, msg.getPassengerKneeAirbagDeployed());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
@@ -91,12 +91,12 @@ public class AirbagStatusTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
index 1f143cb61..1c8fd568c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppInfoTests.java
@@ -49,64 +49,64 @@ import java.util.Iterator;
*/
public class AppInfoTests extends TestCase {
- private AppInfo msg;
-
- @Override
- public void setUp() {
-
- msg = new AppInfo();
- msg.setAppDisplayName(TestValues.GENERAL_STRING);
- msg.setAppBundleID(TestValues.GENERAL_STRING);
- msg.setAppVersion(TestValues.GENERAL_STRING);
- msg.setAppIcon(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String appDisplayName = msg.getAppDisplayName();
- String appBundleID = msg.getAppBundleID();
- String appVersion = msg.getAppVersion();
- String appIcon = msg.getAppIcon();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_STRING, appDisplayName);
- assertEquals(TestValues.GENERAL_STRING, appBundleID);
- assertEquals(TestValues.GENERAL_STRING, appVersion);
- assertEquals(TestValues.GENERAL_STRING, appIcon);
-
- // Invalid/Null Tests
- AppInfo msg = new AppInfo();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getAppDisplayName());
- assertNull(TestValues.NULL, msg.getAppBundleID());
- assertNull(TestValues.NULL, msg.getAppVersion());
- assertNull(TestValues.NULL, msg.getAppIcon());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(AppInfo.KEY_APP_DISPLAY_NAME, TestValues.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_BUNDLE_ID, TestValues.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_VERSION, TestValues.GENERAL_STRING);
- reference.put(AppInfo.KEY_APP_ICON, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AppInfo msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppInfo();
+ msg.setAppDisplayName(TestValues.GENERAL_STRING);
+ msg.setAppBundleID(TestValues.GENERAL_STRING);
+ msg.setAppVersion(TestValues.GENERAL_STRING);
+ msg.setAppIcon(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String appDisplayName = msg.getAppDisplayName();
+ String appBundleID = msg.getAppBundleID();
+ String appVersion = msg.getAppVersion();
+ String appIcon = msg.getAppIcon();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_STRING, appDisplayName);
+ assertEquals(TestValues.GENERAL_STRING, appBundleID);
+ assertEquals(TestValues.GENERAL_STRING, appVersion);
+ assertEquals(TestValues.GENERAL_STRING, appIcon);
+
+ // Invalid/Null Tests
+ AppInfo msg = new AppInfo();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getAppDisplayName());
+ assertNull(TestValues.NULL, msg.getAppBundleID());
+ assertNull(TestValues.NULL, msg.getAppVersion());
+ assertNull(TestValues.NULL, msg.getAppIcon());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(AppInfo.KEY_APP_DISPLAY_NAME, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_BUNDLE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_VERSION, TestValues.GENERAL_STRING);
+ reference.put(AppInfo.KEY_APP_ICON, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
index 1579e1ec1..15f55dd6c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceCapabilityTest.java
@@ -28,107 +28,107 @@ import java.util.List;
*/
public class AppServiceCapabilityTest extends TestCase {
- private AppServiceCapability msg;
+ private AppServiceCapability msg;
- @Override
- public void setUp(){
+ @Override
+ public void setUp() {
- msg = new AppServiceCapability();
- msg.setUpdatedAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
- msg.setUpdateReason(TestValues.GENERAL_SERVICE_UPDATE_REASON);
- }
+ msg = new AppServiceCapability();
+ msg.setUpdatedAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
+ msg.setUpdateReason(TestValues.GENERAL_SERVICE_UPDATE_REASON);
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
- ServiceUpdateReason updateReason = msg.getUpdateReason();
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ ServiceUpdateReason updateReason = msg.getUpdateReason();
- // Valid Tests
- assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
- assertEquals(TestValues.MATCH, updateReason, TestValues.GENERAL_SERVICE_UPDATE_REASON);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
+ assertEquals(TestValues.MATCH, updateReason, TestValues.GENERAL_SERVICE_UPDATE_REASON);
- // Invalid/Null Tests
- AppServiceCapability msg = new AppServiceCapability();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ AppServiceCapability msg = new AppServiceCapability();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getUpdatedAppServiceRecord());
- assertNull(TestValues.NULL, msg.getUpdateReason());
- }
+ assertNull(TestValues.NULL, msg.getUpdatedAppServiceRecord());
+ assertNull(TestValues.NULL, msg.getUpdateReason());
+ }
- public void testRequiredParamsConstructor(){
- msg = new AppServiceCapability(TestValues.GENERAL_APPSERVICERECORD);
- AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
- assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
- }
+ public void testRequiredParamsConstructor() {
+ msg = new AppServiceCapability(TestValues.GENERAL_APPSERVICERECORD);
+ AppServiceRecord serviceRecord = msg.getUpdatedAppServiceRecord();
+ assertEquals(TestValues.MATCH, serviceRecord, TestValues.GENERAL_APPSERVICERECORD);
+ }
- public void testJson(){
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try{
- reference.put(AppServiceCapability.KEY_UPDATE_REASON, TestValues.GENERAL_SERVICE_UPDATE_REASON);
- reference.put(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD, TestValues.GENERAL_APPSERVICERECORD);
+ try {
+ reference.put(AppServiceCapability.KEY_UPDATE_REASON, TestValues.GENERAL_SERVICE_UPDATE_REASON);
+ reference.put(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD, TestValues.GENERAL_APPSERVICERECORD);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()) {
- String key = (String) iterator.next();
- if (key.equals(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, new AppServiceRecord(hashTest)));
- } else{
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(AppServiceCapability.KEY_UPDATED_APP_SERVICE_RECORD)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, new AppServiceRecord(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
- public void testMatchesAppService(){
+ public void testMatchesAppService() {
- String baseName = "NavTest", baseID = "37F98053AE";
+ String baseName = "NavTest", baseID = "37F98053AE";
- AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
- AppServiceCapability capability2 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
+ AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
+ AppServiceCapability capability2 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
- assertTrue(capability1.matchesAppService(capability2));
+ assertTrue(capability1.matchesAppService(capability2));
- //Remove the service id from record 2
- capability2.getUpdatedAppServiceRecord().setServiceID(null);
- assertNull(capability2.getUpdatedAppServiceRecord().getServiceID());
- assertTrue(capability1.matchesAppService(capability2));
+ //Remove the service id from record 2
+ capability2.getUpdatedAppServiceRecord().setServiceID(null);
+ assertNull(capability2.getUpdatedAppServiceRecord().getServiceID());
+ assertTrue(capability1.matchesAppService(capability2));
- /* UPDATE WITH NEW SERVICE MANIFEST CHANGES */
+ /* UPDATE WITH NEW SERVICE MANIFEST CHANGES */
- AppServiceManifest appServiceManifest2 = capability2.getUpdatedAppServiceRecord().getServiceManifest();
+ AppServiceManifest appServiceManifest2 = capability2.getUpdatedAppServiceRecord().getServiceManifest();
- List<FunctionID> handledRPCs2 = new ArrayList<>();
- handledRPCs2.add(FunctionID.SEND_LOCATION);
- handledRPCs2.add(FunctionID.GET_WAY_POINTS);
- appServiceManifest2.setHandledRpcsUsingFunctionIDs(handledRPCs2);
- capability2.getUpdatedAppServiceRecord().setServiceManifest(appServiceManifest2);
+ List<FunctionID> handledRPCs2 = new ArrayList<>();
+ handledRPCs2.add(FunctionID.SEND_LOCATION);
+ handledRPCs2.add(FunctionID.GET_WAY_POINTS);
+ appServiceManifest2.setHandledRpcsUsingFunctionIDs(handledRPCs2);
+ capability2.getUpdatedAppServiceRecord().setServiceManifest(appServiceManifest2);
- assertTrue(capability1.matchesAppService(capability2));
+ assertTrue(capability1.matchesAppService(capability2));
- /* UPDATE WITH NEW SERVICE MANIFEST APP NAME */
- capability2.getUpdatedAppServiceRecord().getServiceManifest().setServiceName("Nav-Test");
- assertFalse(capability1.matchesAppService(capability2));
+ /* UPDATE WITH NEW SERVICE MANIFEST APP NAME */
+ capability2.getUpdatedAppServiceRecord().getServiceManifest().setServiceName("Nav-Test");
+ assertFalse(capability1.matchesAppService(capability2));
- /* UPDATE WITH NEW SERVICE ID */
- //Reset name
- capability2.getUpdatedAppServiceRecord().getServiceManifest().setServiceName(baseName);
+ /* UPDATE WITH NEW SERVICE ID */
+ //Reset name
+ capability2.getUpdatedAppServiceRecord().getServiceManifest().setServiceName(baseName);
- capability2.getUpdatedAppServiceRecord().setServiceID("EEEEEEEEEE");
- assertFalse(capability1.matchesAppService(capability2));
- }
+ capability2.getUpdatedAppServiceRecord().setServiceID("EEEEEEEEEE");
+ assertFalse(capability1.matchesAppService(capability2));
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
index d909d0d5d..7e18554c5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceDataTests.java
@@ -23,96 +23,96 @@ import java.util.Iterator;
*/
public class AppServiceDataTests extends TestCase {
- private AppServiceData msg;
-
- @Override
- public void setUp() {
-
- msg = new AppServiceData();
- msg.setServiceType(TestValues.GENERAL_STRING);
- msg.setServiceID(TestValues.GENERAL_STRING);
- msg.setMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA);
- msg.setWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA);
- msg.setNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA);
-
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String appServiceType = msg.getServiceType();
- String serviceId = msg.getServiceID();
- MediaServiceData mediaServiceData = msg.getMediaServiceData();
- WeatherServiceData weatherServiceData = msg.getWeatherServiceData();
- NavigationServiceData navigationServiceData = msg.getNavigationServiceData();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_STRING, appServiceType);
- assertEquals(TestValues.GENERAL_STRING, serviceId);
- assertEquals(TestValues.GENERAL_MEDIASERVICEDATA, mediaServiceData);
- assertEquals(TestValues.GENERAL_WEATHERSERVICEDATA, weatherServiceData);
- assertEquals(TestValues.GENERAL_NAVIGATIONSERVICEDATA, navigationServiceData);
-
- // Invalid/Null Tests
- AppServiceData msg = new AppServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getServiceType());
- assertNull(TestValues.NULL, msg.getServiceID());
- assertNull(TestValues.NULL, msg.getMediaServiceData());
- assertNull(TestValues.NULL, msg.getWeatherServiceData());
- assertNull(TestValues.NULL, msg.getNavigationServiceData());
-
- }
-
- public void testRequiredParamsConstructor(){
-
- msg = new AppServiceData(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
- String appServiceType = msg.getServiceType();
- String serviceId = msg.getServiceID();
- assertEquals(TestValues.GENERAL_STRING, appServiceType);
- assertEquals(TestValues.GENERAL_STRING, serviceId);
-
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(AppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
- reference.put(AppServiceData.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
- reference.put(AppServiceData.KEY_MEDIA_SERVICE_DATA, TestValues.GENERAL_MEDIASERVICEDATA);
- reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, TestValues.GENERAL_WEATHERSERVICEDATA);
- reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, TestValues.GENERAL_NAVIGATIONSERVICEDATA);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if (key.equals(AppServiceData.KEY_MEDIA_SERVICE_DATA)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA, new MediaServiceData(hashTest)));
- } else if (key.equals(AppServiceData.KEY_WEATHER_SERVICE_DATA)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA, new WeatherServiceData(hashTest)));
- } else if (key.equals(AppServiceData.KEY_NAVIGATION_SERVICE_DATA)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA, new NavigationServiceData(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AppServiceData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppServiceData();
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setServiceID(TestValues.GENERAL_STRING);
+ msg.setMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA);
+ msg.setWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA);
+ msg.setNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceID();
+ MediaServiceData mediaServiceData = msg.getMediaServiceData();
+ WeatherServiceData weatherServiceData = msg.getWeatherServiceData();
+ NavigationServiceData navigationServiceData = msg.getNavigationServiceData();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_STRING, serviceId);
+ assertEquals(TestValues.GENERAL_MEDIASERVICEDATA, mediaServiceData);
+ assertEquals(TestValues.GENERAL_WEATHERSERVICEDATA, weatherServiceData);
+ assertEquals(TestValues.GENERAL_NAVIGATIONSERVICEDATA, navigationServiceData);
+
+ // Invalid/Null Tests
+ AppServiceData msg = new AppServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getServiceType());
+ assertNull(TestValues.NULL, msg.getServiceID());
+ assertNull(TestValues.NULL, msg.getMediaServiceData());
+ assertNull(TestValues.NULL, msg.getWeatherServiceData());
+ assertNull(TestValues.NULL, msg.getNavigationServiceData());
+
+ }
+
+ public void testRequiredParamsConstructor() {
+
+ msg = new AppServiceData(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ String serviceId = msg.getServiceID();
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_STRING, serviceId);
+
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(AppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppServiceData.KEY_MEDIA_SERVICE_DATA, TestValues.GENERAL_MEDIASERVICEDATA);
+ reference.put(AppServiceData.KEY_WEATHER_SERVICE_DATA, TestValues.GENERAL_WEATHERSERVICEDATA);
+ reference.put(AppServiceData.KEY_NAVIGATION_SERVICE_DATA, TestValues.GENERAL_NAVIGATIONSERVICEDATA);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(AppServiceData.KEY_MEDIA_SERVICE_DATA)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateMediaServiceData(TestValues.GENERAL_MEDIASERVICEDATA, new MediaServiceData(hashTest)));
+ } else if (key.equals(AppServiceData.KEY_WEATHER_SERVICE_DATA)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateWeatherServiceData(TestValues.GENERAL_WEATHERSERVICEDATA, new WeatherServiceData(hashTest)));
+ } else if (key.equals(AppServiceData.KEY_NAVIGATION_SERVICE_DATA)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateNavigationServiceData(TestValues.GENERAL_NAVIGATIONSERVICEDATA, new NavigationServiceData(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
index 8a9f2b0ff..94b1b799c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceManifestTests.java
@@ -26,123 +26,123 @@ import java.util.List;
*/
public class AppServiceManifestTests extends TestCase {
- private AppServiceManifest msg;
-
- @Override
- public void setUp(){
-
- msg = new AppServiceManifest();
- msg.setServiceType(TestValues.GENERAL_STRING);
- msg.setAllowAppConsumers(TestValues.GENERAL_BOOLEAN);
- msg.setHandledRpcs(TestValues.GENERAL_FUNCTION_ID_LIST);
- msg.setMediaServiceManifest(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
- msg.setRpcSpecVersion(TestValues.GENERAL_SDLMSGVERSION);
- msg.setServiceIcon(TestValues.GENERAL_IMAGE);
- msg.setServiceName(TestValues.GENERAL_STRING);
- msg.setWeatherServiceManifest(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
- msg.setNavigationServiceManifest(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Image serviceIcon = msg.getServiceIcon();
- String serviceName = msg.getServiceName();
- String appServiceType = msg.getServiceType();
- boolean allowAppConsumers = msg.getAllowAppConsumers();
- SdlMsgVersion version = msg.getRpcSpecVersion();
- List<Integer> handledRPCs = msg.getHandledRpcs();
- WeatherServiceManifest weatherServiceManifestTest = msg.getWeatherServiceManifest();
- MediaServiceManifest mediaServiceManifestTest = msg.getMediaServiceManifest();
- NavigationServiceManifest navigationServiceManifest = msg.getNavigationServiceManifest();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_BOOLEAN, allowAppConsumers);
- assertEquals(TestValues.GENERAL_IMAGE, serviceIcon);
- assertEquals(TestValues.GENERAL_STRING, serviceName);
- assertEquals(TestValues.GENERAL_STRING, appServiceType);
- assertEquals(TestValues.GENERAL_SDLMSGVERSION, version);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FUNCTION_ID_LIST, handledRPCs);
- assertEquals(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, weatherServiceManifestTest);
- assertEquals(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, mediaServiceManifestTest);
- assertEquals(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
-
- // Invalid/Null Tests
- AppServiceManifest msg = new AppServiceManifest();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getServiceIcon());
- assertNull(TestValues.NULL, msg.getServiceName());
- assertNull(TestValues.NULL, msg.getServiceType());
- assertNull(TestValues.NULL, msg.getAllowAppConsumers());
- assertNull(TestValues.NULL, msg.getRpcSpecVersion());
- assertNull(TestValues.NULL, msg.getHandledRpcs());
- assertNull(TestValues.NULL, msg.getWeatherServiceManifest());
- assertNull(TestValues.NULL, msg.getMediaServiceManifest());
- assertNull(TestValues.NULL, msg.getNavigationServiceManifest());
- }
-
- public void testRequiredParamsConstructor(){
- msg = new AppServiceManifest(TestValues.GENERAL_STRING);
- String appServiceType = msg.getServiceType();
- assertEquals(TestValues.GENERAL_STRING, appServiceType);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(AppServiceManifest.KEY_SERVICE_NAME, TestValues.GENERAL_STRING);
- reference.put(AppServiceManifest.KEY_SERVICE_ICON, TestValues.GENERAL_IMAGE);
- reference.put(AppServiceManifest.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
- reference.put(AppServiceManifest.KEY_ALLOW_APP_CONSUMERS, TestValues.GENERAL_BOOLEAN);
- reference.put(AppServiceManifest.KEY_RPC_SPEC_VERSION, TestValues.GENERAL_SDLMSGVERSION.serializeJSON());
- reference.put(AppServiceManifest.KEY_HANDLED_RPCS, TestValues.GENERAL_FUNCTION_ID_LIST);
- reference.put(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST, TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
- reference.put(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST, TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
- reference.put(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST, TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if(key.equals(AppServiceManifest.KEY_RPC_SPEC_VERSION)){
- 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(TestValues.TRUE, Validator.validateSdlMsgVersion( new SdlMsgVersion(hashReference), new SdlMsgVersion(hashTest)));
- }else if(key.equals(AppServiceManifest.KEY_HANDLED_RPCS)){
- List<Integer> list1 = TestValues.GENERAL_FUNCTION_ID_LIST;
- List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1,list2));
- }else if(key.equals(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateWeatherServiceManifest( TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, new WeatherServiceManifest(hashTest)));
- }else if(key.equals(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateMediaServiceManifest( TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, new MediaServiceManifest(hashTest)));
- } else if(key.equals(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateNavigationServiceManifest( TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, new NavigationServiceManifest(hashTest)));
- }else if(key.equals(AppServiceManifest.KEY_SERVICE_ICON)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
- assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getServiceIcon()));
- }else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AppServiceManifest msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppServiceManifest();
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setAllowAppConsumers(TestValues.GENERAL_BOOLEAN);
+ msg.setHandledRpcs(TestValues.GENERAL_FUNCTION_ID_LIST);
+ msg.setMediaServiceManifest(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
+ msg.setRpcSpecVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setServiceIcon(TestValues.GENERAL_IMAGE);
+ msg.setServiceName(TestValues.GENERAL_STRING);
+ msg.setWeatherServiceManifest(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
+ msg.setNavigationServiceManifest(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Image serviceIcon = msg.getServiceIcon();
+ String serviceName = msg.getServiceName();
+ String appServiceType = msg.getServiceType();
+ boolean allowAppConsumers = msg.getAllowAppConsumers();
+ SdlMsgVersion version = msg.getRpcSpecVersion();
+ List<Integer> handledRPCs = msg.getHandledRpcs();
+ WeatherServiceManifest weatherServiceManifestTest = msg.getWeatherServiceManifest();
+ MediaServiceManifest mediaServiceManifestTest = msg.getMediaServiceManifest();
+ NavigationServiceManifest navigationServiceManifest = msg.getNavigationServiceManifest();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_BOOLEAN, allowAppConsumers);
+ assertEquals(TestValues.GENERAL_IMAGE, serviceIcon);
+ assertEquals(TestValues.GENERAL_STRING, serviceName);
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ assertEquals(TestValues.GENERAL_SDLMSGVERSION, version);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FUNCTION_ID_LIST, handledRPCs);
+ assertEquals(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, weatherServiceManifestTest);
+ assertEquals(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, mediaServiceManifestTest);
+ assertEquals(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
+
+ // Invalid/Null Tests
+ AppServiceManifest msg = new AppServiceManifest();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getServiceIcon());
+ assertNull(TestValues.NULL, msg.getServiceName());
+ assertNull(TestValues.NULL, msg.getServiceType());
+ assertNull(TestValues.NULL, msg.getAllowAppConsumers());
+ assertNull(TestValues.NULL, msg.getRpcSpecVersion());
+ assertNull(TestValues.NULL, msg.getHandledRpcs());
+ assertNull(TestValues.NULL, msg.getWeatherServiceManifest());
+ assertNull(TestValues.NULL, msg.getMediaServiceManifest());
+ assertNull(TestValues.NULL, msg.getNavigationServiceManifest());
+ }
+
+ public void testRequiredParamsConstructor() {
+ msg = new AppServiceManifest(TestValues.GENERAL_STRING);
+ String appServiceType = msg.getServiceType();
+ assertEquals(TestValues.GENERAL_STRING, appServiceType);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(AppServiceManifest.KEY_SERVICE_NAME, TestValues.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_SERVICE_ICON, TestValues.GENERAL_IMAGE);
+ reference.put(AppServiceManifest.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ reference.put(AppServiceManifest.KEY_ALLOW_APP_CONSUMERS, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceManifest.KEY_RPC_SPEC_VERSION, TestValues.GENERAL_SDLMSGVERSION.serializeJSON());
+ reference.put(AppServiceManifest.KEY_HANDLED_RPCS, TestValues.GENERAL_FUNCTION_ID_LIST);
+ reference.put(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST, TestValues.GENERAL_WEATHER_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST, TestValues.GENERAL_MEDIA_SERVICE_MANIFEST);
+ reference.put(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST, TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(AppServiceManifest.KEY_RPC_SPEC_VERSION)) {
+ 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(TestValues.TRUE, Validator.validateSdlMsgVersion(new SdlMsgVersion(hashReference), new SdlMsgVersion(hashTest)));
+ } else if (key.equals(AppServiceManifest.KEY_HANDLED_RPCS)) {
+ List<Integer> list1 = TestValues.GENERAL_FUNCTION_ID_LIST;
+ List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1, list2));
+ } else if (key.equals(AppServiceManifest.KEY_WEATHER_SERVICE_MANIFEST)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateWeatherServiceManifest(TestValues.GENERAL_WEATHER_SERVICE_MANIFEST, new WeatherServiceManifest(hashTest)));
+ } else if (key.equals(AppServiceManifest.KEY_MEDIA_SERVICE_MANIFEST)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateMediaServiceManifest(TestValues.GENERAL_MEDIA_SERVICE_MANIFEST, new MediaServiceManifest(hashTest)));
+ } else if (key.equals(AppServiceManifest.KEY_NAVIGATION_SERVICE_MANIFEST)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateNavigationServiceManifest(TestValues.GENERAL_NAVIGATION_SERVICE_MANIFEST, new NavigationServiceManifest(hashTest)));
+ } else if (key.equals(AppServiceManifest.KEY_SERVICE_ICON)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getServiceIcon()));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
index c8c70f0de..af0b20f91 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServiceRecordTests.java
@@ -21,87 +21,87 @@ import java.util.Iterator;
*/
public class AppServiceRecordTests extends TestCase {
- private AppServiceRecord msg;
-
- @Override
- public void setUp(){
-
- msg = new AppServiceRecord();
- msg.setServicePublished(TestValues.GENERAL_BOOLEAN);
- msg.setServiceActive(TestValues.GENERAL_BOOLEAN);
- msg.setServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
- msg.setServiceID(TestValues.GENERAL_STRING);
-
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
-
- boolean isServicePublished = msg.getServicePublished();
- boolean isServiceActive = msg.getServiceActive();
- AppServiceManifest serviceManifest = msg.getServiceManifest();
- String serviceID = msg.getServiceID();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
- assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
- assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
- assertEquals(TestValues.GENERAL_STRING, serviceID);
-
- // Invalid/Null Tests
- AppServiceRecord msg = new AppServiceRecord();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getServicePublished());
- assertNull(TestValues.NULL, msg.getServiceActive());
- assertNull(TestValues.NULL, msg.getServiceManifest());
- assertNull(TestValues.NULL, msg.getServiceID());
- }
-
- public void testRequiredParamsConstructor(){
- msg = new AppServiceRecord(TestValues.GENERAL_STRING, TestValues.GENERAL_APPSERVICEMANIFEST, TestValues.GENERAL_BOOLEAN, TestValues.GENERAL_BOOLEAN);
-
- boolean isServicePublished = msg.getServicePublished();
- boolean isServiceActive = msg.getServiceActive();
- AppServiceManifest serviceManifest = msg.getServiceManifest();
- String serviceID = msg.getServiceID();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
- assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
- assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
- assertEquals(TestValues.GENERAL_STRING, serviceID);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(AppServiceRecord.KEY_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
- reference.put(AppServiceRecord.KEY_SERVICE_PUBLISHED, TestValues.GENERAL_BOOLEAN);
- reference.put(AppServiceRecord.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
- reference.put(AppServiceRecord.KEY_SERVICE_MANIFEST, TestValues.GENERAL_APPSERVICEMANIFEST);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if(key.equals(AppServiceRecord.KEY_SERVICE_MANIFEST)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest( TestValues.GENERAL_APPSERVICEMANIFEST, new AppServiceManifest(hashTest)));
- }else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AppServiceRecord msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new AppServiceRecord();
+ msg.setServicePublished(TestValues.GENERAL_BOOLEAN);
+ msg.setServiceActive(TestValues.GENERAL_BOOLEAN);
+ msg.setServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
+ msg.setServiceID(TestValues.GENERAL_STRING);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceID();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
+ assertEquals(TestValues.GENERAL_STRING, serviceID);
+
+ // Invalid/Null Tests
+ AppServiceRecord msg = new AppServiceRecord();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getServicePublished());
+ assertNull(TestValues.NULL, msg.getServiceActive());
+ assertNull(TestValues.NULL, msg.getServiceManifest());
+ assertNull(TestValues.NULL, msg.getServiceID());
+ }
+
+ public void testRequiredParamsConstructor() {
+ msg = new AppServiceRecord(TestValues.GENERAL_STRING, TestValues.GENERAL_APPSERVICEMANIFEST, TestValues.GENERAL_BOOLEAN, TestValues.GENERAL_BOOLEAN);
+
+ boolean isServicePublished = msg.getServicePublished();
+ boolean isServiceActive = msg.getServiceActive();
+ AppServiceManifest serviceManifest = msg.getServiceManifest();
+ String serviceID = msg.getServiceID();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServicePublished);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isServiceActive);
+ assertEquals(TestValues.GENERAL_APPSERVICEMANIFEST, serviceManifest);
+ assertEquals(TestValues.GENERAL_STRING, serviceID);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(AppServiceRecord.KEY_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_PUBLISHED, TestValues.GENERAL_BOOLEAN);
+ reference.put(AppServiceRecord.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ reference.put(AppServiceRecord.KEY_SERVICE_MANIFEST, TestValues.GENERAL_APPSERVICEMANIFEST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(AppServiceRecord.KEY_SERVICE_MANIFEST)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, new AppServiceManifest(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
index f39df464a..f9195f85d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AppServicesCapabilitiesTests.java
@@ -25,119 +25,119 @@ import java.util.List;
*/
public class AppServicesCapabilitiesTests extends TestCase {
- private AppServicesCapabilities msg;
+ private AppServicesCapabilities msg;
- @Override
- public void setUp(){
+ @Override
+ public void setUp() {
- msg = new AppServicesCapabilities();
- msg.setAppServices(TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
- }
+ msg = new AppServicesCapabilities();
+ msg.setAppServices(TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- List<AppServiceCapability> serviceCapabilityList = msg.getAppServices();
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<AppServiceCapability> serviceCapabilityList = msg.getAppServices();
- // Valid Tests
- assertEquals(TestValues.MATCH, serviceCapabilityList, TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, serviceCapabilityList, TestValues.GENERAL_APPSERVICECAPABILITY_LIST);
- // Invalid/Null Tests
- AppServicesCapabilities msg = new AppServicesCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ AppServicesCapabilities msg = new AppServicesCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getAppServices());
- }
+ assertNull(TestValues.NULL, msg.getAppServices());
+ }
- public void testJson(){
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try{
- reference.put(AppServicesCapabilities.KEY_APP_SERVICES, TestValues.GENERAL_APPSERVICETYPE_LIST);
+ try {
+ reference.put(AppServicesCapabilities.KEY_APP_SERVICES, TestValues.GENERAL_APPSERVICETYPE_LIST);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()) {
- String key = (String) iterator.next();
- if (key.equals(AppServicesCapabilities.KEY_APP_SERVICES)) {
- List<AppServiceCapability> list1 = TestValues.GENERAL_APPSERVICECAPABILITY_LIST;
- List<AppServiceCapability> list2 = JsonUtils.readAppServiceCapabilityListFromJsonObject(underTest, key);
- assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilityList(list1,list2));
- }else{
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(AppServicesCapabilities.KEY_APP_SERVICES)) {
+ List<AppServiceCapability> list1 = TestValues.GENERAL_APPSERVICECAPABILITY_LIST;
+ List<AppServiceCapability> list2 = JsonUtils.readAppServiceCapabilityListFromJsonObject(underTest, key);
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilityList(list1, list2));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
- public void testUpdate(){
- String baseName = "NavTest", baseID = "37F98053AE";
- AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, null, true, null);
- AppServicesCapabilities capabilities1 = new AppServicesCapabilities();
- capabilities1.setAppServices(Collections.singletonList(capability1));
+ public void testUpdate() {
+ String baseName = "NavTest", baseID = "37F98053AE";
+ AppServiceCapability capability1 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, null, true, null);
+ AppServicesCapabilities capabilities1 = new AppServicesCapabilities();
+ capabilities1.setAppServices(Collections.singletonList(capability1));
- assertNotNull(capabilities1.getAppServices());
- assertEquals(capabilities1.getAppServices().size(), 1);
- /* TEST TO ENSURE A THE RECORD HAS THE CORRECT "NULL" VALUE FOR SERVICE ID */
- assertNull(capabilities1.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID());
+ assertNotNull(capabilities1.getAppServices());
+ assertEquals(capabilities1.getAppServices().size(), 1);
+ /* TEST TO ENSURE A THE RECORD HAS THE CORRECT "NULL" VALUE FOR SERVICE ID */
+ assertNull(capabilities1.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID());
- /* TEST TO ENSURE THAT THE LIST DOES NOT GET UPDATED FOR NULL OR EMPTY LISTS */
- assertFalse(capabilities1.updateAppServices(null));
- assertFalse(capabilities1.updateAppServices(new ArrayList<AppServiceCapability>()));
+ /* TEST TO ENSURE THAT THE LIST DOES NOT GET UPDATED FOR NULL OR EMPTY LISTS */
+ assertFalse(capabilities1.updateAppServices(null));
+ assertFalse(capabilities1.updateAppServices(new ArrayList<AppServiceCapability>()));
- AppServiceCapability capability2 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
+ AppServiceCapability capability2 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, baseName, baseID, true, null);
- /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
- assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability2)));
+ /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
+ assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability2)));
- /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
- assertEquals(capabilities1.getAppServices().size(), 1);
+ /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
+ assertEquals(capabilities1.getAppServices().size(), 1);
- assertTrue(capabilities1.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equals(baseID));
+ assertTrue(capabilities1.getAppServices().get(0).getUpdatedAppServiceRecord().getServiceID().equals(baseID));
- AppServiceCapability capability3 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", null, true, null);
+ AppServiceCapability capability3 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", null, true, null);
- /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
- assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability3)));
+ /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
+ assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability3)));
- /* TEST TO ENSURE A NEW RECORD WAS ADDED */
- assertEquals(capabilities1.getAppServices().size(), 2);
+ /* TEST TO ENSURE A NEW RECORD WAS ADDED */
+ assertEquals(capabilities1.getAppServices().size(), 2);
- AppServiceCapability capability4 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", true, null);
+ AppServiceCapability capability4 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "eeeeeeeee", true, null);
- /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
- assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability4)));
+ /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
+ assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability4)));
- /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
- assertEquals(capabilities1.getAppServices().size(), 2);
+ /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
+ assertEquals(capabilities1.getAppServices().size(), 2);
- AppServiceCapability capability5 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "fffffff", true, null);
+ AppServiceCapability capability5 = AppServiceFactory.createAppServiceCapability(AppServiceType.NAVIGATION, "NewNav", "fffffff", true, null);
- /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
- assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability5)));
+ /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
+ assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability5)));
- /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
- assertEquals(capabilities1.getAppServices().size(), 3);
+ /* TEST TO ENSURE A NEW RECORD WAS NOT ADDED */
+ assertEquals(capabilities1.getAppServices().size(), 3);
- capability5.setUpdateReason(ServiceUpdateReason.REMOVED);
+ capability5.setUpdateReason(ServiceUpdateReason.REMOVED);
- /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
- assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability5)));
+ /* TEST TO ENSURE A THE LIST BEING STORED WAS MODIFIED */
+ assertTrue(capabilities1.updateAppServices(Collections.singletonList(capability5)));
- /* TEST TO ENSURE THE RECORD WAS REMOVED */
- assertEquals(capabilities1.getAppServices().size(), 2);
+ /* TEST TO ENSURE THE RECORD WAS REMOVED */
+ assertEquals(capabilities1.getAppServices().size(), 2);
- /* TEST TO ENSURE THE RECORD REMOVED WAS THE CORRECT ONE */
- assertFalse(capabilities1.getAppServices().contains(capability5));
+ /* TEST TO ENSURE THE RECORD REMOVED WAS THE CORRECT ONE */
+ assertFalse(capabilities1.getAppServices().contains(capability5));
- }
+ }
} \ No newline at end of file
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 905c568c9..cf2b88604 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
@@ -21,89 +21,89 @@ import java.util.Iterator;
*/
public class AudioControlCapabilitiesTests extends TestCase {
- private AudioControlCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new AudioControlCapabilities();
-
- msg.setModuleName(TestValues.GENERAL_STRING);
- msg.setSourceAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setKeepContextAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setEqualizerAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setEqualizerMaxChannelId(TestValues.GENERAL_INT);
- msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
-
- String moduleName = msg.getModuleName();
- Boolean sourceAvailable = msg.getSourceAvailable();
- Boolean keepContextAvailable = msg.getKeepContextAvailable();
- Boolean volumeAvailable = msg.getVolumeAvailable();
- Boolean equalizerAvailable = msg.getEqualizerAvailable();
- int equalizerMaxChannelId = msg.getEqualizerMaxChannelId();
- ModuleInfo info = msg.getModuleInfo();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) sourceAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContextAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) volumeAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, equalizerMaxChannelId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
-
- // Invalid/Null Tests
- AudioControlCapabilities msg = new AudioControlCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModuleName());
- assertNull(TestValues.NULL, msg.getSourceAvailable());
- assertNull(TestValues.NULL, msg.getKeepContextAvailable());
- assertNull(TestValues.NULL, msg.getVolumeAvailable());
- assertNull(TestValues.NULL, msg.getEqualizerAvailable());
- assertNull(TestValues.NULL, msg.getEqualizerMaxChannelId());
- assertNull(TestValues.NULL, msg.getModuleInfo());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
-
- reference.put(AudioControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
- reference.put(AudioControlCapabilities.KEY_SOURCE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_KEEP_CONTEXT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, TestValues.GENERAL_INT);
- reference.put(AudioControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AudioControlCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new AudioControlCapabilities();
+
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setSourceAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setKeepContextAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setEqualizerAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVolumeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setEqualizerMaxChannelId(TestValues.GENERAL_INT);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+
+ String moduleName = msg.getModuleName();
+ Boolean sourceAvailable = msg.getSourceAvailable();
+ Boolean keepContextAvailable = msg.getKeepContextAvailable();
+ Boolean volumeAvailable = msg.getVolumeAvailable();
+ Boolean equalizerAvailable = msg.getEqualizerAvailable();
+ int equalizerMaxChannelId = msg.getEqualizerMaxChannelId();
+ ModuleInfo info = msg.getModuleInfo();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) sourceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContextAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) volumeAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, equalizerMaxChannelId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
+
+ // Invalid/Null Tests
+ AudioControlCapabilities msg = new AudioControlCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getSourceAvailable());
+ assertNull(TestValues.NULL, msg.getKeepContextAvailable());
+ assertNull(TestValues.NULL, msg.getVolumeAvailable());
+ assertNull(TestValues.NULL, msg.getEqualizerAvailable());
+ assertNull(TestValues.NULL, msg.getEqualizerMaxChannelId());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+
+ reference.put(AudioControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(AudioControlCapabilities.KEY_SOURCE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_KEEP_CONTEXT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, TestValues.GENERAL_INT);
+ reference.put(AudioControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
index 8975c898d..8a09342db 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlDataTests.java
@@ -23,76 +23,76 @@ import java.util.List;
*/
public class AudioControlDataTests extends TestCase {
- private AudioControlData msg;
-
- @Override
- public void setUp() {
- msg = new AudioControlData();
-
- msg.setSource(TestValues.GENERAL_PRIMARYAUDIOSOURCE);
- msg.setKeepContext(TestValues.GENERAL_BOOLEAN);
- msg.setVolume(TestValues.GENERAL_INT);
- msg.setEqualizerSettings(TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- PrimaryAudioSource source = msg.getSource();
- Boolean keepContext = msg.getKeepContext();
- int volume = msg.getVolume();
- List<EqualizerSettings> equalizerSettings = msg.getEqualizerSettings();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_PRIMARYAUDIOSOURCE, source);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContext);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, volume);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_EQUALIZERSETTINGS_LIST.size(), equalizerSettings.size());
-
- assertTrue(TestValues.TRUE, Validator.validateEqualizerSettingsList(TestValues.GENERAL_EQUALIZERSETTINGS_LIST, equalizerSettings));
-
- // Invalid/Null Tests
- AudioControlData msg = new AudioControlData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getSource());
- assertNull(TestValues.NULL, msg.getVolume());
- assertNull(TestValues.NULL, msg.getKeepContext());
- assertNull(TestValues.NULL, msg.getEqualizerSettings());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(AudioControlData.KEY_SOURCE, TestValues.GENERAL_PRIMARYAUDIOSOURCE);
- reference.put(AudioControlData.KEY_KEEP_CONTEXT, TestValues.GENERAL_BOOLEAN);
- reference.put(AudioControlData.KEY_VOLUME, TestValues.GENERAL_INT);
- reference.put(AudioControlData.KEY_EQUALIZER_SETTINGS, TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(AudioControlData.KEY_EQUALIZER_SETTINGS)) {
- List<EqualizerSettings> esReference = (List<EqualizerSettings>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray esArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (EqualizerSettings es : esReference) {
- assertTrue(Validator.validateEqualizerSettings(es, new EqualizerSettings(JsonRPCMarshaller.deserializeJSONObject(esArray.getJSONObject(i++)))));
- }
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
-
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private AudioControlData msg;
+
+ @Override
+ public void setUp() {
+ msg = new AudioControlData();
+
+ msg.setSource(TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ msg.setKeepContext(TestValues.GENERAL_BOOLEAN);
+ msg.setVolume(TestValues.GENERAL_INT);
+ msg.setEqualizerSettings(TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ PrimaryAudioSource source = msg.getSource();
+ Boolean keepContext = msg.getKeepContext();
+ int volume = msg.getVolume();
+ List<EqualizerSettings> equalizerSettings = msg.getEqualizerSettings();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PRIMARYAUDIOSOURCE, source);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) keepContext);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, volume);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_EQUALIZERSETTINGS_LIST.size(), equalizerSettings.size());
+
+ assertTrue(TestValues.TRUE, Validator.validateEqualizerSettingsList(TestValues.GENERAL_EQUALIZERSETTINGS_LIST, equalizerSettings));
+
+ // Invalid/Null Tests
+ AudioControlData msg = new AudioControlData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getSource());
+ assertNull(TestValues.NULL, msg.getVolume());
+ assertNull(TestValues.NULL, msg.getKeepContext());
+ assertNull(TestValues.NULL, msg.getEqualizerSettings());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(AudioControlData.KEY_SOURCE, TestValues.GENERAL_PRIMARYAUDIOSOURCE);
+ reference.put(AudioControlData.KEY_KEEP_CONTEXT, TestValues.GENERAL_BOOLEAN);
+ reference.put(AudioControlData.KEY_VOLUME, TestValues.GENERAL_INT);
+ reference.put(AudioControlData.KEY_EQUALIZER_SETTINGS, TestValues.GENERAL_EQUALIZERSETTINGS_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(AudioControlData.KEY_EQUALIZER_SETTINGS)) {
+ List<EqualizerSettings> esReference = (List<EqualizerSettings>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray esArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (EqualizerSettings es : esReference) {
+ assertTrue(Validator.validateEqualizerSettings(es, new EqualizerSettings(JsonRPCMarshaller.deserializeJSONObject(esArray.getJSONObject(i++)))));
+ }
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
index 6af615dd4..4940391cc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioPassThruCapabilitiesTest.java
@@ -15,37 +15,37 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities}
*/
-public class AudioPassThruCapabilitiesTest extends TestCase{
+public class AudioPassThruCapabilitiesTest extends TestCase {
- private AudioPassThruCapabilities msg;
+ private AudioPassThruCapabilities msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new AudioPassThruCapabilities();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
msg.setAudioType(TestValues.GENERAL_AUDIOTYPE);
msg.setBitsPerSample(TestValues.GENERAL_BITSPERSAMPLE);
msg.setSamplingRate(TestValues.GENERAL_SAMPLINGRATE);
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
SamplingRate samplingRate = msg.getSamplingRate();
BitsPerSample bitsPerSample = msg.getBitsPerSample();
AudioType audioType = msg.getAudioType();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_SAMPLINGRATE, samplingRate);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BITSPERSAMPLE, bitsPerSample);
assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOTYPE, audioType);
-
+
// Invalid/Null Tests
AudioPassThruCapabilities msg = new AudioPassThruCapabilities();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -54,11 +54,11 @@ public class AudioPassThruCapabilitiesTest extends TestCase{
assertNull(TestValues.NULL, msg.getBitsPerSample());
assertNull(TestValues.NULL, msg.getSamplingRate());
}
-
- public void testJson(){
+
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(AudioPassThruCapabilities.KEY_AUDIO_TYPE, TestValues.GENERAL_AUDIOTYPE);
reference.put(AudioPassThruCapabilities.KEY_BITS_PER_SAMPLE, TestValues.GENERAL_BITSPERSAMPLE);
reference.put(AudioPassThruCapabilities.KEY_SAMPLING_RATE, TestValues.GENERAL_SAMPLINGRATE);
@@ -67,12 +67,12 @@ public class AudioPassThruCapabilitiesTest extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
index 2d1607be0..72bf52a7d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BeltStatusTests.java
@@ -13,18 +13,18 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.BeltStatus}
*/
-public class BeltStatusTests extends TestCase{
-
- private BeltStatus msg;
+public class BeltStatusTests extends TestCase {
+
+ private BeltStatus msg;
@Override
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
msg = new BeltStatus();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
msg.setLeftRearInflatableBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setPassengerChildDetected(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
msg.setRightRearInflatableBelted(TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
@@ -43,46 +43,46 @@ public class BeltStatusTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Valid Tests
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Valid Tests
VehicleDataEventStatus leftRearInflatable = msg.getLeftRearInflatableBelted();
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, leftRearInflatable);
-
+
VehicleDataEventStatus rightRearInflatable = msg.getRightRearInflatableBelted();
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, rightRearInflatable);
-
+
VehicleDataEventStatus passengerChild = msg.getPassengerChildDetected();
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, passengerChild);
-
- VehicleDataEventStatus driverBuckled = msg.getDriverBuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getPassengerBuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getRightRow2BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getMiddleRow1BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getLeftRow2BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getMiddleRow2BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getMiddleRow3BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getLeftRow3BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
- driverBuckled = msg.getRightRow3BuckleBelted();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
-
- VehicleDataEventStatus driverBeltDeployed = msg.getDriverBeltDeployed();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
- driverBeltDeployed = msg.getPassengerBeltDeployed();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
- driverBeltDeployed = msg.getMiddleRow1BeltDeployed();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
-
- // Invalid/Null Tests
+
+ VehicleDataEventStatus driverBuckled = msg.getDriverBuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getPassengerBuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getRightRow2BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getMiddleRow1BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getLeftRow2BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getMiddleRow2BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getMiddleRow3BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getLeftRow3BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+ driverBuckled = msg.getRightRow3BuckleBelted();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBuckled);
+
+ VehicleDataEventStatus driverBeltDeployed = msg.getDriverBeltDeployed();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+ driverBeltDeployed = msg.getPassengerBeltDeployed();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+ driverBeltDeployed = msg.getMiddleRow1BeltDeployed();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, driverBeltDeployed);
+
+ // Invalid/Null Tests
BeltStatus msg = new BeltStatus();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -102,10 +102,10 @@ public class BeltStatusTests extends TestCase{
assertNull(TestValues.NULL, msg.getMiddleRow1BeltDeployed());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
@@ -122,16 +122,16 @@ public class BeltStatusTests extends TestCase{
reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
- JSONObject underTest = msg.serializeJSON();
+ JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
index 0a090606a..1db5aa77a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
@@ -14,15 +14,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.BodyInformation}
*/
-public class BodyInformationTests extends TestCase{
-
- private BodyInformation msg;
+public class BodyInformationTests extends TestCase {
+
+ private BodyInformation msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new BodyInformation();
msg.setParkBrakeActive(TestValues.GENERAL_BOOLEAN);
msg.setIgnitionStatus(TestValues.GENERAL_IGNITIONSTATUS);
@@ -35,25 +35,25 @@ public class BodyInformationTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean parkBrake = msg.getParkBrakeActive();
IgnitionStatus ignitionStatus = msg.getIgnitionStatus();
IgnitionStableStatus ignitionStable = msg.getIgnitionStableStatus();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, parkBrake);
assertEquals(TestValues.MATCH, TestValues.GENERAL_IGNITIONSTATUS, ignitionStatus);
assertEquals(TestValues.MATCH, TestValues.GENERAL_IGNITIONSTABLESTATUS, ignitionStable);
-
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getDriverDoorAjar());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getPassengerDoorAjar());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearLeftDoorAjar());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearRightDoorAjar());
-
- // Invalid/Null Tests
+
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getDriverDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getPassengerDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearLeftDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearRightDoorAjar());
+
+ // Invalid/Null Tests
BodyInformation msg = new BodyInformation();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -66,10 +66,10 @@ public class BodyInformationTests extends TestCase{
assertNull(TestValues.NULL, msg.getRearRightDoorAjar());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, TestValues.GENERAL_BOOLEAN);
reference.put(BodyInformation.KEY_IGNITION_STATUS, TestValues.GENERAL_IGNITIONSTATUS);
reference.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, TestValues.GENERAL_IGNITIONSTABLESTATUS);
@@ -78,16 +78,16 @@ public class BodyInformationTests extends TestCase{
reference.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
reference.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
- JSONObject underTest = msg.serializeJSON();
+ JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
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 ef9b8ec69..99c80fe39 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
@@ -17,15 +17,15 @@ import java.util.Hashtable;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ButtonCapabilities}
*/
-public class ButtonCapabilitiesTests extends TestCase{
+public class ButtonCapabilitiesTests extends TestCase {
private ButtonCapabilities msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ButtonCapabilities();
msg.setLongPressAvailable(TestValues.GENERAL_BOOLEAN);
@@ -37,23 +37,23 @@ public class ButtonCapabilitiesTests extends TestCase{
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean shortPress = msg.getShortPressAvailable();
boolean longPress = msg.getLongPressAvailable();
boolean upDown = msg.getUpDownAvailable();
ButtonName buttonName = msg.getName();
ModuleInfo info = msg.getModuleInfo();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, shortPress);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, longPress);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, upDown);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, buttonName);
assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
-
+
// Invalid/Null Tests
ButtonCapabilities msg = new ButtonCapabilities();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -64,10 +64,10 @@ public class ButtonCapabilitiesTests extends TestCase{
assertNull(TestValues.NULL, msg.getName());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, TestValues.GENERAL_BOOLEAN);
@@ -91,8 +91,8 @@ public class ButtonCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
- }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
index 6eecece4e..d4f24e186 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ChoiceTests.java
@@ -17,15 +17,15 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Choice}
*/
-public class ChoiceTests extends TestCase{
-
+public class ChoiceTests extends TestCase {
+
private Choice msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new Choice();
msg.setChoiceID(TestValues.GENERAL_INT);
@@ -38,10 +38,10 @@ public class ChoiceTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String text3 = msg.getTertiaryText();
String text2 = msg.getSecondaryText();
String menuName = msg.getMenuName();
@@ -49,7 +49,7 @@ public class ChoiceTests extends TestCase{
List<String> vrCommands = msg.getVrCommands();
Image image2 = msg.getSecondaryImage();
Image image = msg.getImage();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text3);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text2);
@@ -58,7 +58,7 @@ public class ChoiceTests extends TestCase{
assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, vrCommands));
assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image2));
assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
-
+
// Invalid/Null Tests
Choice msg = new Choice();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -72,10 +72,10 @@ public class ChoiceTests extends TestCase{
assertNull(TestValues.NULL, msg.getVrCommands());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(Choice.KEY_CHOICE_ID, TestValues.GENERAL_INT);
reference.put(Choice.KEY_MENU_NAME, TestValues.GENERAL_STRING);
reference.put(Choice.KEY_SECONDARY_TEXT, TestValues.GENERAL_STRING);
@@ -83,31 +83,31 @@ public class ChoiceTests extends TestCase{
reference.put(Choice.KEY_IMAGE, TestValues.JSON_IMAGE);
reference.put(Choice.KEY_SECONDARY_IMAGE, TestValues.JSON_IMAGE);
reference.put(Choice.KEY_VR_COMMANDS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
-
+
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(Choice.KEY_VR_COMMANDS)){
+ if (key.equals(Choice.KEY_VR_COMMANDS)) {
assertTrue(TestValues.TRUE,
Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key),
JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else if(key.equals(Choice.KEY_IMAGE) || key.equals(Choice.KEY_SECONDARY_IMAGE)){
- JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
-
+ } else if (key.equals(Choice.KEY_IMAGE) || key.equals(Choice.KEY_SECONDARY_IMAGE)) {
+ JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+
assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
- } else{
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
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 d0ce94de1..22cdc427e 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
@@ -24,12 +24,12 @@ import java.util.List;
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ClimateControlCapabilities}
*/
-public class ClimateControlCapabilitiesTests extends TestCase{
-
+public class ClimateControlCapabilitiesTests extends TestCase {
+
private ClimateControlCapabilities msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ClimateControlCapabilities();
msg.setModuleName(TestValues.GENERAL_STRING);
@@ -54,9 +54,9 @@ public class ClimateControlCapabilitiesTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
String moduleName = msg.getModuleName();
boolean fanSpeedAvailable = msg.getFanSpeedAvailable();
@@ -95,10 +95,10 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
assertEquals(TestValues.MATCH, TestValues.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
- for(int i = 0; i < TestValues.GENERAL_DEFROSTZONE_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_DEFROSTZONE_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_DEFROSTZONE_LIST.get(i), defrostZone.get(i));
}
- for(int i = 0; i < TestValues.GENERAL_VENTILATIONMODE_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_VENTILATIONMODE_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_VENTILATIONMODE_LIST.get(i), ventilationMode.get(i));
}
@@ -132,10 +132,10 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertNull(TestValues.NULL, msg.getClimateEnableAvailable());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ClimateControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
reference.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
@@ -160,10 +160,10 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(ClimateControlCapabilities.KEY_DEFROST_ZONE)) {
+ if (key.equals(ClimateControlCapabilities.KEY_DEFROST_ZONE)) {
JSONArray defrostZoneArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray defrostZoneArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<DefrostZone> defrostZoneListReference = new ArrayList<DefrostZone>();
@@ -171,12 +171,12 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, defrostZoneArrayReference.length(), defrostZoneArrayTest.length());
- for (int index = 0 ; index < defrostZoneArrayReference.length(); index++) {
- defrostZoneListReference.add( (DefrostZone)defrostZoneArrayReference.get(index) );
- defrostZoneListTest.add( (DefrostZone)defrostZoneArrayTest.get(index) );
+ for (int index = 0; index < defrostZoneArrayReference.length(); index++) {
+ defrostZoneListReference.add((DefrostZone) defrostZoneArrayReference.get(index));
+ defrostZoneListTest.add((DefrostZone) defrostZoneArrayTest.get(index));
}
assertTrue(TestValues.TRUE, defrostZoneListReference.containsAll(defrostZoneListTest) && defrostZoneListTest.containsAll(defrostZoneListReference));
- } else if(key.equals(ClimateControlCapabilities.KEY_VENTILATION_MODE)) {
+ } else if (key.equals(ClimateControlCapabilities.KEY_VENTILATION_MODE)) {
JSONArray ventilationModeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray ventilationModeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<VentilationMode> ventilationModeListReference = new ArrayList<VentilationMode>();
@@ -184,9 +184,9 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, ventilationModeArrayReference.length(), ventilationModeArrayTest.length());
- for (int index = 0 ; index < ventilationModeArrayReference.length(); index++) {
- ventilationModeListReference.add( (VentilationMode)ventilationModeArrayReference.get(index) );
- ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) );
+ for (int index = 0; index < ventilationModeArrayReference.length(); index++) {
+ ventilationModeListReference.add((VentilationMode) ventilationModeArrayReference.get(index));
+ ventilationModeListTest.add((VentilationMode) ventilationModeArrayTest.get(index));
}
assertTrue(TestValues.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
} else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) {
@@ -195,12 +195,12 @@ public class ClimateControlCapabilitiesTests extends TestCase{
Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
- } else{
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
index 53af43a48..81c654c43 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
@@ -21,12 +21,12 @@ import java.util.Iterator;
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ClimateControlData}
*/
-public class ClimateControlDataTests extends TestCase{
-
+public class ClimateControlDataTests extends TestCase {
+
private ClimateControlData msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ClimateControlData();
msg.setFanSpeed(TestValues.GENERAL_INT);
@@ -47,9 +47,9 @@ public class ClimateControlDataTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
int fanSpeed = msg.getFanSpeed();
Temperature currentTemperature = msg.getCurrentTemperature();
@@ -105,10 +105,10 @@ public class ClimateControlDataTests extends TestCase{
assertNull(TestValues.NULL, msg.getClimateEnable());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ClimateControlData.KEY_FAN_SPEED, TestValues.GENERAL_INT);
reference.put(ClimateControlData.KEY_CURRENT_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_TEMPERATURE.getStore()));
reference.put(ClimateControlData.KEY_DESIRED_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_TEMPERATURE.getStore()));
@@ -129,27 +129,27 @@ public class ClimateControlDataTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(ClimateControlData.KEY_CURRENT_TEMPERATURE)){
+ if (key.equals(ClimateControlData.KEY_CURRENT_TEMPERATURE)) {
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(TestValues.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
- } else if(key.equals(ClimateControlData.KEY_DESIRED_TEMPERATURE)){
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(new Temperature(hashReference), new Temperature(hashTest)));
+ } else if (key.equals(ClimateControlData.KEY_DESIRED_TEMPERATURE)) {
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(TestValues.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
- } else{
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(new Temperature(hashReference), new Temperature(hashTest)));
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
index 5b1ac322d..121f988f7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
@@ -18,87 +18,87 @@ import java.util.List;
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CloudAppProperties}
*/
-public class CloudAppPropertiesTests extends TestCase{
-
- private CloudAppProperties msg;
-
- @Override
- public void setUp(){
- msg = new CloudAppProperties();
-
- msg.setNicknames(TestValues.GENERAL_STRING_LIST);
- msg.setAppID(TestValues.GENERAL_STRING);
- msg.setEnabled(TestValues.GENERAL_BOOLEAN);
- msg.setAuthToken(TestValues.GENERAL_STRING);
- msg.setCloudTransportType(TestValues.GENERAL_STRING);
- msg.setHybridAppPreference(TestValues.GENERAL_HYBRID_APP_PREFERENCE);
- msg.setEndpoint(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- List<String> nicknames = msg.getNicknames();
- String appID = msg.getAppID();
- boolean enabled = msg.isEnabled();
- String authToken = msg.getAuthToken();
- String cloudTransportType = msg.getCloudTransportType();
- HybridAppPreference hybridAppPreference = msg.getHybridAppPreference();
- String endpoint = msg.getEndpoint();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, nicknames);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appID);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, enabled);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, authToken);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, cloudTransportType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_HYBRID_APP_PREFERENCE, hybridAppPreference);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, endpoint);
-
- // Invalid/Null Tests
- CloudAppProperties msg = new CloudAppProperties();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getNicknames());
- assertNull(TestValues.NULL, msg.getAppID());
- assertNull(TestValues.NULL, msg.isEnabled());
- assertNull(TestValues.NULL, msg.getAuthToken());
- assertNull(TestValues.NULL, msg.getCloudTransportType());
- assertNull(TestValues.NULL, msg.getHybridAppPreference());
- assertNull(TestValues.NULL, msg.getEndpoint());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(CloudAppProperties.KEY_NICKNAMES, TestValues.GENERAL_STRING_LIST);
- reference.put(CloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_ENABLED, TestValues.GENERAL_BOOLEAN);
- reference.put(CloudAppProperties.KEY_AUTH_TOKEN, TestValues.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_CLOUD_TRANSPORT_TYPE, TestValues.GENERAL_STRING);
- reference.put(CloudAppProperties.KEY_HYBRID_APP_PREFERENCE, TestValues.GENERAL_HYBRID_APP_PREFERENCE);
- reference.put(CloudAppProperties.KEY_ENDPOINT, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
-
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if (key.equals(CloudAppProperties.KEY_NICKNAMES)){
- Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key),
- JsonUtils.readStringListFromJsonObject(underTest, key));
- }else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+public class CloudAppPropertiesTests extends TestCase {
+
+ private CloudAppProperties msg;
+
+ @Override
+ public void setUp() {
+ msg = new CloudAppProperties();
+
+ msg.setNicknames(TestValues.GENERAL_STRING_LIST);
+ msg.setAppID(TestValues.GENERAL_STRING);
+ msg.setEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setAuthToken(TestValues.GENERAL_STRING);
+ msg.setCloudTransportType(TestValues.GENERAL_STRING);
+ msg.setHybridAppPreference(TestValues.GENERAL_HYBRID_APP_PREFERENCE);
+ msg.setEndpoint(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<String> nicknames = msg.getNicknames();
+ String appID = msg.getAppID();
+ boolean enabled = msg.isEnabled();
+ String authToken = msg.getAuthToken();
+ String cloudTransportType = msg.getCloudTransportType();
+ HybridAppPreference hybridAppPreference = msg.getHybridAppPreference();
+ String endpoint = msg.getEndpoint();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, nicknames);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, enabled);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, authToken);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, cloudTransportType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HYBRID_APP_PREFERENCE, hybridAppPreference);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, endpoint);
+
+ // Invalid/Null Tests
+ CloudAppProperties msg = new CloudAppProperties();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getNicknames());
+ assertNull(TestValues.NULL, msg.getAppID());
+ assertNull(TestValues.NULL, msg.isEnabled());
+ assertNull(TestValues.NULL, msg.getAuthToken());
+ assertNull(TestValues.NULL, msg.getCloudTransportType());
+ assertNull(TestValues.NULL, msg.getHybridAppPreference());
+ assertNull(TestValues.NULL, msg.getEndpoint());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(CloudAppProperties.KEY_NICKNAMES, TestValues.GENERAL_STRING_LIST);
+ reference.put(CloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(CloudAppProperties.KEY_AUTH_TOKEN, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_CLOUD_TRANSPORT_TYPE, TestValues.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_HYBRID_APP_PREFERENCE, TestValues.GENERAL_HYBRID_APP_PREFERENCE);
+ reference.put(CloudAppProperties.KEY_ENDPOINT, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(CloudAppProperties.KEY_NICKNAMES)) {
+ Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key),
+ JsonUtils.readStringListFromJsonObject(underTest, key));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
index 22a316e9a..7eb76cc2c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClusterModeStatusTests.java
@@ -15,15 +15,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ClusterModeStatus}
*/
-public class ClusterModeStatusTests extends TestCase{
+public class ClusterModeStatusTests extends TestCase {
- private ClusterModeStatus msg;
+ private ClusterModeStatus msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ClusterModeStatus();
msg.setPowerModeActive(TestValues.GENERAL_BOOLEAN);
@@ -33,21 +33,21 @@ public class ClusterModeStatusTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean powerMode = msg.getPowerModeActive();
PowerModeQualificationStatus qualification = msg.getPowerModeQualificationStatus();
PowerModeStatus status = msg.getPowerModeStatus();
CarModeStatus carStatus = msg.getCarModeStatus();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, powerMode);
assertEquals(TestValues.MATCH, TestValues.GENERAL_POWERMODEQUALIFICATIONSTATUS, qualification);
assertEquals(TestValues.MATCH, TestValues.GENERAL_POWERMODESTATUS, status);
assertEquals(TestValues.MATCH, TestValues.GENERAL_CARMODESTATUS, carStatus);
-
+
// Invalid/Null Tests
ClusterModeStatus msg = new ClusterModeStatus();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -57,11 +57,11 @@ public class ClusterModeStatusTests extends TestCase{
assertNull(TestValues.NULL, msg.getPowerModeQualificationStatus());
assertNull(TestValues.NULL, msg.getCarModeStatus());
}
-
- public void testJson(){
+
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, TestValues.GENERAL_BOOLEAN);
reference.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, TestValues.GENERAL_POWERMODESTATUS);
reference.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, TestValues.GENERAL_POWERMODEQUALIFICATIONSTATUS);
@@ -71,12 +71,12 @@ public class ClusterModeStatusTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
index 40931dc1e..8c32ea7c1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CoordinateTests.java
@@ -20,7 +20,7 @@ public class CoordinateTests extends TestCase {
private Coordinate msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new Coordinate();
msg.setLatitudeDegrees(TestValues.GENERAL_FLOAT);
@@ -30,7 +30,7 @@ public class CoordinateTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
float floatLat = msg.getLatitudeDegrees();
float floatLong = msg.getLongitudeDegrees();
@@ -46,10 +46,10 @@ public class CoordinateTests extends TestCase {
assertNull(TestValues.NULL, msg.getLongitudeDegrees());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(Coordinate.KEY_LATITUDE_DEGREES, (Float) TestValues.GENERAL_FLOAT);
reference.put(Coordinate.KEY_LONGITUDE_DEGREES, (Float) TestValues.GENERAL_FLOAT);
@@ -58,7 +58,7 @@ public class CoordinateTests extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
Object a = JsonUtils.readObjectFromJsonObject(reference, key);
@@ -66,7 +66,7 @@ public class CoordinateTests extends TestCase {
assertEquals(TestValues.MATCH, a, b);
}
- } catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
index 3fa76b93a..441d71562 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DIDResultTests.java
@@ -13,7 +13,7 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DIDResult}
*/
public class DIDResultTests extends TestCase {
@@ -21,7 +21,7 @@ public class DIDResultTests extends TestCase {
private DIDResult msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new DIDResult();
msg.setData(TestValues.GENERAL_STRING);
@@ -29,17 +29,17 @@ public class DIDResultTests extends TestCase {
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String data = msg.getData();
VehicleDataResultCode resultCode = msg.getResultCode();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, data);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATARESULTCODE, resultCode);
-
+
// Invalid/Null Tests
DIDResult msg = new DIDResult();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -48,10 +48,10 @@ public class DIDResultTests extends TestCase {
assertNull(TestValues.NULL, msg.getResultCode());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DIDResult.KEY_DATA, TestValues.GENERAL_STRING);
reference.put(DIDResult.KEY_RESULT_CODE, TestValues.GENERAL_VEHICLEDATARESULTCODE);
@@ -59,12 +59,12 @@ public class DIDResultTests extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
index a31a897ae..ba5ce05a0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DTCTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DTC}
*/
-public class DTCTests extends TestCase{
+public class DTCTests extends TestCase {
private DTC msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new DTC();
msg.setIdentifier(TestValues.GENERAL_STRING);
@@ -28,17 +28,17 @@ public class DTCTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String identifier = msg.getIdentifier();
String statusByte = msg.getStatusByte();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, identifier);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, statusByte);
-
+
// Invalid/Null Tests
DTC msg = new DTC();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -47,10 +47,10 @@ public class DTCTests extends TestCase{
assertNull(TestValues.NULL, msg.getStatusByte());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DTC.KEY_IDENTIFIER, TestValues.GENERAL_STRING);
reference.put(DTC.KEY_STATUS_BYTE, TestValues.GENERAL_STRING);
@@ -58,12 +58,12 @@ public class DTCTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
index b0bd3a2dd..7ef000abd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DateTimeTests.java
@@ -20,7 +20,7 @@ public class DateTimeTests extends TestCase {
private DateTime msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new DateTime();
msg.setYear(TestValues.GENERAL_INT);
@@ -37,7 +37,7 @@ public class DateTimeTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
Integer year = msg.getYear();
Integer month = msg.getMonth();
@@ -75,10 +75,10 @@ public class DateTimeTests extends TestCase {
assertNull(TestValues.NULL, msg.getTzMinute());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DateTime.KEY_YEAR, (Integer) TestValues.GENERAL_INT);
reference.put(DateTime.KEY_MONTH, (Integer) TestValues.GENERAL_INT);
reference.put(DateTime.KEY_DAY, (Integer) TestValues.GENERAL_INT);
@@ -94,7 +94,7 @@ public class DateTimeTests extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
Object a = JsonUtils.readObjectFromJsonObject(reference, key);
@@ -102,7 +102,7 @@ public class DateTimeTests extends TestCase {
assertEquals(TestValues.MATCH, a, b);
}
- } catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
index c08b5e525..2274d512f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceInfoTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeviceInfo}
*/
-public class DeviceInfoTests extends TestCase{
+public class DeviceInfoTests extends TestCase {
- private DeviceInfo msg;
+ private DeviceInfo msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new DeviceInfo();
msg.setCarrier(TestValues.GENERAL_STRING);
@@ -32,17 +32,17 @@ public class DeviceInfoTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String carrier = msg.getCarrier();
String hardware = msg.getHardware();
String firmwareRev = msg.getFirmwareRev();
String os = msg.getOs();
String osVer = msg.getOsVersion();
int maxNum = msg.getMaxNumberRFCOMMPorts();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, maxNum);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, osVer);
@@ -50,7 +50,7 @@ public class DeviceInfoTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, firmwareRev);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, hardware);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, carrier);
-
+
// Invalid/Null Tests
DeviceInfo msg = new DeviceInfo();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -63,10 +63,10 @@ public class DeviceInfoTests extends TestCase{
assertNull(TestValues.NULL, msg.getMaxNumberRFCOMMPorts());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DeviceInfo.KEY_CARRIER, TestValues.GENERAL_STRING);
reference.put(DeviceInfo.KEY_HARDWARE, TestValues.GENERAL_STRING);
reference.put(DeviceInfo.KEY_FIRMWARE_REV, TestValues.GENERAL_STRING);
@@ -78,12 +78,12 @@ public class DeviceInfoTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
index 610ded046..65dfea4e3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DeviceStatusTests.java
@@ -14,7 +14,7 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeviceStatus}
*/
public class DeviceStatusTests extends TestCase {
@@ -22,7 +22,7 @@ public class DeviceStatusTests extends TestCase {
private DeviceStatus msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new DeviceStatus();
msg.setBattLevelStatus(TestValues.GENERAL_DEVICELEVELSTATUS);
@@ -39,10 +39,10 @@ public class DeviceStatusTests extends TestCase {
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
DeviceLevelStatus battLevel = msg.getBattLevelStatus();
boolean btIcon = msg.getBtIconOn();
boolean callActive = msg.getCallActive();
@@ -54,7 +54,7 @@ public class DeviceStatusTests extends TestCase {
boolean stereoAudio = msg.getStereoAudioOutputMuted();
boolean textAvailable = msg.getTextMsgAvailable();
boolean voiceRec = msg.getVoiceRecOn();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_DEVICELEVELSTATUS, battLevel);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, btIcon);
@@ -67,7 +67,7 @@ public class DeviceStatusTests extends TestCase {
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, stereoAudio);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, textAvailable);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, voiceRec);
-
+
// Invalid/Null Tests
DeviceStatus msg = new DeviceStatus();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -85,10 +85,10 @@ public class DeviceStatusTests extends TestCase {
assertNull(TestValues.NULL, msg.getVoiceRecOn());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, TestValues.GENERAL_DEVICELEVELSTATUS);
reference.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, TestValues.GENERAL_DEVICELEVELSTATUS);
reference.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, TestValues.GENERAL_PRIMARYAUDIOSOURCE);
@@ -105,12 +105,12 @@ public class DeviceStatusTests extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
index a533df277..186f75992 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
@@ -22,16 +22,16 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DisplayCapabilities}
*/
-public class DisplayCapabilitiesTests extends TestCase{
-
+public class DisplayCapabilitiesTests extends TestCase {
+
private DisplayCapabilities msg;
@Override
- public void setUp(){
- msg = new DisplayCapabilities();
+ public void setUp() {
+ msg = new DisplayCapabilities();
msg.setGraphicSupported(TestValues.GENERAL_BOOLEAN);
msg.setNumCustomPresetsAvailable(TestValues.GENERAL_INT);
@@ -45,10 +45,10 @@ public class DisplayCapabilitiesTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean graphicSupported = msg.getGraphicSupported();
int numPresets = msg.getNumCustomPresetsAvailable();
DisplayType displayType = msg.getDisplayType();
@@ -66,27 +66,27 @@ public class DisplayCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, displayName);
assertTrue(TestValues.TRUE, Validator.validateScreenParams(TestValues.GENERAL_SCREENPARAMS, screenParams));
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), templatesAvailable.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
- for(int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
}
-
- for(int i = 0; i < TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(); i++){
+
+ for (int i = 0; i < TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_MEDIACLOCKFORMAT_LIST.get(i), mediaClock.get(i));
}
- for(int i = 0; i < TestValues.GENERAL_TEXTFIELD_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_TEXTFIELD_LIST.size(); i++) {
assertTrue(TestValues.TRUE, Validator.validateTextFields(TestValues.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
}
- for(int i = 0; i < TestValues.GENERAL_IMAGEFIELD_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_IMAGEFIELD_LIST.size(); i++) {
assertTrue(TestValues.TRUE, Validator.validateImageFields(TestValues.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
}
-
+
// Invalid/Null Tests
DisplayCapabilities msg = new DisplayCapabilities();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -101,11 +101,11 @@ public class DisplayCapabilitiesTests extends TestCase{
assertNull(TestValues.NULL, msg.getTemplatesAvailable());
assertNull(TestValues.NULL, msg.getTextFields());
}
-
- public void testJson(){
+
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(DisplayCapabilities.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, TestValues.GENERAL_INT);
reference.put(DisplayCapabilities.KEY_GRAPHIC_SUPPORTED, TestValues.GENERAL_BOOLEAN);
reference.put(DisplayCapabilities.KEY_DISPLAY_TYPE, TestValues.GENERAL_DISPLAYTYPE);
@@ -118,56 +118,56 @@ public class DisplayCapabilitiesTests extends TestCase{
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
+
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(DisplayCapabilities.KEY_IMAGE_FIELDS)){
+ if (key.equals(DisplayCapabilities.KEY_IMAGE_FIELDS)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
assertEquals(TestValues.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(TestValues.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
+ 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(TestValues.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
}
- } else if(key.equals(DisplayCapabilities.KEY_TEXT_FIELDS)){
- JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ } else if (key.equals(DisplayCapabilities.KEY_TEXT_FIELDS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
assertEquals(TestValues.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(TestValues.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
+
+ 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(TestValues.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
}
- } else if(key.equals(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE)){
+ } else if (key.equals(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else if(key.equals(DisplayCapabilities.KEY_SCREEN_PARAMS)){
+ } else if (key.equals(DisplayCapabilities.KEY_SCREEN_PARAMS)) {
JSONObject referenceArray = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject underTestArray = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
- Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray);
-
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray);
+
assertTrue(TestValues.TRUE, Validator.validateScreenParams(new ScreenParams(hashReference), new ScreenParams(hashTest)));
- } else if(key.equals(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS)){
+ } else if (key.equals(DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS)) {
JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
- for(int i = 0; i < referenceArray.length(); i++){
+ for (int i = 0; i < referenceArray.length(); i++) {
assertTrue(TestValues.TRUE, Validator.validateText(referenceArray.getString(i), underTestArray.getString(i)));// not a string?
}
- } else{
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
index 767c264fa..274dadc3b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DriverDistractionCapabilityTest.java
@@ -57,7 +57,7 @@ public class DriverDistractionCapabilityTest extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DynamicUpdateCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DynamicUpdateCapabilitiesTests.java
index 01e318e8a..60d7b7a15 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DynamicUpdateCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DynamicUpdateCapabilitiesTests.java
@@ -76,15 +76,15 @@ public class DynamicUpdateCapabilitiesTests extends TestCase {
assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
- imageFieldNameListReference.add( (ImageFieldName) referenceArray.get(i));
- imageFieldNameListTest.add( (ImageFieldName) underTestArray.get(i));
+ imageFieldNameListReference.add((ImageFieldName) referenceArray.get(i));
+ imageFieldNameListTest.add((ImageFieldName) underTestArray.get(i));
}
assertTrue(TestValues.TRUE, imageFieldNameListReference.containsAll(imageFieldNameListTest) && imageFieldNameListTest.containsAll(imageFieldNameListReference));
} else if (key.equals(DynamicUpdateCapabilities.KEY_SUPPORTS_DYNAMIC_SUB_MENUS)) {
boolean referenceBool = JsonUtils.readBooleanFromJsonObject(reference, key);
boolean underTestBool = JsonUtils.readBooleanFromJsonObject(underTest, key);
assertEquals(TestValues.MATCH, referenceBool, underTestBool);
- } else {
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
index eaf777f23..621223110 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ECallInfoTests.java
@@ -14,15 +14,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ECallInfo}
*/
-public class ECallInfoTests extends TestCase{
+public class ECallInfoTests extends TestCase {
private ECallInfo msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ECallInfo();
msg.setAuxECallNotificationStatus(TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
@@ -31,19 +31,19 @@ public class ECallInfoTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
VehicleDataNotificationStatus auxEcall = msg.getAuxECallNotificationStatus();
VehicleDataNotificationStatus ecallNotify = msg.getECallNotificationStatus();
ECallConfirmationStatus ecallConfirm = msg.getECallConfirmationStatus();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, auxEcall);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS, ecallNotify);
assertEquals(TestValues.MATCH, TestValues.GENERAL_ECALLCONFIRMATIONSTATUS, ecallConfirm);
-
+
// Invalid/Null Tests
ECallInfo msg = new ECallInfo();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -53,10 +53,10 @@ public class ECallInfoTests extends TestCase{
assertNull(TestValues.NULL, msg.getAuxECallNotificationStatus());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
reference.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, TestValues.GENERAL_VEHICLEDATANOTIFICATIONSTATUS);
reference.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, TestValues.GENERAL_ECALLCONFIRMATIONSTATUS);
@@ -65,12 +65,12 @@ public class ECallInfoTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
index 6bfd4b094..4a97fe9ef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EmergencyEventTests.java
@@ -15,15 +15,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.EmergencyEvent}
*/
-public class EmergencyEventTests extends TestCase{
+public class EmergencyEventTests extends TestCase {
private EmergencyEvent msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new EmergencyEvent();
msg.setEmergencyEventType(TestValues.GENERAL_EMERGENCYEVENTTYPE);
@@ -34,23 +34,23 @@ public class EmergencyEventTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
EmergencyEventType type = msg.getEmergencyEventType();
FuelCutoffStatus cutoffStatus = msg.getFuelCutoffStatus();
VehicleDataEventStatus multipleEvents = msg.getMultipleEvents();
int changeVelocity = msg.getMaximumChangeVelocity();
VehicleDataEventStatus rollover = msg.getRolloverEvent();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_EMERGENCYEVENTTYPE, type);
assertEquals(TestValues.MATCH, TestValues.GENERAL_FUELCUTOFFSTATUS, cutoffStatus);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, changeVelocity);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, multipleEvents);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS, rollover);
-
+
// Invalid/Null Tests
EmergencyEvent msg = new EmergencyEvent();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -62,10 +62,10 @@ public class EmergencyEventTests extends TestCase{
assertNull(TestValues.NULL, msg.getRolloverEvent());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, TestValues.GENERAL_FUELCUTOFFSTATUS);
reference.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
reference.put(EmergencyEvent.KEY_ROLLOVER_EVENT, TestValues.GENERAL_VEHCILEDATAEVENTSTATUS);
@@ -76,12 +76,12 @@ public class EmergencyEventTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
index 7df963cd8..b9ab22812 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/EqualizerSettingsTests.java
@@ -17,62 +17,62 @@ import java.util.Iterator;
*/
public class EqualizerSettingsTests extends TestCase {
- private EqualizerSettings msg;
+ private EqualizerSettings msg;
- @Override
- public void setUp() {
- msg = new EqualizerSettings();
+ @Override
+ public void setUp() {
+ msg = new EqualizerSettings();
- msg.setChannelId(TestValues.GENERAL_INT);
- msg.setChannelName(TestValues.GENERAL_STRING);
- msg.setChannelSetting(TestValues.GENERAL_INT);
- }
+ msg.setChannelId(TestValues.GENERAL_INT);
+ msg.setChannelName(TestValues.GENERAL_STRING);
+ msg.setChannelSetting(TestValues.GENERAL_INT);
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
- int channelId = msg.getChannelId();
- String channelName = msg.getChannelName();
- int channelSetting = msg.getChannelSetting();
+ int channelId = msg.getChannelId();
+ String channelName = msg.getChannelName();
+ int channelSetting = msg.getChannelSetting();
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, channelName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelSetting);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, channelName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, channelSetting);
- // Invalid/Null Tests
- EqualizerSettings msg = new EqualizerSettings();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ EqualizerSettings msg = new EqualizerSettings();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getChannelId());
- assertNull(TestValues.NULL, msg.getChannelName());
- assertNull(TestValues.NULL, msg.getChannelSetting());
- }
+ assertNull(TestValues.NULL, msg.getChannelId());
+ assertNull(TestValues.NULL, msg.getChannelName());
+ assertNull(TestValues.NULL, msg.getChannelSetting());
+ }
- public void testJson() {
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try {
+ try {
- reference.put(EqualizerSettings.KEY_CHANNEL_ID, TestValues.GENERAL_INT);
- reference.put(EqualizerSettings.KEY_CHANNEL_NAME, TestValues.GENERAL_STRING);
- reference.put(EqualizerSettings.KEY_CHANNEL_SETTING, TestValues.GENERAL_INT);
+ reference.put(EqualizerSettings.KEY_CHANNEL_ID, TestValues.GENERAL_INT);
+ reference.put(EqualizerSettings.KEY_CHANNEL_NAME, TestValues.GENERAL_STRING);
+ reference.put(EqualizerSettings.KEY_CHANNEL_SETTING, TestValues.GENERAL_INT);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
index 547aae247..586050a72 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
@@ -15,15 +15,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.FuelRange}
*/
-public class FuelRangeTests extends TestCase{
+public class FuelRangeTests extends TestCase {
private FuelRange msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new FuelRange();
msg.setType(TestValues.GENERAL_FUELTYPE);
@@ -35,10 +35,10 @@ public class FuelRangeTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
FuelType fuelType = msg.getType();
float range = msg.getRange();
float level = msg.getLevel();
@@ -53,7 +53,7 @@ public class FuelRangeTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, levelState);
assertEquals(TestValues.MATCH, TestValues.GENERAL_CAPACITYUNIT, capacityUnit);
assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, capacity);
-
+
// Invalid/Null Tests
FuelRange msg = new FuelRange();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -66,10 +66,10 @@ public class FuelRangeTests extends TestCase{
assertNull(TestValues.NULL, msg.getCapacity());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(FuelRange.KEY_TYPE, TestValues.GENERAL_FUELTYPE);
reference.put(FuelRange.KEY_RANGE, (Float) TestValues.GENERAL_FLOAT);
reference.put(FuelRange.KEY_LEVEL, TestValues.GENERAL_FLOAT);
@@ -81,13 +81,13 @@ public class FuelRangeTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
index dbbdd2ac8..ccd85154d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
@@ -14,15 +14,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GPSData}
*/
-public class GPSDataTests extends TestCase{
+public class GPSDataTests extends TestCase {
private GPSData msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new GPSData();
msg.setActual(TestValues.GENERAL_BOOLEAN);
@@ -47,10 +47,10 @@ public class GPSDataTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean actual = msg.getActual();
double latitude = msg.getLatitudeDegrees();
double longitude = msg.getLongitudeDegrees();
@@ -70,7 +70,7 @@ public class GPSDataTests extends TestCase{
Dimension dimension = msg.getDimension();
CompassDirection direction = msg.getCompassDirection();
boolean shifted = msg.getShifted();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, actual);
assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, latitude);
@@ -91,7 +91,7 @@ public class GPSDataTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_DIMENSION, dimension);
assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPASSDIRECTION, direction);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, shifted);
-
+
// Invalid/Null Tests
GPSData msg = new GPSData();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -117,10 +117,10 @@ public class GPSDataTests extends TestCase{
assertNull(TestValues.NULL, msg.getShifted());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(GPSData.KEY_ACTUAL, TestValues.GENERAL_BOOLEAN);
reference.put(GPSData.KEY_LATITUDE_DEGREES, TestValues.GENERAL_DOUBLE);
reference.put(GPSData.KEY_LONGITUDE_DEGREES, TestValues.GENERAL_DOUBLE);
@@ -145,12 +145,12 @@ public class GPSDataTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
}
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
index ab45ec434..44ed2c581 100644
--- 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
@@ -13,88 +13,88 @@ import java.util.Iterator;
public class GridTests extends TestCase {
- private Grid msg;
+ private Grid msg;
- @Override
- public void setUp() {
- msg = new Grid();
- msg.setCol(TestValues.GENERAL_INT);
- msg.setRow(TestValues.GENERAL_INT);
- msg.setLevel(TestValues.GENERAL_INT);
- msg.setColSpan(TestValues.GENERAL_INT);
- msg.setRowSpan(TestValues.GENERAL_INT);
- msg.setLevelSpan(TestValues.GENERAL_INT);
- }
+ @Override
+ public void setUp() {
+ msg = new Grid();
+ msg.setCol(TestValues.GENERAL_INT);
+ msg.setRow(TestValues.GENERAL_INT);
+ msg.setLevel(TestValues.GENERAL_INT);
+ msg.setColSpan(TestValues.GENERAL_INT);
+ msg.setRowSpan(TestValues.GENERAL_INT);
+ msg.setLevelSpan(TestValues.GENERAL_INT);
+ }
- public void testRpcValues() {
- int col = msg.getCol();
- int row = msg.getRow();
- int level = msg.getLevel();
- int colSpan = msg.getColSpan();
- int rowSpan = msg.getRowSpan();
- int levelSpan = msg.getLevelSpan();
+ public void testRpcValues() {
+ int col = msg.getCol();
+ int row = msg.getRow();
+ int level = msg.getLevel();
+ int colSpan = msg.getColSpan();
+ int rowSpan = msg.getRowSpan();
+ int levelSpan = msg.getLevelSpan();
- //valid tests
- assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, colSpan, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, rowSpan, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, levelSpan, TestValues.GENERAL_INT);
+ //valid tests
+ assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, colSpan, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, rowSpan, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, levelSpan, TestValues.GENERAL_INT);
- //null tests
- Grid msg = new Grid();
- assertNull(TestValues.NULL, msg.getCol());
- assertNull(TestValues.NULL, msg.getRow());
- assertNull(TestValues.NULL, msg.getLevel());
- assertNull(TestValues.NULL, msg.getColSpan());
- assertNull(TestValues.NULL, msg.getRowSpan());
- assertNull(TestValues.NULL, msg.getLevelSpan());
+ //null tests
+ Grid msg = new Grid();
+ assertNull(TestValues.NULL, msg.getCol());
+ assertNull(TestValues.NULL, msg.getRow());
+ assertNull(TestValues.NULL, msg.getLevel());
+ assertNull(TestValues.NULL, msg.getColSpan());
+ assertNull(TestValues.NULL, msg.getRowSpan());
+ assertNull(TestValues.NULL, msg.getLevelSpan());
- //test required constructor
- Grid msg2 = new Grid(TestValues.GENERAL_INT, TestValues.GENERAL_INT);
- int row2 = msg2.getRow();
- int col2 = msg2.getCol();
- assertEquals(TestValues.MATCH, col2, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, row2, TestValues.GENERAL_INT);
- }
+ //test required constructor
+ Grid msg2 = new Grid(TestValues.GENERAL_INT, TestValues.GENERAL_INT);
+ int row2 = msg2.getRow();
+ int col2 = msg2.getCol();
+ assertEquals(TestValues.MATCH, col2, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, row2, TestValues.GENERAL_INT);
+ }
- public void testJson() {
- JSONObject original = new JSONObject();
- try {
- original.put(Grid.KEY_COL, TestValues.GENERAL_INT);
- original.put(Grid.KEY_ROW, TestValues.GENERAL_INT);
- original.put(Grid.KEY_LEVEL, TestValues.GENERAL_INT);
- original.put(Grid.KEY_COL_SPAN, TestValues.GENERAL_INT);
- original.put(Grid.KEY_ROW_SPAN, TestValues.GENERAL_INT);
- original.put(Grid.KEY_LEVEL_SPAN, TestValues.GENERAL_INT);
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(Grid.KEY_COL, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_ROW, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_COL_SPAN, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_ROW_SPAN, TestValues.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL_SPAN, TestValues.GENERAL_INT);
- JSONObject serialized = msg.serializeJSON();
- assertEquals(serialized.length(), original.length());
+ 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_COL)) {
- assertEquals(TestValues.MATCH, grid1.getCol(), grid2.getCol());
- } else if (key.equals(Grid.KEY_ROW)) {
- assertEquals(TestValues.MATCH, grid1.getRow(), grid2.getRow());
- } else if (key.equals(Grid.KEY_LEVEL)) {
- assertEquals(TestValues.MATCH, grid1.getLevel(), grid2.getLevel());
- } else if (key.equals(Grid.KEY_COL_SPAN)) {
- assertEquals(TestValues.MATCH, grid1.getColSpan(), grid2.getColSpan());
- } else if (key.equals(Grid.KEY_ROW_SPAN)) {
- assertEquals(TestValues.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
- } else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
- assertEquals(TestValues.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ 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_COL)) {
+ assertEquals(TestValues.MATCH, grid1.getCol(), grid2.getCol());
+ } else if (key.equals(Grid.KEY_ROW)) {
+ assertEquals(TestValues.MATCH, grid1.getRow(), grid2.getRow());
+ } else if (key.equals(Grid.KEY_LEVEL)) {
+ assertEquals(TestValues.MATCH, grid1.getLevel(), grid2.getLevel());
+ } else if (key.equals(Grid.KEY_COL_SPAN)) {
+ assertEquals(TestValues.MATCH, grid1.getColSpan(), grid2.getColSpan());
+ } else if (key.equals(Grid.KEY_ROW_SPAN)) {
+ assertEquals(TestValues.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
+ } else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
+ assertEquals(TestValues.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
index 40c873285..4ab264787 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
@@ -18,7 +18,7 @@ public class HMICapabilitiesTests extends TestCase {
private HMICapabilities msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new HMICapabilities();
msg.setNavigationAvilable(TestValues.GENERAL_BOOLEAN);
@@ -30,7 +30,7 @@ public class HMICapabilitiesTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
Boolean navAvail = msg.isNavigationAvailable();
Boolean phoneAvail = msg.isPhoneCallAvailable();
@@ -40,8 +40,8 @@ public class HMICapabilitiesTests extends TestCase {
// Valid Tests
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, navAvail);
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, phoneAvail);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, vidStreamAvail);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, driverDistractionAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, vidStreamAvail);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, driverDistractionAvail);
// Invalid/Null Tests
HMICapabilities msg = new HMICapabilities();
@@ -54,10 +54,10 @@ public class HMICapabilitiesTests extends TestCase {
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(KEY_NAVIGATION, TestValues.GENERAL_BOOLEAN);
reference.put(HMICapabilities.KEY_PHONE_CALL, TestValues.GENERAL_BOOLEAN);
reference.put(HMICapabilities.KEY_VIDEO_STREAMING, TestValues.GENERAL_BOOLEAN);
@@ -73,11 +73,11 @@ public class HMICapabilitiesTests extends TestCase {
JsonUtils.readStringListFromJsonObject(underTest, KEY_PHONE_CALL));
assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_VIDEO_STREAMING),
- JsonUtils.readStringListFromJsonObject(underTest, KEY_VIDEO_STREAMING));
+ JsonUtils.readStringListFromJsonObject(underTest, KEY_VIDEO_STREAMING));
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(reference, KEY_DRIVER_DISTRACTION),
JsonUtils.readStringFromJsonObject(underTest, KEY_DRIVER_DISTRACTION));
- } catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
index 98bf2f549..6c3279a6a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMIPermissionsTests.java
@@ -14,15 +14,15 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.HMIPermissions}
*/
-public class HMIPermissionsTests extends TestCase{
+public class HMIPermissionsTests extends TestCase {
private HMIPermissions msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new HMIPermissions();
msg.setAllowed(TestValues.GENERAL_HMILEVEL_LIST);
@@ -30,24 +30,24 @@ public class HMIPermissionsTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
List<HMILevel> allowed = msg.getAllowed();
List<HMILevel> disallowed = msg.getUserDisallowed();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.size(), allowed.size());
assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.size(), disallowed.size());
-
- for(int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++){
+
+ for (int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.get(i), allowed.get(i));
}
- for(int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_HMILEVEL_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL_LIST.get(i), disallowed.get(i));
}
-
+
// Invalid/Null Tests
HMIPermissions msg = new HMIPermissions();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -56,10 +56,10 @@ public class HMIPermissionsTests extends TestCase{
assertNull(TestValues.NULL, msg.getUserDisallowed());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(HMIPermissions.KEY_ALLOWED, TestValues.JSON_HMILEVELS);
reference.put(HMIPermissions.KEY_USER_DISALLOWED, TestValues.JSON_HMILEVELS);
@@ -67,18 +67,18 @@ public class HMIPermissionsTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
List<String> referenceList = JsonUtils.readStringListFromJsonObject(reference, key);
List<String> underTestList = JsonUtils.readStringListFromJsonObject(underTest, key);
assertEquals(TestValues.MATCH, referenceList.size(), underTestList.size());
- for(int i = 0; i < referenceList.size(); i++){
+ for (int i = 0; i < referenceList.size(); i++) {
assertEquals(TestValues.MATCH, referenceList.get(i), underTestList.get(i));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
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 f91cc9fdf..2d0851568 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
@@ -21,76 +21,76 @@ import java.util.Iterator;
*/
public class HMISettingsControlCapabilitiesTests extends TestCase {
- private HMISettingsControlCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new HMISettingsControlCapabilities();
-
- msg.setModuleName(TestValues.GENERAL_STRING);
- msg.setDistanceUnitAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setTemperatureUnitAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setDisplayModeUnitAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- String moduleName = msg.getModuleName();
- Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable();
- Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable();
- Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable();
- ModuleInfo info = msg.getModuleInfo();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
-
- // Invalid/Null Tests
- HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModuleName());
- assertNull(TestValues.NULL, msg.getDistanceUnitAvailable());
- assertNull(TestValues.NULL, msg.getTemperatureUnitAvailable());
- assertNull(TestValues.NULL, msg.getDisplayModeUnitAvailable());
- assertNull(TestValues.NULL, msg.getModuleInfo());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(HMISettingsControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
- reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private HMISettingsControlCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new HMISettingsControlCapabilities();
+
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setDistanceUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setTemperatureUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDisplayModeUnitAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String moduleName = msg.getModuleName();
+ Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable();
+ Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable();
+ Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable();
+ ModuleInfo info = msg.getModuleInfo();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
+
+ // Invalid/Null Tests
+ HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getDistanceUnitAvailable());
+ assertNull(TestValues.NULL, msg.getTemperatureUnitAvailable());
+ assertNull(TestValues.NULL, msg.getDisplayModeUnitAvailable());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
index 3a193b14f..4182b2a1c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlDataTests.java
@@ -20,59 +20,59 @@ import java.util.Iterator;
*/
public class HMISettingsControlDataTests extends TestCase {
- private HMISettingsControlData msg;
-
- @Override
- public void setUp() {
- msg = new HMISettingsControlData();
-
- msg.setDisplayMode(TestValues.GENERAL_DISPLAYMODE);
- msg.setTemperatureUnit(TestValues.GENERAL_TEMPERATUREUNIT);
- msg.setDistanceUnit(TestValues.GENERAL_DISTANCEUNIT);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- DisplayMode displayMode = msg.getDisplayMode();
- TemperatureUnit temperatureUnit = msg.getTemperatureUnit();
- DistanceUnit distanceUnit = msg.getDistanceUnit();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DISPLAYMODE, displayMode);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TEMPERATUREUNIT, temperatureUnit);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DISTANCEUNIT, distanceUnit);
-
- // Invalid/Null Tests
- HMISettingsControlData msg = new HMISettingsControlData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getDisplayMode());
- assertNull(TestValues.NULL, msg.getTemperatureUnit());
- assertNull(TestValues.NULL, msg.getDistanceUnit());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(HMISettingsControlData.KEY_DISPLAY_MODE, TestValues.GENERAL_DISPLAYMODE);
- reference.put(HMISettingsControlData.KEY_TEMPERATURE_UNIT, TestValues.GENERAL_TEMPERATUREUNIT);
- reference.put(HMISettingsControlData.KEY_DISTANCE_UNIT, TestValues.GENERAL_DISTANCEUNIT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private HMISettingsControlData msg;
+
+ @Override
+ public void setUp() {
+ msg = new HMISettingsControlData();
+
+ msg.setDisplayMode(TestValues.GENERAL_DISPLAYMODE);
+ msg.setTemperatureUnit(TestValues.GENERAL_TEMPERATUREUNIT);
+ msg.setDistanceUnit(TestValues.GENERAL_DISTANCEUNIT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ DisplayMode displayMode = msg.getDisplayMode();
+ TemperatureUnit temperatureUnit = msg.getTemperatureUnit();
+ DistanceUnit distanceUnit = msg.getDistanceUnit();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DISPLAYMODE, displayMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEMPERATUREUNIT, temperatureUnit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DISTANCEUNIT, distanceUnit);
+
+ // Invalid/Null Tests
+ HMISettingsControlData msg = new HMISettingsControlData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getDisplayMode());
+ assertNull(TestValues.NULL, msg.getTemperatureUnit());
+ assertNull(TestValues.NULL, msg.getDistanceUnit());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(HMISettingsControlData.KEY_DISPLAY_MODE, TestValues.GENERAL_DISPLAYMODE);
+ reference.put(HMISettingsControlData.KEY_TEMPERATURE_UNIT, TestValues.GENERAL_TEMPERATUREUNIT);
+ reference.put(HMISettingsControlData.KEY_DISTANCE_UNIT, TestValues.GENERAL_DISTANCEUNIT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
index f235761bf..a5e348947 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
@@ -18,56 +18,56 @@ import org.json.JSONObject;
public class HapticRectTests extends TestCase {
- private HapticRect msg;
-
- @Override
- public void setUp() {
- msg = new HapticRect();
-
- msg.setId(TestValues.GENERAL_INTEGER);
- msg.setRect(TestValues.GENERAL_RECTANGLE);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer id = msg.getId();
- Rectangle rect = msg.getRect();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, id);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_RECTANGLE, rect);
-
- // Invalid/Null Tests
- HapticRect msg = new HapticRect();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getId());
- assertNull(TestValues.NULL, msg.getRect());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(HapticRect.KEY_ID, TestValues.GENERAL_INTEGER);
- reference.put(HapticRect.KEY_RECT, TestValues.GENERAL_RECTANGLE);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(reference, HapticRect.KEY_ID),
- JsonUtils.readIntegerFromJsonObject(underTest, HapticRect.KEY_ID));
-
- assertTrue(Validator.validateRectangle(
- (Rectangle) JsonUtils.readObjectFromJsonObject(reference, HapticRect.KEY_RECT),
- new Rectangle(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, HapticRect.KEY_RECT))))
- );
-
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private HapticRect msg;
+
+ @Override
+ public void setUp() {
+ msg = new HapticRect();
+
+ msg.setId(TestValues.GENERAL_INTEGER);
+ msg.setRect(TestValues.GENERAL_RECTANGLE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer id = msg.getId();
+ Rectangle rect = msg.getRect();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RECTANGLE, rect);
+
+ // Invalid/Null Tests
+ HapticRect msg = new HapticRect();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getRect());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(HapticRect.KEY_ID, TestValues.GENERAL_INTEGER);
+ reference.put(HapticRect.KEY_RECT, TestValues.GENERAL_RECTANGLE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(reference, HapticRect.KEY_ID),
+ JsonUtils.readIntegerFromJsonObject(underTest, HapticRect.KEY_ID));
+
+ assertTrue(Validator.validateRectangle(
+ (Rectangle) JsonUtils.readObjectFromJsonObject(reference, HapticRect.KEY_RECT),
+ new Rectangle(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, HapticRect.KEY_RECT))))
+ );
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
index c236d5355..e9860b5a4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadLampStatusTests.java
@@ -13,15 +13,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.HeadLampStatus}
*/
-public class HeadLampStatusTests extends TestCase{
-
+public class HeadLampStatusTests extends TestCase {
+
private HeadLampStatus msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new HeadLampStatus();
msg.setAmbientLightStatus(TestValues.GENERAL_AMBIENTLIGHTSTATUS);
@@ -30,19 +30,19 @@ public class HeadLampStatusTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean lowBeams = msg.getLowBeamsOn();
boolean highBeams = msg.getHighBeamsOn();
AmbientLightStatus ambientLights = msg.getAmbientLightStatus();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_AMBIENTLIGHTSTATUS, ambientLights);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, highBeams);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, lowBeams);
-
+
// Invalid/Null Tests
HeadLampStatus msg = new HeadLampStatus();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -52,10 +52,10 @@ public class HeadLampStatusTests extends TestCase{
assertNull(TestValues.NULL, msg.getAmbientLightStatus());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, TestValues.GENERAL_BOOLEAN);
reference.put(HeadLampStatus.KEY_LOW_BEAMS_ON, TestValues.GENERAL_BOOLEAN);
reference.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, TestValues.GENERAL_AMBIENTLIGHTSTATUS);
@@ -64,12 +64,12 @@ public class HeadLampStatusTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
index 814c92467..435f4cc76 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HeadersTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Headers}
*/
-public class HeadersTests extends TestCase{
+public class HeadersTests extends TestCase {
private Headers msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new Headers();
msg.setCharset(TestValues.GENERAL_STRING);
@@ -36,10 +36,10 @@ public class HeadersTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String charset = msg.getCharset();
String contentType = msg.getContentType();
String requestMode = msg.getRequestMethod();
@@ -50,7 +50,7 @@ public class HeadersTests extends TestCase{
boolean doInput = msg.getDoInput();
boolean useCache = msg.getUseCaches();
boolean instanceFollow = msg.getInstanceFollowRedirects();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, charset);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, contentType);
@@ -62,7 +62,7 @@ public class HeadersTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, doInput);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, useCache);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, instanceFollow);
-
+
// Invalid/Null Tests
Headers msg = new Headers();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -79,10 +79,10 @@ public class HeadersTests extends TestCase{
assertNull(TestValues.NULL, msg.getUseCaches());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(Headers.KEY_CHARSET, TestValues.GENERAL_STRING);
reference.put(Headers.KEY_CONTENT_TYPE, TestValues.GENERAL_STRING);
reference.put(Headers.KEY_REQUEST_METHOD, TestValues.GENERAL_STRING);
@@ -98,12 +98,12 @@ public class HeadersTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
index 0c4090870..630a7157c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageFieldTests.java
@@ -21,15 +21,15 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ImageField}
*/
-public class ImageFieldTests extends TestCase{
+public class ImageFieldTests extends TestCase {
private ImageField msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ImageField();
msg.setImageResolution(TestValues.GENERAL_IMAGERESOLUTION);
@@ -38,19 +38,19 @@ public class ImageFieldTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
ImageResolution imageRes = msg.getImageResolution();
List<FileType> imageTypes = msg.getImageTypeSupported();
ImageFieldName name = msg.getName();
-
+
// Valid Tests
assertTrue(TestValues.TRUE, Validator.validateImageResolution(TestValues.GENERAL_IMAGERESOLUTION, imageRes));
assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGEFIELDNAME, name);
assertTrue(TestValues.TRUE, Validator.validateFileTypes(TestValues.GENERAL_FILETYPE_LIST, imageTypes));
-
+
// Invalid/Null Tests
ImageField msg = new ImageField();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -60,46 +60,46 @@ public class ImageFieldTests extends TestCase{
assertNull(TestValues.NULL, msg.getName());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ImageField.KEY_IMAGE_RESOLUTION, TestValues.JSON_IMAGERESOLUTION);
reference.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(TestValues.GENERAL_FILETYPE_LIST));
reference.put(ImageField.KEY_NAME, TestValues.GENERAL_IMAGEFIELDNAME);
-
+
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(ImageField.KEY_IMAGE_RESOLUTION)){
- JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateImageResolution( new ImageResolution(hashReference), new ImageResolution(hashTest)));
- } else if(key.equals(ImageField.KEY_IMAGE_TYPE_SUPPORTED)) {
- JSONArray imageTypeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- JSONArray imageTypeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<FileType> imageTypeListReference = new ArrayList<FileType>();
- List<FileType> imageTypeListTest = new ArrayList<FileType>();
-
- assertEquals(TestValues.MATCH, imageTypeArrayReference.length(), imageTypeArrayTest.length());
-
- for (int index = 0 ; index < imageTypeArrayReference.length(); index++) {
- imageTypeListReference.add( (FileType)imageTypeArrayReference.get(index) );
- imageTypeListTest.add( (FileType)imageTypeArrayTest.get(index) );
- }
- assertTrue(TestValues.TRUE, imageTypeListReference.containsAll(imageTypeListTest) && imageTypeListTest.containsAll(imageTypeListReference));
- } else{
+ if (key.equals(ImageField.KEY_IMAGE_RESOLUTION)) {
+ JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(new ImageResolution(hashReference), new ImageResolution(hashTest)));
+ } else if (key.equals(ImageField.KEY_IMAGE_TYPE_SUPPORTED)) {
+ JSONArray imageTypeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray imageTypeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<FileType> imageTypeListReference = new ArrayList<FileType>();
+ List<FileType> imageTypeListTest = new ArrayList<FileType>();
+
+ assertEquals(TestValues.MATCH, imageTypeArrayReference.length(), imageTypeArrayTest.length());
+
+ for (int index = 0; index < imageTypeArrayReference.length(); index++) {
+ imageTypeListReference.add((FileType) imageTypeArrayReference.get(index));
+ imageTypeListTest.add((FileType) imageTypeArrayTest.get(index));
+ }
+ assertTrue(TestValues.TRUE, imageTypeListReference.containsAll(imageTypeListTest) && imageTypeListTest.containsAll(imageTypeListReference));
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
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 bdabce23b..ba1352e23 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
@@ -13,15 +13,15 @@ import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ImageResolution}
*/
-public class ImageResolutionTests extends TestCase{
+public class ImageResolutionTests extends TestCase {
private ImageResolution msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ImageResolution();
msg.setResolutionHeight(TestValues.GENERAL_INT);
@@ -29,17 +29,17 @@ public class ImageResolutionTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
int height = msg.getResolutionHeight();
int width = msg.getResolutionWidth();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, height);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, width);
-
+
// Invalid/Null Tests
ImageResolution msg = new ImageResolution();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -48,10 +48,10 @@ public class ImageResolutionTests extends TestCase{
assertNull(TestValues.NULL, msg.getResolutionWidth());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ImageResolution.KEY_RESOLUTION_HEIGHT, TestValues.GENERAL_INT);
reference.put(ImageResolution.KEY_RESOLUTION_WIDTH, TestValues.GENERAL_INT);
@@ -59,34 +59,34 @@ public class ImageResolutionTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
public void testSetResolutionWidth_Odd() {
msg.setResolutionWidth(175);
- assertEquals(176, (int)msg.getResolutionWidth());
+ assertEquals(176, (int) msg.getResolutionWidth());
}
public void testSetResolutionHeight_Odd() {
msg.setResolutionHeight(175);
- assertEquals(176, (int)msg.getResolutionHeight());
+ assertEquals(176, (int) msg.getResolutionHeight());
}
public void testSetResolutionWidth_Pair() {
msg.setResolutionWidth(176);
- assertEquals(176, (int)msg.getResolutionWidth());
+ assertEquals(176, (int) msg.getResolutionWidth());
}
public void testSetResolutionHeight_Pair() {
msg.setResolutionHeight(176);
- assertEquals(176, (int)msg.getResolutionHeight());
+ 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/ImageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
index 108686879..24405857c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageTests.java
@@ -13,15 +13,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Image}
*/
-public class ImageTests extends TestCase{
+public class ImageTests extends TestCase {
private Image msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new Image();
msg.setImageType(TestValues.GENERAL_IMAGETYPE);
@@ -30,19 +30,19 @@ public class ImageTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
ImageType imageType = msg.getImageType();
String value = msg.getValue();
Boolean isTemplate = msg.getIsTemplate();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_IMAGETYPE, imageType);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, value);
assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isTemplate);
-
+
// Invalid/Null Tests
Image msg = new Image();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -53,10 +53,10 @@ public class ImageTests extends TestCase{
assertNull(TestValues.NULL, msg.getIsTemplate());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(Image.KEY_IMAGE_TYPE, TestValues.GENERAL_IMAGETYPE);
reference.put(Image.KEY_VALUE, TestValues.GENERAL_STRING);
reference.put(Image.KEY_IS_TEMPLATE, TestValues.GENERAL_BOOLEAN);
@@ -65,12 +65,12 @@ public class ImageTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
index cfb0c1c7d..e06bd5e0b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
@@ -17,15 +17,15 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.KeyboardProperties}
*/
-public class KeyboardPropertiesTests extends TestCase{
+public class KeyboardPropertiesTests extends TestCase {
private KeyboardProperties msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new KeyboardProperties();
msg.setAutoCompleteText(TestValues.GENERAL_STRING);
@@ -37,17 +37,17 @@ public class KeyboardPropertiesTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String autoCompleteText = msg.getAutoCompleteText();
List<String> autoCompleteList = msg.getAutoCompleteList();
KeyboardLayout keyboardLayout = msg.getKeyboardLayout();
KeypressMode keypressMode = msg.getKeypressMode();
Language language = msg.getLanguage();
List<String> limitedChars = msg.getLimitedCharacterList();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, autoCompleteText);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), autoCompleteList.size());
@@ -57,11 +57,11 @@ public class KeyboardPropertiesTests extends TestCase{
assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, language);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), limitedChars.size());
assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, limitedChars));
-
+
// Invalid/Null Tests
KeyboardProperties msg = new KeyboardProperties();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
// Keypress mode is created in the object constructor
assertNotNull(TestValues.NOT_NULL, msg.getKeypressMode());
assertNull(TestValues.NULL, msg.getAutoCompleteText());
@@ -71,10 +71,10 @@ public class KeyboardPropertiesTests extends TestCase{
assertNull(TestValues.NULL, msg.getLimitedCharacterList());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, TestValues.GENERAL_STRING);
reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
reference.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, TestValues.GENERAL_KEYBOARDLAYOUT);
@@ -86,16 +86,16 @@ public class KeyboardPropertiesTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST) || key.equals(KeyboardProperties.KEY_AUTO_COMPLETE_LIST)){
+ if (key.equals(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST) || key.equals(KeyboardProperties.KEY_AUTO_COMPLETE_LIST)) {
assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else{
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
index ba4df001f..c58f0d35b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightCapabilitiesTests.java
@@ -18,64 +18,64 @@ import java.util.Iterator;
*/
public class LightCapabilitiesTests extends TestCase {
- private LightCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new LightCapabilities();
-
- msg.setName(TestValues.GENERAL_LIGHTNAME);
- msg.setDensityAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setRGBColorSpaceAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setStatusAvailable(TestValues.GENERAL_BOOLEAN);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- LightName name = msg.getName();
- Boolean densityAvailable = msg.getDensityAvailable();
- Boolean rgbColorSpaceAvailable = msg.getRGBColorSpaceAvailable();
- Boolean statusAvailable = msg.getStatusAvailable();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, name);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) densityAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) rgbColorSpaceAvailable);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) statusAvailable);
-
- // Invalid/Null Tests
- LightCapabilities msg = new LightCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getName());
- assertNull(TestValues.NULL, msg.getDensityAvailable());
- assertNull(TestValues.NULL, msg.getRGBColorSpaceAvailable());
- assertNull(TestValues.NULL, msg.getStatusAvailable());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(LightCapabilities.KEY_NAME, TestValues.GENERAL_LIGHTNAME);
- reference.put(LightCapabilities.KEY_DENSITY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(LightCapabilities.KEY_RGB_COLOR_SPACE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(LightCapabilities.KEY_STATUS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private LightCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new LightCapabilities();
+
+ msg.setName(TestValues.GENERAL_LIGHTNAME);
+ msg.setDensityAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setRGBColorSpaceAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setStatusAvailable(TestValues.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ LightName name = msg.getName();
+ Boolean densityAvailable = msg.getDensityAvailable();
+ Boolean rgbColorSpaceAvailable = msg.getRGBColorSpaceAvailable();
+ Boolean statusAvailable = msg.getStatusAvailable();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, name);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) densityAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) rgbColorSpaceAvailable);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) statusAvailable);
+
+ // Invalid/Null Tests
+ LightCapabilities msg = new LightCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getDensityAvailable());
+ assertNull(TestValues.NULL, msg.getRGBColorSpaceAvailable());
+ assertNull(TestValues.NULL, msg.getStatusAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(LightCapabilities.KEY_NAME, TestValues.GENERAL_LIGHTNAME);
+ reference.put(LightCapabilities.KEY_DENSITY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(LightCapabilities.KEY_RGB_COLOR_SPACE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(LightCapabilities.KEY_STATUS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ 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 8487bf17f..e92ce7c6f 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
@@ -24,77 +24,76 @@ import java.util.List;
*/
public class LightControlCapabilitiesTests extends TestCase {
- private LightControlCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new LightControlCapabilities();
-
- msg.setModuleName(TestValues.GENERAL_STRING);
- msg.setSupportedLights(TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
- msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- String moduleName = msg.getModuleName();
- List<LightCapabilities> supportedLights = msg.getSupportedLights();
- ModuleInfo info = msg.getModuleInfo();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
-
- assertTrue(TestValues.TRUE, Validator.validateLightCapabilitiesList(TestValues.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
-
- // Invalid/Null Tests
- LightControlCapabilities msg = new LightControlCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModuleName());
- assertNull(TestValues.NULL, msg.getSupportedLights());
- assertNull(TestValues.NULL, msg.getModuleInfo());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(LightControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
- reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
- reference.put(LightControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(LightControlCapabilities.KEY_SUPPORTED_LIGHTS)) {
- List<LightCapabilities> lcReference = (List<LightCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray lsArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (LightCapabilities lc : lcReference) {
- assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
- }
- } 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
- }
- else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private LightControlCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new LightControlCapabilities();
+
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setSupportedLights(TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
+ msg.setModuleInfo(TestValues.GENERAL_MODULE_INFO);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String moduleName = msg.getModuleName();
+ List<LightCapabilities> supportedLights = msg.getSupportedLights();
+ ModuleInfo info = msg.getModuleInfo();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULE_INFO, info);
+
+ assertTrue(TestValues.TRUE, Validator.validateLightCapabilitiesList(TestValues.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
+
+ // Invalid/Null Tests
+ LightControlCapabilities msg = new LightControlCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getSupportedLights());
+ assertNull(TestValues.NULL, msg.getModuleInfo());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(LightControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, TestValues.GENERAL_LIGHTCAPABILITIES_LIST);
+ reference.put(LightControlCapabilities.KEY_MODULE_INFO, TestValues.JSON_MODULE_INFO);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(LightControlCapabilities.KEY_SUPPORTED_LIGHTS)) {
+ List<LightCapabilities> lcReference = (List<LightCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray lsArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (LightCapabilities lc : lcReference) {
+ assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
+ }
+ } 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(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
index 48989a3d9..5d4417f36 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlDataTests.java
@@ -22,58 +22,58 @@ import java.util.List;
*/
public class LightControlDataTests extends TestCase {
- private LightControlData msg;
-
- @Override
- public void setUp() {
- msg = new LightControlData();
-
- msg.setLightState(TestValues.GENERAL_LIGHTSTATE_LIST);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- List<LightState> lightState = msg.getLightState();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATE_LIST.size(), lightState.size());
-
- assertTrue(TestValues.TRUE, Validator.validateLightStateList(TestValues.GENERAL_LIGHTSTATE_LIST, lightState));
-
- // Invalid/Null Tests
- LightControlData msg = new LightControlData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getLightState());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(LightControlData.KEY_LIGHT_STATE, TestValues.GENERAL_LIGHTSTATE_LIST);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(LightControlData.KEY_LIGHT_STATE)) {
- List<LightState> lsReference = (List<LightState>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray lsArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (LightState ls : lsReference) {
- assertTrue(Validator.validateLightState(ls, new LightState(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
- }
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private LightControlData msg;
+
+ @Override
+ public void setUp() {
+ msg = new LightControlData();
+
+ msg.setLightState(TestValues.GENERAL_LIGHTSTATE_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<LightState> lightState = msg.getLightState();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATE_LIST.size(), lightState.size());
+
+ assertTrue(TestValues.TRUE, Validator.validateLightStateList(TestValues.GENERAL_LIGHTSTATE_LIST, lightState));
+
+ // Invalid/Null Tests
+ LightControlData msg = new LightControlData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getLightState());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(LightControlData.KEY_LIGHT_STATE, TestValues.GENERAL_LIGHTSTATE_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(LightControlData.KEY_LIGHT_STATE)) {
+ List<LightState> lsReference = (List<LightState>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray lsArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (LightState ls : lsReference) {
+ assertTrue(Validator.validateLightState(ls, new LightState(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
index 272880ff0..0fc59d32d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightStateTests.java
@@ -23,72 +23,72 @@ import java.util.Iterator;
*/
public class LightStateTests extends TestCase {
- private LightState msg;
-
- @Override
- public void setUp() {
- msg = new LightState();
-
- msg.setId(TestValues.GENERAL_LIGHTNAME);
- msg.setStatus(TestValues.GENERAL_LIGHTSTATUS);
- msg.setDensity(TestValues.GENERAL_FLOAT);
- msg.setColor(TestValues.GENERAL_RGBCOLOR);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- LightName id = msg.getId();
- LightStatus status = msg.getStatus();
- Float density = msg.getDensity();
- RGBColor color = msg.getColor();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, id);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATUS, status);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, (float) density);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_RGBCOLOR, color);
-
- // Invalid/Null Tests
- LightState msg = new LightState();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getId());
- assertNull(TestValues.NULL, msg.getStatus());
- assertNull(TestValues.NULL, msg.getDensity());
- assertNull(TestValues.NULL, msg.getColor());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(LightState.KEY_ID, TestValues.GENERAL_LIGHTNAME);
- reference.put(LightState.KEY_STATUS, TestValues.GENERAL_LIGHTSTATUS);
- reference.put(LightState.KEY_DENSITY, TestValues.GENERAL_FLOAT);
- reference.put(LightState.KEY_COLOR, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RGBCOLOR.getStore()));
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(LightState.KEY_COLOR)) {
- 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(TestValues.TRUE, Validator.validateRGBColor(new RGBColor(hashReference), new RGBColor(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private LightState msg;
+
+ @Override
+ public void setUp() {
+ msg = new LightState();
+
+ msg.setId(TestValues.GENERAL_LIGHTNAME);
+ msg.setStatus(TestValues.GENERAL_LIGHTSTATUS);
+ msg.setDensity(TestValues.GENERAL_FLOAT);
+ msg.setColor(TestValues.GENERAL_RGBCOLOR);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ LightName id = msg.getId();
+ LightStatus status = msg.getStatus();
+ Float density = msg.getDensity();
+ RGBColor color = msg.getColor();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTNAME, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LIGHTSTATUS, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, (float) density);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RGBCOLOR, color);
+
+ // Invalid/Null Tests
+ LightState msg = new LightState();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getStatus());
+ assertNull(TestValues.NULL, msg.getDensity());
+ assertNull(TestValues.NULL, msg.getColor());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(LightState.KEY_ID, TestValues.GENERAL_LIGHTNAME);
+ reference.put(LightState.KEY_STATUS, TestValues.GENERAL_LIGHTSTATUS);
+ reference.put(LightState.KEY_DENSITY, TestValues.GENERAL_FLOAT);
+ reference.put(LightState.KEY_COLOR, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RGBCOLOR.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(LightState.KEY_COLOR)) {
+ 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(TestValues.TRUE, Validator.validateRGBColor(new RGBColor(hashReference), new RGBColor(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
index 3792f64b7..c1a2b78f7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LocationDetailsTests.java
@@ -24,14 +24,14 @@ public class LocationDetailsTests extends TestCase {
private LocationDetails msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = TestValues.GENERAL_LOCATIONDETAILS;
}
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
List<String> field1 = msg.getAddressLines();
String field2 = msg.getLocationDescription();
@@ -64,10 +64,10 @@ public class LocationDetailsTests extends TestCase {
assertNull(msg.getSearchAddress());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(LocationDetails.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
reference.put(LocationDetails.KEY_LOCATION_DESCRIPTION, TestValues.GENERAL_STRING);
reference.put(LocationDetails.KEY_LOCATION_NAME, TestValues.GENERAL_STRING);
@@ -93,20 +93,20 @@ public class LocationDetailsTests extends TestCase {
assertTrue(Validator.validateCoordinate(
(Coordinate) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_COORDINATE),
- new Coordinate(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_COORDINATE))))
- );
+ new Coordinate(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_COORDINATE))))
+ );
assertTrue(Validator.validateImage(
(Image) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_LOCATION_IMAGE),
new Image(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_LOCATION_IMAGE)))
- ));
+ ));
assertTrue(Validator.validateOasisAddress(
(OasisAddress) JsonUtils.readObjectFromJsonObject(reference, LocationDetails.KEY_SEARCH_ADDRESS),
new OasisAddress(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, LocationDetails.KEY_SEARCH_ADDRESS)))
));
- } catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
index fb3e9a764..f4485698b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageCushionFirmnessTest.java
@@ -18,54 +18,54 @@ import java.util.Iterator;
*/
public class MassageCushionFirmnessTest extends TestCase {
- private MassageCushionFirmness msg;
-
- @Override
- public void setUp() {
- msg = new MassageCushionFirmness();
-
- msg.setCushion(TestValues.GENERAL_MASSAGECUSHION);
- msg.setFirmness(TestValues.GENERAL_INT);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- MassageCushion cushion = msg.getCushion();
- Integer firmness = msg.getFirmness();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGECUSHION, cushion);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, firmness);
-
- // Invalid/Null Tests
- MassageCushionFirmness msg = new MassageCushionFirmness();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getCushion());
- assertNull(TestValues.NULL, msg.getFirmness());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(MassageCushionFirmness.KEY_CUSHION, TestValues.GENERAL_MASSAGECUSHION);
- reference.put(MassageCushionFirmness.KEY_FIRMNESS, TestValues.GENERAL_INT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private MassageCushionFirmness msg;
+
+ @Override
+ public void setUp() {
+ msg = new MassageCushionFirmness();
+
+ msg.setCushion(TestValues.GENERAL_MASSAGECUSHION);
+ msg.setFirmness(TestValues.GENERAL_INT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ MassageCushion cushion = msg.getCushion();
+ Integer firmness = msg.getFirmness();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGECUSHION, cushion);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, firmness);
+
+ // Invalid/Null Tests
+ MassageCushionFirmness msg = new MassageCushionFirmness();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getCushion());
+ assertNull(TestValues.NULL, msg.getFirmness());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(MassageCushionFirmness.KEY_CUSHION, TestValues.GENERAL_MASSAGECUSHION);
+ reference.put(MassageCushionFirmness.KEY_FIRMNESS, TestValues.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
index 7f89422a0..5cd86343b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MassageModeDataTest.java
@@ -19,56 +19,56 @@ import java.util.Iterator;
*/
public class MassageModeDataTest extends TestCase {
- private MassageModeData msg;
+ private MassageModeData msg;
- @Override
- public void setUp() {
- msg = new MassageModeData();
+ @Override
+ public void setUp() {
+ msg = new MassageModeData();
- msg.setMassageZone(TestValues.GENERAL_MASSAGEZONE);
- msg.setMassageMode(TestValues.GENERAL_MASSAGEMODE);
- }
+ msg.setMassageZone(TestValues.GENERAL_MASSAGEZONE);
+ msg.setMassageMode(TestValues.GENERAL_MASSAGEMODE);
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- MassageZone massageZone = msg.getMassageZone();
- MassageMode massageMode = msg.getMassageMode();
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ MassageZone massageZone = msg.getMassageZone();
+ MassageMode massageMode = msg.getMassageMode();
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEZONE, massageZone);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEMODE, massageMode);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEZONE, massageZone);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MASSAGEMODE, massageMode);
- // Invalid/Null Tests
- MassageModeData msg = new MassageModeData();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ MassageModeData msg = new MassageModeData();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getMassageMode());
- assertNull(TestValues.NULL, msg.getMassageZone());
- }
+ assertNull(TestValues.NULL, msg.getMassageMode());
+ assertNull(TestValues.NULL, msg.getMassageZone());
+ }
- public void testJson() {
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try {
- reference.put(MassageModeData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODE);
- reference.put(MassageModeData.KEY_MASSAGE_ZONE, TestValues.GENERAL_MASSAGEZONE);
+ try {
+ reference.put(MassageModeData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODE);
+ reference.put(MassageModeData.KEY_MASSAGE_ZONE, TestValues.GENERAL_MASSAGEZONE);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
index 5d1baded5..6f7dd148a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
@@ -22,116 +22,116 @@ import java.util.Iterator;
*/
public class MediaServiceDataTests extends TestCase {
- private MediaServiceData msg;
-
- @Override
- public void setUp(){
-
- msg = new MediaServiceData();
- msg.setMediaType(TestValues.GENERAL_MEDIATYPE);
- msg.setMediaTitle(TestValues.GENERAL_STRING);
- msg.setMediaArtist(TestValues.GENERAL_STRING);
- msg.setMediaAlbum(TestValues.GENERAL_STRING);
- msg.setMediaImage(TestValues.GENERAL_IMAGE);
- msg.setPlaylistName(TestValues.GENERAL_STRING);
- msg.setIsExplicit(TestValues.GENERAL_BOOLEAN);
- msg.setTrackPlaybackProgress(TestValues.GENERAL_INTEGER);
- msg.setTrackPlaybackDuration(TestValues.GENERAL_INTEGER);
- msg.setQueuePlaybackProgress(TestValues.GENERAL_INTEGER);
- msg.setQueuePlaybackDuration(TestValues.GENERAL_INTEGER);
- msg.setQueueCurrentTrackNumber(TestValues.GENERAL_INTEGER);
- msg.setQueueTotalTrackCount(TestValues.GENERAL_INTEGER);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- MediaType mediaType = msg.getMediaType();
- String mediaTitle = msg.getMediaTitle();
- String mediaArtist = msg.getMediaArtist();
- String mediaAlbum = msg.getMediaAlbum();
- Image mediaImage = msg.getMediaImage();
- String playlistName = msg.getPlaylistName();
- boolean isExplicit = msg.getIsExplicit();
- Integer trackPlaybackProgress = msg.getTrackPlaybackProgress();
- Integer trackPlaybackDuration = msg.getTrackPlaybackDuration();
- Integer queuePlaybackProgress = msg.getQueuePlaybackProgress();
- Integer queuePlaybackDuration = msg.getQueuePlaybackDuration();
- Integer queueCurrentTrackNumber = msg.getQueueCurrentTrackNumber();
- Integer queueTotalTrackCount = msg.getQueueTotalTrackCount();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_MEDIATYPE, mediaType);
- assertEquals(TestValues.GENERAL_STRING, mediaTitle);
- assertEquals(TestValues.GENERAL_STRING, mediaArtist);
- assertEquals(TestValues.GENERAL_STRING, mediaAlbum);
- assertEquals(TestValues.GENERAL_IMAGE, mediaImage);
- assertEquals(TestValues.GENERAL_STRING, playlistName);
- assertEquals(TestValues.GENERAL_BOOLEAN, isExplicit);
- assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackProgress);
- assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackDuration);
- assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackProgress);
- assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackDuration);
- assertEquals(TestValues.GENERAL_INTEGER, queueCurrentTrackNumber);
- assertEquals(TestValues.GENERAL_INTEGER, queueTotalTrackCount);
-
- // Invalid/Null Tests
- MediaServiceData msg = new MediaServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getMediaType());
- assertNull(TestValues.NULL, msg.getMediaTitle());
- assertNull(TestValues.NULL, msg.getMediaArtist());
- assertNull(TestValues.NULL, msg.getMediaAlbum());
- assertNull(TestValues.NULL, msg.getMediaImage());
- assertNull(TestValues.NULL, msg.getPlaylistName());
- assertNull(TestValues.NULL, msg.getIsExplicit());
- assertNull(TestValues.NULL, msg.getTrackPlaybackProgress());
- assertNull(TestValues.NULL, msg.getTrackPlaybackDuration());
- assertNull(TestValues.NULL, msg.getQueuePlaybackProgress());
- assertNull(TestValues.NULL, msg.getQueuePlaybackDuration());
- assertNull(TestValues.NULL, msg.getQueueCurrentTrackNumber());
- assertNull(TestValues.NULL, msg.getQueueTotalTrackCount());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(MediaServiceData.KEY_MEDIA_TYPE, TestValues.GENERAL_MEDIATYPE);
- reference.put(MediaServiceData.KEY_MEDIA_TITLE, TestValues.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_ARTIST, TestValues.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_ALBUM, TestValues.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_MEDIA_IMAGE, TestValues.GENERAL_IMAGE);
- reference.put(MediaServiceData.KEY_PLAYLIST_NAME, TestValues.GENERAL_STRING);
- reference.put(MediaServiceData.KEY_IS_EXPLICIT, TestValues.GENERAL_BOOLEAN);
- reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_CURRENT_TRACK_NUMBER, TestValues.GENERAL_INTEGER);
- reference.put(MediaServiceData.KEY_QUEUE_TOTAL_TRACK_COUNT, TestValues.GENERAL_INTEGER);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if (key.equals(MediaServiceData.KEY_MEDIA_IMAGE)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private MediaServiceData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new MediaServiceData();
+ msg.setMediaType(TestValues.GENERAL_MEDIATYPE);
+ msg.setMediaTitle(TestValues.GENERAL_STRING);
+ msg.setMediaArtist(TestValues.GENERAL_STRING);
+ msg.setMediaAlbum(TestValues.GENERAL_STRING);
+ msg.setMediaImage(TestValues.GENERAL_IMAGE);
+ msg.setPlaylistName(TestValues.GENERAL_STRING);
+ msg.setIsExplicit(TestValues.GENERAL_BOOLEAN);
+ msg.setTrackPlaybackProgress(TestValues.GENERAL_INTEGER);
+ msg.setTrackPlaybackDuration(TestValues.GENERAL_INTEGER);
+ msg.setQueuePlaybackProgress(TestValues.GENERAL_INTEGER);
+ msg.setQueuePlaybackDuration(TestValues.GENERAL_INTEGER);
+ msg.setQueueCurrentTrackNumber(TestValues.GENERAL_INTEGER);
+ msg.setQueueTotalTrackCount(TestValues.GENERAL_INTEGER);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ MediaType mediaType = msg.getMediaType();
+ String mediaTitle = msg.getMediaTitle();
+ String mediaArtist = msg.getMediaArtist();
+ String mediaAlbum = msg.getMediaAlbum();
+ Image mediaImage = msg.getMediaImage();
+ String playlistName = msg.getPlaylistName();
+ boolean isExplicit = msg.getIsExplicit();
+ Integer trackPlaybackProgress = msg.getTrackPlaybackProgress();
+ Integer trackPlaybackDuration = msg.getTrackPlaybackDuration();
+ Integer queuePlaybackProgress = msg.getQueuePlaybackProgress();
+ Integer queuePlaybackDuration = msg.getQueuePlaybackDuration();
+ Integer queueCurrentTrackNumber = msg.getQueueCurrentTrackNumber();
+ Integer queueTotalTrackCount = msg.getQueueTotalTrackCount();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_MEDIATYPE, mediaType);
+ assertEquals(TestValues.GENERAL_STRING, mediaTitle);
+ assertEquals(TestValues.GENERAL_STRING, mediaArtist);
+ assertEquals(TestValues.GENERAL_STRING, mediaAlbum);
+ assertEquals(TestValues.GENERAL_IMAGE, mediaImage);
+ assertEquals(TestValues.GENERAL_STRING, playlistName);
+ assertEquals(TestValues.GENERAL_BOOLEAN, isExplicit);
+ assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackProgress);
+ assertEquals(TestValues.GENERAL_INTEGER, trackPlaybackDuration);
+ assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackProgress);
+ assertEquals(TestValues.GENERAL_INTEGER, queuePlaybackDuration);
+ assertEquals(TestValues.GENERAL_INTEGER, queueCurrentTrackNumber);
+ assertEquals(TestValues.GENERAL_INTEGER, queueTotalTrackCount);
+
+ // Invalid/Null Tests
+ MediaServiceData msg = new MediaServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMediaType());
+ assertNull(TestValues.NULL, msg.getMediaTitle());
+ assertNull(TestValues.NULL, msg.getMediaArtist());
+ assertNull(TestValues.NULL, msg.getMediaAlbum());
+ assertNull(TestValues.NULL, msg.getMediaImage());
+ assertNull(TestValues.NULL, msg.getPlaylistName());
+ assertNull(TestValues.NULL, msg.getIsExplicit());
+ assertNull(TestValues.NULL, msg.getTrackPlaybackProgress());
+ assertNull(TestValues.NULL, msg.getTrackPlaybackDuration());
+ assertNull(TestValues.NULL, msg.getQueuePlaybackProgress());
+ assertNull(TestValues.NULL, msg.getQueuePlaybackDuration());
+ assertNull(TestValues.NULL, msg.getQueueCurrentTrackNumber());
+ assertNull(TestValues.NULL, msg.getQueueTotalTrackCount());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(MediaServiceData.KEY_MEDIA_TYPE, TestValues.GENERAL_MEDIATYPE);
+ reference.put(MediaServiceData.KEY_MEDIA_TITLE, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ARTIST, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_ALBUM, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_IMAGE, TestValues.GENERAL_IMAGE);
+ reference.put(MediaServiceData.KEY_PLAYLIST_NAME, TestValues.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_IS_EXPLICIT, TestValues.GENERAL_BOOLEAN);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_PROGRESS, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_PLAYBACK_DURATION, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_CURRENT_TRACK_NUMBER, TestValues.GENERAL_INTEGER);
+ reference.put(MediaServiceData.KEY_QUEUE_TOTAL_TRACK_COUNT, TestValues.GENERAL_INTEGER);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(MediaServiceData.KEY_MEDIA_IMAGE)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
index d85e064f4..e81f207fe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceManifestTests.java
@@ -11,20 +11,20 @@ import junit.framework.TestCase;
*/
public class MediaServiceManifestTests extends TestCase {
- @Override
- public void setUp(){
- // nothing to setup yet, this class doesn't contain anything
- }
+ @Override
+ public void setUp() {
+ // nothing to setup yet, this class doesn't contain anything
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
- // Invalid/Null Tests
- MediaServiceManifest msg = new MediaServiceManifest();
- assertNotNull(TestValues.NOT_NULL, msg);
- }
+ // Invalid/Null Tests
+ MediaServiceManifest msg = new MediaServiceManifest();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
index c3670f9df..998d8f4d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MenuParamsTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.MenuParams}
*/
-public class MenuParamsTests extends TestCase{
+public class MenuParamsTests extends TestCase {
private MenuParams msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new MenuParams();
msg.setMenuName(TestValues.GENERAL_STRING);
@@ -29,19 +29,19 @@ public class MenuParamsTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
String menuName = msg.getMenuName();
int parentId = msg.getParentID();
int position = msg.getPosition();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, menuName);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, parentId);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, position);
-
+
// Invalid/Null Tests
MenuParams msg = new MenuParams();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -51,10 +51,10 @@ public class MenuParamsTests extends TestCase{
assertNull(TestValues.NULL, msg.getPosition());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(MenuParams.KEY_MENU_NAME, TestValues.GENERAL_STRING);
reference.put(MenuParams.KEY_PARENT_ID, TestValues.GENERAL_INT);
reference.put(MenuParams.KEY_POSITION, TestValues.GENERAL_INT);
@@ -63,12 +63,12 @@ public class MenuParamsTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
index 9b08c8e73..44d5d758a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
@@ -22,89 +22,89 @@ import java.util.List;
public class MetadataTagsTests extends TestCase {
- private MetadataTags msg;
- private MetadataTags msg2;
- private List<MetadataType> exampleList;
-
- @Override
- public void setUp() {
- // Create List for Testing
- exampleList = new ArrayList<>();
- exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
- exampleList.add(1, MetadataType.MEDIA_ALBUM);
- exampleList.add(2, MetadataType.MEDIA_ARTIST);
-
- msg = new MetadataTags();
- msg.setMainField1(exampleList);
- msg.setMainField2(exampleList);
- msg.setMainField3(exampleList);
- msg.setMainField4(exampleList);
-
- // Setup without a list
- msg2 = new MetadataTags();
- msg2.setMainField1(MetadataType.CURRENT_TEMPERATURE);
- msg2.setMainField2(MetadataType.HUMIDITY);
- msg2.setMainField3(MetadataType.MAXIMUM_TEMPERATURE);
- msg2.setMainField4(MetadataType.MEDIA_ALBUM);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- List<MetadataType> mainField1Types = msg.getMainField1();
- List<MetadataType> mainField2Types = msg.getMainField2();
- List<MetadataType> mainField3Types = msg.getMainField3();
- List<MetadataType> mainField4Types = msg.getMainField4();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, exampleList, mainField1Types);
- assertEquals(TestValues.MATCH, exampleList, mainField2Types);
- assertEquals(TestValues.MATCH, exampleList, mainField3Types);
- assertEquals(TestValues.MATCH, exampleList, mainField4Types);
-
- // Test metadata set without a list
- mainField1Types = msg2.getMainField1();
- mainField2Types = msg2.getMainField2();
- mainField3Types = msg2.getMainField3();
- mainField4Types = msg2.getMainField4();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
- assertEquals(TestValues.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
- assertEquals(TestValues.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
- assertEquals(TestValues.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
-
- // Invalid/Null Tests
- MetadataTags msg = new MetadataTags();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getMainField1());
- assertNull(TestValues.NULL, msg.getMainField2());
- assertNull(TestValues.NULL, msg.getMainField3());
- assertNull(TestValues.NULL, msg.getMainField4());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, TestValues.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, TestValues.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, TestValues.JSON_TEXTFIELDTYPES);
- reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, TestValues.JSON_TEXTFIELDTYPES);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private MetadataTags msg;
+ private MetadataTags msg2;
+ private List<MetadataType> exampleList;
+
+ @Override
+ public void setUp() {
+ // Create List for Testing
+ exampleList = new ArrayList<>();
+ exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
+ exampleList.add(1, MetadataType.MEDIA_ALBUM);
+ exampleList.add(2, MetadataType.MEDIA_ARTIST);
+
+ msg = new MetadataTags();
+ msg.setMainField1(exampleList);
+ msg.setMainField2(exampleList);
+ msg.setMainField3(exampleList);
+ msg.setMainField4(exampleList);
+
+ // Setup without a list
+ msg2 = new MetadataTags();
+ msg2.setMainField1(MetadataType.CURRENT_TEMPERATURE);
+ msg2.setMainField2(MetadataType.HUMIDITY);
+ msg2.setMainField3(MetadataType.MAXIMUM_TEMPERATURE);
+ msg2.setMainField4(MetadataType.MEDIA_ALBUM);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<MetadataType> mainField1Types = msg.getMainField1();
+ List<MetadataType> mainField2Types = msg.getMainField2();
+ List<MetadataType> mainField3Types = msg.getMainField3();
+ List<MetadataType> mainField4Types = msg.getMainField4();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, exampleList, mainField1Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField2Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField3Types);
+ assertEquals(TestValues.MATCH, exampleList, mainField4Types);
+
+ // Test metadata set without a list
+ mainField1Types = msg2.getMainField1();
+ mainField2Types = msg2.getMainField2();
+ mainField3Types = msg2.getMainField3();
+ mainField4Types = msg2.getMainField4();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
+ assertEquals(TestValues.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
+
+ // Invalid/Null Tests
+ MetadataTags msg = new MetadataTags();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMainField1());
+ assertNull(TestValues.NULL, msg.getMainField2());
+ assertNull(TestValues.NULL, msg.getMainField3());
+ assertNull(TestValues.NULL, msg.getMainField4());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, TestValues.JSON_TEXTFIELDTYPES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
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 c6a88dcc3..dd48b1baf 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
@@ -27,121 +27,121 @@ import java.util.Iterator;
*/
public class ModuleDataTests extends TestCase {
- private ModuleData msg;
-
- @Override
- public void setUp() {
- msg = new ModuleData();
- msg.setModuleType(TestValues.GENERAL_MODULETYPE);
- msg.setRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA);
- msg.setClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA);
- msg.setSeatControlData(TestValues.GENERAL_SEATCONTROLDATA);
- msg.setAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA);
- msg.setHmiSettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA);
- msg.setLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA);
- msg.setModuleId(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- ModuleType moduleType = msg.getModuleType();
- RadioControlData radioControlData = msg.getRadioControlData();
- ClimateControlData climateControlData = msg.getClimateControlData();
- SeatControlData seatControlData = msg.getSeatControlData();
- AudioControlData audioControlData = msg.getAudioControlData();
- HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData();
- LightControlData lightControlData = msg.getLightControlData();
- String moduleId = msg.getModuleId();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, moduleType);
- assertTrue(TestValues.TRUE, Validator.validateRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA, radioControlData));
- assertTrue(TestValues.TRUE, Validator.validateClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA, climateControlData));
- assertTrue(TestValues.TRUE, Validator.validateSeatControlData(TestValues.GENERAL_SEATCONTROLDATA, seatControlData));
- assertTrue(TestValues.TRUE, Validator.validateAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA, audioControlData));
- assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
- assertTrue(TestValues.TRUE, Validator.validateLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA, lightControlData));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleId);
-
- // Invalid/Null Tests
- ModuleData msg = new ModuleData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModuleType());
- assertNull(TestValues.NULL, msg.getRadioControlData());
- assertNull(TestValues.NULL, msg.getClimateControlData());
- assertNull(TestValues.NULL, msg.getSeatControlData());
- assertNull(TestValues.NULL, msg.getAudioControlData());
- assertNull(TestValues.NULL, msg.getHmiSettingsControlData());
- assertNull(TestValues.NULL, msg.getLightControlData());
- assertNull(TestValues.NULL, msg.getModuleId());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(ModuleData.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
- reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RADIOCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_CLIMATECONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_SEAT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SEATCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_AUDIOCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLDATA.getStore()));
- reference.put(ModuleData.KEY_MODULE_ID, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(ModuleData.KEY_RADIO_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateRadioControlData(new RadioControlData(hashReference), new RadioControlData(hashTest)));
- } else if (key.equals(ModuleData.KEY_CLIMATE_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateClimateControlData(new ClimateControlData(hashReference), new ClimateControlData(hashTest)));
- } else if (key.equals(ModuleData.KEY_SEAT_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateSeatControlData(new SeatControlData(hashReference), new SeatControlData(hashTest)));
- } else if (key.equals(ModuleData.KEY_AUDIO_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateAudioControlData(new AudioControlData(hashReference), new AudioControlData(hashTest)));
- } else if (key.equals(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateHMISettingsControlData(new HMISettingsControlData(hashReference), new HMISettingsControlData(hashTest)));
- } else if (key.equals(ModuleData.KEY_LIGHT_CONTROL_DATA)) {
- 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(TestValues.TRUE, Validator.validateLightControlData(new LightControlData(hashReference), new LightControlData(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private ModuleData msg;
+
+ @Override
+ public void setUp() {
+ msg = new ModuleData();
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA);
+ msg.setClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA);
+ msg.setSeatControlData(TestValues.GENERAL_SEATCONTROLDATA);
+ msg.setAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA);
+ msg.setHmiSettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA);
+ msg.setLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA);
+ msg.setModuleId(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ ModuleType moduleType = msg.getModuleType();
+ RadioControlData radioControlData = msg.getRadioControlData();
+ ClimateControlData climateControlData = msg.getClimateControlData();
+ SeatControlData seatControlData = msg.getSeatControlData();
+ AudioControlData audioControlData = msg.getAudioControlData();
+ HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData();
+ LightControlData lightControlData = msg.getLightControlData();
+ String moduleId = msg.getModuleId();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, moduleType);
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlData(TestValues.GENERAL_RADIOCONTROLDATA, radioControlData));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlData(TestValues.GENERAL_CLIMATECONTROLDATA, climateControlData));
+ assertTrue(TestValues.TRUE, Validator.validateSeatControlData(TestValues.GENERAL_SEATCONTROLDATA, seatControlData));
+ assertTrue(TestValues.TRUE, Validator.validateAudioControlData(TestValues.GENERAL_AUDIOCONTROLDATA, audioControlData));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlData(TestValues.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlData(TestValues.GENERAL_LIGHTCONTROLDATA, lightControlData));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleId);
+
+ // Invalid/Null Tests
+ ModuleData msg = new ModuleData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getRadioControlData());
+ assertNull(TestValues.NULL, msg.getClimateControlData());
+ assertNull(TestValues.NULL, msg.getSeatControlData());
+ assertNull(TestValues.NULL, msg.getAudioControlData());
+ assertNull(TestValues.NULL, msg.getHmiSettingsControlData());
+ assertNull(TestValues.NULL, msg.getLightControlData());
+ assertNull(TestValues.NULL, msg.getModuleId());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(ModuleData.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_RADIOCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_CLIMATECONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_SEAT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SEATCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_AUDIOCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_MODULE_ID, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(ModuleData.KEY_RADIO_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateRadioControlData(new RadioControlData(hashReference), new RadioControlData(hashTest)));
+ } else if (key.equals(ModuleData.KEY_CLIMATE_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateClimateControlData(new ClimateControlData(hashReference), new ClimateControlData(hashTest)));
+ } else if (key.equals(ModuleData.KEY_SEAT_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateSeatControlData(new SeatControlData(hashReference), new SeatControlData(hashTest)));
+ } else if (key.equals(ModuleData.KEY_AUDIO_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateAudioControlData(new AudioControlData(hashReference), new AudioControlData(hashTest)));
+ } else if (key.equals(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateHMISettingsControlData(new HMISettingsControlData(hashReference), new HMISettingsControlData(hashTest)));
+ } else if (key.equals(ModuleData.KEY_LIGHT_CONTROL_DATA)) {
+ 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(TestValues.TRUE, Validator.validateLightControlData(new LightControlData(hashReference), new LightControlData(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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
index ef09a270f..e1af40a70 100644
--- 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
@@ -14,57 +14,57 @@ import org.json.JSONObject;
import java.util.Hashtable;
public class ModuleInfoTests extends TestCase {
- private ModuleInfo msg;
+ private ModuleInfo msg;
- @Override
- public void setUp() {
- msg = new ModuleInfo();
- msg.setModuleId(TestValues.GENERAL_STRING);
- msg.setModuleLocation(TestValues.GENERAL_GRID);
- msg.setModuleServiceArea(TestValues.GENERAL_GRID);
- msg.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
- }
+ @Override
+ public void setUp() {
+ msg = new ModuleInfo();
+ msg.setModuleId(TestValues.GENERAL_STRING);
+ msg.setModuleLocation(TestValues.GENERAL_GRID);
+ msg.setModuleServiceArea(TestValues.GENERAL_GRID);
+ msg.setMultipleAccessAllowance(TestValues.GENERAL_BOOLEAN);
+ }
- public void testRpcValues() {
- String id = msg.getModuleId();
- Grid loc = msg.getModuleLocation();
- Grid area = msg.getModuleServiceArea();
- boolean isAllowed = msg.getMultipleAccessAllowance();
+ public void testRpcValues() {
+ String id = msg.getModuleId();
+ Grid loc = msg.getModuleLocation();
+ Grid area = msg.getModuleServiceArea();
+ boolean isAllowed = msg.getMultipleAccessAllowance();
- //valid tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, loc);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, area);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isAllowed);
+ //valid tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, loc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, area);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isAllowed);
- //null test
- ModuleInfo msg = new ModuleInfo();
- assertNull(TestValues.NULL, msg.getModuleId());
- assertNull(TestValues.NULL, msg.getModuleLocation());
- assertNull(TestValues.NULL, msg.getModuleServiceArea());
- assertNull(TestValues.NULL, msg.getMultipleAccessAllowance());
+ //null test
+ ModuleInfo msg = new ModuleInfo();
+ assertNull(TestValues.NULL, msg.getModuleId());
+ assertNull(TestValues.NULL, msg.getModuleLocation());
+ assertNull(TestValues.NULL, msg.getModuleServiceArea());
+ assertNull(TestValues.NULL, msg.getMultipleAccessAllowance());
- //test required params constructor
- ModuleInfo msg2 = new ModuleInfo(TestValues.GENERAL_STRING);
- assertEquals(TestValues.MATCH, msg2.getModuleId(), TestValues.GENERAL_STRING);
- }
+ //test required params constructor
+ ModuleInfo msg2 = new ModuleInfo(TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, msg2.getModuleId(), TestValues.GENERAL_STRING);
+ }
- public void testJson() {
- JSONObject original = new JSONObject();
- try {
- original.put(ModuleInfo.KEY_MODULE_ID, TestValues.GENERAL_STRING);
- original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
- original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
- original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(ModuleInfo.KEY_MODULE_ID, TestValues.GENERAL_STRING);
+ original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
- JSONObject serialized = msg.serializeJSON();
- assertEquals(TestValues.MATCH, original.length(), serialized.length());
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, original.length(), serialized.length());
- Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
- Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
- assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
+ assertTrue(TestValues.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
index c5dabaf50..05ebd66ff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MyKeyTests.java
@@ -13,29 +13,29 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.MyKey}
*/
-public class MyKeyTests extends TestCase{
+public class MyKeyTests extends TestCase {
private MyKey msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new MyKey();
msg.setE911Override(TestValues.GENERAL_VEHICLEDATASTATUS);
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
VehicleDataStatus override = msg.getE911Override();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATASTATUS, override);
-
+
// Invalid/Null Tests
MyKey msg = new MyKey();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -43,22 +43,22 @@ public class MyKeyTests extends TestCase{
assertNull(TestValues.NULL, msg.getE911Override());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(MyKey.KEY_E_911_OVERRIDE, TestValues.GENERAL_VEHICLEDATASTATUS);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
index af2410155..200d33fbe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.NavigationCapability}
*/
-public class NavigationCapabilityTests extends TestCase{
+public class NavigationCapabilityTests extends TestCase {
private NavigationCapability msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new NavigationCapability();
msg.setSendLocationEnabled(TestValues.GENERAL_BOOLEAN);
@@ -28,10 +28,10 @@ public class NavigationCapabilityTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean sendLocationEnabled = msg.getSendLocationEnabled();
boolean getWayPointsEnabled = msg.getWayPointsEnabled();
@@ -47,10 +47,10 @@ public class NavigationCapabilityTests extends TestCase{
assertNull(TestValues.NULL, msg.getWayPointsEnabled());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(NavigationCapability.KEY_GETWAYPOINTS_ENABLED, TestValues.GENERAL_BOOLEAN);
reference.put(NavigationCapability.KEY_LOCATION_ENABLED, TestValues.GENERAL_BOOLEAN);
@@ -58,12 +58,12 @@ public class NavigationCapabilityTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
index cfb791f02..ff7e9e13e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationInstructionTests.java
@@ -26,109 +26,109 @@ import java.util.Iterator;
*/
public class NavigationInstructionTests extends TestCase {
- private NavigationInstruction msg;
-
- @Override
- public void setUp(){
- msg = new NavigationInstruction();
-
- msg.setLocationDetails(TestValues.GENERAL_LOCATIONDETAILS);
- msg.setAction(TestValues.GENERAL_NAVIGATIONACTION);
- msg.setEta(TestValues.GENERAL_DATETIME);
- msg.setBearing(TestValues.GENERAL_INTEGER);
- msg.setJunctionType(TestValues.GENERAL_NAVIGATION_JUNCTION);
- msg.setDrivingSide(TestValues.GENERAL_DIRECTION);
- msg.setDetails(TestValues.GENERAL_STRING);
- msg.setImage(TestValues.GENERAL_IMAGE);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- LocationDetails locationDetails = msg.getLocationDetails();
- NavigationAction action = msg.getAction();
- DateTime eta = msg.getEta();
- Integer bearing = msg.getBearing();
- NavigationJunction junctionType = msg.getJunctionType();
- Direction drivingSide = msg.getDrivingSide();
- String details = msg.getDetails();
- Image image = msg.getImage();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
- assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
- assertEquals(TestValues.GENERAL_DATETIME, eta);
- assertEquals(TestValues.GENERAL_INTEGER, bearing);
- assertEquals(TestValues.GENERAL_NAVIGATION_JUNCTION, junctionType);
- assertEquals(TestValues.GENERAL_DIRECTION, drivingSide);
- assertEquals(TestValues.GENERAL_STRING, details);
- assertEquals(TestValues.GENERAL_IMAGE, image);
-
- // Invalid/Null Tests
- NavigationInstruction msg = new NavigationInstruction();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getLocationDetails());
- assertNull(TestValues.NULL, msg.getAction());
- assertNull(TestValues.NULL, msg.getEta());
- assertNull(TestValues.NULL, msg.getBearing());
- assertNull(TestValues.NULL, msg.getJunctionType());
- assertNull(TestValues.NULL, msg.getDrivingSide());
- assertNull(TestValues.NULL, msg.getDetails());
- assertNull(TestValues.NULL, msg.getImage());
- }
-
- public void testRequiredConstructor(){
- NavigationInstruction msg = new NavigationInstruction(TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_NAVIGATIONACTION);
- assertNotNull(TestValues.NOT_NULL, msg);
-
- LocationDetails locationDetails = msg.getLocationDetails();
- NavigationAction action = msg.getAction();
-
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
- assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(NavigationInstruction.KEY_LOCATION_DETAILS, TestValues.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationInstruction.KEY_ACTION, TestValues.GENERAL_NAVIGATIONACTION);
- reference.put(NavigationInstruction.KEY_ETA, TestValues.GENERAL_DATETIME);
- reference.put(NavigationInstruction.KEY_BEARING, TestValues.GENERAL_INTEGER);
- reference.put(NavigationInstruction.KEY_JUNCTION_TYPE, TestValues.GENERAL_NAVIGATION_JUNCTION);
- reference.put(NavigationInstruction.KEY_DRIVING_SIDE, TestValues.GENERAL_DIRECTION);
- reference.put(NavigationInstruction.KEY_DETAILS, TestValues.GENERAL_STRING);
- reference.put(NavigationInstruction.KEY_IMAGE, TestValues.GENERAL_IMAGE);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if(key.equals(NavigationInstruction.KEY_IMAGE)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
- assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getImage()));
- }else if(key.equals(NavigationInstruction.KEY_LOCATION_DETAILS)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
- }else if (key.equals(NavigationInstruction.KEY_ETA)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
- }else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private NavigationInstruction msg;
+
+ @Override
+ public void setUp() {
+ msg = new NavigationInstruction();
+
+ msg.setLocationDetails(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setAction(TestValues.GENERAL_NAVIGATIONACTION);
+ msg.setEta(TestValues.GENERAL_DATETIME);
+ msg.setBearing(TestValues.GENERAL_INTEGER);
+ msg.setJunctionType(TestValues.GENERAL_NAVIGATION_JUNCTION);
+ msg.setDrivingSide(TestValues.GENERAL_DIRECTION);
+ msg.setDetails(TestValues.GENERAL_STRING);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+ DateTime eta = msg.getEta();
+ Integer bearing = msg.getBearing();
+ NavigationJunction junctionType = msg.getJunctionType();
+ Direction drivingSide = msg.getDrivingSide();
+ String details = msg.getDetails();
+ Image image = msg.getImage();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
+ assertEquals(TestValues.GENERAL_DATETIME, eta);
+ assertEquals(TestValues.GENERAL_INTEGER, bearing);
+ assertEquals(TestValues.GENERAL_NAVIGATION_JUNCTION, junctionType);
+ assertEquals(TestValues.GENERAL_DIRECTION, drivingSide);
+ assertEquals(TestValues.GENERAL_STRING, details);
+ assertEquals(TestValues.GENERAL_IMAGE, image);
+
+ // Invalid/Null Tests
+ NavigationInstruction msg = new NavigationInstruction();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getLocationDetails());
+ assertNull(TestValues.NULL, msg.getAction());
+ assertNull(TestValues.NULL, msg.getEta());
+ assertNull(TestValues.NULL, msg.getBearing());
+ assertNull(TestValues.NULL, msg.getJunctionType());
+ assertNull(TestValues.NULL, msg.getDrivingSide());
+ assertNull(TestValues.NULL, msg.getDetails());
+ assertNull(TestValues.NULL, msg.getImage());
+ }
+
+ public void testRequiredConstructor() {
+ NavigationInstruction msg = new NavigationInstruction(TestValues.GENERAL_LOCATIONDETAILS, TestValues.GENERAL_NAVIGATIONACTION);
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ LocationDetails locationDetails = msg.getLocationDetails();
+ NavigationAction action = msg.getAction();
+
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, locationDetails);
+ assertEquals(TestValues.GENERAL_NAVIGATIONACTION, action);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(NavigationInstruction.KEY_LOCATION_DETAILS, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationInstruction.KEY_ACTION, TestValues.GENERAL_NAVIGATIONACTION);
+ reference.put(NavigationInstruction.KEY_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationInstruction.KEY_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(NavigationInstruction.KEY_JUNCTION_TYPE, TestValues.GENERAL_NAVIGATION_JUNCTION);
+ reference.put(NavigationInstruction.KEY_DRIVING_SIDE, TestValues.GENERAL_DIRECTION);
+ reference.put(NavigationInstruction.KEY_DETAILS, TestValues.GENERAL_STRING);
+ reference.put(NavigationInstruction.KEY_IMAGE, TestValues.GENERAL_IMAGE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(NavigationInstruction.KEY_IMAGE)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(testEquals));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, msg.getImage()));
+ } else if (key.equals(NavigationInstruction.KEY_LOCATION_DETAILS)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails(TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ } else if (key.equals(NavigationInstruction.KEY_ETA)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
index 9276fc091..d80bfab14 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceDataTests.java
@@ -26,118 +26,118 @@ import java.util.List;
*/
public class NavigationServiceDataTests extends TestCase {
- private NavigationServiceData msg;
-
- @Override
- public void setUp(){
- msg = new NavigationServiceData();
-
- msg.setTimeStamp(TestValues.GENERAL_DATETIME);
- msg.setOrigin(TestValues.GENERAL_LOCATIONDETAILS);
- msg.setDestination(TestValues.GENERAL_LOCATIONDETAILS);
- msg.setDestinationETA(TestValues.GENERAL_DATETIME);
- msg.setInstructions(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
- msg.setNextInstructionETA(TestValues.GENERAL_DATETIME);
- msg.setNextInstructionDistance(TestValues.GENERAL_FLOAT);
- msg.setNextInstructionDistanceScale(TestValues.GENERAL_FLOAT);
- msg.setPrompt(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- DateTime timestamp = msg.getTimeStamp();
- LocationDetails origin = msg.getOrigin();
- LocationDetails destination = msg.getDestination();
- DateTime destinationETA = msg.getDestinationETA();
- List<NavigationInstruction> instructions = msg.getInstructions();
- DateTime nextInstructionETA = msg.getNextInstructionETA();
- Float nextInstructionDistance = msg.getNextInstructionDistance();
- Float nextInstructionDistanceScale = msg.getNextInstructionDistanceScale();
- String prompt = msg.getPrompt();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_DATETIME, timestamp);
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, origin);
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, destination);
- assertEquals(TestValues.GENERAL_DATETIME, destinationETA);
- assertEquals(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, instructions);
- assertEquals(TestValues.GENERAL_DATETIME, nextInstructionETA);
- assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistance);
- assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistanceScale);
- assertEquals(TestValues.GENERAL_STRING, prompt);
-
- // Invalid/Null Tests
- NavigationServiceData msg = new NavigationServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getTimeStamp());
- assertNull(TestValues.NULL, msg.getOrigin());
- assertNull(TestValues.NULL, msg.getDestination());
- assertNull(TestValues.NULL, msg.getDestinationETA());
- assertNull(TestValues.NULL, msg.getInstructions());
- assertNull(TestValues.NULL, msg.getNextInstructionETA());
- assertNull(TestValues.NULL, msg.getNextInstructionDistance());
- assertNull(TestValues.NULL, msg.getNextInstructionDistanceScale());
- assertNull(TestValues.NULL, msg.getPrompt());
- }
-
- public void testRequiredConstructor(){
- NavigationServiceData msg = new NavigationServiceData(TestValues.GENERAL_DATETIME);
- assertNotNull(TestValues.NOT_NULL, msg);
-
- DateTime locationDetails = msg.getTimeStamp();
-
- assertEquals(TestValues.GENERAL_DATETIME, locationDetails);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(NavigationServiceData.KEY_TIMESTAMP, TestValues.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_ORIGIN, TestValues.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationServiceData.KEY_DESTINATION, TestValues.GENERAL_LOCATIONDETAILS);
- reference.put(NavigationServiceData.KEY_DESTINATION_ETA, TestValues.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_INSTRUCTIONS, TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA, TestValues.GENERAL_DATETIME);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE, TestValues.GENERAL_FLOAT);
- reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, TestValues.GENERAL_FLOAT);
- reference.put(NavigationServiceData.KEY_PROMPT, TestValues.GENERAL_STRING);
-
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if(key.equals(NavigationServiceData.KEY_TIMESTAMP)||key.equals(NavigationServiceData.KEY_DESTINATION_ETA)||key.equals(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
- }else if(key.equals(NavigationServiceData.KEY_DESTINATION)||key.equals(NavigationServiceData.KEY_ORIGIN)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
- }else if (key.equals(NavigationServiceData.KEY_INSTRUCTIONS)){
- JSONArray NavigationInstructionUnderTestListArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<NavigationInstruction> NavigationInstructionUnderTestList = new ArrayList<>();
- for (int index = 0; index < NavigationInstructionUnderTestListArrayObjTest.length(); index++) {
- NavigationInstruction NavigationInstructionData = new NavigationInstruction(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)NavigationInstructionUnderTestListArrayObjTest.get(index) ));
- NavigationInstructionUnderTestList.add(NavigationInstructionData);
- }
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateNavigationInstructionList(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
- }else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private NavigationServiceData msg;
+
+ @Override
+ public void setUp() {
+ msg = new NavigationServiceData();
+
+ msg.setTimeStamp(TestValues.GENERAL_DATETIME);
+ msg.setOrigin(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setDestination(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setDestinationETA(TestValues.GENERAL_DATETIME);
+ msg.setInstructions(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ msg.setNextInstructionETA(TestValues.GENERAL_DATETIME);
+ msg.setNextInstructionDistance(TestValues.GENERAL_FLOAT);
+ msg.setNextInstructionDistanceScale(TestValues.GENERAL_FLOAT);
+ msg.setPrompt(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ DateTime timestamp = msg.getTimeStamp();
+ LocationDetails origin = msg.getOrigin();
+ LocationDetails destination = msg.getDestination();
+ DateTime destinationETA = msg.getDestinationETA();
+ List<NavigationInstruction> instructions = msg.getInstructions();
+ DateTime nextInstructionETA = msg.getNextInstructionETA();
+ Float nextInstructionDistance = msg.getNextInstructionDistance();
+ Float nextInstructionDistanceScale = msg.getNextInstructionDistanceScale();
+ String prompt = msg.getPrompt();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_DATETIME, timestamp);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, origin);
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, destination);
+ assertEquals(TestValues.GENERAL_DATETIME, destinationETA);
+ assertEquals(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, instructions);
+ assertEquals(TestValues.GENERAL_DATETIME, nextInstructionETA);
+ assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistance);
+ assertEquals(TestValues.GENERAL_FLOAT, nextInstructionDistanceScale);
+ assertEquals(TestValues.GENERAL_STRING, prompt);
+
+ // Invalid/Null Tests
+ NavigationServiceData msg = new NavigationServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getTimeStamp());
+ assertNull(TestValues.NULL, msg.getOrigin());
+ assertNull(TestValues.NULL, msg.getDestination());
+ assertNull(TestValues.NULL, msg.getDestinationETA());
+ assertNull(TestValues.NULL, msg.getInstructions());
+ assertNull(TestValues.NULL, msg.getNextInstructionETA());
+ assertNull(TestValues.NULL, msg.getNextInstructionDistance());
+ assertNull(TestValues.NULL, msg.getNextInstructionDistanceScale());
+ assertNull(TestValues.NULL, msg.getPrompt());
+ }
+
+ public void testRequiredConstructor() {
+ NavigationServiceData msg = new NavigationServiceData(TestValues.GENERAL_DATETIME);
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ DateTime locationDetails = msg.getTimeStamp();
+
+ assertEquals(TestValues.GENERAL_DATETIME, locationDetails);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(NavigationServiceData.KEY_TIMESTAMP, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_ORIGIN, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(NavigationServiceData.KEY_DESTINATION_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_INSTRUCTIONS, TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA, TestValues.GENERAL_DATETIME);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE, TestValues.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, TestValues.GENERAL_FLOAT);
+ reference.put(NavigationServiceData.KEY_PROMPT, TestValues.GENERAL_STRING);
+
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(NavigationServiceData.KEY_TIMESTAMP) || key.equals(NavigationServiceData.KEY_DESTINATION_ETA) || key.equals(NavigationServiceData.KEY_NEXT_INSTRUCTION_ETA)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else if (key.equals(NavigationServiceData.KEY_DESTINATION) || key.equals(NavigationServiceData.KEY_ORIGIN)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails(TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+ } else if (key.equals(NavigationServiceData.KEY_INSTRUCTIONS)) {
+ JSONArray NavigationInstructionUnderTestListArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<NavigationInstruction> NavigationInstructionUnderTestList = new ArrayList<>();
+ for (int index = 0; index < NavigationInstructionUnderTestListArrayObjTest.length(); index++) {
+ NavigationInstruction NavigationInstructionData = new NavigationInstruction(JsonRPCMarshaller.deserializeJSONObject((JSONObject) NavigationInstructionUnderTestListArrayObjTest.get(index)));
+ NavigationInstructionUnderTestList.add(NavigationInstructionData);
+ }
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateNavigationInstructionList(TestValues.GENERAL_NAVIGATION_INSTRUCTION_LIST, NavigationInstructionUnderTestList));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
index b9298dcf6..3a95f1341 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationServiceManifestTests.java
@@ -17,48 +17,48 @@ import java.util.Iterator;
*/
public class NavigationServiceManifestTests extends TestCase {
- private NavigationServiceManifest msg;
-
- @Override
- public void setUp(){
- msg = new NavigationServiceManifest();
-
- msg.setAcceptsWayPoints(TestValues.GENERAL_BOOLEAN);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- boolean acceptsWayPoints = msg.getAcceptsWayPoints();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_BOOLEAN, acceptsWayPoints);
-
- // Invalid/Null Tests
- NavigationServiceManifest msg = new NavigationServiceManifest();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getAcceptsWayPoints());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private NavigationServiceManifest msg;
+
+ @Override
+ public void setUp() {
+ msg = new NavigationServiceManifest();
+
+ msg.setAcceptsWayPoints(TestValues.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ boolean acceptsWayPoints = msg.getAcceptsWayPoints();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_BOOLEAN, acceptsWayPoints);
+
+ // Invalid/Null Tests
+ NavigationServiceManifest msg = new NavigationServiceManifest();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getAcceptsWayPoints());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(NavigationServiceManifest.KEY_ACCEPTS_WAY_POINTS, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
index 2ea76cd1d..15f096713 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/OasisAddressTests.java
@@ -18,14 +18,14 @@ public class OasisAddressTests extends TestCase {
private OasisAddress msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = TestValues.GENERAL_OASISADDRESS;
}
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
String f1 = msg.getAdministrativeArea();
String f2 = msg.getSubAdministrativeArea();
@@ -64,10 +64,10 @@ public class OasisAddressTests extends TestCase {
assertNull(msg.getSubThoroughfare());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(OasisAddress.KEY_ADMINISTRATIVE_AREA, TestValues.GENERAL_STRING);
reference.put(OasisAddress.KEY_SUB_ADMINISTRATIVE_AREA, TestValues.GENERAL_STRING);
reference.put(OasisAddress.KEY_COUNTRY_CODE, TestValues.GENERAL_STRING);
@@ -88,7 +88,7 @@ public class OasisAddressTests extends TestCase {
underTest.get(key));
}
- } catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
index 1b7074831..f9becd9f2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ParameterPermissionsTests.java
@@ -14,15 +14,15 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ParameterPermissions}
*/
-public class ParameterPermissionsTests extends TestCase{
-
+public class ParameterPermissionsTests extends TestCase {
+
private ParameterPermissions msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new ParameterPermissions();
msg.setAllowed(TestValues.GENERAL_STRING_LIST);
@@ -30,29 +30,29 @@ public class ParameterPermissionsTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- List<String> allowed = msg.getAllowed();
- List<String> disallowed = msg.getUserDisallowed();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, allowed));
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, disallowed));
-
- // Invalid/Null Tests
- ParameterPermissions msg = new ParameterPermissions();
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<String> allowed = msg.getAllowed();
+ List<String> disallowed = msg.getUserDisallowed();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, allowed));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, disallowed));
+
+ // Invalid/Null Tests
+ ParameterPermissions msg = new ParameterPermissions();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
assertNull(TestValues.NULL, msg.getAllowed());
assertNull(TestValues.NULL, msg.getUserDisallowed());
}
-
- public void testJson(){
+
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(ParameterPermissions.KEY_ALLOWED, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
reference.put(ParameterPermissions.KEY_USER_DISALLOWED, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
@@ -60,12 +60,12 @@ public class ParameterPermissionsTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
index 9fa3d7e2c..38eb020ea 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
@@ -15,77 +15,77 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PermissionItem}
*/
public class PermissionItemTest extends TestCase {
- private PermissionItem msg;
+ private PermissionItem msg;
- @Override
- public void setUp() {
- msg = new PermissionItem();
-
- msg.setRpcName(TestValues.GENERAL_STRING);
- msg.setHMIPermissions(TestValues.GENERAL_HMIPERMISSIONS);
- msg.setParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS);
- msg.setRequireEncryption(TestValues.GENERAL_BOOLEAN);
- }
+ @Override
+ public void setUp() {
+ msg = new PermissionItem();
+
+ msg.setRpcName(TestValues.GENERAL_STRING);
+ msg.setHMIPermissions(TestValues.GENERAL_HMIPERMISSIONS);
+ msg.setParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS);
+ msg.setRequireEncryption(TestValues.GENERAL_BOOLEAN);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String rpcName = msg.getRpcName();
- HMIPermissions hmiPermissions = msg.getHMIPermissions();
- ParameterPermissions parameterPermissions = msg.getParameterPermissions();
- boolean isEncryptionRequired = msg.getRequireEncryption();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, rpcName);
- assertTrue(TestValues.TRUE, Validator.validateHmiPermissions(TestValues.GENERAL_HMIPERMISSIONS, hmiPermissions));
- assertTrue(TestValues.TRUE, Validator.validateParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS, parameterPermissions));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isEncryptionRequired);
-
- // Invalid/Null Tests
- PermissionItem msg = new PermissionItem();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getRpcName());
- assertNull(TestValues.NULL, msg.getHMIPermissions());
- assertNull(TestValues.NULL, msg.getParameterPermissions());
- assertNull(TestValues.NULL, msg.getRequireEncryption());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(PermissionItem.KEY_RPC_NAME, TestValues.GENERAL_STRING);
- reference.put(PermissionItem.KEY_HMI_PERMISSIONS, TestValues.JSON_HMIPERMISSIONS);
- reference.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, TestValues.JSON_PARAMETERPERMISSIONS);
- reference.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(PermissionItem.KEY_HMI_PERMISSIONS)) {
- assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else if (key.equals(PermissionItem.KEY_PARAMETER_PERMISSIONS)) {
- assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else if (key.equals(PermissionItem.KEY_REQUIRE_ENCRYPTION)) {
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String rpcName = msg.getRpcName();
+ HMIPermissions hmiPermissions = msg.getHMIPermissions();
+ ParameterPermissions parameterPermissions = msg.getParameterPermissions();
+ boolean isEncryptionRequired = msg.getRequireEncryption();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, rpcName);
+ assertTrue(TestValues.TRUE, Validator.validateHmiPermissions(TestValues.GENERAL_HMIPERMISSIONS, hmiPermissions));
+ assertTrue(TestValues.TRUE, Validator.validateParameterPermissions(TestValues.GENERAL_PARAMETERPERMISSIONS, parameterPermissions));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isEncryptionRequired);
+
+ // Invalid/Null Tests
+ PermissionItem msg = new PermissionItem();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getRpcName());
+ assertNull(TestValues.NULL, msg.getHMIPermissions());
+ assertNull(TestValues.NULL, msg.getParameterPermissions());
+ assertNull(TestValues.NULL, msg.getRequireEncryption());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(PermissionItem.KEY_RPC_NAME, TestValues.GENERAL_STRING);
+ reference.put(PermissionItem.KEY_HMI_PERMISSIONS, TestValues.JSON_HMIPERMISSIONS);
+ reference.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, TestValues.JSON_PARAMETERPERMISSIONS);
+ reference.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(PermissionItem.KEY_HMI_PERMISSIONS)) {
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else if (key.equals(PermissionItem.KEY_PARAMETER_PERMISSIONS)) {
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else if (key.equals(PermissionItem.KEY_REQUIRE_ENCRYPTION)) {
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
index 2125eca16..f85890cbe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
@@ -12,25 +12,25 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PhoneCapability}
*/
-public class PhoneCapabilityTests extends TestCase{
+public class PhoneCapabilityTests extends TestCase {
private PhoneCapability msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new PhoneCapability();
msg.setDialNumberEnabled(TestValues.GENERAL_BOOLEAN);
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
boolean dialNumberEnabled = msg.getDialNumberEnabled();
// Valid Tests
@@ -43,22 +43,22 @@ public class PhoneCapabilityTests extends TestCase{
assertNull(TestValues.NULL, msg.getDialNumberEnabled());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, TestValues.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
index b614ce272..5556c8223 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PresetBankCapabilitiesTest.java
@@ -12,53 +12,53 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PresetBankCapabilities}
*/
public class PresetBankCapabilitiesTest extends TestCase {
-
- private PresetBankCapabilities msg;
- @Override
- public void setUp() {
- msg = new PresetBankCapabilities();
-
- msg.setOnScreenPresetsAvailable(TestValues.GENERAL_BOOLEAN);
- }
+ private PresetBankCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new PresetBankCapabilities();
+
+ msg.setOnScreenPresetsAvailable(TestValues.GENERAL_BOOLEAN);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- boolean presets = msg.onScreenPresetsAvailable();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, presets);
-
- // Invalid/Null Tests
- PresetBankCapabilities msg = new PresetBankCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.onScreenPresetsAvailable());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ boolean presets = msg.onScreenPresetsAvailable();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, presets);
+
+ // Invalid/Null Tests
+ PresetBankCapabilities msg = new PresetBankCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.onScreenPresetsAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(PresetBankCapabilities.KEY_ON_SCREEN_PRESETS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
index d2f0254f4..ebf7fb31c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RGBColorTest.java
@@ -12,59 +12,59 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RGBColor}
*/
public class RGBColorTest extends TestCase {
-
- private RGBColor msg;
- @Override
- public void setUp() {
- msg = new RGBColor(TestValues.GENERAL_INT, TestValues.GENERAL_INT, TestValues.GENERAL_INT);
- }
+ private RGBColor msg;
+
+ @Override
+ public void setUp() {
+ msg = new RGBColor(TestValues.GENERAL_INT, TestValues.GENERAL_INT, TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer red = msg.getRed();
- Integer green = msg.getGreen();
- Integer blue = msg.getBlue();
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer red = msg.getRed();
+ Integer green = msg.getGreen();
+ Integer blue = msg.getBlue();
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, red);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, green);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, blue);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, red);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, green);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, blue);
- // Invalid/Null Tests
- RGBColor msg = new RGBColor();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ RGBColor msg = new RGBColor();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertEquals(TestValues.MATCH, msg.getRed(), (Integer) 0);
- assertEquals(TestValues.MATCH, msg.getGreen(), (Integer) 0);
- assertEquals(TestValues.MATCH, msg.getBlue(), (Integer) 0);
- }
+ assertEquals(TestValues.MATCH, msg.getRed(), (Integer) 0);
+ assertEquals(TestValues.MATCH, msg.getGreen(), (Integer) 0);
+ assertEquals(TestValues.MATCH, msg.getBlue(), (Integer) 0);
+ }
- public void testJson() {
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try {
- reference.put(RGBColor.KEY_RED, TestValues.GENERAL_INT);
- reference.put(RGBColor.KEY_GREEN, TestValues.GENERAL_INT);
- reference.put(RGBColor.KEY_BLUE, TestValues.GENERAL_INT);
+ try {
+ reference.put(RGBColor.KEY_RED, TestValues.GENERAL_INT);
+ reference.put(RGBColor.KEY_GREEN, TestValues.GENERAL_INT);
+ reference.put(RGBColor.KEY_BLUE, TestValues.GENERAL_INT);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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 143c6cb99..dd57d9b16 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
@@ -19,12 +19,12 @@ import java.util.Iterator;
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RadioControlCapabilities}
*/
-public class RadioControlCapabilitiesTests extends TestCase{
-
+public class RadioControlCapabilitiesTests extends TestCase {
+
private RadioControlCapabilities msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new RadioControlCapabilities();
msg.setModuleName(TestValues.GENERAL_STRING);
@@ -45,9 +45,9 @@ public class RadioControlCapabilitiesTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
String moduleName = msg.getModuleName();
boolean radioEnableAvailable = msg.getRadioEnableAvailable();
@@ -104,10 +104,10 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertNull(TestValues.NULL, msg.getAvailableHdChannelsAvailable());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(RadioControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
reference.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, TestValues.GENERAL_BOOLEAN);
@@ -128,7 +128,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(RadioControlCapabilities.KEY_MODULE_INFO)) {
JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
@@ -141,8 +141,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
index e5ac58518..de934e2bc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
@@ -23,12 +23,12 @@ import java.util.List;
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RadioControlData}
*/
-public class RadioControlDataTests extends TestCase{
-
+public class RadioControlDataTests extends TestCase {
+
private RadioControlData msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new RadioControlData();
msg.setFrequencyInteger(TestValues.GENERAL_INT);
@@ -47,9 +47,9 @@ public class RadioControlDataTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
int frequencyInteger = msg.getFrequencyInteger();
int frequencyFraction = msg.getFrequencyFraction();
@@ -99,10 +99,10 @@ public class RadioControlDataTests extends TestCase{
assertNull(TestValues.NULL, msg.getAvailableHdChannels());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(RadioControlData.KEY_FREQUENCY_INTEGER, TestValues.GENERAL_INT);
reference.put(RadioControlData.KEY_FREQUENCY_FRACTION, TestValues.GENERAL_INT);
reference.put(RadioControlData.KEY_BAND, TestValues.GENERAL_RADIOBAND);
@@ -121,31 +121,31 @@ public class RadioControlDataTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(RadioControlData.KEY_RDS_DATA)){
+ if (key.equals(RadioControlData.KEY_RDS_DATA)) {
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(TestValues.TRUE, Validator.validateRdsData(new RdsData(hashReference), new RdsData(hashTest)));
} else if (key.equals(RadioControlData.KEY_SIS_DATA)) {
- 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(TestValues.TRUE, Validator.validateSisData(new SisData(hashReference), new SisData(hashTest)));
- } else if(key.equals(RadioControlData.KEY_AVAILABLE_HD_CHANNELS)){
+ 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(TestValues.TRUE, Validator.validateSisData(new SisData(hashReference), new SisData(hashTest)));
+ } else if (key.equals(RadioControlData.KEY_AVAILABLE_HD_CHANNELS)) {
List<Integer> list1 = TestValues.GENERAL_AVAILABLE_HD_CHANNELS_LIST;
List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1,list2));
- } else{
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(list1, list2));
+ } else {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
index b7b468751..61e5ac127 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
@@ -12,15 +12,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RdsData}
*/
-public class RdsDataTests extends TestCase{
-
+public class RdsDataTests extends TestCase {
+
private RdsData msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new RdsData();
msg.setProgramService(TestValues.GENERAL_STRING);
@@ -34,9 +34,9 @@ public class RdsDataTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
String ps = msg.getProgramService();
String rt = msg.getRadioText();
@@ -71,10 +71,10 @@ public class RdsDataTests extends TestCase{
assertNull(TestValues.NULL, msg.getProgramType());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(RdsData.KEY_PS, TestValues.GENERAL_STRING);
reference.put(RdsData.KEY_RT, TestValues.GENERAL_STRING);
reference.put(RdsData.KEY_CT, TestValues.GENERAL_STRING);
@@ -88,14 +88,14 @@ public class RdsDataTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
index ec8bcad9c..c30a8e5a1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
@@ -17,63 +17,63 @@ import java.util.Iterator;
*/
public class RectangleTests extends TestCase {
- private Rectangle msg;
-
- @Override
- public void setUp() {
- msg = new Rectangle();
-
- msg.setX(TestValues.GENERAL_FLOAT);
- msg.setY(TestValues.GENERAL_FLOAT);
- msg.setWidth(TestValues.GENERAL_FLOAT);
- msg.setHeight(TestValues.GENERAL_FLOAT);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Float x = msg.getX();
- Float y = msg.getY();
- Float width = msg.getWidth();
- Float height = msg.getHeight();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, x);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, y);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, width);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, height);
-
- // Invalid/Null Tests
- Rectangle msg = new Rectangle();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getX());
- assertNull(TestValues.NULL, msg.getY());
- assertNull(TestValues.NULL, msg.getWidth());
- assertNull(TestValues.NULL, msg.getHeight());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(Rectangle.KEY_X, (TestValues.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_Y, (TestValues.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_WIDTH, (TestValues.GENERAL_FLOAT));
- reference.put(Rectangle.KEY_HEIGHT, (TestValues.GENERAL_FLOAT));
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private Rectangle msg;
+
+ @Override
+ public void setUp() {
+ msg = new Rectangle();
+
+ msg.setX(TestValues.GENERAL_FLOAT);
+ msg.setY(TestValues.GENERAL_FLOAT);
+ msg.setWidth(TestValues.GENERAL_FLOAT);
+ msg.setHeight(TestValues.GENERAL_FLOAT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Float x = msg.getX();
+ Float y = msg.getY();
+ Float width = msg.getWidth();
+ Float height = msg.getHeight();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, x);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, y);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, width);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, height);
+
+ // Invalid/Null Tests
+ Rectangle msg = new Rectangle();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getX());
+ assertNull(TestValues.NULL, msg.getY());
+ assertNull(TestValues.NULL, msg.getWidth());
+ assertNull(TestValues.NULL, msg.getHeight());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(Rectangle.KEY_X, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_Y, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_WIDTH, (TestValues.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_HEIGHT, (TestValues.GENERAL_FLOAT));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
index fed1fafda..88dde9f75 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
@@ -30,151 +30,151 @@ import java.util.List;
*/
public class RemoteControlCapabilitiesTests extends TestCase {
- private RemoteControlCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new RemoteControlCapabilities();
- msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST);
- msg.setClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
- msg.setSeatControlCapabilities(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
- msg.setAudioControlCapabilities(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
- msg.setHmiSettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES);
- msg.setLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- List<ButtonCapabilities> buttonCapabilities = msg.getButtonCapabilities();
- List<RadioControlCapabilities> radioControlCapabilities = msg.getRadioControlCapabilities();
- List<ClimateControlCapabilities> climateControlCapabilities = msg.getClimateControlCapabilities();
- List<SeatControlCapabilities> seatControlCapabilities = msg.getSeatControlCapabilities();
- List<AudioControlCapabilities> audioControlCapabilities = msg.getAudioControlCapabilities();
- HMISettingsControlCapabilities hmiSettingsControlCapabilities = msg.getHmiSettingsControlCapabilities();
- LightControlCapabilities lightControlCapabilities = msg.getLightControlCapabilities();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST.size(), seatControlCapabilities.size());
-
- assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateSeatControlCapabilitiesList(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST, seatControlCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateAudioControlCapabilitiesList(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST, audioControlCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES, hmiSettingsControlCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES, lightControlCapabilities));
-
- // Invalid/Null Tests
- RemoteControlCapabilities msg = new RemoteControlCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getButtonCapabilities());
- assertNull(TestValues.NULL, msg.getRadioControlCapabilities());
- assertNull(TestValues.NULL, msg.getClimateControlCapabilities());
- assertNull(TestValues.NULL, msg.getSeatControlCapabilities());
- assertNull(TestValues.NULL, msg.getAudioControlCapabilities());
- assertNull(TestValues.NULL, msg.getHmiSettingsControlCapabilities());
- assertNull(TestValues.NULL, msg.getLightControlCapabilities());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, TestValues.JSON_RADIOCONTROLCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, TestValues.JSON_CLIMATECONTROLCAPABILITIES);
- reference.put(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
- reference.put(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES, TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
- reference.put(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES.getStore()));
- reference.put(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES.getStore()));
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES)) {
- JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(TestValues.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(TestValues.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
- } else if (key.equals(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES)) {
- JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
-
- List<RadioControlCapabilities> referenceList = new ArrayList<RadioControlCapabilities>();
- List<RadioControlCapabilities> testList = new ArrayList<RadioControlCapabilities>();
- for (int i = 0; i < referenceArray.length(); i++) {
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
- referenceList.add(new RadioControlCapabilities(hashReference));
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- testList.add(new RadioControlCapabilities(hashTest));
- }
- assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(referenceList, testList));
- } else if (key.equals(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES)) {
- JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
-
- List<ClimateControlCapabilities> referenceList = new ArrayList<ClimateControlCapabilities>();
- List<ClimateControlCapabilities> testList = new ArrayList<ClimateControlCapabilities>();
- for (int i = 0; i < referenceArray.length(); i++) {
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
- referenceList.add(new ClimateControlCapabilities(hashReference));
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
- testList.add(new ClimateControlCapabilities(hashTest));
- }
- assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList));
- } else if (key.equals(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES)) {
- List<SeatControlCapabilities> sccReference = (List<SeatControlCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray sccArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (SeatControlCapabilities scc : sccReference) {
- assertTrue(Validator.validateSeatControlCapabilities(scc, new SeatControlCapabilities(JsonRPCMarshaller.deserializeJSONObject(sccArray.getJSONObject(i++)))));
- }
- } else if (key.equals(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES)) {
- List<AudioControlCapabilities> accReference = (List<AudioControlCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray accArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (AudioControlCapabilities acc : accReference) {
- assertTrue(Validator.validateAudioControlCapabilities(acc, new AudioControlCapabilities(JsonRPCMarshaller.deserializeJSONObject(accArray.getJSONObject(i++)))));
- }
- } else if (key.equals(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES)) {
- 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(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(new HMISettingsControlCapabilities(hashReference), new HMISettingsControlCapabilities(hashTest)));
- } else if (key.equals(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES)) {
- 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(TestValues.TRUE, Validator.validateLightControlCapabilities(new LightControlCapabilities(hashReference), new LightControlCapabilities(hashTest)));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private RemoteControlCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new RemoteControlCapabilities();
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST);
+ msg.setClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
+ msg.setSeatControlCapabilities(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
+ msg.setAudioControlCapabilities(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
+ msg.setHmiSettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES);
+ msg.setLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<ButtonCapabilities> buttonCapabilities = msg.getButtonCapabilities();
+ List<RadioControlCapabilities> radioControlCapabilities = msg.getRadioControlCapabilities();
+ List<ClimateControlCapabilities> climateControlCapabilities = msg.getClimateControlCapabilities();
+ List<SeatControlCapabilities> seatControlCapabilities = msg.getSeatControlCapabilities();
+ List<AudioControlCapabilities> audioControlCapabilities = msg.getAudioControlCapabilities();
+ HMISettingsControlCapabilities hmiSettingsControlCapabilities = msg.getHmiSettingsControlCapabilities();
+ LightControlCapabilities lightControlCapabilities = msg.getLightControlCapabilities();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST.size(), seatControlCapabilities.size());
+
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(TestValues.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(TestValues.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateSeatControlCapabilitiesList(TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST, seatControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateAudioControlCapabilitiesList(TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST, audioControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES, hmiSettingsControlCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateLightControlCapabilities(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES, lightControlCapabilities));
+
+ // Invalid/Null Tests
+ RemoteControlCapabilities msg = new RemoteControlCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getRadioControlCapabilities());
+ assertNull(TestValues.NULL, msg.getClimateControlCapabilities());
+ assertNull(TestValues.NULL, msg.getSeatControlCapabilities());
+ assertNull(TestValues.NULL, msg.getAudioControlCapabilities());
+ assertNull(TestValues.NULL, msg.getHmiSettingsControlCapabilities());
+ assertNull(TestValues.NULL, msg.getLightControlCapabilities());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, TestValues.JSON_RADIOCONTROLCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, TestValues.JSON_CLIMATECONTROLCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES, TestValues.GENERAL_SEATCONTROLCAPABILITIES_LIST);
+ reference.put(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES, TestValues.GENERAL_AUDIOCONTROLCAPABILITIES_LIST);
+ reference.put(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HMISETTINGSCONTROLCAPABILITIES.getStore()));
+ reference.put(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_LIGHTCONTROLCAPABILITIES.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(TestValues.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(TestValues.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ } else if (key.equals(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<RadioControlCapabilities> referenceList = new ArrayList<RadioControlCapabilities>();
+ List<RadioControlCapabilities> testList = new ArrayList<RadioControlCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new RadioControlCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new RadioControlCapabilities(hashTest));
+ }
+ assertTrue(TestValues.TRUE, Validator.validateRadioControlCapabilities(referenceList, testList));
+ } else if (key.equals(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<ClimateControlCapabilities> referenceList = new ArrayList<ClimateControlCapabilities>();
+ List<ClimateControlCapabilities> testList = new ArrayList<ClimateControlCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new ClimateControlCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new ClimateControlCapabilities(hashTest));
+ }
+ assertTrue(TestValues.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList));
+ } else if (key.equals(RemoteControlCapabilities.KEY_SEAT_CONTROL_CAPABILITIES)) {
+ List<SeatControlCapabilities> sccReference = (List<SeatControlCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray sccArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (SeatControlCapabilities scc : sccReference) {
+ assertTrue(Validator.validateSeatControlCapabilities(scc, new SeatControlCapabilities(JsonRPCMarshaller.deserializeJSONObject(sccArray.getJSONObject(i++)))));
+ }
+ } else if (key.equals(RemoteControlCapabilities.KEY_AUDIO_CONTROL_CAPABILITIES)) {
+ List<AudioControlCapabilities> accReference = (List<AudioControlCapabilities>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray accArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (AudioControlCapabilities acc : accReference) {
+ assertTrue(Validator.validateAudioControlCapabilities(acc, new AudioControlCapabilities(JsonRPCMarshaller.deserializeJSONObject(accArray.getJSONObject(i++)))));
+ }
+ } else if (key.equals(RemoteControlCapabilities.KEY_HMI_SETTINGS_CONTROL_CAPABILITIES)) {
+ 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(TestValues.TRUE, Validator.validateHMISettingsControlCapabilities(new HMISettingsControlCapabilities(hashReference), new HMISettingsControlCapabilities(hashTest)));
+ } else if (key.equals(RemoteControlCapabilities.KEY_LIGHT_CONTROL_CAPABILITIES)) {
+ 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(TestValues.TRUE, Validator.validateLightControlCapabilities(new LightControlCapabilities(hashReference), new LightControlCapabilities(hashTest)));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
index eb618abcf..0e69ca513 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ScreenParamsTest.java
@@ -16,75 +16,75 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ScreenParams}
*/
public class ScreenParamsTest extends TestCase {
-
- private ScreenParams msg;
- @Override
- public void setUp() {
- msg = new ScreenParams();
-
- msg.setImageResolution(TestValues.GENERAL_IMAGERESOLUTION);
- msg.setTouchEventAvailable(TestValues.GENERAL_TOUCHEVENTCAPABILITIES);
- }
+ private ScreenParams msg;
+
+ @Override
+ public void setUp() {
+ msg = new ScreenParams();
+
+ msg.setImageResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ msg.setTouchEventAvailable(TestValues.GENERAL_TOUCHEVENTCAPABILITIES);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- ImageResolution imageRes = msg.getImageResolution();
- TouchEventCapabilities touchEvent = msg.getTouchEventAvailable();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateImageResolution(TestValues.GENERAL_IMAGERESOLUTION, imageRes));
- assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(TestValues.GENERAL_TOUCHEVENTCAPABILITIES, touchEvent));
-
- // Invalid/Null Tests
- ScreenParams msg = new ScreenParams();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getImageResolution());
- assertNull(TestValues.NULL, msg.getTouchEventAvailable());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(ScreenParams.KEY_RESOLUTION, TestValues.JSON_IMAGERESOLUTION);
- reference.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, TestValues.JSON_TOUCHEVENTCAPABILITIES);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE)) {
- JSONObject touchEventObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject touchEventObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(
- new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjReference)),
- new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjTest))));
- } else if (key.equals(ScreenParams.KEY_RESOLUTION)) {
- JSONObject resolutionObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject resolutionObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateImageResolution(
- new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjReference)),
- new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjTest))));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ ImageResolution imageRes = msg.getImageResolution();
+ TouchEventCapabilities touchEvent = msg.getTouchEventAvailable();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(TestValues.GENERAL_IMAGERESOLUTION, imageRes));
+ assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(TestValues.GENERAL_TOUCHEVENTCAPABILITIES, touchEvent));
+
+ // Invalid/Null Tests
+ ScreenParams msg = new ScreenParams();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getImageResolution());
+ assertNull(TestValues.NULL, msg.getTouchEventAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(ScreenParams.KEY_RESOLUTION, TestValues.JSON_IMAGERESOLUTION);
+ reference.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, TestValues.JSON_TOUCHEVENTCAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE)) {
+ JSONObject touchEventObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject touchEventObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateTouchEventCapabilities(
+ new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjReference)),
+ new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjTest))));
+ } else if (key.equals(ScreenParams.KEY_RESOLUTION)) {
+ JSONObject resolutionObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject resolutionObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateImageResolution(
+ new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjReference)),
+ new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjTest))));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
index 8cadc99bf..0b8eb2842 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SdlMsgVersionTest.java
@@ -12,63 +12,63 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SdlMsgVersion}
*/
public class SdlMsgVersionTest extends TestCase {
-
- private SdlMsgVersion msg;
- @Override
- public void setUp() {
- msg = new SdlMsgVersion();
+ private SdlMsgVersion msg;
- msg.setMajorVersion(TestValues.GENERAL_INT);
- msg.setMinorVersion(TestValues.GENERAL_INT);
- msg.setPatchVersion(TestValues.GENERAL_INT);
- }
+ @Override
+ public void setUp() {
+ msg = new SdlMsgVersion();
+
+ msg.setMajorVersion(TestValues.GENERAL_INT);
+ msg.setMinorVersion(TestValues.GENERAL_INT);
+ msg.setPatchVersion(TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer major = msg.getMajorVersion();
- Integer minor = msg.getMinorVersion();
- Integer patch = msg.getPatchVersion();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, major);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minor);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, patch);
-
- // Invalid/Null Tests
- SdlMsgVersion msg = new SdlMsgVersion();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getMajorVersion());
- assertNull(TestValues.NULL, msg.getMinorVersion());
- assertNull(TestValues.NULL, msg.getPatchVersion());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SdlMsgVersion.KEY_MAJOR_VERSION, TestValues.GENERAL_INT);
- reference.put(SdlMsgVersion.KEY_MINOR_VERSION, TestValues.GENERAL_INT);
- reference.put(SdlMsgVersion.KEY_PATCH_VERSION, TestValues.GENERAL_INT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer major = msg.getMajorVersion();
+ Integer minor = msg.getMinorVersion();
+ Integer patch = msg.getPatchVersion();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, major);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minor);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, patch);
+
+ // Invalid/Null Tests
+ SdlMsgVersion msg = new SdlMsgVersion();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMajorVersion());
+ assertNull(TestValues.NULL, msg.getMinorVersion());
+ assertNull(TestValues.NULL, msg.getPatchVersion());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SdlMsgVersion.KEY_MAJOR_VERSION, TestValues.GENERAL_INT);
+ reference.put(SdlMsgVersion.KEY_MINOR_VERSION, TestValues.GENERAL_INT);
+ reference.put(SdlMsgVersion.KEY_PATCH_VERSION, TestValues.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
index 2831d2416..8e5001035 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlCapabilitiesTest.java
@@ -17,125 +17,125 @@ import java.util.Iterator;
*/
public class SeatControlCapabilitiesTest extends TestCase {
- private SeatControlCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new SeatControlCapabilities();
- msg.setModuleName(TestValues.GENERAL_STRING);
- msg.setHeatingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setCoolingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setHeatingLevelAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setCoolingLevelAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setFrontVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setBackVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setBackTiltAngleAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setHeadSupportVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setHeadSupportHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setMassageEnabledAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setMassageModeAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setMassageCushionFirmnessAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setMemoryAvailable(TestValues.GENERAL_BOOLEAN);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- String moduleName = msg.getModuleName();
- Boolean heatingEnabledAvailable = msg.getHeatingEnabledAvailable();
- Boolean coolingEnabledAvailable = msg.getCoolingEnabledAvailable();
- Boolean heatingLevelAvailable = msg.getHeatingLevelAvailable();
- Boolean coolingLevelAvailable = msg.getCoolingLevelAvailable();
- Boolean horizontalPositionAvailable = msg.getHorizontalPositionAvailable();
- Boolean verticalPositionAvailable = msg.getVerticalPositionAvailable();
- Boolean frontVerticalPositionAvailable = msg.getFrontVerticalPositionAvailable();
- Boolean backVerticalPositionAvailable = msg.getBackVerticalPositionAvailable();
- Boolean backTiltAngleAvailable = msg.getBackTiltAngleAvailable();
- Boolean headSupportHorizontalPositionAvailable = msg.getHeadSupportHorizontalPositionAvailable();
- Boolean headSupportVerticalPositionAvailable = msg.getHeadSupportVerticalPositionAvailable();
- Boolean massageEnabledAvailable = msg.getMassageEnabledAvailable();
- Boolean massageModeAvailable = msg.getMassageModeAvailable();
- Boolean massageCushionFirmnessAvailable = msg.getMassageCushionFirmnessAvailable();
-
- Boolean memoryAvailable = msg.getMemoryAvailable();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabledAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabledAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingLevelAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingLevelAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, horizontalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, verticalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, frontVerticalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backVerticalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backTiltAngleAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportHorizontalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportVerticalPositionAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabledAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageModeAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageCushionFirmnessAvailable);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, memoryAvailable);
-
- // Invalid/Null Tests
- SeatControlCapabilities msg = new SeatControlCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModuleName());
- assertNull(TestValues.NULL, msg.getHeatingEnabledAvailable());
- assertNull(TestValues.NULL, msg.getCoolingEnabledAvailable());
- assertNull(TestValues.NULL, msg.getHeatingLevelAvailable());
- assertNull(TestValues.NULL, msg.getCoolingLevelAvailable());
- assertNull(TestValues.NULL, msg.getHorizontalPositionAvailable());
- assertNull(TestValues.NULL, msg.getVerticalPositionAvailable());
- assertNull(TestValues.NULL, msg.getFrontVerticalPositionAvailable());
- assertNull(TestValues.NULL, msg.getBackVerticalPositionAvailable());
- assertNull(TestValues.NULL, msg.getBackTiltAngleAvailable());
- assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPositionAvailable());
- assertNull(TestValues.NULL, msg.getHeadSupportVerticalPositionAvailable());
- assertNull(TestValues.NULL, msg.getMassageEnabledAvailable());
- assertNull(TestValues.NULL, msg.getMassageModeAvailable());
- assertNull(TestValues.NULL, msg.getMassageCushionFirmnessAvailable());
- assertNull(TestValues.NULL, msg.getMemoryAvailable());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SeatControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
- reference.put(SeatControlCapabilities.KEY_HEATING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_COOLING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEATING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_COOLING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_FRONT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_BACK_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_BACK_TILT_ANGLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_MASSAGE_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- reference.put(SeatControlCapabilities.KEY_MASSAGE_MODE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlCapabilities.KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- reference.put(SeatControlCapabilities.KEY_MEMORY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private SeatControlCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatControlCapabilities();
+ msg.setModuleName(TestValues.GENERAL_STRING);
+ msg.setHeatingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatingLevelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingLevelAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setFrontVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setBackVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setBackTiltAngleAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadSupportVerticalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadSupportHorizontalPositionAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageEnabledAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageModeAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageCushionFirmnessAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMemoryAvailable(TestValues.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String moduleName = msg.getModuleName();
+ Boolean heatingEnabledAvailable = msg.getHeatingEnabledAvailable();
+ Boolean coolingEnabledAvailable = msg.getCoolingEnabledAvailable();
+ Boolean heatingLevelAvailable = msg.getHeatingLevelAvailable();
+ Boolean coolingLevelAvailable = msg.getCoolingLevelAvailable();
+ Boolean horizontalPositionAvailable = msg.getHorizontalPositionAvailable();
+ Boolean verticalPositionAvailable = msg.getVerticalPositionAvailable();
+ Boolean frontVerticalPositionAvailable = msg.getFrontVerticalPositionAvailable();
+ Boolean backVerticalPositionAvailable = msg.getBackVerticalPositionAvailable();
+ Boolean backTiltAngleAvailable = msg.getBackTiltAngleAvailable();
+ Boolean headSupportHorizontalPositionAvailable = msg.getHeadSupportHorizontalPositionAvailable();
+ Boolean headSupportVerticalPositionAvailable = msg.getHeadSupportVerticalPositionAvailable();
+ Boolean massageEnabledAvailable = msg.getMassageEnabledAvailable();
+ Boolean massageModeAvailable = msg.getMassageModeAvailable();
+ Boolean massageCushionFirmnessAvailable = msg.getMassageCushionFirmnessAvailable();
+
+ Boolean memoryAvailable = msg.getMemoryAvailable();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, moduleName);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingLevelAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingLevelAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, horizontalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, verticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, frontVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, backTiltAngleAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportHorizontalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, headSupportVerticalPositionAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabledAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageModeAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageCushionFirmnessAvailable);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, memoryAvailable);
+
+ // Invalid/Null Tests
+ SeatControlCapabilities msg = new SeatControlCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModuleName());
+ assertNull(TestValues.NULL, msg.getHeatingEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getCoolingEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getHeatingLevelAvailable());
+ assertNull(TestValues.NULL, msg.getCoolingLevelAvailable());
+ assertNull(TestValues.NULL, msg.getHorizontalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getFrontVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getBackVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getBackTiltAngleAvailable());
+ assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getHeadSupportVerticalPositionAvailable());
+ assertNull(TestValues.NULL, msg.getMassageEnabledAvailable());
+ assertNull(TestValues.NULL, msg.getMassageModeAvailable());
+ assertNull(TestValues.NULL, msg.getMassageCushionFirmnessAvailable());
+ assertNull(TestValues.NULL, msg.getMemoryAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SeatControlCapabilities.KEY_MODULE_NAME, TestValues.GENERAL_STRING);
+ reference.put(SeatControlCapabilities.KEY_HEATING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_COOLING_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEATING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_COOLING_LEVEL_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_FRONT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_BACK_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_BACK_TILT_ANGLE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_ENABLED_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_MODE_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlCapabilities.KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlCapabilities.KEY_MEMORY_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
index b275f784f..b8dfe214d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatControlDataTest.java
@@ -26,148 +26,148 @@ import java.util.List;
*/
public class SeatControlDataTest extends TestCase {
- private SeatControlData msg;
-
- @Override
- public void setUp() {
- msg = new SeatControlData();
- msg.setId(TestValues.GENERAL_SUPPORTEDSEAT);
- msg.setHeatingEnabled(TestValues.GENERAL_BOOLEAN);
- msg.setCoolingEnabled(TestValues.GENERAL_BOOLEAN);
- msg.setHeatingLevel(TestValues.GENERAL_INT);
- msg.setCoolingLevel(TestValues.GENERAL_INT);
- msg.setHorizontalPosition(TestValues.GENERAL_INT);
- msg.setVerticalPosition(TestValues.GENERAL_INT);
- msg.setFrontVerticalPosition(TestValues.GENERAL_INT);
- msg.setBackVerticalPosition(TestValues.GENERAL_INT);
- msg.setBackTiltAngle(TestValues.GENERAL_INT);
- msg.setHeadSupportVerticalPosition(TestValues.GENERAL_INT);
- msg.setHeadSupportHorizontalPosition(TestValues.GENERAL_INT);
- msg.setMassageEnabled(TestValues.GENERAL_BOOLEAN);
- msg.setMassageMode(TestValues.GENERAL_MASSAGEMODEDATA_LIST);
- msg.setMassageCushionFirmness(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
- msg.setMemory(TestValues.GENERAL_SEATMEMORYACTION);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- SupportedSeat id = msg.getId();
- Boolean heatingEnabled = msg.getHeatingEnabled();
- Boolean coolingEnabled = msg.getCoolingEnabled();
- Integer heatingLevel = msg.getHeatingLevel();
- Integer coolingLevel = msg.getCoolingLevel();
- Integer horizontalPosition = msg.getHorizontalPosition();
- Integer verticalPosition = msg.getVerticalPosition();
- Integer frontVerticalPosition = msg.getFrontVerticalPosition();
- Integer backVerticalPosition = msg.getBackVerticalPosition();
- Integer backTiltAngle = msg.getBackTiltAngle();
- Integer headSupportHorizontalPosition = msg.getHeadSupportHorizontalPosition();
- Integer headSupportVerticalPosition = msg.getHeadSupportVerticalPosition();
- Boolean massageEnabled = msg.getMassageEnabled();
-
- List<MassageModeData> massageMode = msg.getMassageMode();
- List<MassageCushionFirmness> massageCushionFirmness = msg.getMassageCushionFirmness();
- SeatMemoryAction memory = msg.getMemory();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SUPPORTEDSEAT, id);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabled);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabled);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, heatingLevel);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, coolingLevel);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, horizontalPosition);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, verticalPosition);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, frontVerticalPosition);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backVerticalPosition);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backTiltAngle);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportHorizontalPosition);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportVerticalPosition);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabled);
-
- assertTrue(TestValues.TRUE, Validator.validateMassageModeDataList(TestValues.GENERAL_MASSAGEMODEDATA_LIST, massageMode));
- assertTrue(TestValues.TRUE, Validator.validateMassageCushionFirmnessList(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST, massageCushionFirmness));
-
- assertTrue(TestValues.TRUE, Validator.validateSeatMemoryAction(TestValues.GENERAL_SEATMEMORYACTION, memory));
-
- // Invalid/Null Tests
- SeatControlData msg = new SeatControlData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getId());
- assertNull(TestValues.NULL, msg.getHeatingEnabled());
- assertNull(TestValues.NULL, msg.getCoolingEnabled());
- assertNull(TestValues.NULL, msg.getHeatingLevel());
- assertNull(TestValues.NULL, msg.getCoolingLevel());
- assertNull(TestValues.NULL, msg.getHorizontalPosition());
- assertNull(TestValues.NULL, msg.getVerticalPosition());
- assertNull(TestValues.NULL, msg.getFrontVerticalPosition());
- assertNull(TestValues.NULL, msg.getBackVerticalPosition());
- assertNull(TestValues.NULL, msg.getBackTiltAngle());
- assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPosition());
- assertNull(TestValues.NULL, msg.getHeadSupportVerticalPosition());
- assertNull(TestValues.NULL, msg.getMassageEnabled());
- assertNull(TestValues.NULL, msg.getMassageMode());
- assertNull(TestValues.NULL, msg.getMassageCushionFirmness());
- assertNull(TestValues.NULL, msg.getMemory());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SeatControlData.KEY_ID, TestValues.GENERAL_SUPPORTEDSEAT);
- reference.put(SeatControlData.KEY_HEATING_ENABLED, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlData.KEY_COOLING_ENABLED, TestValues.GENERAL_BOOLEAN);
- reference.put(SeatControlData.KEY_HEATING_LEVEL, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_COOLING_LEVEL, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_VERTICAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_FRONT_VERTICAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_BACK_VERTICAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_BACK_TILT_ANGLE, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_HEAD_SUPPORT_VERTICAL_POSITION, TestValues.GENERAL_INT);
- reference.put(SeatControlData.KEY_MASSAGE_ENABLED, TestValues.GENERAL_BOOLEAN);
-
- reference.put(SeatControlData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODEDATA_LIST);
- reference.put(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS, TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
-
- reference.put(SeatControlData.KEY_MEMORY, TestValues.GENERAL_SEATMEMORYACTION);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(SeatControlData.KEY_MASSAGE_MODE)) {
- List<MassageModeData> mmdReference = (List<MassageModeData>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray mmdArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (MassageModeData mmd : mmdReference) {
- assertTrue(Validator.validateMassageModeData(mmd, new MassageModeData(JsonRPCMarshaller.deserializeJSONObject(mmdArray.getJSONObject(i++)))));
- }
- } else if (key.equals(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS)) {
- List<MassageCushionFirmness> mcfReference = (List<MassageCushionFirmness>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray mcfArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- for (MassageCushionFirmness mcf : mcfReference) {
- assertTrue(Validator.validateMassageCushionFirmness(mcf, new MassageCushionFirmness(JsonRPCMarshaller.deserializeJSONObject(mcfArray.getJSONObject(i++)))));
- }
- } else if (key.equals(SeatControlData.KEY_MEMORY)) {
- SeatMemoryAction mReference = (SeatMemoryAction) JsonUtils.readObjectFromJsonObject(reference, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
- assertTrue(Validator.validateSeatMemoryAction(mReference, new SeatMemoryAction(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private SeatControlData msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatControlData();
+ msg.setId(TestValues.GENERAL_SUPPORTEDSEAT);
+ msg.setHeatingEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setCoolingEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setHeatingLevel(TestValues.GENERAL_INT);
+ msg.setCoolingLevel(TestValues.GENERAL_INT);
+ msg.setHorizontalPosition(TestValues.GENERAL_INT);
+ msg.setVerticalPosition(TestValues.GENERAL_INT);
+ msg.setFrontVerticalPosition(TestValues.GENERAL_INT);
+ msg.setBackVerticalPosition(TestValues.GENERAL_INT);
+ msg.setBackTiltAngle(TestValues.GENERAL_INT);
+ msg.setHeadSupportVerticalPosition(TestValues.GENERAL_INT);
+ msg.setHeadSupportHorizontalPosition(TestValues.GENERAL_INT);
+ msg.setMassageEnabled(TestValues.GENERAL_BOOLEAN);
+ msg.setMassageMode(TestValues.GENERAL_MASSAGEMODEDATA_LIST);
+ msg.setMassageCushionFirmness(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
+ msg.setMemory(TestValues.GENERAL_SEATMEMORYACTION);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ SupportedSeat id = msg.getId();
+ Boolean heatingEnabled = msg.getHeatingEnabled();
+ Boolean coolingEnabled = msg.getCoolingEnabled();
+ Integer heatingLevel = msg.getHeatingLevel();
+ Integer coolingLevel = msg.getCoolingLevel();
+ Integer horizontalPosition = msg.getHorizontalPosition();
+ Integer verticalPosition = msg.getVerticalPosition();
+ Integer frontVerticalPosition = msg.getFrontVerticalPosition();
+ Integer backVerticalPosition = msg.getBackVerticalPosition();
+ Integer backTiltAngle = msg.getBackTiltAngle();
+ Integer headSupportHorizontalPosition = msg.getHeadSupportHorizontalPosition();
+ Integer headSupportVerticalPosition = msg.getHeadSupportVerticalPosition();
+ Boolean massageEnabled = msg.getMassageEnabled();
+
+ List<MassageModeData> massageMode = msg.getMassageMode();
+ List<MassageCushionFirmness> massageCushionFirmness = msg.getMassageCushionFirmness();
+ SeatMemoryAction memory = msg.getMemory();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SUPPORTEDSEAT, id);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, heatingEnabled);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, coolingEnabled);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, heatingLevel);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, coolingLevel);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, horizontalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, verticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, frontVerticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backVerticalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, backTiltAngle);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportHorizontalPosition);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, headSupportVerticalPosition);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, massageEnabled);
+
+ assertTrue(TestValues.TRUE, Validator.validateMassageModeDataList(TestValues.GENERAL_MASSAGEMODEDATA_LIST, massageMode));
+ assertTrue(TestValues.TRUE, Validator.validateMassageCushionFirmnessList(TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST, massageCushionFirmness));
+
+ assertTrue(TestValues.TRUE, Validator.validateSeatMemoryAction(TestValues.GENERAL_SEATMEMORYACTION, memory));
+
+ // Invalid/Null Tests
+ SeatControlData msg = new SeatControlData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getHeatingEnabled());
+ assertNull(TestValues.NULL, msg.getCoolingEnabled());
+ assertNull(TestValues.NULL, msg.getHeatingLevel());
+ assertNull(TestValues.NULL, msg.getCoolingLevel());
+ assertNull(TestValues.NULL, msg.getHorizontalPosition());
+ assertNull(TestValues.NULL, msg.getVerticalPosition());
+ assertNull(TestValues.NULL, msg.getFrontVerticalPosition());
+ assertNull(TestValues.NULL, msg.getBackVerticalPosition());
+ assertNull(TestValues.NULL, msg.getBackTiltAngle());
+ assertNull(TestValues.NULL, msg.getHeadSupportHorizontalPosition());
+ assertNull(TestValues.NULL, msg.getHeadSupportVerticalPosition());
+ assertNull(TestValues.NULL, msg.getMassageEnabled());
+ assertNull(TestValues.NULL, msg.getMassageMode());
+ assertNull(TestValues.NULL, msg.getMassageCushionFirmness());
+ assertNull(TestValues.NULL, msg.getMemory());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SeatControlData.KEY_ID, TestValues.GENERAL_SUPPORTEDSEAT);
+ reference.put(SeatControlData.KEY_HEATING_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlData.KEY_COOLING_ENABLED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SeatControlData.KEY_HEATING_LEVEL, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_COOLING_LEVEL, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_FRONT_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_BACK_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_BACK_TILT_ANGLE, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HEAD_SUPPORT_HORIZONTAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_HEAD_SUPPORT_VERTICAL_POSITION, TestValues.GENERAL_INT);
+ reference.put(SeatControlData.KEY_MASSAGE_ENABLED, TestValues.GENERAL_BOOLEAN);
+
+ reference.put(SeatControlData.KEY_MASSAGE_MODE, TestValues.GENERAL_MASSAGEMODEDATA_LIST);
+ reference.put(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS, TestValues.GENERAL_MASSAGECUSHIONFIRMNESS_LIST);
+
+ reference.put(SeatControlData.KEY_MEMORY, TestValues.GENERAL_SEATMEMORYACTION);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(SeatControlData.KEY_MASSAGE_MODE)) {
+ List<MassageModeData> mmdReference = (List<MassageModeData>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray mmdArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (MassageModeData mmd : mmdReference) {
+ assertTrue(Validator.validateMassageModeData(mmd, new MassageModeData(JsonRPCMarshaller.deserializeJSONObject(mmdArray.getJSONObject(i++)))));
+ }
+ } else if (key.equals(SeatControlData.KEY_MASSAGE_CUSHION_FIRMNESS)) {
+ List<MassageCushionFirmness> mcfReference = (List<MassageCushionFirmness>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray mcfArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ for (MassageCushionFirmness mcf : mcfReference) {
+ assertTrue(Validator.validateMassageCushionFirmness(mcf, new MassageCushionFirmness(JsonRPCMarshaller.deserializeJSONObject(mcfArray.getJSONObject(i++)))));
+ }
+ } else if (key.equals(SeatControlData.KEY_MEMORY)) {
+ SeatMemoryAction mReference = (SeatMemoryAction) JsonUtils.readObjectFromJsonObject(reference, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
+ assertTrue(Validator.validateSeatMemoryAction(mReference, new SeatMemoryAction(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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
index 1666c89fb..23e15aee1 100644
--- 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
@@ -20,80 +20,80 @@ import java.util.List;
public class SeatLocationCapabilityTests extends TestCase {
- private SeatLocationCapability msg;
+ private SeatLocationCapability msg;
- @Override
- public void setUp() {
- msg = new SeatLocationCapability();
- msg.setCols(TestValues.GENERAL_INT);
- msg.setRows(TestValues.GENERAL_INT);
- msg.setLevels(TestValues.GENERAL_INT);
- msg.setSeats(TestValues.GENERAL_SEAT_LIST);
- }
+ @Override
+ public void setUp() {
+ msg = new SeatLocationCapability();
+ msg.setCols(TestValues.GENERAL_INT);
+ msg.setRows(TestValues.GENERAL_INT);
+ msg.setLevels(TestValues.GENERAL_INT);
+ msg.setSeats(TestValues.GENERAL_SEAT_LIST);
+ }
- public void testRpcValues() {
- int row = msg.getRows();
- int col = msg.getCols();
- int level = msg.getLevels();
- List<SeatLocation> seats = msg.getSeats();
+ public void testRpcValues() {
+ int row = msg.getRows();
+ int col = msg.getCols();
+ int level = msg.getLevels();
+ List<SeatLocation> seats = msg.getSeats();
- //valid tests
- assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
- assertEquals(TestValues.MATCH, seats.size(), TestValues.GENERAL_SEAT_LIST.size());
- for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
- assertTrue(TestValues.TRUE, Validator.validateGrid(TestValues.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
- }
+ //valid tests
+ assertEquals(TestValues.MATCH, row, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, col, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, level, TestValues.GENERAL_INT);
+ assertEquals(TestValues.MATCH, seats.size(), TestValues.GENERAL_SEAT_LIST.size());
+ for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
+ assertTrue(TestValues.TRUE, Validator.validateGrid(TestValues.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
+ }
- //null tests
- SeatLocationCapability msg = new SeatLocationCapability();
- assertNull(TestValues.NULL, msg.getCols());
- assertNull(TestValues.NULL, msg.getRows());
- assertNull(TestValues.NULL, msg.getLevels());
- assertNull(TestValues.NULL, msg.getSeats());
- }
+ //null tests
+ SeatLocationCapability msg = new SeatLocationCapability();
+ assertNull(TestValues.NULL, msg.getCols());
+ assertNull(TestValues.NULL, msg.getRows());
+ assertNull(TestValues.NULL, msg.getLevels());
+ assertNull(TestValues.NULL, msg.getSeats());
+ }
- public void testJson() {
- JSONObject original = new JSONObject();
- try {
- original.put(SeatLocationCapability.KEY_COLS, TestValues.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_ROWS, TestValues.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_LEVELS, TestValues.GENERAL_INT);
- original.put(SeatLocationCapability.KEY_SEATS, TestValues.JSON_SEAT_LOCATIONS);
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocationCapability.KEY_COLS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_ROWS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_LEVELS, TestValues.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_SEATS, TestValues.JSON_SEAT_LOCATIONS);
- JSONObject serialized = msg.serializeJSON();
- assertEquals(serialized.length(), original.length());
+ 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(TestValues.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(TestValues.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(TestValues.MATCH, i1, i2);
- } else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
- JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
- JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
- assertEquals(TestValues.MATCH, arr1.length(), arr2.length());
- for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
- Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
- Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
- assertTrue(TestValues.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
- }
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ 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(TestValues.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(TestValues.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(TestValues.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
+ JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
+ JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
+ assertEquals(TestValues.MATCH, arr1.length(), arr2.length());
+ for (int i = 0; i < TestValues.GENERAL_SEAT_LIST.size(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
+ assertTrue(TestValues.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.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
index cf954b702..958b55317 100644
--- 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
@@ -13,36 +13,36 @@ import org.json.JSONObject;
public class SeatLocationTests extends TestCase {
- private SeatLocation msg;
-
- @Override
- public void setUp() {
- msg = new SeatLocation();
- msg.setGrid(TestValues.GENERAL_GRID);
- }
-
- public void testRpcValues() {
- Grid grid = msg.getGrid();
-
- //valid test
- assertTrue(Validator.validateGrid(TestValues.GENERAL_GRID, grid));
-
- //null test
- SeatLocation msg = new SeatLocation();
- assertNull(TestValues.NULL, msg.getGrid());
- }
-
- public void testJson() {
- JSONObject original = new JSONObject();
- try {
- original.put(SeatLocation.KEY_GRID, TestValues.GENERAL_GRID);
-
- JSONObject serialized = msg.serializeJSON();
- assertEquals(serialized.length(), original.length());
- assertTrue(TestValues.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
- new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private SeatLocation msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocation();
+ msg.setGrid(TestValues.GENERAL_GRID);
+ }
+
+ public void testRpcValues() {
+ Grid grid = msg.getGrid();
+
+ //valid test
+ assertTrue(Validator.validateGrid(TestValues.GENERAL_GRID, grid));
+
+ //null test
+ SeatLocation msg = new SeatLocation();
+ assertNull(TestValues.NULL, msg.getGrid());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocation.KEY_GRID, TestValues.GENERAL_GRID);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+ assertTrue(TestValues.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
+ new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
index 54b99be2d..c949c9216 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatMemoryActionTest.java
@@ -18,58 +18,58 @@ import java.util.Iterator;
*/
public class SeatMemoryActionTest extends TestCase {
- private SeatMemoryAction msg;
-
- @Override
- public void setUp() {
- msg = new SeatMemoryAction();
-
- msg.setId(TestValues.GENERAL_INT);
- msg.setLabel(TestValues.GENERAL_STRING);
- msg.setAction(TestValues.GENERAL_SEATMEMORYACTIONTYPE);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- Integer id = msg.getId();
- String label = msg.getLabel();
- SeatMemoryActionType action = msg.getAction();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, label);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATMEMORYACTIONTYPE, action);
-
- // Invalid/Null Tests
- SeatMemoryAction msg = new SeatMemoryAction();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getId());
- assertNull(TestValues.NULL, msg.getLabel());
- assertNull(TestValues.NULL, msg.getAction());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SeatMemoryAction.KEY_ID, TestValues.GENERAL_INT);
- reference.put(SeatMemoryAction.KEY_LABEL, TestValues.GENERAL_STRING);
- reference.put(SeatMemoryAction.KEY_ACTION, TestValues.GENERAL_SEATMEMORYACTIONTYPE);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private SeatMemoryAction msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatMemoryAction();
+
+ msg.setId(TestValues.GENERAL_INT);
+ msg.setLabel(TestValues.GENERAL_STRING);
+ msg.setAction(TestValues.GENERAL_SEATMEMORYACTIONTYPE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer id = msg.getId();
+ String label = msg.getLabel();
+ SeatMemoryActionType action = msg.getAction();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, label);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SEATMEMORYACTIONTYPE, action);
+
+ // Invalid/Null Tests
+ SeatMemoryAction msg = new SeatMemoryAction();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getLabel());
+ assertNull(TestValues.NULL, msg.getAction());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SeatMemoryAction.KEY_ID, TestValues.GENERAL_INT);
+ reference.put(SeatMemoryAction.KEY_LABEL, TestValues.GENERAL_STRING);
+ reference.put(SeatMemoryAction.KEY_ACTION, TestValues.GENERAL_SEATMEMORYACTIONTYPE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
index 14f9890f2..7a231d7f5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SingleTireStatusTest.java
@@ -14,63 +14,63 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SingleTireStatus}
*/
public class SingleTireStatusTest extends TestCase {
-
- private SingleTireStatus msg;
-
- @Override
- public void setUp() {
- msg = new SingleTireStatus();
-
- msg.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setTPMS(TestValues.GENERAL_TPMS);
- msg.setPressure(TestValues.GENERAL_FLOAT);
- }
+
+ private SingleTireStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new SingleTireStatus();
+
+ msg.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setTPMS(TestValues.GENERAL_TPMS);
+ msg.setPressure(TestValues.GENERAL_FLOAT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- ComponentVolumeStatus status = msg.getStatus();
- TPMS tpms = msg.getTPMS();
- Float pressure = msg.getPressure();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, status);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TPMS, tpms);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, pressure);
-
- // Invalid/Null Tests
- SingleTireStatus msg = new SingleTireStatus();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getStatus());
- assertNull(TestValues.NULL, msg.getTPMS());
- assertNull(TestValues.NULL, msg.getPressure());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(SingleTireStatus.KEY_TPMS, TestValues.GENERAL_TPMS);
- reference.put(SingleTireStatus.KEY_PRESSURE, TestValues.GENERAL_FLOAT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ ComponentVolumeStatus status = msg.getStatus();
+ TPMS tpms = msg.getTPMS();
+ Float pressure = msg.getPressure();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TPMS, tpms);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, pressure);
+
+ // Invalid/Null Tests
+ SingleTireStatus msg = new SingleTireStatus();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getStatus());
+ assertNull(TestValues.NULL, msg.getTPMS());
+ assertNull(TestValues.NULL, msg.getPressure());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(SingleTireStatus.KEY_TPMS, TestValues.GENERAL_TPMS);
+ reference.put(SingleTireStatus.KEY_PRESSURE, TestValues.GENERAL_FLOAT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
index c33a69a5f..86d0058be 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SisDataTests.java
@@ -23,83 +23,83 @@ import java.util.Iterator;
*/
public class SisDataTests extends TestCase {
- private SisData msg;
-
- @Override
- public void setUp() {
- msg = new SisData();
-
- msg.setStationShortName(TestValues.GENERAL_STRING);
- msg.setStationIDNumber(TestValues.GENERAL_STATIONIDNUMBER);
- msg.setStationLongName(TestValues.GENERAL_STRING);
- msg.setStationLocation(VehicleDataHelper.GPS);
- msg.setStationMessage(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
- String stationShortName = msg.getStationShortName();
- StationIDNumber stationIDNumber = msg.getStationIDNumber();
- String stationLongName = msg.getStationLongName();
- GPSData stationLocation = msg.getStationLocation();
- String stationMessage = msg.getStationMessage();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationShortName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STATIONIDNUMBER, stationIDNumber);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationLongName);
- assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, stationLocation);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationMessage);
-
- // Invalid/Null Tests
- SisData msg = new SisData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getStationShortName());
- assertNull(TestValues.NULL, msg.getStationIDNumber());
- assertNull(TestValues.NULL, msg.getStationLongName());
- assertNull(TestValues.NULL, msg.getStationLocation());
- assertNull(TestValues.NULL, msg.getStationMessage());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SisData.KEY_STATION_SHORT_NAME, TestValues.GENERAL_STRING);
- reference.put(SisData.KEY_STATION_ID_NUMBER, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_STATIONIDNUMBER.getStore()));
- reference.put(SisData.KEY_STATION_LONG_NAME, TestValues.GENERAL_STRING);
- reference.put(SisData.KEY_STATION_LOCATION, JsonRPCMarshaller.serializeHashtable(VehicleDataHelper.GPS.getStore()));
- reference.put(SisData.KEY_STATION_MESSAGE, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(SisData.KEY_STATION_ID_NUMBER)) {
- 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(TestValues.TRUE, Validator.validateStationIDNumber(new StationIDNumber(hashReference), new StationIDNumber(hashTest)));
- } else if (key.equals(SisData.KEY_STATION_LOCATION)) {
- 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(TestValues.TRUE, Validator.validateGpsData(new GPSData(hashReference), new GPSData(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private SisData msg;
+
+ @Override
+ public void setUp() {
+ msg = new SisData();
+
+ msg.setStationShortName(TestValues.GENERAL_STRING);
+ msg.setStationIDNumber(TestValues.GENERAL_STATIONIDNUMBER);
+ msg.setStationLongName(TestValues.GENERAL_STRING);
+ msg.setStationLocation(VehicleDataHelper.GPS);
+ msg.setStationMessage(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String stationShortName = msg.getStationShortName();
+ StationIDNumber stationIDNumber = msg.getStationIDNumber();
+ String stationLongName = msg.getStationLongName();
+ GPSData stationLocation = msg.getStationLocation();
+ String stationMessage = msg.getStationMessage();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationShortName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STATIONIDNUMBER, stationIDNumber);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationLongName);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, stationLocation);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, stationMessage);
+
+ // Invalid/Null Tests
+ SisData msg = new SisData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getStationShortName());
+ assertNull(TestValues.NULL, msg.getStationIDNumber());
+ assertNull(TestValues.NULL, msg.getStationLongName());
+ assertNull(TestValues.NULL, msg.getStationLocation());
+ assertNull(TestValues.NULL, msg.getStationMessage());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SisData.KEY_STATION_SHORT_NAME, TestValues.GENERAL_STRING);
+ reference.put(SisData.KEY_STATION_ID_NUMBER, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_STATIONIDNUMBER.getStore()));
+ reference.put(SisData.KEY_STATION_LONG_NAME, TestValues.GENERAL_STRING);
+ reference.put(SisData.KEY_STATION_LOCATION, JsonRPCMarshaller.serializeHashtable(VehicleDataHelper.GPS.getStore()));
+ reference.put(SisData.KEY_STATION_MESSAGE, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(SisData.KEY_STATION_ID_NUMBER)) {
+ 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(TestValues.TRUE, Validator.validateStationIDNumber(new StationIDNumber(hashReference), new StationIDNumber(hashTest)));
+ } else if (key.equals(SisData.KEY_STATION_LOCATION)) {
+ 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(TestValues.TRUE, Validator.validateGpsData(new GPSData(hashReference), new GPSData(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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 25feeb6f8..7778c60a4 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
@@ -12,73 +12,73 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SoftButtonCapabilities}
*/
public class SoftButtonCapabilitiesTest extends TestCase {
- private SoftButtonCapabilities msg;
+ private SoftButtonCapabilities msg;
- @Override
- public void setUp() {
- msg = new SoftButtonCapabilities();
-
- msg.setImageSupported(TestValues.GENERAL_BOOLEAN);
- msg.setShortPressAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setLongPressAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setUpDownAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setTextSupported(TestValues.GENERAL_BOOLEAN);
- }
+ @Override
+ public void setUp() {
+ msg = new SoftButtonCapabilities();
+
+ msg.setImageSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setShortPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setLongPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setUpDownAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setTextSupported(TestValues.GENERAL_BOOLEAN);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Boolean imageSupp = msg.getImageSupported();
- Boolean updown = msg.getUpDownAvailable();
- Boolean longPress = msg.getLongPressAvailable();
- Boolean shortPress = msg.getShortPressAvailable();
- Boolean textSupported = msg.getTextSupported();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, imageSupp);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, updown);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, longPress);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, shortPress);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, textSupported);
-
- // Invalid/Null Tests
- SoftButtonCapabilities msg = new SoftButtonCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getImageSupported());
- assertNull(TestValues.NULL, msg.getLongPressAvailable());
- assertNull(TestValues.NULL, msg.getShortPressAvailable());
- assertNull(TestValues.NULL, msg.getUpDownAvailable());
- assertNull(TestValues.NULL, msg.getTextSupported());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, TestValues.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Boolean imageSupp = msg.getImageSupported();
+ Boolean updown = msg.getUpDownAvailable();
+ Boolean longPress = msg.getLongPressAvailable();
+ Boolean shortPress = msg.getShortPressAvailable();
+ Boolean textSupported = msg.getTextSupported();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, imageSupp);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, updown);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, longPress);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, shortPress);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, textSupported);
+
+ // Invalid/Null Tests
+ SoftButtonCapabilities msg = new SoftButtonCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getImageSupported());
+ assertNull(TestValues.NULL, msg.getLongPressAvailable());
+ assertNull(TestValues.NULL, msg.getShortPressAvailable());
+ assertNull(TestValues.NULL, msg.getUpDownAvailable());
+ assertNull(TestValues.NULL, msg.getTextSupported());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SoftButtonCapabilities.KEY_IMAGE_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
index fda0b8cc6..964eb8834 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonTest.java
@@ -18,87 +18,87 @@ import java.util.Hashtable;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SoftButton}
*/
public class SoftButtonTest extends TestCase {
-
- private SoftButton msg;
-
- @Override
- public void setUp() {
- msg = new SoftButton();
-
- msg.setType(TestValues.GENERAL_SOFTBUTTONTYPE);
- msg.setText(TestValues.GENERAL_STRING);
- msg.setSystemAction(TestValues.GENERAL_SYSTEMACTION);
- msg.setImage(TestValues.GENERAL_IMAGE);
- msg.setIsHighlighted(TestValues.GENERAL_BOOLEAN);
- msg.setSoftButtonID(TestValues.GENERAL_INT);
- }
+
+ private SoftButton msg;
+
+ @Override
+ public void setUp() {
+ msg = new SoftButton();
+
+ msg.setType(TestValues.GENERAL_SOFTBUTTONTYPE);
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setSystemAction(TestValues.GENERAL_SYSTEMACTION);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ msg.setIsHighlighted(TestValues.GENERAL_BOOLEAN);
+ msg.setSoftButtonID(TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- SoftButtonType type = msg.getType();
- String text = msg.getText();
- SystemAction sysAction = msg.getSystemAction();
- Image image = msg.getImage();
- Boolean isHighlighted = msg.getIsHighlighted();
- Integer id = msg.getSoftButtonID();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONTYPE, type);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMACTION, sysAction);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHighlighted);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
-
- // Invalid/Null Tests
- SoftButton msg = new SoftButton();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getSoftButtonID());
- assertNull(TestValues.NULL, msg.getImage());
- assertNull(TestValues.NULL, msg.getIsHighlighted());
- assertNull(TestValues.NULL, msg.getSystemAction());
- assertNull(TestValues.NULL, msg.getText());
- assertNull(TestValues.NULL, msg.getType());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(SoftButton.KEY_SOFT_BUTTON_ID, TestValues.GENERAL_INT);
- reference.put(SoftButton.KEY_TYPE, TestValues.GENERAL_SOFTBUTTONTYPE);
- reference.put(SoftButton.KEY_TEXT, TestValues.GENERAL_STRING);
- reference.put(SoftButton.KEY_IMAGE, TestValues.JSON_IMAGE);
- reference.put(SoftButton.KEY_SYSTEM_ACTION, TestValues.GENERAL_SYSTEMACTION);
- reference.put(SoftButton.KEY_IS_HIGHLIGHTED, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if(key.equals(SoftButton.KEY_IMAGE)){
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ SoftButtonType type = msg.getType();
+ String text = msg.getText();
+ SystemAction sysAction = msg.getSystemAction();
+ Image image = msg.getImage();
+ Boolean isHighlighted = msg.getIsHighlighted();
+ Integer id = msg.getSoftButtonID();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONTYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMACTION, sysAction);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHighlighted);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
+
+ // Invalid/Null Tests
+ SoftButton msg = new SoftButton();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getSoftButtonID());
+ assertNull(TestValues.NULL, msg.getImage());
+ assertNull(TestValues.NULL, msg.getIsHighlighted());
+ assertNull(TestValues.NULL, msg.getSystemAction());
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getType());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SoftButton.KEY_SOFT_BUTTON_ID, TestValues.GENERAL_INT);
+ reference.put(SoftButton.KEY_TYPE, TestValues.GENERAL_SOFTBUTTONTYPE);
+ reference.put(SoftButton.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(SoftButton.KEY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(SoftButton.KEY_SYSTEM_ACTION, TestValues.GENERAL_SYSTEMACTION);
+ reference.put(SoftButton.KEY_IS_HIGHLIGHTED, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(SoftButton.KEY_IMAGE)) {
JSONObject referenceArray = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject underTestArray = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
- Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray);
- assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray);
+ assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
index 1de8abfdf..3cf46b7ab 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
@@ -26,7 +26,7 @@ public class StabilityControlsStatusTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
VehicleDataStatus esc = msg.getEscSystem();
VehicleDataStatus sTrailer = msg.getTrailerSwayControl();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
index 54752d5ef..d33cc1ac0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StartTimeTest.java
@@ -12,68 +12,68 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.StartTime}
*/
public class StartTimeTest extends TestCase {
-
- private StartTime msg;
-
- @Override
- public void setUp() {
- msg = new StartTime();
-
- msg.setHours(TestValues.GENERAL_INT);
- msg.setMinutes(TestValues.GENERAL_INT);
- msg.setSeconds(TestValues.GENERAL_INT);
- }
+
+ private StartTime msg;
+
+ @Override
+ public void setUp() {
+ msg = new StartTime();
+
+ msg.setHours(TestValues.GENERAL_INT);
+ msg.setMinutes(TestValues.GENERAL_INT);
+ msg.setSeconds(TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer hours = msg.getHours();
- Integer minutes = msg.getMinutes();
- Integer seconds = msg.getSeconds();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, hours);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minutes);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, seconds);
-
- // TimeInterval constructor test
- StartTime startTime = new StartTime(7000);
- assertEquals(TestValues.MATCH, (Integer) 1, startTime.getHours());
- assertEquals(TestValues.MATCH, (Integer) 56, startTime.getMinutes());
- assertEquals(TestValues.MATCH, (Integer) 40, startTime.getSeconds());
-
- // Invalid/Null Tests
- StartTime msg = new StartTime();
- assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getHours());
- assertNull(TestValues.NULL, msg.getMinutes());
- assertNull(TestValues.NULL, msg.getSeconds());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(StartTime.KEY_HOURS, TestValues.GENERAL_INT);
- reference.put(StartTime.KEY_MINUTES, TestValues.GENERAL_INT);
- reference.put(StartTime.KEY_SECONDS, TestValues.GENERAL_INT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer hours = msg.getHours();
+ Integer minutes = msg.getMinutes();
+ Integer seconds = msg.getSeconds();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, hours);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, minutes);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, seconds);
+
+ // TimeInterval constructor test
+ StartTime startTime = new StartTime(7000);
+ assertEquals(TestValues.MATCH, (Integer) 1, startTime.getHours());
+ assertEquals(TestValues.MATCH, (Integer) 56, startTime.getMinutes());
+ assertEquals(TestValues.MATCH, (Integer) 40, startTime.getSeconds());
+
+ // Invalid/Null Tests
+ StartTime msg = new StartTime();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ assertNull(TestValues.NULL, msg.getHours());
+ assertNull(TestValues.NULL, msg.getMinutes());
+ assertNull(TestValues.NULL, msg.getSeconds());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(StartTime.KEY_HOURS, TestValues.GENERAL_INT);
+ reference.put(StartTime.KEY_MINUTES, TestValues.GENERAL_INT);
+ reference.put(StartTime.KEY_SECONDS, TestValues.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
index f35f0913d..04da073df 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StationIDNumberTests.java
@@ -17,57 +17,57 @@ import java.util.Iterator;
*/
public class StationIDNumberTests extends TestCase {
- private StationIDNumber msg;
+ private StationIDNumber msg;
- @Override
- public void setUp() {
- msg = new StationIDNumber();
+ @Override
+ public void setUp() {
+ msg = new StationIDNumber();
- msg.setCountryCode(TestValues.GENERAL_INT);
- msg.setFccFacilityId(TestValues.GENERAL_INT);
- }
+ msg.setCountryCode(TestValues.GENERAL_INT);
+ msg.setFccFacilityId(TestValues.GENERAL_INT);
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues() {
- // Test Values
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
- int countryCode = msg.getCountryCode();
- int fccFacilityId = msg.getFccFacilityId();
+ int countryCode = msg.getCountryCode();
+ int fccFacilityId = msg.getFccFacilityId();
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, countryCode);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, fccFacilityId);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, countryCode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, fccFacilityId);
- // Invalid/Null Tests
- StationIDNumber msg = new StationIDNumber();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ StationIDNumber msg = new StationIDNumber();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getCountryCode());
- assertNull(TestValues.NULL, msg.getFccFacilityId());
- }
+ assertNull(TestValues.NULL, msg.getCountryCode());
+ assertNull(TestValues.NULL, msg.getFccFacilityId());
+ }
- public void testJson() {
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try {
+ try {
- reference.put(StationIDNumber.KEY_COUNTRY_CODE, TestValues.GENERAL_INT);
- reference.put(StationIDNumber.KEY_FCC_FACILITY_ID, TestValues.GENERAL_INT);
+ reference.put(StationIDNumber.KEY_COUNTRY_CODE, TestValues.GENERAL_INT);
+ reference.put(StationIDNumber.KEY_FCC_FACILITY_ID, TestValues.GENERAL_INT);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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 4ba99dda0..bbccdd042 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
@@ -51,7 +51,7 @@ public class SystemCapabilityTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
SystemCapabilityType testType = msg.getSystemCapabilityType();
NavigationCapability testNavigationCapability = (NavigationCapability) msg.getCapabilityForType(SystemCapabilityType.NAVIGATION);
@@ -70,7 +70,7 @@ public class SystemCapabilityTests extends TestCase {
assertTrue(TestValues.TRUE, Validator.validateDriverDistractionCapability(TestValues.GENERAL_DRIVERDISTRACTIONCAPABILITY, testDriverDistractionCapability));
- for(int i = 0; i < TestValues.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++) {
assertTrue(TestValues.TRUE, Validator.validateDisplayCapability(TestValues.GENERAL_DISPLAYCAPABILITY_LIST.get(i), displayCapabilities.get(i)));
}
@@ -112,40 +112,40 @@ public class SystemCapabilityTests extends TestCase {
while (iterator.hasNext()) {
String key = (String) iterator.next();
- if(key.equals(SystemCapability.KEY_NAVIGATION_CAPABILITY)){
+ if (key.equals(SystemCapability.KEY_NAVIGATION_CAPABILITY)) {
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(TestValues.TRUE, Validator.validateNavigationCapability( new NavigationCapability(hashReference), new NavigationCapability(hashTest)));
- } else if(key.equals(SystemCapability.KEY_PHONE_CAPABILITY)){
+ assertTrue(TestValues.TRUE, Validator.validateNavigationCapability(new NavigationCapability(hashReference), new NavigationCapability(hashTest)));
+ } else if (key.equals(SystemCapability.KEY_PHONE_CAPABILITY)) {
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(TestValues.TRUE, Validator.validatePhoneCapability( new PhoneCapability(hashReference), new PhoneCapability(hashTest)));
- } else if(key.equals(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY)){
+ assertTrue(TestValues.TRUE, Validator.validatePhoneCapability(new PhoneCapability(hashReference), new PhoneCapability(hashTest)));
+ } else if (key.equals(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY)) {
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(TestValues.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
- } else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
+ assertTrue(TestValues.TRUE, Validator.validateRemoteControlCapabilities(new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
+ } 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);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
Log.i("TEST REF", hashReference.toString());
Log.i("TEST TEST", hashTest.toString());
- assertTrue(TestValues.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
- } else if(key.equals(SystemCapability.KEY_DISPLAY_CAPABILITIES)){
+ assertTrue(TestValues.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(TestValues.MATCH, referenceArray.length(), underTestArray.length());
- for(int i = 0; i < referenceArray.length(); i++){
+ 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));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
assertTrue(TestValues.TRUE, Validator.validateDisplayCapability(new DisplayCapability(hashReference), new DisplayCapability(hashTest)));
}
} else if (key.equals(SystemCapability.KEY_DRIVER_DISTRACTION_CAPABILITY)) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
index 8a30b1c21..9d04b07de 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TTSChunkTest.java
@@ -13,54 +13,54 @@ import org.json.JSONObject;
import java.util.Iterator;
public class TTSChunkTest extends TestCase {
-
- private TTSChunk msg;
- @Override
- public void setUp() {
- msg = new TTSChunk();
-
- msg.setText(TestValues.GENERAL_STRING);
- msg.setType(TestValues.GENERAL_SPEECHCAPABILITIES);
- }
+ private TTSChunk msg;
+
+ @Override
+ public void setUp() {
+ msg = new TTSChunk();
+
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setType(TestValues.GENERAL_SPEECHCAPABILITIES);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String text = msg.getText();
- SpeechCapabilities speechType = msg.getType();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES, speechType);
-
- // Invalid/Null Tests
- TTSChunk msg = new TTSChunk();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getText());
- assertNull(TestValues.NULL, msg.getType());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TTSChunk.KEY_TEXT, TestValues.GENERAL_STRING);
- reference.put(TTSChunk.KEY_TYPE, TestValues.GENERAL_SPEECHCAPABILITIES);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String text = msg.getText();
+ SpeechCapabilities speechType = msg.getType();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES, speechType);
+
+ // Invalid/Null Tests
+ TTSChunk msg = new TTSChunk();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getType());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TTSChunk.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(TTSChunk.KEY_TYPE, TestValues.GENERAL_SPEECHCAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
index 2bff0d31b..98bb58fb7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
@@ -13,15 +13,15 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Temperature}
*/
-public class TemperatureTests extends TestCase{
-
+public class TemperatureTests extends TestCase {
+
private Temperature msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new Temperature();
msg.setUnit(TestValues.GENERAL_TEMPERATUREUNIT);
@@ -29,9 +29,9 @@ public class TemperatureTests extends TestCase{
}
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
// Test Values
TemperatureUnit unit = msg.getUnit();
float value = msg.getValue();
@@ -48,10 +48,10 @@ public class TemperatureTests extends TestCase{
assertNull(TestValues.NULL, msg.getValue());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(Temperature.KEY_VALUE, (Float) TestValues.GENERAL_FLOAT);
reference.put(Temperature.KEY_UNIT, TestValues.GENERAL_TEMPERATUREUNIT);
@@ -59,14 +59,14 @@ public class TemperatureTests extends TestCase{
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
index 22ef586d2..be1150c5b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateColorSchemeTest.java
@@ -15,66 +15,66 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TemplateColorScheme}
*/
public class TemplateColorSchemeTest extends TestCase {
-
- private TemplateColorScheme msg;
- @Override
- public void setUp() {
- msg = new TemplateColorScheme();
- msg.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
- msg.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
- msg.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
- }
+ private TemplateColorScheme msg;
+
+ @Override
+ public void setUp() {
+ msg = new TemplateColorScheme();
+ msg.setPrimaryColor(TestValues.GENERAL_RGBCOLOR);
+ msg.setSecondaryColor(TestValues.GENERAL_RGBCOLOR);
+ msg.setBackgroundColor(TestValues.GENERAL_RGBCOLOR);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- RGBColor primaryColor = msg.getPrimaryColor();
- RGBColor secondaryColor = msg.getSecondaryColor();
- RGBColor backgroundColor = msg.getBackgroundColor();
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ RGBColor primaryColor = msg.getPrimaryColor();
+ RGBColor secondaryColor = msg.getSecondaryColor();
+ RGBColor backgroundColor = msg.getBackgroundColor();
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, primaryColor));
- assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, secondaryColor));
- assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, backgroundColor));
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, primaryColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, secondaryColor));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(TestValues.GENERAL_RGBCOLOR, backgroundColor));
- // Invalid/Null Tests
- TemplateColorScheme msg = new TemplateColorScheme();
- assertNotNull(TestValues.NOT_NULL, msg);
+ // Invalid/Null Tests
+ TemplateColorScheme msg = new TemplateColorScheme();
+ assertNotNull(TestValues.NOT_NULL, msg);
- assertNull(TestValues.NULL, msg.getPrimaryColor());
- assertNull(TestValues.NULL, msg.getSecondaryColor());
- assertNull(TestValues.NULL, msg.getBackgroundColor());
- }
+ assertNull(TestValues.NULL, msg.getPrimaryColor());
+ assertNull(TestValues.NULL, msg.getSecondaryColor());
+ assertNull(TestValues.NULL, msg.getBackgroundColor());
+ }
- public void testJson() {
- JSONObject reference = new JSONObject();
+ public void testJson() {
+ JSONObject reference = new JSONObject();
- try {
- reference.put(TemplateColorScheme.KEY_PRIMARY_COLOR, TestValues.JSON_RGBCOLOR);
- reference.put(TemplateColorScheme.KEY_SECONDARY_COLOR, TestValues.JSON_RGBCOLOR);
- reference.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, TestValues.JSON_RGBCOLOR);
+ try {
+ reference.put(TemplateColorScheme.KEY_PRIMARY_COLOR, TestValues.JSON_RGBCOLOR);
+ reference.put(TemplateColorScheme.KEY_SECONDARY_COLOR, TestValues.JSON_RGBCOLOR);
+ reference.put(TemplateColorScheme.KEY_BACKGROUND_COLOR, TestValues.JSON_RGBCOLOR);
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- JSONObject referenceColorObj = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- RGBColor referenceColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(referenceColorObj));
- JSONObject underTestColorObj = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- RGBColor underTestColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(underTestColorObj));
- assertTrue(TestValues.TRUE, Validator.validateRGBColor(referenceColor, underTestColor));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ JSONObject referenceColorObj = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ RGBColor referenceColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(referenceColorObj));
+ JSONObject underTestColorObj = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+ RGBColor underTestColor = new RGBColor(JsonRPCMarshaller.deserializeJSONObject(underTestColorObj));
+ assertTrue(TestValues.TRUE, Validator.validateRGBColor(referenceColor, underTestColor));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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
index d01bb92fd..6b0ea016f 100644
--- 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
@@ -16,7 +16,7 @@ import java.util.Hashtable;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TemplateConfiguration}
*/
public class TemplateConfigurationTests extends TestCase {
@@ -24,7 +24,7 @@ public class TemplateConfigurationTests extends TestCase {
private TemplateConfiguration msg;
@Override
- public void setUp(){
+ public void setUp() {
msg = new TemplateConfiguration();
msg.setTemplate(TestValues.GENERAL_STRING);
@@ -36,17 +36,17 @@ public class TemplateConfigurationTests extends TestCase {
/**
* Tests the expected values of the RPC message.
*/
- public void testRpcValues () {
- // Test Values
+ public void testRpcValues() {
+ // Test Values
String testTemplate = msg.getTemplate();
TemplateColorScheme testDayColorScheme = msg.getDayColorScheme();
TemplateColorScheme testNightColorScheme = msg.getNightColorScheme();
-
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTemplate);
assertEquals(TestValues.MATCH, TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme);
assertEquals(TestValues.MATCH, TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme);
-
+
// Invalid/Null Tests
TemplateConfiguration msg = new TemplateConfiguration();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -56,10 +56,10 @@ public class TemplateConfigurationTests extends TestCase {
assertNull(TestValues.NULL, msg.getNightColorScheme());
}
- public void testJson(){
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
+ try {
reference.put(TemplateConfiguration.KEY_TEMPLATE, TestValues.GENERAL_STRING);
reference.put(TemplateConfiguration.KEY_DAY_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_DAYCOLORSCHEME.getStore()));
reference.put(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_NIGHTCOLORSCHEME.getStore()));
@@ -68,7 +68,7 @@ public class TemplateConfigurationTests extends TestCase {
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(TemplateConfiguration.KEY_DAY_COLOR_SCHEME)) {
@@ -87,8 +87,8 @@ public class TemplateConfigurationTests extends TestCase {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
index cf12f3d1f..affa8c624 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TextFieldTest.java
@@ -14,68 +14,68 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TextField}
*/
public class TextFieldTest extends TestCase {
-
- private TextField msg;
-
- @Override
- public void setUp() {
- msg = new TextField();
-
- msg.setName(TestValues.GENERAL_TEXTFIELDNAME);
- msg.setCharacterSet(TestValues.GENERAL_CHARACTERSET);
- msg.setWidth(TestValues.GENERAL_INT);
- msg.setRows(TestValues.GENERAL_INT);
- }
+
+ private TextField msg;
+
+ @Override
+ public void setUp() {
+ msg = new TextField();
+
+ msg.setName(TestValues.GENERAL_TEXTFIELDNAME);
+ msg.setCharacterSet(TestValues.GENERAL_CHARACTERSET);
+ msg.setWidth(TestValues.GENERAL_INT);
+ msg.setRows(TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- TextFieldName name = msg.getName();
- CharacterSet charSet = msg.getCharacterSet();
- Integer width = msg.getWidth();
- Integer rows = msg.getRows();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELDNAME, name);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_CHARACTERSET, charSet);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, width);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, rows);
-
- // Invalid/Null Tests
- TextField msg = new TextField();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getName());
- assertNull(TestValues.NULL, msg.getWidth());
- assertNull(TestValues.NULL, msg.getRows());
- assertNull(TestValues.NULL, msg.getCharacterSet());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TextField.KEY_CHARACTER_SET, TestValues.GENERAL_CHARACTERSET);
- reference.put(TextField.KEY_WIDTH, TestValues.GENERAL_INT);
- reference.put(TextField.KEY_ROWS, TestValues.GENERAL_INT);
- reference.put(TextField.KEY_NAME, TestValues.GENERAL_TEXTFIELDNAME);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ TextFieldName name = msg.getName();
+ CharacterSet charSet = msg.getCharacterSet();
+ Integer width = msg.getWidth();
+ Integer rows = msg.getRows();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTFIELDNAME, name);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CHARACTERSET, charSet);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, width);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, rows);
+
+ // Invalid/Null Tests
+ TextField msg = new TextField();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getName());
+ assertNull(TestValues.NULL, msg.getWidth());
+ assertNull(TestValues.NULL, msg.getRows());
+ assertNull(TestValues.NULL, msg.getCharacterSet());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TextField.KEY_CHARACTER_SET, TestValues.GENERAL_CHARACTERSET);
+ reference.put(TextField.KEY_WIDTH, TestValues.GENERAL_INT);
+ reference.put(TextField.KEY_ROWS, TestValues.GENERAL_INT);
+ reference.put(TextField.KEY_NAME, TestValues.GENERAL_TEXTFIELDNAME);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
index 59d289546..dfbf4bc7c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TireStatusTest.java
@@ -13,96 +13,96 @@ import org.json.JSONException;
import org.json.JSONObject;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TireStatus}
*/
public class TireStatusTest extends TestCase {
-
- private TireStatus msg;
- @Override
- public void setUp() {
- msg = new TireStatus();
- msg.setPressureTellTale(TestValues.GENERAL_WARNINGLIGHTSTATUS);
- SingleTireStatus tireLeftFront = new SingleTireStatus();
- tireLeftFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setLeftFront(tireLeftFront);
- SingleTireStatus tireRightFront = new SingleTireStatus();
- tireRightFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setRightFront(tireRightFront);
- SingleTireStatus tireLeftRear = new SingleTireStatus();
- tireLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setLeftRear(tireLeftRear);
- SingleTireStatus tireRightRear = new SingleTireStatus();
- tireRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setRightRear(tireRightRear);
- SingleTireStatus tireInnerLeftRear = new SingleTireStatus();
- tireInnerLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setInnerLeftRear(tireInnerLeftRear);
- SingleTireStatus tireInnerRightRear = new SingleTireStatus();
- tireInnerRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- msg.setInnerRightRear(tireInnerRightRear);
- }
+ private TireStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new TireStatus();
+ msg.setPressureTellTale(TestValues.GENERAL_WARNINGLIGHTSTATUS);
+ SingleTireStatus tireLeftFront = new SingleTireStatus();
+ tireLeftFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setLeftFront(tireLeftFront);
+ SingleTireStatus tireRightFront = new SingleTireStatus();
+ tireRightFront.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setRightFront(tireRightFront);
+ SingleTireStatus tireLeftRear = new SingleTireStatus();
+ tireLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setLeftRear(tireLeftRear);
+ SingleTireStatus tireRightRear = new SingleTireStatus();
+ tireRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setRightRear(tireRightRear);
+ SingleTireStatus tireInnerLeftRear = new SingleTireStatus();
+ tireInnerLeftRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setInnerLeftRear(tireInnerLeftRear);
+ SingleTireStatus tireInnerRightRear = new SingleTireStatus();
+ tireInnerRightRear.setStatus(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setInnerRightRear(tireInnerRightRear);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- WarningLightStatus pressure = msg.getPressureTellTale();
- SingleTireStatus leftFront = msg.getLeftFront();
- SingleTireStatus rightFront = msg.getRightFront();
- SingleTireStatus leftRear = msg.getLeftRear();
- SingleTireStatus rightRear = msg.getRightRear();
- SingleTireStatus innerLeftRear = msg.getInnerLeftRear();
- SingleTireStatus innerRightRear = msg.getInnerRightRear();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_WARNINGLIGHTSTATUS, pressure);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftFront.getStatus());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightFront.getStatus());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftRear.getStatus());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightRear.getStatus());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerLeftRear.getStatus());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerRightRear.getStatus());
-
- // Invalid/Null Tests
- TireStatus msg = new TireStatus();
- assertNotNull(TestValues.NOT_NULL, msg);
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ WarningLightStatus pressure = msg.getPressureTellTale();
+ SingleTireStatus leftFront = msg.getLeftFront();
+ SingleTireStatus rightFront = msg.getRightFront();
+ SingleTireStatus leftRear = msg.getLeftRear();
+ SingleTireStatus rightRear = msg.getRightRear();
+ SingleTireStatus innerLeftRear = msg.getInnerLeftRear();
+ SingleTireStatus innerRightRear = msg.getInnerRightRear();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WARNINGLIGHTSTATUS, pressure);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftFront.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightFront.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, leftRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, rightRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerLeftRear.getStatus());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, innerRightRear.getStatus());
+
+ // Invalid/Null Tests
+ TireStatus msg = new TireStatus();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TireStatus.KEY_PRESSURE_TELL_TALE, TestValues.GENERAL_WARNINGLIGHTSTATUS);
+ JSONObject tireLeftFront = new JSONObject();
+ tireLeftFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
+ JSONObject tireRightFront = new JSONObject();
+ tireRightFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
+ JSONObject tireLeftRear = new JSONObject();
+ tireLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
+ JSONObject tireRightRear = new JSONObject();
+ tireRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
+ JSONObject tireInnerLeftRear = new JSONObject();
+ tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
+ JSONObject tireInnerRightRear = new JSONObject();
+ tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TireStatus.KEY_PRESSURE_TELL_TALE, TestValues.GENERAL_WARNINGLIGHTSTATUS);
- JSONObject tireLeftFront = new JSONObject();
- tireLeftFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
- JSONObject tireRightFront = new JSONObject();
- tireRightFront.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
- JSONObject tireLeftRear = new JSONObject();
- tireLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
- JSONObject tireRightRear = new JSONObject();
- tireRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
- JSONObject tireInnerLeftRear = new JSONObject();
- tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
- JSONObject tireInnerRightRear = new JSONObject();
- tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
- reference.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- assertTrue(TestValues.TRUE, Validator.validateTireStatus(
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(reference)),
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(underTest))));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(reference)),
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(underTest))));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
index bf0242bd9..6bb4626f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchCoordTest.java
@@ -12,58 +12,58 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TouchCoord}
*/
public class TouchCoordTest extends TestCase {
-
- private TouchCoord msg;
- @Override
- public void setUp() {
- msg = new TouchCoord();
-
- msg.setX(TestValues.GENERAL_INT);
- msg.setY(TestValues.GENERAL_INT);
- }
+ private TouchCoord msg;
+
+ @Override
+ public void setUp() {
+ msg = new TouchCoord();
+
+ msg.setX(TestValues.GENERAL_INT);
+ msg.setY(TestValues.GENERAL_INT);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer x = msg.getX();
- Integer y = msg.getY();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, x);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, y);
-
- // Invalid/Null Tests
- TouchCoord msg = new TouchCoord();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getX());
- assertNull(TestValues.NULL, msg.getY());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TouchCoord.KEY_X, TestValues.GENERAL_INT);
- reference.put(TouchCoord.KEY_Y, TestValues.GENERAL_INT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer x = msg.getX();
+ Integer y = msg.getY();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, x);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, y);
+
+ // Invalid/Null Tests
+ TouchCoord msg = new TouchCoord();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getX());
+ assertNull(TestValues.NULL, msg.getY());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TouchCoord.KEY_X, TestValues.GENERAL_INT);
+ reference.put(TouchCoord.KEY_Y, TestValues.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
index 82085632f..dba539b81 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventCapabilitiesTest.java
@@ -12,63 +12,63 @@ import org.json.JSONObject;
import java.util.Iterator;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TouchEventCapabilities}
*/
public class TouchEventCapabilitiesTest extends TestCase {
-
- private TouchEventCapabilities msg;
-
- @Override
- public void setUp() {
- msg = new TouchEventCapabilities();
-
- msg.setPressAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setDoublePressAvailable(TestValues.GENERAL_BOOLEAN);
- msg.setMultiTouchAvailable(TestValues.GENERAL_BOOLEAN);
- }
+
+ private TouchEventCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new TouchEventCapabilities();
+
+ msg.setPressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setDoublePressAvailable(TestValues.GENERAL_BOOLEAN);
+ msg.setMultiTouchAvailable(TestValues.GENERAL_BOOLEAN);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Boolean press = msg.getPressAvailable();
- Boolean multiTouch = msg.getMultiTouchAvailable();
- Boolean doublePress = msg.getDoublePressAvailable();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, press);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, multiTouch);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, doublePress);
-
- // Invalid/Null Tests
- TouchEventCapabilities msg = new TouchEventCapabilities();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getPressAvailable());
- assertNull(TestValues.NULL, msg.getMultiTouchAvailable());
- assertNull(TestValues.NULL, msg.getDoublePressAvailable());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, TestValues.GENERAL_BOOLEAN);
- reference.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Boolean press = msg.getPressAvailable();
+ Boolean multiTouch = msg.getMultiTouchAvailable();
+ Boolean doublePress = msg.getDoublePressAvailable();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, press);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, multiTouch);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, doublePress);
+
+ // Invalid/Null Tests
+ TouchEventCapabilities msg = new TouchEventCapabilities();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getPressAvailable());
+ assertNull(TestValues.NULL, msg.getMultiTouchAvailable());
+ assertNull(TestValues.NULL, msg.getDoublePressAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TouchEventCapabilities.KEY_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+ reference.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, TestValues.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
index f26558ad8..56654b679 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TouchEventTest.java
@@ -15,75 +15,75 @@ import java.util.Iterator;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.TouchEvent}
*/
public class TouchEventTest extends TestCase {
-
- private TouchEvent msg;
- @Override
- public void setUp() {
- msg = new TouchEvent();
- msg.setId(TestValues.GENERAL_INT);
- msg.setTs(TestValues.GENERAL_LONG_LIST);
- msg.setC(TestValues.GENERAL_TOUCHCOORD_LIST);
- }
+ private TouchEvent msg;
+
+ @Override
+ public void setUp() {
+ msg = new TouchEvent();
+ msg.setId(TestValues.GENERAL_INT);
+ msg.setTs(TestValues.GENERAL_LONG_LIST);
+ msg.setC(TestValues.GENERAL_TOUCHCOORD_LIST);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Integer id = msg.getId();
- List<Long> timestamp = msg.getTs();
- List<TouchCoord> coordTest = msg.getC();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
- assertTrue(TestValues.TRUE, Validator.validateLongList(TestValues.GENERAL_LONG_LIST, timestamp));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHCOORD_LIST.size(), coordTest.size());
-
- for (int index = 0; index < TestValues.GENERAL_TOUCHCOORD_LIST.size(); index++) {
- assertTrue(TestValues.TRUE, Validator.validateTouchCoord(TestValues.GENERAL_TOUCHCOORD_LIST.get(index), coordTest.get(index)));
- }
-
- // Invalid/Null Tests
- TouchEvent msg = new TouchEvent();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getId());
- assertNull(TestValues.NULL, msg.getTs());
- assertNull(TestValues.NULL, msg.getC());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(TouchEvent.KEY_ID, TestValues.GENERAL_INT);
- reference.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(TestValues.GENERAL_LONG_LIST));
- reference.put(TouchEvent.KEY_C, TestValues.JSON_TOUCHCOORDS);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(TouchEvent.KEY_C)) {
- assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
- } else if (key.equals(TouchEvent.KEY_TS)) {
- List<Long> tsListReference = JsonUtils.readLongListFromJsonObject(reference, key);
- List<Long> tsListTest = JsonUtils.readLongListFromJsonObject(underTest, key);
- assertTrue(TestValues.TRUE, tsListReference.containsAll(tsListTest) && tsListTest.containsAll(tsListReference));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Integer id = msg.getId();
+ List<Long> timestamp = msg.getTs();
+ List<TouchCoord> coordTest = msg.getC();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, id);
+ assertTrue(TestValues.TRUE, Validator.validateLongList(TestValues.GENERAL_LONG_LIST, timestamp));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHCOORD_LIST.size(), coordTest.size());
+
+ for (int index = 0; index < TestValues.GENERAL_TOUCHCOORD_LIST.size(); index++) {
+ assertTrue(TestValues.TRUE, Validator.validateTouchCoord(TestValues.GENERAL_TOUCHCOORD_LIST.get(index), coordTest.get(index)));
+ }
+
+ // Invalid/Null Tests
+ TouchEvent msg = new TouchEvent();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getId());
+ assertNull(TestValues.NULL, msg.getTs());
+ assertNull(TestValues.NULL, msg.getC());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(TouchEvent.KEY_ID, TestValues.GENERAL_INT);
+ reference.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(TestValues.GENERAL_LONG_LIST));
+ reference.put(TouchEvent.KEY_C, TestValues.JSON_TOUCHCOORDS);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(TouchEvent.KEY_C)) {
+ assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
+ } else if (key.equals(TouchEvent.KEY_TS)) {
+ List<Long> tsListReference = JsonUtils.readLongListFromJsonObject(reference, key);
+ List<Long> tsListTest = JsonUtils.readLongListFromJsonObject(underTest, key);
+ assertTrue(TestValues.TRUE, tsListReference.containsAll(tsListTest) && tsListTest.containsAll(tsListReference));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
index 6b4b71988..b40d4ca6c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TurnTests.java
@@ -11,46 +11,46 @@ import org.json.JSONException;
import org.json.JSONObject;
public class TurnTests extends TestCase {
-
- private Turn msg;
- @Override
- public void setUp(){
+ private Turn msg;
+
+ @Override
+ public void setUp() {
msg = new Turn();
assertNotNull(TestValues.NOT_NULL, msg);
-
+
msg.setTurnIcon(TestValues.GENERAL_IMAGE);
msg.setNavigationText(TestValues.GENERAL_STRING);
- }
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Image icon = msg.getTurnIcon();
- String text = msg.getNavigationText();
-
- // Valid Tests
- assertTrue(TestValues.MATCH, Validator.validateImage(TestValues.GENERAL_IMAGE, icon));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
-
- // Invalid/Null Tests
- Turn msg = new Turn();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getNavigationText());
- assertNull(TestValues.NULL, msg.getTurnIcon());
- }
-
- public void testJson(){
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Image icon = msg.getTurnIcon();
+ String text = msg.getNavigationText();
+
+ // Valid Tests
+ assertTrue(TestValues.MATCH, Validator.validateImage(TestValues.GENERAL_IMAGE, icon));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+
+ // Invalid/Null Tests
+ Turn msg = new Turn();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getNavigationText());
+ assertNull(TestValues.NULL, msg.getTurnIcon());
+ }
+
+ public void testJson() {
JSONObject reference = new JSONObject();
- try{
- reference.put(Turn.KEY_NAVIGATION_TEXT, TestValues.GENERAL_STRING);
- reference.put(Turn.KEY_TURN_IMAGE, TestValues.JSON_IMAGE);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ try {
+ reference.put(Turn.KEY_NAVIGATION_TEXT, TestValues.GENERAL_STRING);
+ reference.put(Turn.KEY_TURN_IMAGE, TestValues.JSON_IMAGE);
+ } catch (JSONException e) {
+ fail(TestValues.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 c3b9034f0..13cdea4da 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
@@ -14,61 +14,61 @@ import org.json.JSONObject;
import java.util.Iterator;
public class VehicleDataResultTest extends TestCase {
-
- private VehicleDataResult msg;
-
- @Override
- public void setUp() {
- msg = new VehicleDataResult();
-
- msg.setDataType(TestValues.GENERAL_VEHICLEDATATYPE);
- msg.setResultCode(TestValues.GENERAL_VEHICLEDATARESULTCODE);
- msg.setOEMCustomVehicleDataType(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
- }
+
+ private VehicleDataResult msg;
+
+ @Override
+ public void setUp() {
+ msg = new VehicleDataResult();
+
+ msg.setDataType(TestValues.GENERAL_VEHICLEDATATYPE);
+ msg.setResultCode(TestValues.GENERAL_VEHICLEDATARESULTCODE);
+ msg.setOEMCustomVehicleDataType(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- VehicleDataResultCode result = msg.getResultCode();
- VehicleDataType type = msg.getDataType();
- String oemCustomDataType = msg.getOEMCustomVehicleDataType();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATARESULTCODE, result);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATATYPE, type);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
-
- // Invalid/Null Tests
- VehicleDataResult msg = new VehicleDataResult();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getDataType());
- assertNull(TestValues.NULL, msg.getResultCode());
- assertNull(TestValues.NULL, msg.getOEMCustomVehicleDataType());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(VehicleDataResult.KEY_RESULT_CODE, TestValues.GENERAL_VEHICLEDATARESULTCODE);
- reference.put(VehicleDataResult.KEY_DATA_TYPE, TestValues.GENERAL_VEHICLEDATATYPE);
- reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH,
- JsonUtils.readObjectFromJsonObject(reference, key),
- JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ VehicleDataResultCode result = msg.getResultCode();
+ VehicleDataType type = msg.getDataType();
+ String oemCustomDataType = msg.getOEMCustomVehicleDataType();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATARESULTCODE, result);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VEHICLEDATATYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
+
+ // Invalid/Null Tests
+ VehicleDataResult msg = new VehicleDataResult();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getDataType());
+ assertNull(TestValues.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleDataType());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VehicleDataResult.KEY_RESULT_CODE, TestValues.GENERAL_VEHICLEDATARESULTCODE);
+ reference.put(VehicleDataResult.KEY_DATA_TYPE, TestValues.GENERAL_VEHICLEDATATYPE);
+ reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH,
+ JsonUtils.readObjectFromJsonObject(reference, key),
+ JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
index 1b0d5730e..a77de7473 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleTypeTest.java
@@ -12,64 +12,64 @@ import org.json.JSONObject;
import java.util.Iterator;
public class VehicleTypeTest extends TestCase {
-
- private VehicleType msg;
-
- @Override
- public void setUp() {
- msg = new VehicleType();
-
- msg.setModel(TestValues.GENERAL_STRING);
- msg.setMake(TestValues.GENERAL_STRING);
- msg.setTrim(TestValues.GENERAL_STRING);
- msg.setModelYear(TestValues.GENERAL_STRING);
- }
+
+ private VehicleType msg;
+
+ @Override
+ public void setUp() {
+ msg = new VehicleType();
+
+ msg.setModel(TestValues.GENERAL_STRING);
+ msg.setMake(TestValues.GENERAL_STRING);
+ msg.setTrim(TestValues.GENERAL_STRING);
+ msg.setModelYear(TestValues.GENERAL_STRING);
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String year = msg.getModelYear();
- String trim = msg.getTrim();
- String make = msg.getMake();
- String model = msg.getModel();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, year);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, model);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, make);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, trim);
-
- // Invalid/Null Tests
- VehicleType msg = new VehicleType();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getModel());
- assertNull(TestValues.NULL, msg.getMake());
- assertNull(TestValues.NULL, msg.getModelYear());
- assertNull(TestValues.NULL, msg.getTrim());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(VehicleType.KEY_MODEL, TestValues.GENERAL_STRING);
- reference.put(VehicleType.KEY_MAKE, TestValues.GENERAL_STRING);
- reference.put(VehicleType.KEY_MODEL_YEAR, TestValues.GENERAL_STRING);
- reference.put(VehicleType.KEY_TRIM, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String year = msg.getModelYear();
+ String trim = msg.getTrim();
+ String make = msg.getMake();
+ String model = msg.getModel();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, year);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, model);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, make);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, trim);
+
+ // Invalid/Null Tests
+ VehicleType msg = new VehicleType();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getModel());
+ assertNull(TestValues.NULL, msg.getMake());
+ assertNull(TestValues.NULL, msg.getModelYear());
+ assertNull(TestValues.NULL, msg.getTrim());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VehicleType.KEY_MODEL, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_MAKE, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_MODEL_YEAR, TestValues.GENERAL_STRING);
+ reference.put(VehicleType.KEY_TRIM, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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 0fb0288e2..422cd5ddc 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
@@ -21,94 +21,94 @@ import java.util.List;
public class VideoStreamingCapabilityTests extends TestCase {
- private VideoStreamingCapability msg;
-
- @Override
- public void setUp() {
- msg = new VideoStreamingCapability();
- msg.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- msg.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
- msg.setMaxBitrate(TestValues.GENERAL_INT);
- msg.setIsHapticSpatialDataSupported(TestValues.GENERAL_BOOLEAN);
- msg.setDiagonalScreenSize(TestValues.GENERAL_DOUBLE);
- msg.setPixelPerInch(TestValues.GENERAL_DOUBLE);
- msg.setScale(TestValues.GENERAL_DOUBLE);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- List<VideoStreamingFormat> format = msg.getSupportedFormats();
- 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(TestValues.MATCH, (List<VideoStreamingFormat>) TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
- assertEquals(TestValues.MATCH, (ImageResolution) TestValues.GENERAL_IMAGERESOLUTION, res);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, maxBitrate);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, diagonalScreenSize);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, pixelPerInch);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, scale);
-
- // Invalid/Null Tests
- VideoStreamingCapability msg = new VideoStreamingCapability();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getMaxBitrate());
- assertNull(TestValues.NULL, msg.getPreferredResolution());
- assertNull(TestValues.NULL, msg.getSupportedFormats());
- assertNull(TestValues.NULL, msg.getIsHapticSpatialDataSupported());
- assertNull(TestValues.NULL, msg.getDiagonalScreenSize());
- assertNull(TestValues.NULL, msg.getPixelPerInch());
- assertNull(TestValues.NULL, msg.getScale());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, TestValues.GENERAL_INT);
- reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, TestValues.GENERAL_IMAGERESOLUTION);
- reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
- reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, TestValues.GENERAL_BOOLEAN);
- reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, TestValues.GENERAL_DOUBLE);
- reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, TestValues.GENERAL_DOUBLE);
- reference.put(VideoStreamingCapability.KEY_SCALE, TestValues.GENERAL_DOUBLE);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
- assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
- } else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
- ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
- assertTrue(Validator.validateImageResolution(irReference, new ImageResolution(hashTest)));
- } else if (key.equals(VideoStreamingCapability.KEY_SUPPORTED_FORMATS)){
- List<VideoStreamingFormat> vsfReference = (List<VideoStreamingFormat>) JsonUtils.readObjectFromJsonObject(reference, key);
- JSONArray vsfArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- int i = 0;
- 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) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private VideoStreamingCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new VideoStreamingCapability();
+ msg.setSupportedFormats(TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ msg.setPreferredResolution(TestValues.GENERAL_IMAGERESOLUTION);
+ msg.setMaxBitrate(TestValues.GENERAL_INT);
+ msg.setIsHapticSpatialDataSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setDiagonalScreenSize(TestValues.GENERAL_DOUBLE);
+ msg.setPixelPerInch(TestValues.GENERAL_DOUBLE);
+ msg.setScale(TestValues.GENERAL_DOUBLE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ List<VideoStreamingFormat> format = msg.getSupportedFormats();
+ 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(TestValues.MATCH, (List<VideoStreamingFormat>) TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
+ assertEquals(TestValues.MATCH, (ImageResolution) TestValues.GENERAL_IMAGERESOLUTION, res);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, maxBitrate);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, diagonalScreenSize);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, pixelPerInch);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, scale);
+
+ // Invalid/Null Tests
+ VideoStreamingCapability msg = new VideoStreamingCapability();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getMaxBitrate());
+ assertNull(TestValues.NULL, msg.getPreferredResolution());
+ assertNull(TestValues.NULL, msg.getSupportedFormats());
+ assertNull(TestValues.NULL, msg.getIsHapticSpatialDataSupported());
+ assertNull(TestValues.NULL, msg.getDiagonalScreenSize());
+ assertNull(TestValues.NULL, msg.getPixelPerInch());
+ assertNull(TestValues.NULL, msg.getScale());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, TestValues.GENERAL_INT);
+ reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, TestValues.GENERAL_IMAGERESOLUTION);
+ reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, TestValues.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, TestValues.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_SCALE, TestValues.GENERAL_DOUBLE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
+ assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
+ } else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
+ ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
+ assertTrue(Validator.validateImageResolution(irReference, new ImageResolution(hashTest)));
+ } else if (key.equals(VideoStreamingCapability.KEY_SUPPORTED_FORMATS)) {
+ List<VideoStreamingFormat> vsfReference = (List<VideoStreamingFormat>) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONArray vsfArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ int i = 0;
+ 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) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
index 935751483..8a8390726 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
@@ -15,54 +15,54 @@ import java.util.Iterator;
public class VideoStreamingFormatTests extends TestCase {
- private VideoStreamingFormat msg;
-
- @Override
- public void setUp() {
- msg = new VideoStreamingFormat();
- msg.setProtocol(TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
- msg.setCodec(TestValues.GENERAL_VIDEOSTREAMINGCODEC);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- VideoStreamingProtocol protocol = msg.getProtocol();
- VideoStreamingCodec codec = msg.getCodec();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (VideoStreamingProtocol) TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL, protocol);
- assertEquals(TestValues.MATCH, (VideoStreamingCodec) TestValues.GENERAL_VIDEOSTREAMINGCODEC, codec);
-
- // Invalid/Null Tests
- VideoStreamingFormat msg = new VideoStreamingFormat();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getProtocol());
- assertNull(TestValues.NULL, msg.getCodec());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(VideoStreamingFormat.KEY_PROTOCOL, TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
- reference.put(VideoStreamingFormat.KEY_CODEC, TestValues.GENERAL_VIDEOSTREAMINGCODEC);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ private VideoStreamingFormat msg;
+
+ @Override
+ public void setUp() {
+ msg = new VideoStreamingFormat();
+ msg.setProtocol(TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ msg.setCodec(TestValues.GENERAL_VIDEOSTREAMINGCODEC);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ VideoStreamingProtocol protocol = msg.getProtocol();
+ VideoStreamingCodec codec = msg.getCodec();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (VideoStreamingProtocol) TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL, protocol);
+ assertEquals(TestValues.MATCH, (VideoStreamingCodec) TestValues.GENERAL_VIDEOSTREAMINGCODEC, codec);
+
+ // Invalid/Null Tests
+ VideoStreamingFormat msg = new VideoStreamingFormat();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getProtocol());
+ assertNull(TestValues.NULL, msg.getCodec());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VideoStreamingFormat.KEY_PROTOCOL, TestValues.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ reference.put(VideoStreamingFormat.KEY_CODEC, TestValues.GENERAL_VIDEOSTREAMINGCODEC);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
index a60615042..b1db6a7e5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VrHelpItemTest.java
@@ -16,70 +16,70 @@ import java.util.Hashtable;
import java.util.Iterator;
public class VrHelpItemTest extends TestCase {
-
- private VrHelpItem msg;
- @Override
- public void setUp() {
- msg = new VrHelpItem();
-
- msg.setText(TestValues.GENERAL_STRING);
- msg.setImage(TestValues.GENERAL_IMAGE);
- msg.setPosition(TestValues.GENERAL_INT);
+ private VrHelpItem msg;
- }
+ @Override
+ public void setUp() {
+ msg = new VrHelpItem();
+
+ msg.setText(TestValues.GENERAL_STRING);
+ msg.setImage(TestValues.GENERAL_IMAGE);
+ msg.setPosition(TestValues.GENERAL_INT);
+
+ }
/**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- String text = msg.getText();
- Image image = msg.getImage();
- Integer position = msg.getPosition();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, position);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
-
- // Invalid/Null Tests
- VrHelpItem msg = new VrHelpItem();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getImage());
- assertNull(TestValues.NULL, msg.getText());
- assertNull(TestValues.NULL, msg.getPosition());
- }
-
- public void testJson() {
- JSONObject reference = new JSONObject();
-
- try {
- reference.put(VrHelpItem.KEY_IMAGE, TestValues.JSON_IMAGE);
- reference.put(VrHelpItem.KEY_TEXT, TestValues.GENERAL_STRING);
- reference.put(VrHelpItem.KEY_POSITION, TestValues.GENERAL_INT);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if(key.equals(VrHelpItem.KEY_IMAGE)){
- JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
-
- assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String text = msg.getText();
+ Image image = msg.getImage();
+ Integer position = msg.getPosition();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, text);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, position);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, image));
+
+ // Invalid/Null Tests
+ VrHelpItem msg = new VrHelpItem();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getImage());
+ assertNull(TestValues.NULL, msg.getText());
+ assertNull(TestValues.NULL, msg.getPosition());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VrHelpItem.KEY_IMAGE, TestValues.JSON_IMAGE);
+ reference.put(VrHelpItem.KEY_TEXT, TestValues.GENERAL_STRING);
+ reference.put(VrHelpItem.KEY_POSITION, TestValues.GENERAL_INT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(VrHelpItem.KEY_IMAGE)) {
+ JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+
+ assertTrue(TestValues.TRUE, Validator.validateImage(new Image(hashReference), new Image(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
index f3537a29b..9fa289cb5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherAlertTests.java
@@ -23,90 +23,90 @@ import java.util.List;
*/
public class WeatherAlertTests extends TestCase {
- private WeatherAlert msg;
-
- @Override
- public void setUp(){
-
- msg = new WeatherAlert();
- msg.setExpires(TestValues.GENERAL_DATETIME);
- msg.setTimeIssued(TestValues.GENERAL_DATETIME);
- msg.setRegions(TestValues.GENERAL_STRING_LIST);
- msg.setSeverity(TestValues.GENERAL_STRING);
- msg.setSummary(TestValues.GENERAL_STRING);
- msg.setTitle(TestValues.GENERAL_STRING);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- DateTime expires = msg.getExpires();
- DateTime issued = msg.getTimeIssued();
- List<String> regions = msg.getRegions();
- String severity = msg.getSeverity();
- String summary = msg.getSummary();
- String title = msg.getTitle();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expires, TestValues.GENERAL_DATETIME);
- assertEquals(TestValues.MATCH, issued, TestValues.GENERAL_DATETIME);
- assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
- assertEquals(TestValues.MATCH, severity, TestValues.GENERAL_STRING);
- assertEquals(TestValues.MATCH, summary, TestValues.GENERAL_STRING);
- assertEquals(TestValues.MATCH, title, TestValues.GENERAL_STRING);
-
- // Invalid/Null Tests
- WeatherAlert msg = new WeatherAlert();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getExpires());
- assertNull(TestValues.NULL, msg.getTimeIssued());
- assertNull(TestValues.NULL, msg.getRegions());
- assertNull(TestValues.NULL, msg.getSeverity());
- assertNull(TestValues.NULL, msg.getSummary());
- assertNull(TestValues.NULL, msg.getTitle());
- }
-
- public void testRequiredParamsConstructor(){
- msg = new WeatherAlert(TestValues.GENERAL_STRING_LIST);
- List<String> regions = msg.getRegions();
- assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(WeatherAlert.KEY_EXPIRES, TestValues.GENERAL_DATETIME);
- reference.put(WeatherAlert.KEY_TIME_ISSUED, TestValues.GENERAL_DATETIME);
- reference.put(WeatherAlert.KEY_REGIONS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- reference.put(WeatherAlert.KEY_SEVERITY, TestValues.GENERAL_STRING);
- reference.put(WeatherAlert.KEY_SUMMARY, TestValues.GENERAL_STRING);
- reference.put(WeatherAlert.KEY_TITLE, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()) {
- String key = (String) iterator.next();
- if (key.equals(WeatherAlert.KEY_EXPIRES)||key.equals(WeatherAlert.KEY_TIME_ISSUED)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
- } else if (key.equals(WeatherAlert.KEY_REGIONS)){
- JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
- assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private WeatherAlert msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new WeatherAlert();
+ msg.setExpires(TestValues.GENERAL_DATETIME);
+ msg.setTimeIssued(TestValues.GENERAL_DATETIME);
+ msg.setRegions(TestValues.GENERAL_STRING_LIST);
+ msg.setSeverity(TestValues.GENERAL_STRING);
+ msg.setSummary(TestValues.GENERAL_STRING);
+ msg.setTitle(TestValues.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ DateTime expires = msg.getExpires();
+ DateTime issued = msg.getTimeIssued();
+ List<String> regions = msg.getRegions();
+ String severity = msg.getSeverity();
+ String summary = msg.getSummary();
+ String title = msg.getTitle();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expires, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, issued, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.MATCH, severity, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, summary, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, title, TestValues.GENERAL_STRING);
+
+ // Invalid/Null Tests
+ WeatherAlert msg = new WeatherAlert();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getExpires());
+ assertNull(TestValues.NULL, msg.getTimeIssued());
+ assertNull(TestValues.NULL, msg.getRegions());
+ assertNull(TestValues.NULL, msg.getSeverity());
+ assertNull(TestValues.NULL, msg.getSummary());
+ assertNull(TestValues.NULL, msg.getTitle());
+ }
+
+ public void testRequiredParamsConstructor() {
+ msg = new WeatherAlert(TestValues.GENERAL_STRING_LIST);
+ List<String> regions = msg.getRegions();
+ assertEquals(TestValues.MATCH, regions, TestValues.GENERAL_STRING_LIST);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WeatherAlert.KEY_EXPIRES, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_TIME_ISSUED, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherAlert.KEY_REGIONS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ reference.put(WeatherAlert.KEY_SEVERITY, TestValues.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_SUMMARY, TestValues.GENERAL_STRING);
+ reference.put(WeatherAlert.KEY_TITLE, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(WeatherAlert.KEY_EXPIRES) || key.equals(WeatherAlert.KEY_TIME_ISSUED)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else if (key.equals(WeatherAlert.KEY_REGIONS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
index cbebce592..66ba0a0e5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherDataTests.java
@@ -23,167 +23,167 @@ import java.util.Iterator;
*/
public class WeatherDataTests extends TestCase {
- private WeatherData msg;
-
- @Override
- public void setUp(){
-
- msg = new WeatherData();
- msg.setCurrentTemperature(TestValues.GENERAL_TEMPERATURE);
- msg.setTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
- msg.setTemperatureLow(TestValues.GENERAL_TEMPERATURE);
- msg.setApparentTemperature(TestValues.GENERAL_TEMPERATURE);
- msg.setApparentTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
- msg.setApparentTemperatureLow(TestValues.GENERAL_TEMPERATURE);
- msg.setWeatherSummary(TestValues.GENERAL_STRING);
- msg.setTime(TestValues.GENERAL_DATETIME);
- msg.setHumidity(TestValues.GENERAL_FLOAT);
- msg.setCloudCover(TestValues.GENERAL_FLOAT);
- msg.setMoonPhase(TestValues.GENERAL_FLOAT);
- msg.setWindBearing(TestValues.GENERAL_INTEGER);
- msg.setWindGust(TestValues.GENERAL_FLOAT);
- msg.setWindSpeed(TestValues.GENERAL_FLOAT);
- msg.setNearestStormBearing(TestValues.GENERAL_INTEGER);
- msg.setNearestStormDistance(TestValues.GENERAL_INTEGER);
- msg.setPrecipAccumulation(TestValues.GENERAL_FLOAT);
- msg.setPrecipIntensity(TestValues.GENERAL_FLOAT);
- msg.setPrecipProbability(TestValues.GENERAL_FLOAT);
- msg.setPrecipType(TestValues.GENERAL_STRING);
- msg.setVisibility(TestValues.GENERAL_FLOAT);
- msg.setWeatherIcon(TestValues.GENERAL_IMAGE);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- Temperature currentTemperature = msg.getCurrentTemperature();
- Temperature temperatureHigh = msg.getTemperatureHigh();
- Temperature temperatureLow = msg.getTemperatureLow();
- Temperature apparentTemperature = msg.getApparentTemperature();
- Temperature apparentTemperatureHigh = msg.getApparentTemperatureHigh();
- String weatherSummary = msg.getWeatherSummary();
- DateTime time = msg.getTime();
- Float humidity = msg.getHumidity();
- Float cloudCover = msg.getCloudCover();
- Float moonPhase = msg.getMoonPhase();
- Integer windBearing = msg.getWindBearing();
- Float windGust = msg.getWindGust();
- Float windSpeed = msg.getWindSpeed();
- Integer nearestStormBearing = msg.getNearestStormBearing();
- Integer nearestStormDistance = msg.getNearestStormDistance();
- Float precipAccumulation = msg.getPrecipAccumulation();
- Float precipIntensity = msg.getPrecipIntensity();
- Float precipProbability = msg.getPrecipProbability();
- String precipType = msg.getPrecipType();
- Float visibility = msg.getVisibility();
- Image weatherIcon = msg.getWeatherIcon();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, currentTemperature, TestValues.GENERAL_TEMPERATURE);
- assertEquals(TestValues.MATCH, temperatureHigh, TestValues.GENERAL_TEMPERATURE);
- assertEquals(TestValues.MATCH, temperatureLow, TestValues.GENERAL_TEMPERATURE);
- assertEquals(TestValues.MATCH, apparentTemperature, TestValues.GENERAL_TEMPERATURE);
- assertEquals(TestValues.MATCH, apparentTemperatureHigh, TestValues.GENERAL_TEMPERATURE);
- assertEquals(TestValues.MATCH, weatherSummary, TestValues.GENERAL_STRING);
- assertEquals(TestValues.MATCH, time, TestValues.GENERAL_DATETIME);
- assertEquals(TestValues.MATCH, humidity, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, cloudCover, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, moonPhase, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, windBearing, TestValues.GENERAL_INTEGER);
- assertEquals(TestValues.MATCH, windGust, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, windSpeed, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, nearestStormBearing, TestValues.GENERAL_INTEGER);
- assertEquals(TestValues.MATCH, nearestStormDistance, TestValues.GENERAL_INTEGER);
- assertEquals(TestValues.MATCH, precipAccumulation, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, precipIntensity, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, precipProbability, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, precipType, TestValues.GENERAL_STRING);
- assertEquals(TestValues.MATCH, visibility, TestValues.GENERAL_FLOAT);
- assertEquals(TestValues.MATCH, weatherIcon, TestValues.GENERAL_IMAGE);
-
- // Invalid/Null Tests
- WeatherData msg = new WeatherData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getCurrentTemperature());
- assertNull(TestValues.NULL, msg.getTemperatureHigh());
- assertNull(TestValues.NULL, msg.getTemperatureLow());
- assertNull(TestValues.NULL, msg.getApparentTemperature());
- assertNull(TestValues.NULL, msg.getApparentTemperatureHigh());
- assertNull(TestValues.NULL, msg.getApparentTemperatureLow());
- assertNull(TestValues.NULL, msg.getWeatherSummary());
- assertNull(TestValues.NULL, msg.getTime());
- assertNull(TestValues.NULL, msg.getHumidity());
- assertNull(TestValues.NULL, msg.getCloudCover());
- assertNull(TestValues.NULL, msg.getMoonPhase());
- assertNull(TestValues.NULL, msg.getWindBearing());
- assertNull(TestValues.NULL, msg.getWindGust());
- assertNull(TestValues.NULL, msg.getWindSpeed());
- assertNull(TestValues.NULL, msg.getNearestStormBearing());
- assertNull(TestValues.NULL, msg.getNearestStormDistance());
- assertNull(TestValues.NULL, msg.getPrecipAccumulation());
- assertNull(TestValues.NULL, msg.getPrecipIntensity());
- assertNull(TestValues.NULL, msg.getPrecipProbability());
- assertNull(TestValues.NULL, msg.getPrecipType());
- assertNull(TestValues.NULL, msg.getVisibility());
- assertNull(TestValues.NULL, msg.getWeatherIcon());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(WeatherData.KEY_CURRENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
- reference.put(WeatherData.KEY_WEATHER_SUMMARY, TestValues.GENERAL_STRING);
- reference.put(WeatherData.KEY_TIME, TestValues.GENERAL_DATETIME);
- reference.put(WeatherData.KEY_HUMIDITY, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_CLOUD_COVER, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_MOON_PHASE, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WIND_BEARING, TestValues.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_WIND_GUST, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WIND_SPEED, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_NEAREST_STORM_BEARING, TestValues.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_NEAREST_STORM_DISTANCE, TestValues.GENERAL_INTEGER);
- reference.put(WeatherData.KEY_PRECIP_ACCUMULATION, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_INTENSITY, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_PROBABILITY, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_PRECIP_TYPE, TestValues.GENERAL_STRING);
- reference.put(WeatherData.KEY_VISIBILITY, TestValues.GENERAL_FLOAT);
- reference.put(WeatherData.KEY_WEATHER_ICON, TestValues.GENERAL_STRING);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()) {
- String key = (String) iterator.next();
- if (key.equals(WeatherData.KEY_CURRENT_TEMPERATURE) || key.equals(WeatherData.KEY_TEMPERATURE_HIGH)||
- key.equals(WeatherData.KEY_TEMPERATURE_LOW) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE)||
- key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_LOW)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateTemperature(TestValues.GENERAL_TEMPERATURE, new Temperature(hashTest)));
- } else if (key.equals(WeatherData.KEY_TIME)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
- } else if (key.equals(WeatherData.KEY_WEATHER_ICON)){
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
- } else {
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private WeatherData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new WeatherData();
+ msg.setCurrentTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
+ msg.setTemperatureLow(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperature(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureHigh(TestValues.GENERAL_TEMPERATURE);
+ msg.setApparentTemperatureLow(TestValues.GENERAL_TEMPERATURE);
+ msg.setWeatherSummary(TestValues.GENERAL_STRING);
+ msg.setTime(TestValues.GENERAL_DATETIME);
+ msg.setHumidity(TestValues.GENERAL_FLOAT);
+ msg.setCloudCover(TestValues.GENERAL_FLOAT);
+ msg.setMoonPhase(TestValues.GENERAL_FLOAT);
+ msg.setWindBearing(TestValues.GENERAL_INTEGER);
+ msg.setWindGust(TestValues.GENERAL_FLOAT);
+ msg.setWindSpeed(TestValues.GENERAL_FLOAT);
+ msg.setNearestStormBearing(TestValues.GENERAL_INTEGER);
+ msg.setNearestStormDistance(TestValues.GENERAL_INTEGER);
+ msg.setPrecipAccumulation(TestValues.GENERAL_FLOAT);
+ msg.setPrecipIntensity(TestValues.GENERAL_FLOAT);
+ msg.setPrecipProbability(TestValues.GENERAL_FLOAT);
+ msg.setPrecipType(TestValues.GENERAL_STRING);
+ msg.setVisibility(TestValues.GENERAL_FLOAT);
+ msg.setWeatherIcon(TestValues.GENERAL_IMAGE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ Temperature currentTemperature = msg.getCurrentTemperature();
+ Temperature temperatureHigh = msg.getTemperatureHigh();
+ Temperature temperatureLow = msg.getTemperatureLow();
+ Temperature apparentTemperature = msg.getApparentTemperature();
+ Temperature apparentTemperatureHigh = msg.getApparentTemperatureHigh();
+ String weatherSummary = msg.getWeatherSummary();
+ DateTime time = msg.getTime();
+ Float humidity = msg.getHumidity();
+ Float cloudCover = msg.getCloudCover();
+ Float moonPhase = msg.getMoonPhase();
+ Integer windBearing = msg.getWindBearing();
+ Float windGust = msg.getWindGust();
+ Float windSpeed = msg.getWindSpeed();
+ Integer nearestStormBearing = msg.getNearestStormBearing();
+ Integer nearestStormDistance = msg.getNearestStormDistance();
+ Float precipAccumulation = msg.getPrecipAccumulation();
+ Float precipIntensity = msg.getPrecipIntensity();
+ Float precipProbability = msg.getPrecipProbability();
+ String precipType = msg.getPrecipType();
+ Float visibility = msg.getVisibility();
+ Image weatherIcon = msg.getWeatherIcon();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, currentTemperature, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, temperatureHigh, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, temperatureLow, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, apparentTemperature, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, apparentTemperatureHigh, TestValues.GENERAL_TEMPERATURE);
+ assertEquals(TestValues.MATCH, weatherSummary, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, time, TestValues.GENERAL_DATETIME);
+ assertEquals(TestValues.MATCH, humidity, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, cloudCover, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, moonPhase, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, windBearing, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, windGust, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, windSpeed, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, nearestStormBearing, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, nearestStormDistance, TestValues.GENERAL_INTEGER);
+ assertEquals(TestValues.MATCH, precipAccumulation, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipIntensity, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipProbability, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, precipType, TestValues.GENERAL_STRING);
+ assertEquals(TestValues.MATCH, visibility, TestValues.GENERAL_FLOAT);
+ assertEquals(TestValues.MATCH, weatherIcon, TestValues.GENERAL_IMAGE);
+
+ // Invalid/Null Tests
+ WeatherData msg = new WeatherData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getCurrentTemperature());
+ assertNull(TestValues.NULL, msg.getTemperatureHigh());
+ assertNull(TestValues.NULL, msg.getTemperatureLow());
+ assertNull(TestValues.NULL, msg.getApparentTemperature());
+ assertNull(TestValues.NULL, msg.getApparentTemperatureHigh());
+ assertNull(TestValues.NULL, msg.getApparentTemperatureLow());
+ assertNull(TestValues.NULL, msg.getWeatherSummary());
+ assertNull(TestValues.NULL, msg.getTime());
+ assertNull(TestValues.NULL, msg.getHumidity());
+ assertNull(TestValues.NULL, msg.getCloudCover());
+ assertNull(TestValues.NULL, msg.getMoonPhase());
+ assertNull(TestValues.NULL, msg.getWindBearing());
+ assertNull(TestValues.NULL, msg.getWindGust());
+ assertNull(TestValues.NULL, msg.getWindSpeed());
+ assertNull(TestValues.NULL, msg.getNearestStormBearing());
+ assertNull(TestValues.NULL, msg.getNearestStormDistance());
+ assertNull(TestValues.NULL, msg.getPrecipAccumulation());
+ assertNull(TestValues.NULL, msg.getPrecipIntensity());
+ assertNull(TestValues.NULL, msg.getPrecipProbability());
+ assertNull(TestValues.NULL, msg.getPrecipType());
+ assertNull(TestValues.NULL, msg.getVisibility());
+ assertNull(TestValues.NULL, msg.getWeatherIcon());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WeatherData.KEY_CURRENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_APPARENT_TEMPERATURE_LOW, TestValues.GENERAL_TEMPERATURE);
+ reference.put(WeatherData.KEY_WEATHER_SUMMARY, TestValues.GENERAL_STRING);
+ reference.put(WeatherData.KEY_TIME, TestValues.GENERAL_DATETIME);
+ reference.put(WeatherData.KEY_HUMIDITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_CLOUD_COVER, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_MOON_PHASE, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_WIND_GUST, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WIND_SPEED, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_NEAREST_STORM_BEARING, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_NEAREST_STORM_DISTANCE, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherData.KEY_PRECIP_ACCUMULATION, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_INTENSITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_PROBABILITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_PRECIP_TYPE, TestValues.GENERAL_STRING);
+ reference.put(WeatherData.KEY_VISIBILITY, TestValues.GENERAL_FLOAT);
+ reference.put(WeatherData.KEY_WEATHER_ICON, TestValues.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(WeatherData.KEY_CURRENT_TEMPERATURE) || key.equals(WeatherData.KEY_TEMPERATURE_HIGH) ||
+ key.equals(WeatherData.KEY_TEMPERATURE_LOW) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE) ||
+ key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_HIGH) || key.equals(WeatherData.KEY_APPARENT_TEMPERATURE_LOW)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateTemperature(TestValues.GENERAL_TEMPERATURE, new Temperature(hashTest)));
+ } else if (key.equals(WeatherData.KEY_TIME)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateDateTime(TestValues.GENERAL_DATETIME, new DateTime(hashTest)));
+ } else if (key.equals(WeatherData.KEY_WEATHER_ICON)) {
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, new Image(hashTest)));
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
index 3e3e26d95..10d40ddfc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceDataTests.java
@@ -27,116 +27,116 @@ import java.util.List;
*/
public class WeatherServiceDataTests extends TestCase {
- private WeatherServiceData msg;
-
- @Override
- public void setUp(){
-
- msg = new WeatherServiceData();
- msg.setLocation(TestValues.GENERAL_LOCATIONDETAILS);
- msg.setCurrentForecast(TestValues.GENERAL_WEATHERDATA);
- msg.setMinuteForecast(TestValues.GENERAL_WEATHERDATA_LIST);
- msg.setHourlyForecast(TestValues.GENERAL_WEATHERDATA_LIST);
- msg.setMultidayForecast(TestValues.GENERAL_WEATHERDATA_LIST);
- msg.setAlerts(TestValues.GENERAL_WEATHERALERT_LIST);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- LocationDetails location = msg.getLocation();
- WeatherData currentForecast = msg.getCurrentForecast();
- List<WeatherData> minuteForecast = msg.getMinuteForecast();
- List<WeatherData> hourlyForecast = msg.getHourlyForecast();
- List<WeatherData> multidayForecast = msg.getMultidayForecast();
- List<WeatherAlert> alerts = msg.getAlerts();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
- assertEquals(TestValues.GENERAL_WEATHERDATA, currentForecast);
- assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, minuteForecast);
- assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, hourlyForecast);
- assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, multidayForecast);
- assertEquals(TestValues.GENERAL_WEATHERALERT_LIST, alerts);
-
- // Invalid/Null Tests
- WeatherServiceData msg = new WeatherServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getLocation());
- assertNull(TestValues.NULL, msg.getCurrentForecast());
- assertNull(TestValues.NULL, msg.getMinuteForecast());
- assertNull(TestValues.NULL, msg.getHourlyForecast());
- assertNull(TestValues.NULL, msg.getMultidayForecast());
- assertNull(TestValues.NULL, msg.getAlerts());
- }
-
- public void testRequiredParamsConstructor(){
- msg = new WeatherServiceData(TestValues.GENERAL_LOCATIONDETAILS);
- LocationDetails location = msg.getLocation();
- assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(WeatherServiceData.KEY_LOCATION, TestValues.GENERAL_LOCATIONDETAILS);
- reference.put(WeatherServiceData.KEY_CURRENT_FORECAST, TestValues.GENERAL_WEATHERDATA);
- reference.put(WeatherServiceData.KEY_MINUTE_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_HOURLY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_MULTIDAY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
- reference.put(WeatherServiceData.KEY_ALERTS, TestValues.GENERAL_WEATHERALERT_LIST);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
-
- if(key.equals(WeatherServiceData.KEY_LOCATION)){
-
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateLocationDetails( TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
-
- } else if(key.equals(WeatherServiceData.KEY_CURRENT_FORECAST)){
-
- JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
- Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
- assertTrue(TestValues.TRUE, Validator.validateWeatherData( TestValues.GENERAL_WEATHERDATA, new WeatherData(hashTest)));
-
- } else if(key.equals(WeatherServiceData.KEY_MINUTE_FORECAST) || key.equals(WeatherServiceData.KEY_HOURLY_FORECAST)
- || key.equals(WeatherServiceData.KEY_MULTIDAY_FORECAST)){
-
- JSONArray weatherDataArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<WeatherData> weatherDataUnderTestList = new ArrayList<>();
- for (int index = 0; index < weatherDataArrayObjTest.length(); index++) {
- WeatherData weatherData1 = new WeatherData(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherDataArrayObjTest.get(index) ));
- weatherDataUnderTestList.add(weatherData1);
- }
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWeatherDataList(TestValues.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
-
- } else if(key.equals(WeatherServiceData.KEY_ALERTS)){
-
- JSONArray weatherAlertArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<WeatherAlert> weatherAlertUnderTestList = new ArrayList<>();
- for (int index = 0; index < weatherAlertArrayObjTest.length(); index++) {
- WeatherAlert weatherAlert1 = new WeatherAlert(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)weatherAlertArrayObjTest.get(index) ));
- weatherAlertUnderTestList.add(weatherAlert1);
- }
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWeatherAlertList(TestValues.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
- }
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private WeatherServiceData msg;
+
+ @Override
+ public void setUp() {
+
+ msg = new WeatherServiceData();
+ msg.setLocation(TestValues.GENERAL_LOCATIONDETAILS);
+ msg.setCurrentForecast(TestValues.GENERAL_WEATHERDATA);
+ msg.setMinuteForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setHourlyForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setMultidayForecast(TestValues.GENERAL_WEATHERDATA_LIST);
+ msg.setAlerts(TestValues.GENERAL_WEATHERALERT_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ LocationDetails location = msg.getLocation();
+ WeatherData currentForecast = msg.getCurrentForecast();
+ List<WeatherData> minuteForecast = msg.getMinuteForecast();
+ List<WeatherData> hourlyForecast = msg.getHourlyForecast();
+ List<WeatherData> multidayForecast = msg.getMultidayForecast();
+ List<WeatherAlert> alerts = msg.getAlerts();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
+ assertEquals(TestValues.GENERAL_WEATHERDATA, currentForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, minuteForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, hourlyForecast);
+ assertEquals(TestValues.GENERAL_WEATHERDATA_LIST, multidayForecast);
+ assertEquals(TestValues.GENERAL_WEATHERALERT_LIST, alerts);
+
+ // Invalid/Null Tests
+ WeatherServiceData msg = new WeatherServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getLocation());
+ assertNull(TestValues.NULL, msg.getCurrentForecast());
+ assertNull(TestValues.NULL, msg.getMinuteForecast());
+ assertNull(TestValues.NULL, msg.getHourlyForecast());
+ assertNull(TestValues.NULL, msg.getMultidayForecast());
+ assertNull(TestValues.NULL, msg.getAlerts());
+ }
+
+ public void testRequiredParamsConstructor() {
+ msg = new WeatherServiceData(TestValues.GENERAL_LOCATIONDETAILS);
+ LocationDetails location = msg.getLocation();
+ assertEquals(TestValues.GENERAL_LOCATIONDETAILS, location);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WeatherServiceData.KEY_LOCATION, TestValues.GENERAL_LOCATIONDETAILS);
+ reference.put(WeatherServiceData.KEY_CURRENT_FORECAST, TestValues.GENERAL_WEATHERDATA);
+ reference.put(WeatherServiceData.KEY_MINUTE_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_HOURLY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_MULTIDAY_FORECAST, TestValues.GENERAL_WEATHERDATA_LIST);
+ reference.put(WeatherServiceData.KEY_ALERTS, TestValues.GENERAL_WEATHERALERT_LIST);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(WeatherServiceData.KEY_LOCATION)) {
+
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateLocationDetails(TestValues.GENERAL_LOCATIONDETAILS, new LocationDetails(hashTest)));
+
+ } else if (key.equals(WeatherServiceData.KEY_CURRENT_FORECAST)) {
+
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(TestValues.TRUE, Validator.validateWeatherData(TestValues.GENERAL_WEATHERDATA, new WeatherData(hashTest)));
+
+ } else if (key.equals(WeatherServiceData.KEY_MINUTE_FORECAST) || key.equals(WeatherServiceData.KEY_HOURLY_FORECAST)
+ || key.equals(WeatherServiceData.KEY_MULTIDAY_FORECAST)) {
+
+ JSONArray weatherDataArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherData> weatherDataUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherDataArrayObjTest.length(); index++) {
+ WeatherData weatherData1 = new WeatherData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) weatherDataArrayObjTest.get(index)));
+ weatherDataUnderTestList.add(weatherData1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherDataList(TestValues.GENERAL_WEATHERDATA_LIST, weatherDataUnderTestList));
+
+ } else if (key.equals(WeatherServiceData.KEY_ALERTS)) {
+
+ JSONArray weatherAlertArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WeatherAlert> weatherAlertUnderTestList = new ArrayList<>();
+ for (int index = 0; index < weatherAlertArrayObjTest.length(); index++) {
+ WeatherAlert weatherAlert1 = new WeatherAlert(JsonRPCMarshaller.deserializeJSONObject((JSONObject) weatherAlertArrayObjTest.get(index)));
+ weatherAlertUnderTestList.add(weatherAlert1);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWeatherAlertList(TestValues.GENERAL_WEATHERALERT_LIST, weatherAlertUnderTestList));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
index 7a576569b..87c1e4639 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WeatherServiceManifestTests.java
@@ -17,68 +17,68 @@ import java.util.Iterator;
*/
public class WeatherServiceManifestTests extends TestCase {
- private WeatherServiceManifest msg;
-
- @Override
- public void setUp(){
- msg = new WeatherServiceManifest();
-
- msg.setCurrentForecastSupported(TestValues.GENERAL_BOOLEAN);
- msg.setMaxHourlyForecastAmount(TestValues.GENERAL_INT);
- msg.setMaxMinutelyForecastAmount(TestValues.GENERAL_INT);
- msg.setMaxMultidayForecastAmount(TestValues.GENERAL_INT);
- msg.setWeatherForLocationSupported(TestValues.GENERAL_BOOLEAN);
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- public void testRpcValues () {
- // Test Values
- boolean currentForecastSupported = msg.getCurrentForecastSupported();
- boolean weatherForLocationSupported = msg.getWeatherForLocationSupported();
- Integer getMaxHourlyForecastAmt = msg.getMaxHourlyForecastAmount();
- Integer getMaxMinutelyForecastAmt = msg.getMaxMinutelyForecastAmount();
- Integer getMaxMultidayForecastAmt = msg.getMaxMultidayForecastAmount();
-
- // Valid Tests
- assertEquals(TestValues.GENERAL_BOOLEAN, currentForecastSupported);
- assertEquals(TestValues.GENERAL_BOOLEAN, weatherForLocationSupported);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxHourlyForecastAmt);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMinutelyForecastAmt);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMultidayForecastAmt);
-
- // Invalid/Null Tests
- WeatherServiceManifest msg = new WeatherServiceManifest();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- assertNull(TestValues.NULL, msg.getCurrentForecastSupported());
- assertNull(TestValues.NULL, msg.getWeatherForLocationSupported());
- assertNull(TestValues.NULL, msg.getMaxHourlyForecastAmount());
- assertNull(TestValues.NULL, msg.getMaxMinutelyForecastAmount());
- assertNull(TestValues.NULL, msg.getMaxMultidayForecastAmount());
- }
-
- public void testJson(){
- JSONObject reference = new JSONObject();
-
- try{
- reference.put(WeatherServiceManifest.KEY_CURRENT_FORECAST_SUPPORTED, TestValues.GENERAL_BOOLEAN);
- reference.put(WeatherServiceManifest.KEY_WEATHER_FOR_LOCATION_SUPPORTED, TestValues.GENERAL_BOOLEAN);
- reference.put(WeatherServiceManifest.KEY_MAX_HOURLY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
- reference.put(WeatherServiceManifest.KEY_MAX_MINUTELY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
- reference.put(WeatherServiceManifest.KEY_MAX_MULTIDAY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
-
- JSONObject underTest = msg.serializeJSON();
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
- String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
- }
+ private WeatherServiceManifest msg;
+
+ @Override
+ public void setUp() {
+ msg = new WeatherServiceManifest();
+
+ msg.setCurrentForecastSupported(TestValues.GENERAL_BOOLEAN);
+ msg.setMaxHourlyForecastAmount(TestValues.GENERAL_INT);
+ msg.setMaxMinutelyForecastAmount(TestValues.GENERAL_INT);
+ msg.setMaxMultidayForecastAmount(TestValues.GENERAL_INT);
+ msg.setWeatherForLocationSupported(TestValues.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ boolean currentForecastSupported = msg.getCurrentForecastSupported();
+ boolean weatherForLocationSupported = msg.getWeatherForLocationSupported();
+ Integer getMaxHourlyForecastAmt = msg.getMaxHourlyForecastAmount();
+ Integer getMaxMinutelyForecastAmt = msg.getMaxMinutelyForecastAmount();
+ Integer getMaxMultidayForecastAmt = msg.getMaxMultidayForecastAmount();
+
+ // Valid Tests
+ assertEquals(TestValues.GENERAL_BOOLEAN, currentForecastSupported);
+ assertEquals(TestValues.GENERAL_BOOLEAN, weatherForLocationSupported);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxHourlyForecastAmt);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMinutelyForecastAmt);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, getMaxMultidayForecastAmt);
+
+ // Invalid/Null Tests
+ WeatherServiceManifest msg = new WeatherServiceManifest();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getCurrentForecastSupported());
+ assertNull(TestValues.NULL, msg.getWeatherForLocationSupported());
+ assertNull(TestValues.NULL, msg.getMaxHourlyForecastAmount());
+ assertNull(TestValues.NULL, msg.getMaxMinutelyForecastAmount());
+ assertNull(TestValues.NULL, msg.getMaxMultidayForecastAmount());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WeatherServiceManifest.KEY_CURRENT_FORECAST_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_WEATHER_FOR_LOCATION_SUPPORTED, TestValues.GENERAL_BOOLEAN);
+ reference.put(WeatherServiceManifest.KEY_MAX_HOURLY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MINUTELY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
+ reference.put(WeatherServiceManifest.KEY_MAX_MULTIDAY_FORECAST_AMOUNT, TestValues.GENERAL_INTEGER);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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
index 6ddee819b..cee5b5f84 100644
--- 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
@@ -92,7 +92,7 @@ public class WindowCapabilityTests extends TestCase {
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
}
- for(int i = 0; i < TestValues.GENERAL_MENU_LAYOUT_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_MENU_LAYOUT_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT_LIST.get(i), menuLayouts.get(i));
}
@@ -210,8 +210,8 @@ public class WindowCapabilityTests extends TestCase {
assertEquals(TestValues.MATCH, referenceArray.length(), underTestArray.length());
for (int i = 0; i < referenceArray.length(); i++) {
- imageFieldNameListReference.add( (ImageFieldName) referenceArray.get(i));
- imageFieldNameListTest.add( (ImageFieldName) underTestArray.get(i));
+ imageFieldNameListReference.add((ImageFieldName) referenceArray.get(i));
+ imageFieldNameListTest.add((ImageFieldName) underTestArray.get(i));
}
assertTrue(TestValues.TRUE, imageFieldNameListReference.containsAll(imageFieldNameListTest) && imageFieldNameListTest.containsAll(imageFieldNameListReference));
} else {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AmbientLightStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AmbientLightStatusTests.java
index adc398eff..5c90c09ed 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AmbientLightStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AmbientLightStatusTests.java
@@ -9,89 +9,87 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus}
*/
public class AmbientLightStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
-
- String example = "DAY";
- AmbientLightStatus enumDay = AmbientLightStatus.valueForString(example);
- example = "NIGHT";
- AmbientLightStatus enumNight = AmbientLightStatus.valueForString(example);
- example = "UNKNOWN";
- AmbientLightStatus enumUnknown = AmbientLightStatus.valueForString(example);
- example = "INVALID";
- AmbientLightStatus enumInvalid = AmbientLightStatus.valueForString(example);
- example = "TWILIGHT_1";
- AmbientLightStatus enumTwilight1 = AmbientLightStatus.valueForString(example);
- example = "TWILIGHT_2";
- AmbientLightStatus enumTwilight2 = AmbientLightStatus.valueForString(example);
- example = "TWILIGHT_3";
- AmbientLightStatus enumTwilight3 = AmbientLightStatus.valueForString(example);
- example = "TWILIGHT_4";
- AmbientLightStatus enumTwilight4 = AmbientLightStatus.valueForString(example);
-
- assertNotNull("DAY returned null", enumDay);
- assertNotNull("NIGHT returned null", enumNight);
- assertNotNull("UNKNOWN returned null", enumUnknown);
- assertNotNull("INVALID returned null", enumInvalid);
- assertNotNull("TWILIGHT_1 returned null", enumTwilight1);
- assertNotNull("TWILIGHT_2 returned null", enumTwilight2);
- assertNotNull("TWILIGHT_3 returned null", enumTwilight3);
- assertNotNull("TWILIGHT_4 returned null", enumTwilight4);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "niGHt";
- try {
- AmbientLightStatus temp = AmbientLightStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+
+ String example = "DAY";
+ AmbientLightStatus enumDay = AmbientLightStatus.valueForString(example);
+ example = "NIGHT";
+ AmbientLightStatus enumNight = AmbientLightStatus.valueForString(example);
+ example = "UNKNOWN";
+ AmbientLightStatus enumUnknown = AmbientLightStatus.valueForString(example);
+ example = "INVALID";
+ AmbientLightStatus enumInvalid = AmbientLightStatus.valueForString(example);
+ example = "TWILIGHT_1";
+ AmbientLightStatus enumTwilight1 = AmbientLightStatus.valueForString(example);
+ example = "TWILIGHT_2";
+ AmbientLightStatus enumTwilight2 = AmbientLightStatus.valueForString(example);
+ example = "TWILIGHT_3";
+ AmbientLightStatus enumTwilight3 = AmbientLightStatus.valueForString(example);
+ example = "TWILIGHT_4";
+ AmbientLightStatus enumTwilight4 = AmbientLightStatus.valueForString(example);
+
+ assertNotNull("DAY returned null", enumDay);
+ assertNotNull("NIGHT returned null", enumNight);
+ assertNotNull("UNKNOWN returned null", enumUnknown);
+ assertNotNull("INVALID returned null", enumInvalid);
+ assertNotNull("TWILIGHT_1 returned null", enumTwilight1);
+ assertNotNull("TWILIGHT_2 returned null", enumTwilight2);
+ assertNotNull("TWILIGHT_3 returned null", enumTwilight3);
+ assertNotNull("TWILIGHT_4 returned null", enumTwilight4);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "niGHt";
+ try {
+ AmbientLightStatus temp = AmbientLightStatus.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 {
- AmbientLightStatus temp = AmbientLightStatus.valueForString(example);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AmbientLightStatus temp = AmbientLightStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of AmbientLightStatus.
- */
- public void testListEnum() {
- List<AmbientLightStatus> enumValueList = Arrays.asList(AmbientLightStatus.values());
- List<AmbientLightStatus> enumTestList = new ArrayList<AmbientLightStatus>();
-
- enumTestList.add(AmbientLightStatus.DAY);
- enumTestList.add(AmbientLightStatus.NIGHT);
- enumTestList.add(AmbientLightStatus.UNKNOWN);
- enumTestList.add(AmbientLightStatus.INVALID);
- enumTestList.add(AmbientLightStatus.TWILIGHT_1);
- enumTestList.add(AmbientLightStatus.TWILIGHT_2);
- enumTestList.add(AmbientLightStatus.TWILIGHT_3);
- enumTestList.add(AmbientLightStatus.TWILIGHT_4);
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of AmbientLightStatus.
+ */
+ public void testListEnum() {
+ List<AmbientLightStatus> enumValueList = Arrays.asList(AmbientLightStatus.values());
+ List<AmbientLightStatus> enumTestList = new ArrayList<AmbientLightStatus>();
+
+ enumTestList.add(AmbientLightStatus.DAY);
+ enumTestList.add(AmbientLightStatus.NIGHT);
+ enumTestList.add(AmbientLightStatus.UNKNOWN);
+ enumTestList.add(AmbientLightStatus.INVALID);
+ enumTestList.add(AmbientLightStatus.TWILIGHT_1);
+ enumTestList.add(AmbientLightStatus.TWILIGHT_2);
+ enumTestList.add(AmbientLightStatus.TWILIGHT_3);
+ enumTestList.add(AmbientLightStatus.TWILIGHT_4);
- assertTrue("Enum value list does not match enum class list.",
- enumValueList.containsAll(enumTestList) &&
- enumTestList.containsAll(enumValueList));
- }
+ 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/AppHmiTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
index af0881ad6..32e1d1284 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
@@ -9,107 +9,105 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.AppHMIType}
*/
public class AppHmiTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "DEFAULT";
- AppHMIType enumDefault = AppHMIType.valueForString(example);
- example = "COMMUNICATION";
- AppHMIType enumCommunication = AppHMIType.valueForString(example);
- example = "MEDIA";
- AppHMIType enumMedia = AppHMIType.valueForString(example);
- example = "MESSAGING";
- AppHMIType enumMessaging = AppHMIType.valueForString(example);
- example = "NAVIGATION";
- AppHMIType enumNavigation = AppHMIType.valueForString(example);
- example = "INFORMATION";
- AppHMIType enumInformation = AppHMIType.valueForString(example);
- example = "SOCIAL";
- AppHMIType enumSocial = AppHMIType.valueForString(example);
- example = "BACKGROUND_PROCESS";
- AppHMIType enumBackgroundProcess = AppHMIType.valueForString(example);
- example = "PROJECTION";
- AppHMIType enumProjection = AppHMIType.valueForString(example);
- example = "TESTING";
- AppHMIType enumTesting = AppHMIType.valueForString(example);
- example = "SYSTEM";
- AppHMIType enumSystem = AppHMIType.valueForString(example);
- example = "REMOTE_CONTROL";
- AppHMIType enumRemoteControl = AppHMIType.valueForString(example);
- example = "WEB_VIEW";
- AppHMIType enumWebView = AppHMIType.valueForString(example);
-
- assertNotNull("DEFAULT returned null", enumDefault);
- assertNotNull("COMMUNICATION returned null", enumCommunication);
- assertNotNull("MEDIA returned null", enumMedia);
- assertNotNull("MESSAGING returned null", enumMessaging);
- assertNotNull("NAVIGATION returned null", enumNavigation);
- assertNotNull("INFORMATION returned null", enumInformation);
- assertNotNull("SOCIAL returned null", enumSocial);
- assertNotNull("BACKGROUND_PROCESS returned null", enumBackgroundProcess);
- assertNotNull("PROJECTION returned null", enumProjection);
- assertNotNull("TESTING returned null", enumTesting);
- assertNotNull("SYSTEM returned null", enumSystem);
- assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
- assertNotNull("WEB_VIEW returned null", enumWebView);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "deFaUlt";
- try {
- AppHMIType temp = AppHMIType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DEFAULT";
+ AppHMIType enumDefault = AppHMIType.valueForString(example);
+ example = "COMMUNICATION";
+ AppHMIType enumCommunication = AppHMIType.valueForString(example);
+ example = "MEDIA";
+ AppHMIType enumMedia = AppHMIType.valueForString(example);
+ example = "MESSAGING";
+ AppHMIType enumMessaging = AppHMIType.valueForString(example);
+ example = "NAVIGATION";
+ AppHMIType enumNavigation = AppHMIType.valueForString(example);
+ example = "INFORMATION";
+ AppHMIType enumInformation = AppHMIType.valueForString(example);
+ example = "SOCIAL";
+ AppHMIType enumSocial = AppHMIType.valueForString(example);
+ example = "BACKGROUND_PROCESS";
+ AppHMIType enumBackgroundProcess = AppHMIType.valueForString(example);
+ example = "PROJECTION";
+ AppHMIType enumProjection = AppHMIType.valueForString(example);
+ example = "TESTING";
+ AppHMIType enumTesting = AppHMIType.valueForString(example);
+ example = "SYSTEM";
+ AppHMIType enumSystem = AppHMIType.valueForString(example);
+ example = "REMOTE_CONTROL";
+ AppHMIType enumRemoteControl = AppHMIType.valueForString(example);
+ example = "WEB_VIEW";
+ AppHMIType enumWebView = AppHMIType.valueForString(example);
+
+ assertNotNull("DEFAULT returned null", enumDefault);
+ assertNotNull("COMMUNICATION returned null", enumCommunication);
+ assertNotNull("MEDIA returned null", enumMedia);
+ assertNotNull("MESSAGING returned null", enumMessaging);
+ assertNotNull("NAVIGATION returned null", enumNavigation);
+ assertNotNull("INFORMATION returned null", enumInformation);
+ assertNotNull("SOCIAL returned null", enumSocial);
+ assertNotNull("BACKGROUND_PROCESS returned null", enumBackgroundProcess);
+ assertNotNull("PROJECTION returned null", enumProjection);
+ assertNotNull("TESTING returned null", enumTesting);
+ assertNotNull("SYSTEM returned null", enumSystem);
+ assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
+ assertNotNull("WEB_VIEW returned null", enumWebView);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "deFaUlt";
+ try {
+ AppHMIType temp = AppHMIType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- AppHMIType temp = AppHMIType.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AppHMIType temp = AppHMIType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of AmbientLightStatus.
- */
- public void testListEnum() {
- List<AppHMIType> enumValueList = Arrays.asList(AppHMIType.values());
-
- List<AppHMIType> enumTestList = new ArrayList<AppHMIType>();
- enumTestList.add(AppHMIType.DEFAULT);
- enumTestList.add(AppHMIType.COMMUNICATION);
- enumTestList.add(AppHMIType.MEDIA);
- enumTestList.add(AppHMIType.MESSAGING);
- enumTestList.add(AppHMIType.NAVIGATION);
- enumTestList.add(AppHMIType.INFORMATION);
- enumTestList.add(AppHMIType.SOCIAL);
- enumTestList.add(AppHMIType.BACKGROUND_PROCESS);
- enumTestList.add(AppHMIType.PROJECTION);
- enumTestList.add(AppHMIType.TESTING);
- enumTestList.add(AppHMIType.SYSTEM);
- enumTestList.add(AppHMIType.REMOTE_CONTROL);
- enumTestList.add(AppHMIType.WEB_VIEW);
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of AmbientLightStatus.
+ */
+ public void testListEnum() {
+ List<AppHMIType> enumValueList = Arrays.asList(AppHMIType.values());
+
+ List<AppHMIType> enumTestList = new ArrayList<AppHMIType>();
+ enumTestList.add(AppHMIType.DEFAULT);
+ enumTestList.add(AppHMIType.COMMUNICATION);
+ enumTestList.add(AppHMIType.MEDIA);
+ enumTestList.add(AppHMIType.MESSAGING);
+ enumTestList.add(AppHMIType.NAVIGATION);
+ enumTestList.add(AppHMIType.INFORMATION);
+ enumTestList.add(AppHMIType.SOCIAL);
+ enumTestList.add(AppHMIType.BACKGROUND_PROCESS);
+ enumTestList.add(AppHMIType.PROJECTION);
+ enumTestList.add(AppHMIType.TESTING);
+ enumTestList.add(AppHMIType.SYSTEM);
+ enumTestList.add(AppHMIType.REMOTE_CONTROL);
+ enumTestList.add(AppHMIType.WEB_VIEW);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/AppInterfaceUnregisteredReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
index 333ff8d52..056f57597 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
@@ -9,111 +9,109 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason}
*/
public class AppInterfaceUnregisteredReasonTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "USER_EXIT";
- AppInterfaceUnregisteredReason enumUserExit = AppInterfaceUnregisteredReason.valueForString(example);
- example = "IGNITION_OFF";
- AppInterfaceUnregisteredReason enumIgnitionOff = AppInterfaceUnregisteredReason.valueForString(example);
- example = "BLUETOOTH_OFF";
- AppInterfaceUnregisteredReason enumBluetoothOff = AppInterfaceUnregisteredReason.valueForString(example);
- example = "USB_DISCONNECTED";
- AppInterfaceUnregisteredReason enumUsbDisconnected = AppInterfaceUnregisteredReason.valueForString(example);
- example = "REQUEST_WHILE_IN_NONE_HMI_LEVEL";
- AppInterfaceUnregisteredReason enumRequestWhileInNoneHmiLevel = AppInterfaceUnregisteredReason.valueForString(example);
- example = "TOO_MANY_REQUESTS";
- AppInterfaceUnregisteredReason enumTooManyRequests = AppInterfaceUnregisteredReason.valueForString(example);
- example = "DRIVER_DISTRACTION_VIOLATION";
- AppInterfaceUnregisteredReason enumDriverDistractionViolation = AppInterfaceUnregisteredReason.valueForString(example);
- example = "LANGUAGE_CHANGE";
- AppInterfaceUnregisteredReason enumLanguageChange = AppInterfaceUnregisteredReason.valueForString(example);
- example = "MASTER_RESET";
- AppInterfaceUnregisteredReason enumMasterReset = AppInterfaceUnregisteredReason.valueForString(example);
- example = "FACTORY_DEFAULTS";
- AppInterfaceUnregisteredReason enumFactoryDefaults = AppInterfaceUnregisteredReason.valueForString(example);
- example = "APP_UNAUTHORIZED";
- AppInterfaceUnregisteredReason enumAppAuthorized = AppInterfaceUnregisteredReason.valueForString(example);
- example = "PROTOCOL_VIOLATION";
- AppInterfaceUnregisteredReason enumProtocolViolation = AppInterfaceUnregisteredReason.valueForString(example);
- example = "UNSUPPORTED_HMI_RESOURCE";
- AppInterfaceUnregisteredReason enumUnsupportedHMIResource = AppInterfaceUnregisteredReason.valueForString(example);
- example = "RESOURCE_CONSTRAINT";
- AppInterfaceUnregisteredReason enumResourceConstraint = AppInterfaceUnregisteredReason.valueForString(example);
-
- assertNotNull("USER_EXIT returned null", enumUserExit);
- assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
- assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
- assertNotNull("USB_DISCONNECTED returned null", enumUsbDisconnected);
- assertNotNull("REQUEST_WHILE_IN_NONE_HMI_LEVEL returned null", enumRequestWhileInNoneHmiLevel);
- assertNotNull("TOO_MANY_REQUESTS returned null", enumTooManyRequests);
- assertNotNull("DRIVER_DISTRACTION_VIOLATION returned null", enumDriverDistractionViolation);
- assertNotNull("LANGUAGE_CHANGE returned null", enumLanguageChange);
- assertNotNull("MASTER_RESET returned null", enumMasterReset);
- assertNotNull("FACTORY_DEFAULTS returned null", enumFactoryDefaults);
- assertNotNull("APP_UNAUTHORIZED returned null", enumAppAuthorized);
- assertNotNull("PROTOCOL_VIOLATION returned null", enumProtocolViolation);
- assertNotNull("UNSUPPORTED_HMI_RESOURCE returned null", enumUnsupportedHMIResource);
- assertNotNull("RESOURCE_CONSTRAINT returned null", enumResourceConstraint);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "uSer_ExiT";
- try {
- AppInterfaceUnregisteredReason temp = AppInterfaceUnregisteredReason.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "USER_EXIT";
+ AppInterfaceUnregisteredReason enumUserExit = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "IGNITION_OFF";
+ AppInterfaceUnregisteredReason enumIgnitionOff = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "BLUETOOTH_OFF";
+ AppInterfaceUnregisteredReason enumBluetoothOff = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "USB_DISCONNECTED";
+ AppInterfaceUnregisteredReason enumUsbDisconnected = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "REQUEST_WHILE_IN_NONE_HMI_LEVEL";
+ AppInterfaceUnregisteredReason enumRequestWhileInNoneHmiLevel = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "TOO_MANY_REQUESTS";
+ AppInterfaceUnregisteredReason enumTooManyRequests = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "DRIVER_DISTRACTION_VIOLATION";
+ AppInterfaceUnregisteredReason enumDriverDistractionViolation = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "LANGUAGE_CHANGE";
+ AppInterfaceUnregisteredReason enumLanguageChange = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "MASTER_RESET";
+ AppInterfaceUnregisteredReason enumMasterReset = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "FACTORY_DEFAULTS";
+ AppInterfaceUnregisteredReason enumFactoryDefaults = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "APP_UNAUTHORIZED";
+ AppInterfaceUnregisteredReason enumAppAuthorized = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "PROTOCOL_VIOLATION";
+ AppInterfaceUnregisteredReason enumProtocolViolation = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "UNSUPPORTED_HMI_RESOURCE";
+ AppInterfaceUnregisteredReason enumUnsupportedHMIResource = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "RESOURCE_CONSTRAINT";
+ AppInterfaceUnregisteredReason enumResourceConstraint = AppInterfaceUnregisteredReason.valueForString(example);
+
+ assertNotNull("USER_EXIT returned null", enumUserExit);
+ assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
+ assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
+ assertNotNull("USB_DISCONNECTED returned null", enumUsbDisconnected);
+ assertNotNull("REQUEST_WHILE_IN_NONE_HMI_LEVEL returned null", enumRequestWhileInNoneHmiLevel);
+ assertNotNull("TOO_MANY_REQUESTS returned null", enumTooManyRequests);
+ assertNotNull("DRIVER_DISTRACTION_VIOLATION returned null", enumDriverDistractionViolation);
+ assertNotNull("LANGUAGE_CHANGE returned null", enumLanguageChange);
+ assertNotNull("MASTER_RESET returned null", enumMasterReset);
+ assertNotNull("FACTORY_DEFAULTS returned null", enumFactoryDefaults);
+ assertNotNull("APP_UNAUTHORIZED returned null", enumAppAuthorized);
+ assertNotNull("PROTOCOL_VIOLATION returned null", enumProtocolViolation);
+ assertNotNull("UNSUPPORTED_HMI_RESOURCE returned null", enumUnsupportedHMIResource);
+ assertNotNull("RESOURCE_CONSTRAINT returned null", enumResourceConstraint);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "uSer_ExiT";
+ try {
+ AppInterfaceUnregisteredReason temp = AppInterfaceUnregisteredReason.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- AppInterfaceUnregisteredReason temp = AppInterfaceUnregisteredReason.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AppInterfaceUnregisteredReason temp = AppInterfaceUnregisteredReason.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of AppInterfaceUnregisteredReason.
- */
- public void testListEnum() {
- List<AppInterfaceUnregisteredReason> enumValueList = Arrays.asList(AppInterfaceUnregisteredReason.values());
+ /**
+ * Verifies the possible enum values of AppInterfaceUnregisteredReason.
+ */
+ public void testListEnum() {
+ List<AppInterfaceUnregisteredReason> enumValueList = Arrays.asList(AppInterfaceUnregisteredReason.values());
- List<AppInterfaceUnregisteredReason> enumTestList = new ArrayList<AppInterfaceUnregisteredReason>();
- enumTestList.add(AppInterfaceUnregisteredReason.USER_EXIT);
- enumTestList.add(AppInterfaceUnregisteredReason.IGNITION_OFF);
- enumTestList.add(AppInterfaceUnregisteredReason.BLUETOOTH_OFF);
- enumTestList.add(AppInterfaceUnregisteredReason.USB_DISCONNECTED);
- enumTestList.add(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL);
- enumTestList.add(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS);
- enumTestList.add(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION);
- enumTestList.add(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE);
- enumTestList.add(AppInterfaceUnregisteredReason.MASTER_RESET);
- enumTestList.add(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS);
- enumTestList.add(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED);
- enumTestList.add(AppInterfaceUnregisteredReason.PROTOCOL_VIOLATION);
- enumTestList.add(AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE);
- enumTestList.add(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT);
+ List<AppInterfaceUnregisteredReason> enumTestList = new ArrayList<AppInterfaceUnregisteredReason>();
+ enumTestList.add(AppInterfaceUnregisteredReason.USER_EXIT);
+ enumTestList.add(AppInterfaceUnregisteredReason.IGNITION_OFF);
+ enumTestList.add(AppInterfaceUnregisteredReason.BLUETOOTH_OFF);
+ enumTestList.add(AppInterfaceUnregisteredReason.USB_DISCONNECTED);
+ enumTestList.add(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL);
+ enumTestList.add(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS);
+ enumTestList.add(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION);
+ enumTestList.add(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE);
+ enumTestList.add(AppInterfaceUnregisteredReason.MASTER_RESET);
+ enumTestList.add(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS);
+ enumTestList.add(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED);
+ enumTestList.add(AppInterfaceUnregisteredReason.PROTOCOL_VIOLATION);
+ enumTestList.add(AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE);
+ enumTestList.add(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/AppServiceTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
index ce4867e41..5cecebdd2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppServiceTypeTests.java
@@ -14,62 +14,60 @@ import java.util.List;
*/
public class AppServiceTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "MEDIA";
- AppServiceType enumMedia = AppServiceType.valueForString(example);
- example = "WEATHER";
- AppServiceType enumWeather = AppServiceType.valueForString(example);
- example = "NAVIGATION";
- AppServiceType enumNavigation = AppServiceType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MEDIA";
+ AppServiceType enumMedia = AppServiceType.valueForString(example);
+ example = "WEATHER";
+ AppServiceType enumWeather = AppServiceType.valueForString(example);
+ example = "NAVIGATION";
+ AppServiceType enumNavigation = AppServiceType.valueForString(example);
- assertNotNull("MEDIA returned null", enumMedia);
- assertNotNull("WEATHER returned null", enumWeather);
- assertNotNull("NAVIGATION returned null", enumNavigation);
- }
+ assertNotNull("MEDIA returned null", enumMedia);
+ assertNotNull("WEATHER returned null", enumWeather);
+ assertNotNull("NAVIGATION returned null", enumNavigation);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "MedIas";
- try {
- AppServiceType temp = AppServiceType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "MedIas";
+ try {
+ AppServiceType temp = AppServiceType.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 {
- AppServiceType temp = AppServiceType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AppServiceType temp = AppServiceType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of AppServiceType.
- */
- public void testListEnum() {
- List<AppServiceType> enumValueList = Arrays.asList(AppServiceType.values());
+ /**
+ * Verifies the possible enum values of AppServiceType.
+ */
+ public void testListEnum() {
+ List<AppServiceType> enumValueList = Arrays.asList(AppServiceType.values());
- List<AppServiceType> enumTestList = new ArrayList<>();
- enumTestList.add(AppServiceType.MEDIA);
- enumTestList.add(AppServiceType.NAVIGATION);
- enumTestList.add(AppServiceType.WEATHER);
+ List<AppServiceType> enumTestList = new ArrayList<>();
+ enumTestList.add(AppServiceType.MEDIA);
+ enumTestList.add(AppServiceType.NAVIGATION);
+ enumTestList.add(AppServiceType.WEATHER);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/AudioStreamingIndicatorTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingIndicatorTests.java
index 0d7f17c76..81c4dbd84 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingIndicatorTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingIndicatorTests.java
@@ -14,67 +14,65 @@ import java.util.List;
*/
public class AudioStreamingIndicatorTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "PLAY_PAUSE";
- AudioStreamingIndicator enumPlayPause = AudioStreamingIndicator.valueForString(example);
- example = "PLAY";
- AudioStreamingIndicator enumPlay = AudioStreamingIndicator.valueForString(example);
- example = "PAUSE";
- AudioStreamingIndicator enumPause = AudioStreamingIndicator.valueForString(example);
- example = "STOP";
- AudioStreamingIndicator enumStop = AudioStreamingIndicator.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "PLAY_PAUSE";
+ AudioStreamingIndicator enumPlayPause = AudioStreamingIndicator.valueForString(example);
+ example = "PLAY";
+ AudioStreamingIndicator enumPlay = AudioStreamingIndicator.valueForString(example);
+ example = "PAUSE";
+ AudioStreamingIndicator enumPause = AudioStreamingIndicator.valueForString(example);
+ example = "STOP";
+ AudioStreamingIndicator enumStop = AudioStreamingIndicator.valueForString(example);
- assertNotNull("PLAY_PAUSE returned null", enumPlayPause);
- assertNotNull("PLAY returned null", enumPlay);
- assertNotNull("PAUSE returned null", enumPause);
- assertNotNull("STOP returned null", enumStop);
- }
+ assertNotNull("PLAY_PAUSE returned null", enumPlayPause);
+ assertNotNull("PLAY returned null", enumPlay);
+ assertNotNull("PAUSE returned null", enumPause);
+ assertNotNull("STOP returned null", enumStop);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "pLayPauZe";
- try {
- AudioStreamingIndicator temp = AudioStreamingIndicator.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "pLayPauZe";
+ try {
+ AudioStreamingIndicator temp = AudioStreamingIndicator.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 {
- AudioStreamingIndicator temp = AudioStreamingIndicator.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AudioStreamingIndicator temp = AudioStreamingIndicator.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of AudioStreamingIndicator.
- */
- public void testListEnum() {
- List<AudioStreamingIndicator> enumValueList = Arrays.asList(AudioStreamingIndicator.values());
+ /**
+ * Verifies the possible enum values of AudioStreamingIndicator.
+ */
+ public void testListEnum() {
+ List<AudioStreamingIndicator> enumValueList = Arrays.asList(AudioStreamingIndicator.values());
- List<AudioStreamingIndicator> enumTestList = new ArrayList<>();
- enumTestList.add(AudioStreamingIndicator.PLAY_PAUSE);
- enumTestList.add(AudioStreamingIndicator.PLAY);
- enumTestList.add(AudioStreamingIndicator.PAUSE);
- enumTestList.add(AudioStreamingIndicator.STOP);
+ List<AudioStreamingIndicator> enumTestList = new ArrayList<>();
+ enumTestList.add(AudioStreamingIndicator.PLAY_PAUSE);
+ enumTestList.add(AudioStreamingIndicator.PLAY);
+ enumTestList.add(AudioStreamingIndicator.PAUSE);
+ enumTestList.add(AudioStreamingIndicator.STOP);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/AudioStreamingStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingStateTests.java
index cf9cd87d4..ab6fe5369 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioStreamingStateTests.java
@@ -9,68 +9,66 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.AudioStreamingState}
*/
public class AudioStreamingStateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "AUDIBLE";
- AudioStreamingState enumAudible = AudioStreamingState.valueForString(example);
- example = "ATTENUATED";
- AudioStreamingState enumAttentuated = AudioStreamingState.valueForString(example);
- example = "NOT_AUDIBLE";
- AudioStreamingState enumNotAudible = AudioStreamingState.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "AUDIBLE";
+ AudioStreamingState enumAudible = AudioStreamingState.valueForString(example);
+ example = "ATTENUATED";
+ AudioStreamingState enumAttentuated = AudioStreamingState.valueForString(example);
+ example = "NOT_AUDIBLE";
+ AudioStreamingState enumNotAudible = AudioStreamingState.valueForString(example);
-
- assertNotNull("AUDIBLE returned null", enumAudible);
- assertNotNull("ATTENUATED returned null", enumAttentuated);
- assertNotNull("NOT_AUDIBLE returned null", enumNotAudible);
- }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "aUDibLE";
- try {
- AudioStreamingState temp = AudioStreamingState.valueForString(example);
+ assertNotNull("AUDIBLE returned null", enumAudible);
+ assertNotNull("ATTENUATED returned null", enumAttentuated);
+ assertNotNull("NOT_AUDIBLE returned null", enumNotAudible);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "aUDibLE";
+ try {
+ AudioStreamingState temp = AudioStreamingState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- AudioStreamingState temp = AudioStreamingState.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AudioStreamingState temp = AudioStreamingState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of AudioStreamingState.
- */
- public void testListEnum() {
- List<AudioStreamingState> enumValueList = Arrays.asList(AudioStreamingState.values());
+ /**
+ * Verifies the possible enum values of AudioStreamingState.
+ */
+ public void testListEnum() {
+ List<AudioStreamingState> enumValueList = Arrays.asList(AudioStreamingState.values());
- List<AudioStreamingState> enumTestList = new ArrayList<AudioStreamingState>();
- enumTestList.add(AudioStreamingState.AUDIBLE);
- enumTestList.add(AudioStreamingState.ATTENUATED);
- enumTestList.add(AudioStreamingState.NOT_AUDIBLE);
+ List<AudioStreamingState> enumTestList = new ArrayList<AudioStreamingState>();
+ enumTestList.add(AudioStreamingState.AUDIBLE);
+ enumTestList.add(AudioStreamingState.ATTENUATED);
+ enumTestList.add(AudioStreamingState.NOT_AUDIBLE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/AudioTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioTypeTests.java
index 8daea233f..714265d3a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AudioTypeTests.java
@@ -9,60 +9,58 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.AudioType}
*/
public class AudioTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "PCM";
- AudioType enumPcm = AudioType.valueForString(example);
-
- assertNotNull("PCM returned null", enumPcm);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "PCM";
+ AudioType enumPcm = AudioType.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "pCM";
- try {
- AudioType temp = AudioType.valueForString(example);
+ assertNotNull("PCM returned null", enumPcm);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "pCM";
+ try {
+ AudioType temp = AudioType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- AudioType temp = AudioType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ AudioType temp = AudioType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
+ }
+ }
+
- /**
- * Verifies the possible enum values of AudioType.
- */
- public void testListEnum() {
- List<AudioType> enumValueList = Arrays.asList(AudioType.values());
+ /**
+ * Verifies the possible enum values of AudioType.
+ */
+ public void testListEnum() {
+ List<AudioType> enumValueList = Arrays.asList(AudioType.values());
- List<AudioType> enumTestList = new ArrayList<AudioType>();
- enumTestList.add(AudioType.PCM);
+ List<AudioType> enumTestList = new ArrayList<AudioType>();
+ enumTestList.add(AudioType.PCM);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/BitsPerSampleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/BitsPerSampleTests.java
index f45b6a1de..43ae36e1e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/BitsPerSampleTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/BitsPerSampleTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.BitsPerSample}
*/
public class BitsPerSampleTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "8_BIT";
- BitsPerSample enum8Bit = BitsPerSample.valueForString(example);
- example = "16_BIT";
- BitsPerSample enum16Bit = BitsPerSample.valueForString(example);
-
- assertNotNull("8_BIT returned null", enum8Bit);
- assertNotNull("16_BIT returned null", enum16Bit);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "8_BIT";
+ BitsPerSample enum8Bit = BitsPerSample.valueForString(example);
+ example = "16_BIT";
+ BitsPerSample enum16Bit = BitsPerSample.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "8_biT";
- try {
- BitsPerSample temp = BitsPerSample.valueForString(example);
+ assertNotNull("8_BIT returned null", enum8Bit);
+ assertNotNull("16_BIT returned null", enum16Bit);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "8_biT";
+ try {
+ BitsPerSample temp = BitsPerSample.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- BitsPerSample temp = BitsPerSample.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ BitsPerSample temp = BitsPerSample.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of BitsPerSample.
- */
- public void testListEnum() {
- List<BitsPerSample> enumValueList = Arrays.asList(BitsPerSample.values());
+ /**
+ * Verifies the possible enum values of BitsPerSample.
+ */
+ public void testListEnum() {
+ List<BitsPerSample> enumValueList = Arrays.asList(BitsPerSample.values());
- List<BitsPerSample> enumTestList = new ArrayList<BitsPerSample>();
- enumTestList.add(BitsPerSample._8_BIT);
- enumTestList.add(BitsPerSample._16_BIT);
+ List<BitsPerSample> enumTestList = new ArrayList<BitsPerSample>();
+ enumTestList.add(BitsPerSample._8_BIT);
+ enumTestList.add(BitsPerSample._16_BIT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ButtonEventModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonEventModeTests.java
index 330d739a2..97d775be9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonEventModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonEventModeTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ButtonEventMode}
*/
public class ButtonEventModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "BUTTONUP";
- ButtonEventMode enumButtonUp = ButtonEventMode.valueForString(example);
- example = "BUTTONDOWN";
- ButtonEventMode enumButtonDown = ButtonEventMode.valueForString(example);
-
- assertNotNull("BUTTONUP returned null", enumButtonUp);
- assertNotNull("BUTTONDOWN returned null", enumButtonDown);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "BUTTONUP";
+ ButtonEventMode enumButtonUp = ButtonEventMode.valueForString(example);
+ example = "BUTTONDOWN";
+ ButtonEventMode enumButtonDown = ButtonEventMode.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "buTTonUp";
- try {
- ButtonEventMode temp = ButtonEventMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ assertNotNull("BUTTONUP returned null", enumButtonUp);
+ assertNotNull("BUTTONDOWN returned null", enumButtonDown);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "buTTonUp";
+ try {
+ ButtonEventMode temp = ButtonEventMode.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 {
- ButtonEventMode temp = ButtonEventMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ButtonEventMode temp = ButtonEventMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of ButtonEventMode.
- */
- public void testListEnum() {
- List<ButtonEventMode> enumValueList = Arrays.asList(ButtonEventMode.values());
+ /**
+ * Verifies the possible enum values of ButtonEventMode.
+ */
+ public void testListEnum() {
+ List<ButtonEventMode> enumValueList = Arrays.asList(ButtonEventMode.values());
- List<ButtonEventMode> enumTestList = new ArrayList<ButtonEventMode>();
- enumTestList.add(ButtonEventMode.BUTTONUP);
- enumTestList.add(ButtonEventMode.BUTTONDOWN);
+ List<ButtonEventMode> enumTestList = new ArrayList<ButtonEventMode>();
+ enumTestList.add(ButtonEventMode.BUTTONUP);
+ enumTestList.add(ButtonEventMode.BUTTONDOWN);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ButtonNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
index da768fc0d..10075849a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
@@ -9,250 +9,246 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ButtonName}
*/
public class ButtonNameTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "OK";
- ButtonName enumOk = ButtonName.valueForString(example);
- example = "SEEKLEFT";
- ButtonName enumSeekLeft = ButtonName.valueForString(example);
- example = "SEEKRIGHT";
- ButtonName enumSeekRight = ButtonName.valueForString(example);
- example = "TUNEUP";
- ButtonName enumTuneUp = ButtonName.valueForString(example);
- example = "TUNEDOWN";
- ButtonName enumTuneDown = ButtonName.valueForString(example);
- example = "PRESET_0";
- ButtonName enumPreset0 = ButtonName.valueForString(example);
- example = "PRESET_1";
- ButtonName enumPreset1 = ButtonName.valueForString(example);
- example = "PRESET_2";
- ButtonName enumPreset2 = ButtonName.valueForString(example);
- example = "PRESET_3";
- ButtonName enumPreset3 = ButtonName.valueForString(example);
- example = "PRESET_4";
- ButtonName enumPreset4 = ButtonName.valueForString(example);
- example = "PRESET_5";
- ButtonName enumPreset5 = ButtonName.valueForString(example);
- example = "PRESET_6";
- ButtonName enumPreset6 = ButtonName.valueForString(example);
- example = "PRESET_7";
- ButtonName enumPreset7 = ButtonName.valueForString(example);
- example = "PRESET_8";
- ButtonName enumPreset8 = ButtonName.valueForString(example);
- example = "PRESET_9";
- ButtonName enumPreset9 = ButtonName.valueForString(example);
- example = "CUSTOM_BUTTON";
- ButtonName enumCustomButton = ButtonName.valueForString(example);
- example = "SEARCH";
- ButtonName enumSearch = ButtonName.valueForString(example);
- example = "AC_MAX";
- ButtonName enumAcMax = ButtonName.valueForString(example);
- example = "AC";
- ButtonName enumAc = ButtonName.valueForString(example);
- example = "RECIRCULATE";
- ButtonName enumRecirculate = ButtonName.valueForString(example);
- example = "FAN_UP";
- ButtonName enumFanUp = ButtonName.valueForString(example);
- example = "FAN_DOWN";
- ButtonName enumFanDown = ButtonName.valueForString(example);
- example = "TEMP_UP";
- ButtonName enumTempUp = ButtonName.valueForString(example);
- example = "TEMP_DOWN";
- ButtonName enumTempDown = ButtonName.valueForString(example);
- example = "DEFROST_MAX";
- ButtonName enumDefrostMax = ButtonName.valueForString(example);
- example = "DEFROST";
- ButtonName enumDefrost = ButtonName.valueForString(example);
- example = "DEFROST_REAR";
- ButtonName enumDefrostRear = ButtonName.valueForString(example);
- example = "UPPER_VENT";
- ButtonName enumUpperVent = ButtonName.valueForString(example);
- example = "LOWER_VENT";
- ButtonName enumLowerVent = ButtonName.valueForString(example);
- example = "VOLUME_UP";
- ButtonName enumVolumeUp = ButtonName.valueForString(example);
- example = "VOLUME_DOWN";
- ButtonName enumVolumeDown = ButtonName.valueForString(example);
- example = "EJECT";
- ButtonName enumEject = ButtonName.valueForString(example);
- example = "SOURCE";
- ButtonName enumSource = ButtonName.valueForString(example);
- example = "SHUFFLE";
- ButtonName enumShuffle = ButtonName.valueForString(example);
- example = "REPEAT";
- ButtonName enumRepeat = ButtonName.valueForString(example);
-
-
-
- assertNotNull("OK returned null", enumOk);
- assertNotNull("SEEKLEFT returned null", enumSeekLeft);
- assertNotNull("SEEKRIGHT returned null", enumSeekRight);
- assertNotNull("TUNEUP returned null", enumTuneUp);
- assertNotNull("TUNEDOWN returned null", enumTuneDown);
- assertNotNull("PRESET_0 returned null", enumPreset0);
- assertNotNull("PRESET_1 returned null", enumPreset1);
- assertNotNull("PRESET_2 returned null", enumPreset2);
- assertNotNull("PRESET_3 returned null", enumPreset3);
- assertNotNull("PRESET_4 returned null", enumPreset4);
- assertNotNull("PRESET_5 returned null", enumPreset5);
- assertNotNull("PRESET_6 returned null", enumPreset6);
- assertNotNull("PRESET_7 returned null", enumPreset7);
- assertNotNull("PRESET_8 returned null", enumPreset8);
- assertNotNull("PRESET_9 returned null", enumPreset9);
- assertNotNull("CUSTOM_BUTTON returned null", enumCustomButton);
- assertNotNull("SEARCH returned null", enumSearch);
- assertNotNull("AC_MAX returned null", enumAcMax);
- assertNotNull("AC returned null", enumAc);
- assertNotNull("RECIRCULATE returned null", enumRecirculate);
- assertNotNull("FAN_UP returned null", enumFanUp);
- assertNotNull("FAN_DOWN returned null", enumFanDown);
- assertNotNull("TEMP_UP returned null", enumTempUp);
- assertNotNull("TEMP_DOWN returned null", enumTempDown);
- assertNotNull("DEFROST_MAX returned null", enumDefrostMax);
- assertNotNull("DEFROST returned null", enumDefrost);
- assertNotNull("DEFROST_REAR returned null", enumDefrostRear);
- assertNotNull("UPPER_VENT returned null", enumUpperVent);
- assertNotNull("LOWER_VENT returned null", enumLowerVent);
- assertNotNull("VOLUME_UP returned null", enumVolumeUp);
- assertNotNull("VOLUME_DOWN returned null", enumVolumeDown);
- assertNotNull("EJECT returned null", enumEject);
- assertNotNull("SOURCE returned null", enumSource);
- assertNotNull("SHUFFLE returned null", enumShuffle);
- assertNotNull("REPEAT returned null", enumRepeat);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "oK";
- try {
- ButtonName temp = ButtonName.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "OK";
+ ButtonName enumOk = ButtonName.valueForString(example);
+ example = "SEEKLEFT";
+ ButtonName enumSeekLeft = ButtonName.valueForString(example);
+ example = "SEEKRIGHT";
+ ButtonName enumSeekRight = ButtonName.valueForString(example);
+ example = "TUNEUP";
+ ButtonName enumTuneUp = ButtonName.valueForString(example);
+ example = "TUNEDOWN";
+ ButtonName enumTuneDown = ButtonName.valueForString(example);
+ example = "PRESET_0";
+ ButtonName enumPreset0 = ButtonName.valueForString(example);
+ example = "PRESET_1";
+ ButtonName enumPreset1 = ButtonName.valueForString(example);
+ example = "PRESET_2";
+ ButtonName enumPreset2 = ButtonName.valueForString(example);
+ example = "PRESET_3";
+ ButtonName enumPreset3 = ButtonName.valueForString(example);
+ example = "PRESET_4";
+ ButtonName enumPreset4 = ButtonName.valueForString(example);
+ example = "PRESET_5";
+ ButtonName enumPreset5 = ButtonName.valueForString(example);
+ example = "PRESET_6";
+ ButtonName enumPreset6 = ButtonName.valueForString(example);
+ example = "PRESET_7";
+ ButtonName enumPreset7 = ButtonName.valueForString(example);
+ example = "PRESET_8";
+ ButtonName enumPreset8 = ButtonName.valueForString(example);
+ example = "PRESET_9";
+ ButtonName enumPreset9 = ButtonName.valueForString(example);
+ example = "CUSTOM_BUTTON";
+ ButtonName enumCustomButton = ButtonName.valueForString(example);
+ example = "SEARCH";
+ ButtonName enumSearch = ButtonName.valueForString(example);
+ example = "AC_MAX";
+ ButtonName enumAcMax = ButtonName.valueForString(example);
+ example = "AC";
+ ButtonName enumAc = ButtonName.valueForString(example);
+ example = "RECIRCULATE";
+ ButtonName enumRecirculate = ButtonName.valueForString(example);
+ example = "FAN_UP";
+ ButtonName enumFanUp = ButtonName.valueForString(example);
+ example = "FAN_DOWN";
+ ButtonName enumFanDown = ButtonName.valueForString(example);
+ example = "TEMP_UP";
+ ButtonName enumTempUp = ButtonName.valueForString(example);
+ example = "TEMP_DOWN";
+ ButtonName enumTempDown = ButtonName.valueForString(example);
+ example = "DEFROST_MAX";
+ ButtonName enumDefrostMax = ButtonName.valueForString(example);
+ example = "DEFROST";
+ ButtonName enumDefrost = ButtonName.valueForString(example);
+ example = "DEFROST_REAR";
+ ButtonName enumDefrostRear = ButtonName.valueForString(example);
+ example = "UPPER_VENT";
+ ButtonName enumUpperVent = ButtonName.valueForString(example);
+ example = "LOWER_VENT";
+ ButtonName enumLowerVent = ButtonName.valueForString(example);
+ example = "VOLUME_UP";
+ ButtonName enumVolumeUp = ButtonName.valueForString(example);
+ example = "VOLUME_DOWN";
+ ButtonName enumVolumeDown = ButtonName.valueForString(example);
+ example = "EJECT";
+ ButtonName enumEject = ButtonName.valueForString(example);
+ example = "SOURCE";
+ ButtonName enumSource = ButtonName.valueForString(example);
+ example = "SHUFFLE";
+ ButtonName enumShuffle = ButtonName.valueForString(example);
+ example = "REPEAT";
+ ButtonName enumRepeat = ButtonName.valueForString(example);
+
+
+ assertNotNull("OK returned null", enumOk);
+ assertNotNull("SEEKLEFT returned null", enumSeekLeft);
+ assertNotNull("SEEKRIGHT returned null", enumSeekRight);
+ assertNotNull("TUNEUP returned null", enumTuneUp);
+ assertNotNull("TUNEDOWN returned null", enumTuneDown);
+ assertNotNull("PRESET_0 returned null", enumPreset0);
+ assertNotNull("PRESET_1 returned null", enumPreset1);
+ assertNotNull("PRESET_2 returned null", enumPreset2);
+ assertNotNull("PRESET_3 returned null", enumPreset3);
+ assertNotNull("PRESET_4 returned null", enumPreset4);
+ assertNotNull("PRESET_5 returned null", enumPreset5);
+ assertNotNull("PRESET_6 returned null", enumPreset6);
+ assertNotNull("PRESET_7 returned null", enumPreset7);
+ assertNotNull("PRESET_8 returned null", enumPreset8);
+ assertNotNull("PRESET_9 returned null", enumPreset9);
+ assertNotNull("CUSTOM_BUTTON returned null", enumCustomButton);
+ assertNotNull("SEARCH returned null", enumSearch);
+ assertNotNull("AC_MAX returned null", enumAcMax);
+ assertNotNull("AC returned null", enumAc);
+ assertNotNull("RECIRCULATE returned null", enumRecirculate);
+ assertNotNull("FAN_UP returned null", enumFanUp);
+ assertNotNull("FAN_DOWN returned null", enumFanDown);
+ assertNotNull("TEMP_UP returned null", enumTempUp);
+ assertNotNull("TEMP_DOWN returned null", enumTempDown);
+ assertNotNull("DEFROST_MAX returned null", enumDefrostMax);
+ assertNotNull("DEFROST returned null", enumDefrost);
+ assertNotNull("DEFROST_REAR returned null", enumDefrostRear);
+ assertNotNull("UPPER_VENT returned null", enumUpperVent);
+ assertNotNull("LOWER_VENT returned null", enumLowerVent);
+ assertNotNull("VOLUME_UP returned null", enumVolumeUp);
+ assertNotNull("VOLUME_DOWN returned null", enumVolumeDown);
+ assertNotNull("EJECT returned null", enumEject);
+ assertNotNull("SOURCE returned null", enumSource);
+ assertNotNull("SHUFFLE returned null", enumShuffle);
+ assertNotNull("REPEAT returned null", enumRepeat);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "oK";
+ try {
+ ButtonName temp = ButtonName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ButtonName temp = ButtonName.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ButtonName temp = ButtonName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of ButtonName.
- */
- public void testListEnum() {
- List<ButtonName> enumValueList = Arrays.asList(ButtonName.values());
-
- List<ButtonName> enumTestList = new ArrayList<ButtonName>();
-
- enumTestList.add(ButtonName.OK);
- enumTestList.add(ButtonName.SEEKLEFT);
- enumTestList.add(ButtonName.SEEKRIGHT);
- enumTestList.add(ButtonName.TUNEUP);
- enumTestList.add(ButtonName.TUNEDOWN);
- enumTestList.add(ButtonName.PRESET_0);
- enumTestList.add(ButtonName.PRESET_1);
- enumTestList.add(ButtonName.PRESET_2);
- enumTestList.add(ButtonName.PRESET_3);
- enumTestList.add(ButtonName.PRESET_4);
- enumTestList.add(ButtonName.PRESET_5);
- enumTestList.add(ButtonName.PRESET_6);
- enumTestList.add(ButtonName.PRESET_7);
- enumTestList.add(ButtonName.PRESET_8);
- enumTestList.add(ButtonName.PRESET_9);
- enumTestList.add(ButtonName.CUSTOM_BUTTON);
- enumTestList.add(ButtonName.SEARCH);
- enumTestList.add(ButtonName.AC_MAX);
- enumTestList.add(ButtonName.AC);
- enumTestList.add(ButtonName.RECIRCULATE);
- enumTestList.add(ButtonName.FAN_UP);
- enumTestList.add(ButtonName.FAN_DOWN);
- enumTestList.add(ButtonName.TEMP_UP);
- enumTestList.add(ButtonName.TEMP_DOWN);
- enumTestList.add(ButtonName.DEFROST_MAX);
- enumTestList.add(ButtonName.DEFROST);
- enumTestList.add(ButtonName.DEFROST_REAR);
- enumTestList.add(ButtonName.UPPER_VENT);
- enumTestList.add(ButtonName.LOWER_VENT);
- enumTestList.add(ButtonName.VOLUME_UP);
- enumTestList.add(ButtonName.VOLUME_DOWN);
- enumTestList.add(ButtonName.EJECT);
- enumTestList.add(ButtonName.SOURCE);
- enumTestList.add(ButtonName.SHUFFLE);
- enumTestList.add(ButtonName.REPEAT);
- enumTestList.add(ButtonName.PLAY_PAUSE);
- enumTestList.add(ButtonName.NAV_CENTER_LOCATION);
- enumTestList.add(ButtonName.NAV_ZOOM_IN);
- enumTestList.add(ButtonName.NAV_ZOOM_OUT);
- enumTestList.add(ButtonName.NAV_PAN_UP);
- enumTestList.add(ButtonName.NAV_PAN_UP_RIGHT);
- enumTestList.add(ButtonName.NAV_PAN_RIGHT);
- enumTestList.add(ButtonName.NAV_PAN_DOWN_RIGHT);
- enumTestList.add(ButtonName.NAV_PAN_DOWN);
- enumTestList.add(ButtonName.NAV_PAN_DOWN_LEFT);
- enumTestList.add(ButtonName.NAV_PAN_LEFT);
- enumTestList.add(ButtonName.NAV_PAN_UP_LEFT);
- enumTestList.add(ButtonName.NAV_TILT_TOGGLE);
- enumTestList.add(ButtonName.NAV_ROTATE_CLOCKWISE);
- enumTestList.add(ButtonName.NAV_ROTATE_COUNTERCLOCKWISE);
- enumTestList.add(ButtonName.NAV_HEADING_TOGGLE);
-
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
-
-
- /**
- * Tests the preset numeric order.
- */
- public void testPresetIndeces () {
- ButtonName[] inputPresetArray = new ButtonName[] {
- ButtonName.PRESET_0, ButtonName.PRESET_1, ButtonName.PRESET_2, ButtonName.PRESET_3, ButtonName.PRESET_4,
- ButtonName.PRESET_5, ButtonName.PRESET_6, ButtonName.PRESET_7, ButtonName.PRESET_8, ButtonName.PRESET_9,
- ButtonName.OK};
-
- Integer[] expectedValuesArray = new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, null};
-
- for (int index = 0; index < inputPresetArray.length; index++) {
- ButtonName input = inputPresetArray[index];
- Integer expect = expectedValuesArray[index];
-
- Integer result = ButtonName.indexForPresetButton(input);
- assertSame("Enum input " + result + " does not match expected value " + expect, result, expect);
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of ButtonName.
+ */
+ public void testListEnum() {
+ List<ButtonName> enumValueList = Arrays.asList(ButtonName.values());
+
+ List<ButtonName> enumTestList = new ArrayList<ButtonName>();
+
+ enumTestList.add(ButtonName.OK);
+ enumTestList.add(ButtonName.SEEKLEFT);
+ enumTestList.add(ButtonName.SEEKRIGHT);
+ enumTestList.add(ButtonName.TUNEUP);
+ enumTestList.add(ButtonName.TUNEDOWN);
+ enumTestList.add(ButtonName.PRESET_0);
+ enumTestList.add(ButtonName.PRESET_1);
+ enumTestList.add(ButtonName.PRESET_2);
+ enumTestList.add(ButtonName.PRESET_3);
+ enumTestList.add(ButtonName.PRESET_4);
+ enumTestList.add(ButtonName.PRESET_5);
+ enumTestList.add(ButtonName.PRESET_6);
+ enumTestList.add(ButtonName.PRESET_7);
+ enumTestList.add(ButtonName.PRESET_8);
+ enumTestList.add(ButtonName.PRESET_9);
+ enumTestList.add(ButtonName.CUSTOM_BUTTON);
+ enumTestList.add(ButtonName.SEARCH);
+ enumTestList.add(ButtonName.AC_MAX);
+ enumTestList.add(ButtonName.AC);
+ enumTestList.add(ButtonName.RECIRCULATE);
+ enumTestList.add(ButtonName.FAN_UP);
+ enumTestList.add(ButtonName.FAN_DOWN);
+ enumTestList.add(ButtonName.TEMP_UP);
+ enumTestList.add(ButtonName.TEMP_DOWN);
+ enumTestList.add(ButtonName.DEFROST_MAX);
+ enumTestList.add(ButtonName.DEFROST);
+ enumTestList.add(ButtonName.DEFROST_REAR);
+ enumTestList.add(ButtonName.UPPER_VENT);
+ enumTestList.add(ButtonName.LOWER_VENT);
+ enumTestList.add(ButtonName.VOLUME_UP);
+ enumTestList.add(ButtonName.VOLUME_DOWN);
+ enumTestList.add(ButtonName.EJECT);
+ enumTestList.add(ButtonName.SOURCE);
+ enumTestList.add(ButtonName.SHUFFLE);
+ enumTestList.add(ButtonName.REPEAT);
+ enumTestList.add(ButtonName.PLAY_PAUSE);
+ enumTestList.add(ButtonName.NAV_CENTER_LOCATION);
+ enumTestList.add(ButtonName.NAV_ZOOM_IN);
+ enumTestList.add(ButtonName.NAV_ZOOM_OUT);
+ enumTestList.add(ButtonName.NAV_PAN_UP);
+ enumTestList.add(ButtonName.NAV_PAN_UP_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN_LEFT);
+ enumTestList.add(ButtonName.NAV_PAN_LEFT);
+ enumTestList.add(ButtonName.NAV_PAN_UP_LEFT);
+ enumTestList.add(ButtonName.NAV_TILT_TOGGLE);
+ enumTestList.add(ButtonName.NAV_ROTATE_CLOCKWISE);
+ enumTestList.add(ButtonName.NAV_ROTATE_COUNTERCLOCKWISE);
+ enumTestList.add(ButtonName.NAV_HEADING_TOGGLE);
+
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+
+
+ /**
+ * Tests the preset numeric order.
+ */
+ public void testPresetIndeces() {
+ ButtonName[] inputPresetArray = new ButtonName[]{
+ ButtonName.PRESET_0, ButtonName.PRESET_1, ButtonName.PRESET_2, ButtonName.PRESET_3, ButtonName.PRESET_4,
+ ButtonName.PRESET_5, ButtonName.PRESET_6, ButtonName.PRESET_7, ButtonName.PRESET_8, ButtonName.PRESET_9,
+ ButtonName.OK};
+
+ Integer[] expectedValuesArray = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, null};
+
+ for (int index = 0; index < inputPresetArray.length; index++) {
+ ButtonName input = inputPresetArray[index];
+ Integer expect = expectedValuesArray[index];
+
+ Integer result = ButtonName.indexForPresetButton(input);
+ assertSame("Enum input " + result + " does not match expected value " + expect, result, expect);
+ }
+ }
+
+ /**
+ * Verifies that a null preset lookup is invalid.
+ */
+ public void testPresetNull() {
+ try {
+ assertNull("Passing null as a parameter does not return null", ButtonName.indexForPresetButton(null));
+ } catch (NullPointerException exc) {
+ fail("Passing null as a parameter throws a NullPointerException");
+ }
+
+ }
- /**
- * Verifies that a null preset lookup is invalid.
- */
- public void testPresetNull () {
- try {
- assertNull("Passing null as a parameter does not return null", ButtonName.indexForPresetButton(null));
- }
- catch (NullPointerException exc){
- fail("Passing null as a parameter throws a NullPointerException");
- }
-
- }
-
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonPressModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonPressModeTests.java
index 57f354dc0..5f2de389d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonPressModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonPressModeTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}
*/
public class ButtonPressModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "LONG";
- ButtonPressMode enumLong = ButtonPressMode.valueForString(example);
- example = "SHORT";
- ButtonPressMode enumShort = ButtonPressMode.valueForString(example);
-
- assertNotNull("LONG returned null", enumLong);
- assertNotNull("SHORT returned null", enumShort);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LONG";
+ ButtonPressMode enumLong = ButtonPressMode.valueForString(example);
+ example = "SHORT";
+ ButtonPressMode enumShort = ButtonPressMode.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "lONg";
- try {
- ButtonPressMode temp = ButtonPressMode.valueForString(example);
+ assertNotNull("LONG returned null", enumLong);
+ assertNotNull("SHORT returned null", enumShort);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "lONg";
+ try {
+ ButtonPressMode temp = ButtonPressMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ButtonPressMode temp = ButtonPressMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ButtonPressMode temp = ButtonPressMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of ButtonPressMode.
- */
- public void testListEnum() {
- List<ButtonPressMode> enumValueList = Arrays.asList(ButtonPressMode.values());
+ /**
+ * Verifies the possible enum values of ButtonPressMode.
+ */
+ public void testListEnum() {
+ List<ButtonPressMode> enumValueList = Arrays.asList(ButtonPressMode.values());
- List<ButtonPressMode> enumTestList = new ArrayList<ButtonPressMode>();
- enumTestList.add(ButtonPressMode.LONG);
- enumTestList.add(ButtonPressMode.SHORT);
+ List<ButtonPressMode> enumTestList = new ArrayList<ButtonPressMode>();
+ enumTestList.add(ButtonPressMode.LONG);
+ enumTestList.add(ButtonPressMode.SHORT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/CapacityUnitTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java
index 4da32bebf..755f03637 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java
@@ -13,7 +13,7 @@ public class CapacityUnitTests extends TestCase {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
- public void testValidEnums () {
+ public void testValidEnums() {
String example = "LITERS";
CapacityUnit enumLiters = CapacityUnit.valueForString(example);
example = "KILOWATTHOURS";
@@ -29,13 +29,12 @@ public class CapacityUnitTests extends TestCase {
/**
* Verifies that an invalid assignment is null.
*/
- public void testInvalidEnum () {
+ public void testInvalidEnum() {
String example = "lONg";
try {
CapacityUnit temp = CapacityUnit.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
@@ -43,13 +42,12 @@ public class CapacityUnitTests extends TestCase {
/**
* Verifies that a null assignment is invalid.
*/
- public void testNullEnum () {
+ public void testNullEnum() {
String example = null;
try {
CapacityUnit temp = CapacityUnit.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CarModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CarModeStatusTests.java
index 74a32defa..1ff08ed47 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CarModeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CarModeStatusTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.CarModeStatus}
*/
public class CarModeStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NORMAL";
- CarModeStatus enumNormal = CarModeStatus.valueForString(example);
- example = "FACTORY";
- CarModeStatus enumFactory = CarModeStatus.valueForString(example);
- example = "TRANSPORT";
- CarModeStatus enumTransport = CarModeStatus.valueForString(example);
- example = "CRASH";
- CarModeStatus enumCrash = CarModeStatus.valueForString(example);
-
- assertNotNull("NORMAL returned null", enumNormal);
- assertNotNull("FACTORY returned null", enumFactory);
- assertNotNull("TRANSPORT returned null", enumTransport);
- assertNotNull("CRASH returned null", enumCrash);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NORMAL";
+ CarModeStatus enumNormal = CarModeStatus.valueForString(example);
+ example = "FACTORY";
+ CarModeStatus enumFactory = CarModeStatus.valueForString(example);
+ example = "TRANSPORT";
+ CarModeStatus enumTransport = CarModeStatus.valueForString(example);
+ example = "CRASH";
+ CarModeStatus enumCrash = CarModeStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "noRmaL";
- try {
- CarModeStatus temp = CarModeStatus.valueForString(example);
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("FACTORY returned null", enumFactory);
+ assertNotNull("TRANSPORT returned null", enumTransport);
+ assertNotNull("CRASH returned null", enumCrash);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "noRmaL";
+ try {
+ CarModeStatus temp = CarModeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- CarModeStatus temp = CarModeStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ CarModeStatus temp = CarModeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of CarModeStatus.
- */
- public void testListEnum() {
- List<CarModeStatus> enumValueList = Arrays.asList(CarModeStatus.values());
+ /**
+ * Verifies the possible enum values of CarModeStatus.
+ */
+ public void testListEnum() {
+ List<CarModeStatus> enumValueList = Arrays.asList(CarModeStatus.values());
- List<CarModeStatus> enumTestList = new ArrayList<CarModeStatus>();
- enumTestList.add(CarModeStatus.NORMAL);
- enumTestList.add(CarModeStatus.FACTORY);
- enumTestList.add(CarModeStatus.TRANSPORT);
- enumTestList.add(CarModeStatus.CRASH);
+ List<CarModeStatus> enumTestList = new ArrayList<CarModeStatus>();
+ enumTestList.add(CarModeStatus.NORMAL);
+ enumTestList.add(CarModeStatus.FACTORY);
+ enumTestList.add(CarModeStatus.TRANSPORT);
+ enumTestList.add(CarModeStatus.CRASH);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/CharacterSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
index f84e9c595..1128833d9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CharacterSetTests.java
@@ -9,83 +9,81 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.CharacterSet}
*/
public class CharacterSetTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "TYPE2SET";
- CharacterSet enumType2Set = CharacterSet.valueForString(example);
- example = "TYPE5SET";
- CharacterSet enumType5Set = CharacterSet.valueForString(example);
- example = "CID1SET";
- CharacterSet enumCid1Set = CharacterSet.valueForString(example);
- example = "CID2SET";
- CharacterSet enumCid2Set = CharacterSet.valueForString(example);
- example = "ASCII";
- CharacterSet enumAsciiSet = CharacterSet.valueForString(example);
- example = "ISO_8859_1";
- CharacterSet enumIsoSet = CharacterSet.valueForString(example);
- example = "UTF_8";
- CharacterSet enumUtfSet = CharacterSet.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TYPE2SET";
+ CharacterSet enumType2Set = CharacterSet.valueForString(example);
+ example = "TYPE5SET";
+ CharacterSet enumType5Set = CharacterSet.valueForString(example);
+ example = "CID1SET";
+ CharacterSet enumCid1Set = CharacterSet.valueForString(example);
+ example = "CID2SET";
+ CharacterSet enumCid2Set = CharacterSet.valueForString(example);
+ example = "ASCII";
+ CharacterSet enumAsciiSet = CharacterSet.valueForString(example);
+ example = "ISO_8859_1";
+ CharacterSet enumIsoSet = CharacterSet.valueForString(example);
+ example = "UTF_8";
+ CharacterSet enumUtfSet = CharacterSet.valueForString(example);
- assertNotNull("TYPE2SET returned null", enumType2Set);
- assertNotNull("TYPE5SET returned null", enumType5Set);
- assertNotNull("CID1SET returned null", enumCid1Set);
- assertNotNull("CID2SET returned null", enumCid2Set);
- assertNotNull("ASCII returned null", enumAsciiSet);
- assertNotNull("ISO_8859_1 returned null", enumIsoSet);
- assertNotNull("UTF_8 returned null", enumUtfSet);
- }
+ assertNotNull("TYPE2SET returned null", enumType2Set);
+ assertNotNull("TYPE5SET returned null", enumType5Set);
+ assertNotNull("CID1SET returned null", enumCid1Set);
+ assertNotNull("CID2SET returned null", enumCid2Set);
+ assertNotNull("ASCII returned null", enumAsciiSet);
+ assertNotNull("ISO_8859_1 returned null", enumIsoSet);
+ assertNotNull("UTF_8 returned null", enumUtfSet);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "tyPe2SeT";
- try {
- CharacterSet temp = CharacterSet.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "tyPe2SeT";
+ try {
+ CharacterSet temp = CharacterSet.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- CharacterSet temp = CharacterSet.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ CharacterSet temp = CharacterSet.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of CharacterSet.
- */
- public void testListEnum() {
- List<CharacterSet> enumValueList = Arrays.asList(CharacterSet.values());
+ /**
+ * Verifies the possible enum values of CharacterSet.
+ */
+ public void testListEnum() {
+ List<CharacterSet> enumValueList = Arrays.asList(CharacterSet.values());
- List<CharacterSet> enumTestList = new ArrayList<CharacterSet>();
- enumTestList.add(CharacterSet.TYPE2SET);
- enumTestList.add(CharacterSet.TYPE5SET);
- enumTestList.add(CharacterSet.CID1SET);
- enumTestList.add(CharacterSet.CID2SET);
- enumTestList.add(CharacterSet.ASCII);
- enumTestList.add(CharacterSet.ISO_8859_1);
- enumTestList.add(CharacterSet.UTF_8);
+ List<CharacterSet> enumTestList = new ArrayList<CharacterSet>();
+ enumTestList.add(CharacterSet.TYPE2SET);
+ enumTestList.add(CharacterSet.TYPE5SET);
+ enumTestList.add(CharacterSet.CID1SET);
+ enumTestList.add(CharacterSet.CID2SET);
+ enumTestList.add(CharacterSet.ASCII);
+ enumTestList.add(CharacterSet.ISO_8859_1);
+ enumTestList.add(CharacterSet.UTF_8);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/CompassDirectionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CompassDirectionTests.java
index 3f776bb00..4f7d7267e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CompassDirectionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CompassDirectionTests.java
@@ -9,87 +9,85 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.CompassDirection}
*/
public class CompassDirectionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NORTH";
- CompassDirection enumNorth = CompassDirection.valueForString(example);
- example = "NORTHWEST";
- CompassDirection enumNorthWest = CompassDirection.valueForString(example);
- example = "WEST";
- CompassDirection enumWest = CompassDirection.valueForString(example);
- example = "SOUTHWEST";
- CompassDirection enumSouthWest = CompassDirection.valueForString(example);
- example = "SOUTH";
- CompassDirection enumSouth = CompassDirection.valueForString(example);
- example = "SOUTHEAST";
- CompassDirection enumSouthEast = CompassDirection.valueForString(example);
- example = "EAST";
- CompassDirection enumEast = CompassDirection.valueForString(example);
- example = "NORTHEAST";
- CompassDirection enumNorthEast = CompassDirection.valueForString(example);
-
- assertNotNull("NORTH returned null", enumNorth);
- assertNotNull("NORTHWEST returned null", enumNorthWest);
- assertNotNull("WEST returned null", enumWest);
- assertNotNull("SOUTHWEST returned null", enumSouthWest);
- assertNotNull("SOUTH returned null", enumSouth);
- assertNotNull("SOUTHEAST returned null", enumSouthEast);
- assertNotNull("EAST returned null", enumEast);
- assertNotNull("NORTHEAST returned null", enumNorthEast);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NORTH";
+ CompassDirection enumNorth = CompassDirection.valueForString(example);
+ example = "NORTHWEST";
+ CompassDirection enumNorthWest = CompassDirection.valueForString(example);
+ example = "WEST";
+ CompassDirection enumWest = CompassDirection.valueForString(example);
+ example = "SOUTHWEST";
+ CompassDirection enumSouthWest = CompassDirection.valueForString(example);
+ example = "SOUTH";
+ CompassDirection enumSouth = CompassDirection.valueForString(example);
+ example = "SOUTHEAST";
+ CompassDirection enumSouthEast = CompassDirection.valueForString(example);
+ example = "EAST";
+ CompassDirection enumEast = CompassDirection.valueForString(example);
+ example = "NORTHEAST";
+ CompassDirection enumNorthEast = CompassDirection.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "noRTh";
- try {
- CompassDirection temp = CompassDirection.valueForString(example);
+ assertNotNull("NORTH returned null", enumNorth);
+ assertNotNull("NORTHWEST returned null", enumNorthWest);
+ assertNotNull("WEST returned null", enumWest);
+ assertNotNull("SOUTHWEST returned null", enumSouthWest);
+ assertNotNull("SOUTH returned null", enumSouth);
+ assertNotNull("SOUTHEAST returned null", enumSouthEast);
+ assertNotNull("EAST returned null", enumEast);
+ assertNotNull("NORTHEAST returned null", enumNorthEast);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "noRTh";
+ try {
+ CompassDirection temp = CompassDirection.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- CompassDirection temp = CompassDirection.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ CompassDirection temp = CompassDirection.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of CompassDirection.
- */
- public void testListEnum() {
- List<CompassDirection> enumValueList = Arrays.asList(CompassDirection.values());
+ /**
+ * Verifies the possible enum values of CompassDirection.
+ */
+ public void testListEnum() {
+ List<CompassDirection> enumValueList = Arrays.asList(CompassDirection.values());
- List<CompassDirection> enumTestList = new ArrayList<CompassDirection>();
- enumTestList.add(CompassDirection.NORTH);
- enumTestList.add(CompassDirection.NORTHWEST);
- enumTestList.add(CompassDirection.WEST);
- enumTestList.add(CompassDirection.SOUTHWEST);
- enumTestList.add(CompassDirection.SOUTH);
- enumTestList.add(CompassDirection.SOUTHEAST);
- enumTestList.add(CompassDirection.EAST);
- enumTestList.add(CompassDirection.NORTHEAST);
+ List<CompassDirection> enumTestList = new ArrayList<CompassDirection>();
+ enumTestList.add(CompassDirection.NORTH);
+ enumTestList.add(CompassDirection.NORTHWEST);
+ enumTestList.add(CompassDirection.WEST);
+ enumTestList.add(CompassDirection.SOUTHWEST);
+ enumTestList.add(CompassDirection.SOUTH);
+ enumTestList.add(CompassDirection.SOUTHEAST);
+ enumTestList.add(CompassDirection.EAST);
+ enumTestList.add(CompassDirection.NORTHEAST);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ComponentVolumeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ComponentVolumeStatusTests.java
index 4583efe16..4ba6b8ebb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ComponentVolumeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ComponentVolumeStatusTests.java
@@ -9,79 +9,77 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus}
*/
public class ComponentVolumeStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "UNKNOWN";
- ComponentVolumeStatus enumUnknown = ComponentVolumeStatus.valueForString(example);
- example = "NORMAL";
- ComponentVolumeStatus enumNormal = ComponentVolumeStatus.valueForString(example);
- example = "LOW";
- ComponentVolumeStatus enumLow = ComponentVolumeStatus.valueForString(example);
- example = "FAULT";
- ComponentVolumeStatus enumFault = ComponentVolumeStatus.valueForString(example);
- example = "ALERT";
- ComponentVolumeStatus enumAlert = ComponentVolumeStatus.valueForString(example);
- example = "NOT_SUPPORTED";
- ComponentVolumeStatus enumNotSupported = ComponentVolumeStatus.valueForString(example);
-
- assertNotNull("UNKNOWN returned null", enumUnknown);
- assertNotNull("NORMAL returned null", enumNormal);
- assertNotNull("LOW returned null", enumLow);
- assertNotNull("FAULT returned null", enumFault);
- assertNotNull("ALERT returned null", enumAlert);
- assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "UNKNOWN";
+ ComponentVolumeStatus enumUnknown = ComponentVolumeStatus.valueForString(example);
+ example = "NORMAL";
+ ComponentVolumeStatus enumNormal = ComponentVolumeStatus.valueForString(example);
+ example = "LOW";
+ ComponentVolumeStatus enumLow = ComponentVolumeStatus.valueForString(example);
+ example = "FAULT";
+ ComponentVolumeStatus enumFault = ComponentVolumeStatus.valueForString(example);
+ example = "ALERT";
+ ComponentVolumeStatus enumAlert = ComponentVolumeStatus.valueForString(example);
+ example = "NOT_SUPPORTED";
+ ComponentVolumeStatus enumNotSupported = ComponentVolumeStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "unKNowN";
- try {
- ComponentVolumeStatus temp = ComponentVolumeStatus.valueForString(example);
+ assertNotNull("UNKNOWN returned null", enumUnknown);
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("LOW returned null", enumLow);
+ assertNotNull("FAULT returned null", enumFault);
+ assertNotNull("ALERT returned null", enumAlert);
+ assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "unKNowN";
+ try {
+ ComponentVolumeStatus temp = ComponentVolumeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ComponentVolumeStatus temp = ComponentVolumeStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ComponentVolumeStatus temp = ComponentVolumeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of ComponentVolumeStatus.
- */
- public void testListEnum() {
- List<ComponentVolumeStatus> enumValueList = Arrays.asList(ComponentVolumeStatus.values());
+ /**
+ * Verifies the possible enum values of ComponentVolumeStatus.
+ */
+ public void testListEnum() {
+ List<ComponentVolumeStatus> enumValueList = Arrays.asList(ComponentVolumeStatus.values());
- List<ComponentVolumeStatus> enumTestList = new ArrayList<ComponentVolumeStatus>();
- enumTestList.add(ComponentVolumeStatus.UNKNOWN);
- enumTestList.add(ComponentVolumeStatus.NORMAL);
- enumTestList.add(ComponentVolumeStatus.LOW);
- enumTestList.add(ComponentVolumeStatus.FAULT);
- enumTestList.add(ComponentVolumeStatus.ALERT);
- enumTestList.add(ComponentVolumeStatus.NOT_SUPPORTED);
+ List<ComponentVolumeStatus> enumTestList = new ArrayList<ComponentVolumeStatus>();
+ enumTestList.add(ComponentVolumeStatus.UNKNOWN);
+ enumTestList.add(ComponentVolumeStatus.NORMAL);
+ enumTestList.add(ComponentVolumeStatus.LOW);
+ enumTestList.add(ComponentVolumeStatus.FAULT);
+ enumTestList.add(ComponentVolumeStatus.ALERT);
+ enumTestList.add(ComponentVolumeStatus.NOT_SUPPORTED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DefrostZoneTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java
index 44d7a6241..422bb4428 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.DefrostZone}
*/
public class DefrostZoneTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "FRONT";
- DefrostZone enumFront = DefrostZone.valueForString(example);
- example = "REAR";
- DefrostZone enumRear = DefrostZone.valueForString(example);
- example = "ALL";
- DefrostZone enumAll = DefrostZone.valueForString(example);
- example = "NONE";
- DefrostZone enumNone = DefrostZone.valueForString(example);
-
- assertNotNull("FRONT returned null", enumFront);
- assertNotNull("REAR returned null", enumRear);
- assertNotNull("ALL returned null", enumAll);
- assertNotNull("NONE returned null", enumNone);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "FRONT";
+ DefrostZone enumFront = DefrostZone.valueForString(example);
+ example = "REAR";
+ DefrostZone enumRear = DefrostZone.valueForString(example);
+ example = "ALL";
+ DefrostZone enumAll = DefrostZone.valueForString(example);
+ example = "NONE";
+ DefrostZone enumNone = DefrostZone.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fRONT";
- try {
- DefrostZone temp = DefrostZone.valueForString(example);
+ assertNotNull("FRONT returned null", enumFront);
+ assertNotNull("REAR returned null", enumRear);
+ assertNotNull("ALL returned null", enumAll);
+ assertNotNull("NONE returned null", enumNone);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fRONT";
+ try {
+ DefrostZone temp = DefrostZone.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- DefrostZone temp = DefrostZone.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DefrostZone temp = DefrostZone.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of DefrostZone.
- */
- public void testListEnum() {
- List<DefrostZone> enumValueList = Arrays.asList(DefrostZone.values());
+ /**
+ * Verifies the possible enum values of DefrostZone.
+ */
+ public void testListEnum() {
+ List<DefrostZone> enumValueList = Arrays.asList(DefrostZone.values());
- List<DefrostZone> enumTestList = new ArrayList<DefrostZone>();
- enumTestList.add(DefrostZone.FRONT);
- enumTestList.add(DefrostZone.REAR);
- enumTestList.add(DefrostZone.ALL);
- enumTestList.add(DefrostZone.NONE);
+ List<DefrostZone> enumTestList = new ArrayList<DefrostZone>();
+ enumTestList.add(DefrostZone.FRONT);
+ enumTestList.add(DefrostZone.REAR);
+ enumTestList.add(DefrostZone.ALL);
+ enumTestList.add(DefrostZone.NONE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DeviceLevelStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DeviceLevelStatusTests.java
index 5b60dc6d2..cb8b23120 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DeviceLevelStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DeviceLevelStatusTests.java
@@ -9,79 +9,77 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus}
*/
-public class DeviceLevelStatusTests extends TestCase{
+public class DeviceLevelStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "ZERO_LEVEL_BARS";
- DeviceLevelStatus enumZeroLevel = DeviceLevelStatus.valueForString(example);
- example = "ONE_LEVEL_BARS";
- DeviceLevelStatus enumOneLevel = DeviceLevelStatus.valueForString(example);
- example = "TWO_LEVEL_BARS";
- DeviceLevelStatus enumTwoLevel = DeviceLevelStatus.valueForString(example);
- example = "THREE_LEVEL_BARS";
- DeviceLevelStatus enumThreeLevel = DeviceLevelStatus.valueForString(example);
- example = "FOUR_LEVEL_BARS";
- DeviceLevelStatus enumFourLevel = DeviceLevelStatus.valueForString(example);
- example = "NOT_PROVIDED";
- DeviceLevelStatus enumNotProvided = DeviceLevelStatus.valueForString(example);
-
- assertNotNull("ZERO_LEVEL_BARS returned null", enumZeroLevel);
- assertNotNull("ONE_LEVEL_BARS returned null", enumOneLevel);
- assertNotNull("TWO_LEVEL_BARS returned null", enumTwoLevel);
- assertNotNull("THREE_LEVEL_BARS returned null", enumThreeLevel);
- assertNotNull("FOUR_LEVEL_BARS returned null", enumFourLevel);
- assertNotNull("NOT_PROVIDED returned null", enumNotProvided);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ZERO_LEVEL_BARS";
+ DeviceLevelStatus enumZeroLevel = DeviceLevelStatus.valueForString(example);
+ example = "ONE_LEVEL_BARS";
+ DeviceLevelStatus enumOneLevel = DeviceLevelStatus.valueForString(example);
+ example = "TWO_LEVEL_BARS";
+ DeviceLevelStatus enumTwoLevel = DeviceLevelStatus.valueForString(example);
+ example = "THREE_LEVEL_BARS";
+ DeviceLevelStatus enumThreeLevel = DeviceLevelStatus.valueForString(example);
+ example = "FOUR_LEVEL_BARS";
+ DeviceLevelStatus enumFourLevel = DeviceLevelStatus.valueForString(example);
+ example = "NOT_PROVIDED";
+ DeviceLevelStatus enumNotProvided = DeviceLevelStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "onE_LeVeL_barS";
- try {
- DeviceLevelStatus temp = DeviceLevelStatus.valueForString(example);
+ assertNotNull("ZERO_LEVEL_BARS returned null", enumZeroLevel);
+ assertNotNull("ONE_LEVEL_BARS returned null", enumOneLevel);
+ assertNotNull("TWO_LEVEL_BARS returned null", enumTwoLevel);
+ assertNotNull("THREE_LEVEL_BARS returned null", enumThreeLevel);
+ assertNotNull("FOUR_LEVEL_BARS returned null", enumFourLevel);
+ assertNotNull("NOT_PROVIDED returned null", enumNotProvided);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "onE_LeVeL_barS";
+ try {
+ DeviceLevelStatus temp = DeviceLevelStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- DeviceLevelStatus temp = DeviceLevelStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DeviceLevelStatus temp = DeviceLevelStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of DeviceLevelStatus.
+ */
+ public void testListEnum() {
+ List<DeviceLevelStatus> enumValueList = Arrays.asList(DeviceLevelStatus.values());
- /**
- * Verifies the possible enum values of DeviceLevelStatus.
- */
- public void testListEnum() {
- List<DeviceLevelStatus> enumValueList = Arrays.asList(DeviceLevelStatus.values());
-
- List<DeviceLevelStatus> enumTestList = new ArrayList<DeviceLevelStatus>();
- enumTestList.add(DeviceLevelStatus.ZERO_LEVEL_BARS);
- enumTestList.add(DeviceLevelStatus.ONE_LEVEL_BARS);
- enumTestList.add(DeviceLevelStatus.TWO_LEVEL_BARS);
- enumTestList.add(DeviceLevelStatus.THREE_LEVEL_BARS);
- enumTestList.add(DeviceLevelStatus.FOUR_LEVEL_BARS);
- enumTestList.add(DeviceLevelStatus.NOT_PROVIDED);
+ List<DeviceLevelStatus> enumTestList = new ArrayList<DeviceLevelStatus>();
+ enumTestList.add(DeviceLevelStatus.ZERO_LEVEL_BARS);
+ enumTestList.add(DeviceLevelStatus.ONE_LEVEL_BARS);
+ enumTestList.add(DeviceLevelStatus.TWO_LEVEL_BARS);
+ enumTestList.add(DeviceLevelStatus.THREE_LEVEL_BARS);
+ enumTestList.add(DeviceLevelStatus.FOUR_LEVEL_BARS);
+ enumTestList.add(DeviceLevelStatus.NOT_PROVIDED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DimensionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DimensionTests.java
index ec2d9ec23..60e8d2255 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DimensionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DimensionTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.Dimension}
*/
public class DimensionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NO_FIX";
- Dimension enumNoFix = Dimension.valueForString(example);
- example = "2D";
- Dimension enum2D = Dimension.valueForString(example);
- example = "3D";
- Dimension enum3D = Dimension.valueForString(example);
-
- assertNotNull("NO_FIX returned null", enumNoFix);
- assertNotNull("2D returned null", enum2D);
- assertNotNull("3D returned null", enum3D);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NO_FIX";
+ Dimension enumNoFix = Dimension.valueForString(example);
+ example = "2D";
+ Dimension enum2D = Dimension.valueForString(example);
+ example = "3D";
+ Dimension enum3D = Dimension.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "no_FiX";
- try {
- Dimension temp = Dimension.valueForString(example);
+ assertNotNull("NO_FIX returned null", enumNoFix);
+ assertNotNull("2D returned null", enum2D);
+ assertNotNull("3D returned null", enum3D);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "no_FiX";
+ try {
+ Dimension temp = Dimension.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- Dimension temp = Dimension.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ Dimension temp = Dimension.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of Dimension.
- */
- public void testListEnum() {
- List<Dimension> enumValueList = Arrays.asList(Dimension.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of Dimension.
+ */
+ public void testListEnum() {
+ List<Dimension> enumValueList = Arrays.asList(Dimension.values());
- List<Dimension> enumTestList = new ArrayList<Dimension>();
- enumTestList.add(Dimension.NO_FIX);
- enumTestList.add(Dimension._2D);
- enumTestList.add(Dimension._3D);
+ List<Dimension> enumTestList = new ArrayList<Dimension>();
+ enumTestList.add(Dimension.NO_FIX);
+ enumTestList.add(Dimension._2D);
+ enumTestList.add(Dimension._3D);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DirectionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
index 76492878d..1d6c67f1d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DirectionTests.java
@@ -14,58 +14,56 @@ import java.util.List;
*/
public class DirectionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "LEFT";
- Direction enumLeft = Direction.valueForString(example);
- example = "RIGHT";
- Direction enumRight = Direction.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LEFT";
+ Direction enumLeft = Direction.valueForString(example);
+ example = "RIGHT";
+ Direction enumRight = Direction.valueForString(example);
- assertNotNull("LEFT returned null", enumLeft);
- assertNotNull("RIGHT returned null", enumRight);
- }
+ assertNotNull("LEFT returned null", enumLeft);
+ assertNotNull("RIGHT returned null", enumRight);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fRONT";
- try {
- Direction temp = Direction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fRONT";
+ try {
+ Direction temp = Direction.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 {
- Direction temp = Direction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ Direction temp = Direction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of Direction.
- */
- public void testListEnum() {
- List<Direction> enumValueList = Arrays.asList(Direction.values());
+ /**
+ * Verifies the possible enum values of Direction.
+ */
+ public void testListEnum() {
+ List<Direction> enumValueList = Arrays.asList(Direction.values());
- List<Direction> enumTestList = new ArrayList<>();
- enumTestList.add(Direction.LEFT);
- enumTestList.add(Direction.RIGHT);
+ List<Direction> enumTestList = new ArrayList<>();
+ enumTestList.add(Direction.LEFT);
+ enumTestList.add(Direction.RIGHT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DisplayModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayModeTests.java
index cb8073804..07d6a2f7d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayModeTests.java
@@ -15,60 +15,60 @@ import java.util.List;
*/
public class DisplayModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "DAY";
- DisplayMode enumDay = DisplayMode.valueForString(example);
- example = "NIGHT";
- DisplayMode enumNight = DisplayMode.valueForString(example);
- example = "AUTO";
- DisplayMode enumAuto = DisplayMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DAY";
+ DisplayMode enumDay = DisplayMode.valueForString(example);
+ example = "NIGHT";
+ DisplayMode enumNight = DisplayMode.valueForString(example);
+ example = "AUTO";
+ DisplayMode enumAuto = DisplayMode.valueForString(example);
- assertNotNull("DAY returned null", enumDay);
- assertNotNull("NIGHT returned null", enumNight);
- assertNotNull("AUTO returned null", enumAuto);
- }
+ assertNotNull("DAY returned null", enumDay);
+ assertNotNull("NIGHT returned null", enumNight);
+ assertNotNull("AUTO returned null", enumAuto);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "dAY";
- try {
- DisplayMode temp = DisplayMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "dAY";
+ try {
+ DisplayMode temp = DisplayMode.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 {
- DisplayMode temp = DisplayMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DisplayMode temp = DisplayMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of DisplayMode.
- */
- public void testListEnum() {
- List<DisplayMode> enumValueList = Arrays.asList(DisplayMode.values());
+ /**
+ * Verifies the possible enum values of DisplayMode.
+ */
+ public void testListEnum() {
+ List<DisplayMode> enumValueList = Arrays.asList(DisplayMode.values());
- List<DisplayMode> enumTestList = new ArrayList<DisplayMode>();
- enumTestList.add(DisplayMode.DAY);
- enumTestList.add(DisplayMode.NIGHT);
- enumTestList.add(DisplayMode.AUTO);
+ List<DisplayMode> enumTestList = new ArrayList<DisplayMode>();
+ enumTestList.add(DisplayMode.DAY);
+ enumTestList.add(DisplayMode.NIGHT);
+ enumTestList.add(DisplayMode.AUTO);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DisplayTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayTypeTests.java
index 71b738782..a60183e42 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DisplayTypeTests.java
@@ -14,94 +14,92 @@ import java.util.List;
*/
public class DisplayTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "CID";
- DisplayType enumCid = DisplayType.valueForString(example);
- example = "TYPE2";
- DisplayType enumType2 = DisplayType.valueForString(example);
- example = "TYPE5";
- DisplayType enumType5 = DisplayType.valueForString(example);
- example = "NGN";
- DisplayType enumNgn = DisplayType.valueForString(example);
- example = "GEN2_8_DMA";
- DisplayType enumGen2_8Dma = DisplayType.valueForString(example);
- example = "GEN2_6_DMA";
- DisplayType enumGen2_6Dma = DisplayType.valueForString(example);
- example = "MFD3";
- DisplayType enumMfd3 = DisplayType.valueForString(example);
- example = "MFD4";
- DisplayType enumMfd4 = DisplayType.valueForString(example);
- example = "MFD5";
- DisplayType enumMfd5 = DisplayType.valueForString(example);
- example = "GEN3_8-INCH";
- DisplayType enumGen3_8Inch = DisplayType.valueForString(example);
- example = "SDL_GENERIC";
- DisplayType enumGeneric = DisplayType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "CID";
+ DisplayType enumCid = DisplayType.valueForString(example);
+ example = "TYPE2";
+ DisplayType enumType2 = DisplayType.valueForString(example);
+ example = "TYPE5";
+ DisplayType enumType5 = DisplayType.valueForString(example);
+ example = "NGN";
+ DisplayType enumNgn = DisplayType.valueForString(example);
+ example = "GEN2_8_DMA";
+ DisplayType enumGen2_8Dma = DisplayType.valueForString(example);
+ example = "GEN2_6_DMA";
+ DisplayType enumGen2_6Dma = DisplayType.valueForString(example);
+ example = "MFD3";
+ DisplayType enumMfd3 = DisplayType.valueForString(example);
+ example = "MFD4";
+ DisplayType enumMfd4 = DisplayType.valueForString(example);
+ example = "MFD5";
+ DisplayType enumMfd5 = DisplayType.valueForString(example);
+ example = "GEN3_8-INCH";
+ DisplayType enumGen3_8Inch = DisplayType.valueForString(example);
+ example = "SDL_GENERIC";
+ DisplayType enumGeneric = DisplayType.valueForString(example);
- assertNotNull("CID returned null", enumCid);
- assertNotNull("TYPE2 returned null", enumType2);
- assertNotNull("TYPE5 returned null", enumType5);
- assertNotNull("NGN returned null", enumNgn);
- assertNotNull("GEN2_8_DMA returned null", enumGen2_8Dma);
- assertNotNull("GEN2_6_DMA returned null", enumGen2_6Dma);
- assertNotNull("MFD3 returned null", enumMfd3);
- assertNotNull("MFD4 returned null", enumMfd4);
- assertNotNull("MFD5 returned null", enumMfd5);
- assertNotNull("GEN3_8-INCH returned null", enumGen3_8Inch);
- assertNotNull("SDL_GENERIC returned null", enumGeneric);
- }
+ assertNotNull("CID returned null", enumCid);
+ assertNotNull("TYPE2 returned null", enumType2);
+ assertNotNull("TYPE5 returned null", enumType5);
+ assertNotNull("NGN returned null", enumNgn);
+ assertNotNull("GEN2_8_DMA returned null", enumGen2_8Dma);
+ assertNotNull("GEN2_6_DMA returned null", enumGen2_6Dma);
+ assertNotNull("MFD3 returned null", enumMfd3);
+ assertNotNull("MFD4 returned null", enumMfd4);
+ assertNotNull("MFD5 returned null", enumMfd5);
+ assertNotNull("GEN3_8-INCH returned null", enumGen3_8Inch);
+ assertNotNull("SDL_GENERIC returned null", enumGeneric);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "cId";
- try {
- DisplayType temp = DisplayType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "cId";
+ try {
+ DisplayType temp = DisplayType.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 {
- DisplayType temp = DisplayType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DisplayType temp = DisplayType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of DisplayType.
- */
- public void testListEnum() {
- List<DisplayType> enumValueList = Arrays.asList(DisplayType.values());
+ /**
+ * Verifies the possible enum values of DisplayType.
+ */
+ public void testListEnum() {
+ List<DisplayType> enumValueList = Arrays.asList(DisplayType.values());
- List<DisplayType> enumTestList = new ArrayList<DisplayType>();
- enumTestList.add(DisplayType.CID);
- enumTestList.add(DisplayType.TYPE2);
- enumTestList.add(DisplayType.TYPE5);
- enumTestList.add(DisplayType.NGN);
- enumTestList.add(DisplayType.GEN2_8_DMA);
- enumTestList.add(DisplayType.GEN2_6_DMA);
- enumTestList.add(DisplayType.MFD3);
- enumTestList.add(DisplayType.MFD4);
- enumTestList.add(DisplayType.MFD5);
- enumTestList.add(DisplayType.GEN3_8_INCH);
- enumTestList.add(DisplayType.SDL_GENERIC);
+ List<DisplayType> enumTestList = new ArrayList<DisplayType>();
+ enumTestList.add(DisplayType.CID);
+ enumTestList.add(DisplayType.TYPE2);
+ enumTestList.add(DisplayType.TYPE5);
+ enumTestList.add(DisplayType.NGN);
+ enumTestList.add(DisplayType.GEN2_8_DMA);
+ enumTestList.add(DisplayType.GEN2_6_DMA);
+ enumTestList.add(DisplayType.MFD3);
+ enumTestList.add(DisplayType.MFD4);
+ enumTestList.add(DisplayType.MFD5);
+ enumTestList.add(DisplayType.GEN3_8_INCH);
+ enumTestList.add(DisplayType.SDL_GENERIC);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DistanceUnitTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DistanceUnitTests.java
index a0e491e37..6d2933e62 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DistanceUnitTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DistanceUnitTests.java
@@ -15,55 +15,55 @@ import java.util.List;
*/
public class DistanceUnitTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "MILES";
- DistanceUnit enumMiles = DistanceUnit.valueForString(example);
- example = "KILOMETERS";
- DistanceUnit enumKilometers = DistanceUnit.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MILES";
+ DistanceUnit enumMiles = DistanceUnit.valueForString(example);
+ example = "KILOMETERS";
+ DistanceUnit enumKilometers = DistanceUnit.valueForString(example);
- assertNotNull("MILES returned null", enumMiles);
- assertNotNull("KILOMETERS returned null", enumKilometers);
- }
+ assertNotNull("MILES returned null", enumMiles);
+ assertNotNull("KILOMETERS returned null", enumKilometers);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "mILES";
- try {
- DistanceUnit temp = DistanceUnit.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "mILES";
+ try {
+ DistanceUnit temp = DistanceUnit.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 {
- DistanceUnit temp = DistanceUnit.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DistanceUnit temp = DistanceUnit.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of DistanceUnit.
- */
- public void testListEnum() {
- List<DistanceUnit> enumValueList = Arrays.asList(DistanceUnit.values());
- List<DistanceUnit> enumTestList = new ArrayList<DistanceUnit>();
- enumTestList.add(DistanceUnit.MILES);
- enumTestList.add(DistanceUnit.KILOMETERS);
+ /**
+ * Verifies the possible enum values of DistanceUnit.
+ */
+ public void testListEnum() {
+ List<DistanceUnit> enumValueList = Arrays.asList(DistanceUnit.values());
+ List<DistanceUnit> enumTestList = new ArrayList<DistanceUnit>();
+ enumTestList.add(DistanceUnit.MILES);
+ enumTestList.add(DistanceUnit.KILOMETERS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/DriverDistractionStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DriverDistractionStateTests.java
index 672b8b91d..d63d9ff15 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DriverDistractionStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DriverDistractionStateTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.DriverDistractionState}
*/
public class DriverDistractionStateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "DD_ON";
- DriverDistractionState enumDdOn = DriverDistractionState.valueForString(example);
- example = "DD_OFF";
- DriverDistractionState enumDdOff = DriverDistractionState.valueForString(example);
-
- assertNotNull("DD_ON returned null", enumDdOn);
- assertNotNull("DD_OFF returned null", enumDdOff);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DD_ON";
+ DriverDistractionState enumDdOn = DriverDistractionState.valueForString(example);
+ example = "DD_OFF";
+ DriverDistractionState enumDdOff = DriverDistractionState.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "dD_oN";
- try {
- DriverDistractionState temp = DriverDistractionState.valueForString(example);
+ assertNotNull("DD_ON returned null", enumDdOn);
+ assertNotNull("DD_OFF returned null", enumDdOff);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "dD_oN";
+ try {
+ DriverDistractionState temp = DriverDistractionState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- DriverDistractionState temp = DriverDistractionState.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ DriverDistractionState temp = DriverDistractionState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of DriverDistractionState.
- */
- public void testListEnum() {
- List<DriverDistractionState> enumValueList = Arrays.asList(DriverDistractionState.values());
+ /**
+ * Verifies the possible enum values of DriverDistractionState.
+ */
+ public void testListEnum() {
+ List<DriverDistractionState> enumValueList = Arrays.asList(DriverDistractionState.values());
- List<DriverDistractionState> enumTestList = new ArrayList<DriverDistractionState>();
- enumTestList.add(DriverDistractionState.DD_ON);
- enumTestList.add(DriverDistractionState.DD_OFF);
+ List<DriverDistractionState> enumTestList = new ArrayList<DriverDistractionState>();
+ enumTestList.add(DriverDistractionState.DD_ON);
+ enumTestList.add(DriverDistractionState.DD_OFF);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ECallConfirmationStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ECallConfirmationStatusTests.java
index b7b79fcaf..9135281fa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ECallConfirmationStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ECallConfirmationStatusTests.java
@@ -9,83 +9,81 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus}
*/
public class ECallConfirmationStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NORMAL";
- ECallConfirmationStatus enumNormal = ECallConfirmationStatus.valueForString(example);
- example = "CALL_IN_PROGRESS";
- ECallConfirmationStatus enumCallInProgress = ECallConfirmationStatus.valueForString(example);
- example = "CALL_CANCELLED";
- ECallConfirmationStatus enumCancelled = ECallConfirmationStatus.valueForString(example);
- example = "CALL_COMPLETED";
- ECallConfirmationStatus enumCompleted = ECallConfirmationStatus.valueForString(example);
- example = "CALL_UNSUCCESSFUL";
- ECallConfirmationStatus enumUnsuccessful = ECallConfirmationStatus.valueForString(example);
- example = "ECALL_CONFIGURED_OFF";
- ECallConfirmationStatus enumConfiguredOff = ECallConfirmationStatus.valueForString(example);
- example = "CALL_COMPLETE_DTMF_TIMEOUT";
- ECallConfirmationStatus enumCompleteDtmfTimeout = ECallConfirmationStatus.valueForString(example);
-
- assertNotNull("NORMAL returned null", enumNormal);
- assertNotNull("CALL_IN_PROGRESS returned null", enumCallInProgress);
- assertNotNull("CALL_CANCELLED returned null", enumCancelled);
- assertNotNull("CALL_COMPLETED returned null", enumCompleted);
- assertNotNull("CALL_UNSUCCESSFUL returned null", enumUnsuccessful);
- assertNotNull("ECALL_CONFIGURED_OFF returned null", enumConfiguredOff);
- assertNotNull("CALL_COMPLETE_DTMF_TIMEOUT returned null", enumCompleteDtmfTimeout);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NORMAL";
+ ECallConfirmationStatus enumNormal = ECallConfirmationStatus.valueForString(example);
+ example = "CALL_IN_PROGRESS";
+ ECallConfirmationStatus enumCallInProgress = ECallConfirmationStatus.valueForString(example);
+ example = "CALL_CANCELLED";
+ ECallConfirmationStatus enumCancelled = ECallConfirmationStatus.valueForString(example);
+ example = "CALL_COMPLETED";
+ ECallConfirmationStatus enumCompleted = ECallConfirmationStatus.valueForString(example);
+ example = "CALL_UNSUCCESSFUL";
+ ECallConfirmationStatus enumUnsuccessful = ECallConfirmationStatus.valueForString(example);
+ example = "ECALL_CONFIGURED_OFF";
+ ECallConfirmationStatus enumConfiguredOff = ECallConfirmationStatus.valueForString(example);
+ example = "CALL_COMPLETE_DTMF_TIMEOUT";
+ ECallConfirmationStatus enumCompleteDtmfTimeout = ECallConfirmationStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "noRMal";
- try {
- ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("CALL_IN_PROGRESS returned null", enumCallInProgress);
+ assertNotNull("CALL_CANCELLED returned null", enumCancelled);
+ assertNotNull("CALL_COMPLETED returned null", enumCompleted);
+ assertNotNull("CALL_UNSUCCESSFUL returned null", enumUnsuccessful);
+ assertNotNull("ECALL_CONFIGURED_OFF returned null", enumConfiguredOff);
+ assertNotNull("CALL_COMPLETE_DTMF_TIMEOUT returned null", enumCompleteDtmfTimeout);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "noRMal";
+ try {
+ ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ECallConfirmationStatus temp = ECallConfirmationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of ECallConfirmationStatus.
- */
- public void testListEnum() {
- List<ECallConfirmationStatus> enumValueList = Arrays.asList(ECallConfirmationStatus.values());
+ /**
+ * Verifies the possible enum values of ECallConfirmationStatus.
+ */
+ public void testListEnum() {
+ List<ECallConfirmationStatus> enumValueList = Arrays.asList(ECallConfirmationStatus.values());
- List<ECallConfirmationStatus> enumTestList = new ArrayList<ECallConfirmationStatus>();
- enumTestList.add(ECallConfirmationStatus.NORMAL);
- enumTestList.add(ECallConfirmationStatus.CALL_IN_PROGRESS);
- enumTestList.add(ECallConfirmationStatus.CALL_CANCELLED);
- enumTestList.add(ECallConfirmationStatus.CALL_COMPLETED);
- enumTestList.add(ECallConfirmationStatus.CALL_UNSUCCESSFUL);
- enumTestList.add(ECallConfirmationStatus.ECALL_CONFIGURED_OFF);
- enumTestList.add(ECallConfirmationStatus.CALL_COMPLETE_DTMF_TIMEOUT);
+ List<ECallConfirmationStatus> enumTestList = new ArrayList<ECallConfirmationStatus>();
+ enumTestList.add(ECallConfirmationStatus.NORMAL);
+ enumTestList.add(ECallConfirmationStatus.CALL_IN_PROGRESS);
+ enumTestList.add(ECallConfirmationStatus.CALL_CANCELLED);
+ enumTestList.add(ECallConfirmationStatus.CALL_COMPLETED);
+ enumTestList.add(ECallConfirmationStatus.CALL_UNSUCCESSFUL);
+ enumTestList.add(ECallConfirmationStatus.ECALL_CONFIGURED_OFF);
+ enumTestList.add(ECallConfirmationStatus.CALL_COMPLETE_DTMF_TIMEOUT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ElectronicParkBrakeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ElectronicParkBrakeStatusTests.java
index 10e89fe7f..1d775d710 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ElectronicParkBrakeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ElectronicParkBrakeStatusTests.java
@@ -13,70 +13,68 @@ import java.util.List;
* {@link com.smartdevicelink.proxy.rpc.enums.ElectronicParkBrakeStatus}
*/
public class ElectronicParkBrakeStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "CLOSED";
- ElectronicParkBrakeStatus enumClosed = ElectronicParkBrakeStatus.valueForString(example);
- example = "TRANSITION";
- ElectronicParkBrakeStatus enumTransition = ElectronicParkBrakeStatus.valueForString(example);
- example = "OPEN";
- ElectronicParkBrakeStatus enumOpen = ElectronicParkBrakeStatus.valueForString(example);
- example = "DRIVE_ACTIVE";
- ElectronicParkBrakeStatus enumDriveActive = ElectronicParkBrakeStatus.valueForString(example);
- example = "FAULT";
- ElectronicParkBrakeStatus enumFault = ElectronicParkBrakeStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "CLOSED";
+ ElectronicParkBrakeStatus enumClosed = ElectronicParkBrakeStatus.valueForString(example);
+ example = "TRANSITION";
+ ElectronicParkBrakeStatus enumTransition = ElectronicParkBrakeStatus.valueForString(example);
+ example = "OPEN";
+ ElectronicParkBrakeStatus enumOpen = ElectronicParkBrakeStatus.valueForString(example);
+ example = "DRIVE_ACTIVE";
+ ElectronicParkBrakeStatus enumDriveActive = ElectronicParkBrakeStatus.valueForString(example);
+ example = "FAULT";
+ ElectronicParkBrakeStatus enumFault = ElectronicParkBrakeStatus.valueForString(example);
- assertNotNull("CLOSED returned null", enumClosed);
- assertNotNull("TRANSITION returned null", enumTransition);
- assertNotNull("OPEN returned null", enumOpen);
- assertNotNull("DRIVE_ACTIVE returned null", enumDriveActive);
- assertNotNull("FAULT returned null", enumFault);
- }
+ assertNotNull("CLOSED returned null", enumClosed);
+ assertNotNull("TRANSITION returned null", enumTransition);
+ assertNotNull("OPEN returned null", enumOpen);
+ assertNotNull("DRIVE_ACTIVE returned null", enumDriveActive);
+ assertNotNull("FAULT returned null", enumFault);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "Clsoed";
- try {
- ElectronicParkBrakeStatus temp = ElectronicParkBrakeStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "Clsoed";
+ try {
+ ElectronicParkBrakeStatus temp = ElectronicParkBrakeStatus.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 {
- ElectronicParkBrakeStatus temp = ElectronicParkBrakeStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ElectronicParkBrakeStatus temp = ElectronicParkBrakeStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of Electronic Brake Status.
- */
- public void testListEnum() {
- List<ElectronicParkBrakeStatus> enumValueList = Arrays.asList(ElectronicParkBrakeStatus.values());
+ /**
+ * Verifies the possible enum values of Electronic Brake Status.
+ */
+ public void testListEnum() {
+ List<ElectronicParkBrakeStatus> enumValueList = Arrays.asList(ElectronicParkBrakeStatus.values());
- List<ElectronicParkBrakeStatus> enumTestList = new ArrayList<ElectronicParkBrakeStatus>();
- enumTestList.add(ElectronicParkBrakeStatus.CLOSED);
- enumTestList.add(ElectronicParkBrakeStatus.TRANSITION);
- enumTestList.add(ElectronicParkBrakeStatus.OPEN);
- enumTestList.add(ElectronicParkBrakeStatus.DRIVE_ACTIVE);
- enumTestList.add(ElectronicParkBrakeStatus.FAULT);
+ List<ElectronicParkBrakeStatus> enumTestList = new ArrayList<ElectronicParkBrakeStatus>();
+ enumTestList.add(ElectronicParkBrakeStatus.CLOSED);
+ enumTestList.add(ElectronicParkBrakeStatus.TRANSITION);
+ enumTestList.add(ElectronicParkBrakeStatus.OPEN);
+ enumTestList.add(ElectronicParkBrakeStatus.DRIVE_ACTIVE);
+ enumTestList.add(ElectronicParkBrakeStatus.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/EmergencyEventTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/EmergencyEventTypeTests.java
index 9931af71a..ae4e23e09 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/EmergencyEventTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/EmergencyEventTypeTests.java
@@ -9,83 +9,81 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.EmergencyEventType}
*/
public class EmergencyEventTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NO_EVENT";
- EmergencyEventType enumEventType = EmergencyEventType.valueForString(example);
- example = "FRONTAL";
- EmergencyEventType enumFrontal = EmergencyEventType.valueForString(example);
- example = "SIDE";
- EmergencyEventType enumSide = EmergencyEventType.valueForString(example);
- example = "REAR";
- EmergencyEventType enumRear = EmergencyEventType.valueForString(example);
- example = "ROLLOVER";
- EmergencyEventType enumRollover = EmergencyEventType.valueForString(example);
- example = "NOT_SUPPORTED";
- EmergencyEventType enumNotSupported = EmergencyEventType.valueForString(example);
- example = "FAULT";
- EmergencyEventType enumFault = EmergencyEventType.valueForString(example);
-
- assertNotNull("NO_EVENT returned null", enumEventType);
- assertNotNull("FRONTAL returned null", enumFrontal);
- assertNotNull("SIDE returned null", enumSide);
- assertNotNull("REAR returned null", enumRear);
- assertNotNull("ROLLOVER returned null", enumRollover);
- assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
- assertNotNull("FAULT returned null", enumFault);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NO_EVENT";
+ EmergencyEventType enumEventType = EmergencyEventType.valueForString(example);
+ example = "FRONTAL";
+ EmergencyEventType enumFrontal = EmergencyEventType.valueForString(example);
+ example = "SIDE";
+ EmergencyEventType enumSide = EmergencyEventType.valueForString(example);
+ example = "REAR";
+ EmergencyEventType enumRear = EmergencyEventType.valueForString(example);
+ example = "ROLLOVER";
+ EmergencyEventType enumRollover = EmergencyEventType.valueForString(example);
+ example = "NOT_SUPPORTED";
+ EmergencyEventType enumNotSupported = EmergencyEventType.valueForString(example);
+ example = "FAULT";
+ EmergencyEventType enumFault = EmergencyEventType.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "nO_EvenT";
- try {
- EmergencyEventType temp = EmergencyEventType.valueForString(example);
+ assertNotNull("NO_EVENT returned null", enumEventType);
+ assertNotNull("FRONTAL returned null", enumFrontal);
+ assertNotNull("SIDE returned null", enumSide);
+ assertNotNull("REAR returned null", enumRear);
+ assertNotNull("ROLLOVER returned null", enumRollover);
+ assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
+ assertNotNull("FAULT returned null", enumFault);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "nO_EvenT";
+ try {
+ EmergencyEventType temp = EmergencyEventType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- EmergencyEventType temp = EmergencyEventType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ EmergencyEventType temp = EmergencyEventType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of EmergencyEvent.
- */
- public void testListEnum() {
- List<EmergencyEventType> enumValueList = Arrays.asList(EmergencyEventType.values());
+ /**
+ * Verifies the possible enum values of EmergencyEvent.
+ */
+ public void testListEnum() {
+ List<EmergencyEventType> enumValueList = Arrays.asList(EmergencyEventType.values());
- List<EmergencyEventType> enumTestList = new ArrayList<EmergencyEventType>();
- enumTestList.add(EmergencyEventType.NO_EVENT);
- enumTestList.add(EmergencyEventType.FRONTAL);
- enumTestList.add(EmergencyEventType.SIDE);
- enumTestList.add(EmergencyEventType.REAR);
- enumTestList.add(EmergencyEventType.ROLLOVER);
- enumTestList.add(EmergencyEventType.NOT_SUPPORTED);
- enumTestList.add(EmergencyEventType.FAULT);
+ List<EmergencyEventType> enumTestList = new ArrayList<EmergencyEventType>();
+ enumTestList.add(EmergencyEventType.NO_EVENT);
+ enumTestList.add(EmergencyEventType.FRONTAL);
+ enumTestList.add(EmergencyEventType.SIDE);
+ enumTestList.add(EmergencyEventType.REAR);
+ enumTestList.add(EmergencyEventType.ROLLOVER);
+ enumTestList.add(EmergencyEventType.NOT_SUPPORTED);
+ enumTestList.add(EmergencyEventType.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/FileTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FileTypeTests.java
index d63e232dd..ea728c07a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FileTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FileTypeTests.java
@@ -9,87 +9,85 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.FileType}
*/
public class FileTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "GRAPHIC_BMP";
- FileType enumGraphicBmp = FileType.valueForString(example);
- example = "GRAPHIC_JPEG";
- FileType enumGraphicJpeg = FileType.valueForString(example);
- example = "GRAPHIC_PNG";
- FileType enumGraphicPng = FileType.valueForString(example);
- example = "AUDIO_WAVE";
- FileType enumAudioWave = FileType.valueForString(example);
- example = "AUDIO_AAC";
- FileType enumAudioAac = FileType.valueForString(example);
- example = "AUDIO_MP3";
- FileType enumAudioMp3 = FileType.valueForString(example);
- example = "BINARY";
- FileType enumBinary = FileType.valueForString(example);
- example = "JSON";
- FileType enumJson = FileType.valueForString(example);
-
- assertNotNull("GRAPHIC_BMP returned null", enumGraphicBmp);
- assertNotNull("GRAPHIC_JPEG returned null", enumGraphicJpeg);
- assertNotNull("GRAPHIC_PNG returned null", enumGraphicPng);
- assertNotNull("AUDIO_WAVE returned null", enumAudioWave);
- assertNotNull("AUDIO_AAC returned null", enumAudioAac);
- assertNotNull("AUDIO_MP3 returned null", enumAudioMp3);
- assertNotNull("BINARY returned null", enumBinary);
- assertNotNull("JSON returned null", enumJson);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "GRAPHIC_BMP";
+ FileType enumGraphicBmp = FileType.valueForString(example);
+ example = "GRAPHIC_JPEG";
+ FileType enumGraphicJpeg = FileType.valueForString(example);
+ example = "GRAPHIC_PNG";
+ FileType enumGraphicPng = FileType.valueForString(example);
+ example = "AUDIO_WAVE";
+ FileType enumAudioWave = FileType.valueForString(example);
+ example = "AUDIO_AAC";
+ FileType enumAudioAac = FileType.valueForString(example);
+ example = "AUDIO_MP3";
+ FileType enumAudioMp3 = FileType.valueForString(example);
+ example = "BINARY";
+ FileType enumBinary = FileType.valueForString(example);
+ example = "JSON";
+ FileType enumJson = FileType.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "uSer_ExiT";
- try {
- FileType temp = FileType.valueForString(example);
+ assertNotNull("GRAPHIC_BMP returned null", enumGraphicBmp);
+ assertNotNull("GRAPHIC_JPEG returned null", enumGraphicJpeg);
+ assertNotNull("GRAPHIC_PNG returned null", enumGraphicPng);
+ assertNotNull("AUDIO_WAVE returned null", enumAudioWave);
+ assertNotNull("AUDIO_AAC returned null", enumAudioAac);
+ assertNotNull("AUDIO_MP3 returned null", enumAudioMp3);
+ assertNotNull("BINARY returned null", enumBinary);
+ assertNotNull("JSON returned null", enumJson);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "uSer_ExiT";
+ try {
+ FileType temp = FileType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- FileType temp = FileType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ FileType temp = FileType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of FileType.
- */
- public void testListEnum() {
- List<FileType> enumValueList = Arrays.asList(FileType.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of FileType.
+ */
+ public void testListEnum() {
+ List<FileType> enumValueList = Arrays.asList(FileType.values());
- List<FileType> enumTestList = new ArrayList<FileType>();
- enumTestList.add(FileType.GRAPHIC_BMP);
- enumTestList.add(FileType.GRAPHIC_JPEG);
- enumTestList.add(FileType.GRAPHIC_PNG);
- enumTestList.add(FileType.AUDIO_WAVE);
- enumTestList.add(FileType.AUDIO_AAC);
- enumTestList.add(FileType.AUDIO_MP3);
- enumTestList.add(FileType.BINARY);
- enumTestList.add(FileType.JSON);
+ List<FileType> enumTestList = new ArrayList<FileType>();
+ enumTestList.add(FileType.GRAPHIC_BMP);
+ enumTestList.add(FileType.GRAPHIC_JPEG);
+ enumTestList.add(FileType.GRAPHIC_PNG);
+ enumTestList.add(FileType.AUDIO_WAVE);
+ enumTestList.add(FileType.AUDIO_AAC);
+ enumTestList.add(FileType.AUDIO_MP3);
+ enumTestList.add(FileType.BINARY);
+ enumTestList.add(FileType.JSON);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/FuelCutoffStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelCutoffStatusTests.java
index aad8c0922..749dbd683 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelCutoffStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelCutoffStatusTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.FuelCutoffStatus}
*/
public class FuelCutoffStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "TERMINATE_FUEL";
- FuelCutoffStatus enumTerminateFuel = FuelCutoffStatus.valueForString(example);
- example = "NORMAL_OPERATION";
- FuelCutoffStatus enumNormalOperation = FuelCutoffStatus.valueForString(example);
- example = "FAULT";
- FuelCutoffStatus enumFault = FuelCutoffStatus.valueForString(example);
-
- assertNotNull("TERMINATE_FUEL returned null", enumTerminateFuel);
- assertNotNull("NORMAL_OPERATION returned null", enumNormalOperation);
- assertNotNull("FAULT returned null", enumFault);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TERMINATE_FUEL";
+ FuelCutoffStatus enumTerminateFuel = FuelCutoffStatus.valueForString(example);
+ example = "NORMAL_OPERATION";
+ FuelCutoffStatus enumNormalOperation = FuelCutoffStatus.valueForString(example);
+ example = "FAULT";
+ FuelCutoffStatus enumFault = FuelCutoffStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "tErmINAte_FueL";
- try {
- FuelCutoffStatus temp = FuelCutoffStatus.valueForString(example);
+ assertNotNull("TERMINATE_FUEL returned null", enumTerminateFuel);
+ assertNotNull("NORMAL_OPERATION returned null", enumNormalOperation);
+ assertNotNull("FAULT returned null", enumFault);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "tErmINAte_FueL";
+ try {
+ FuelCutoffStatus temp = FuelCutoffStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- FuelCutoffStatus temp = FuelCutoffStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ FuelCutoffStatus temp = FuelCutoffStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of FuelCutoffStatus.
- */
- public void testListEnum() {
- List<FuelCutoffStatus> enumValueList = Arrays.asList(FuelCutoffStatus.values());
+ /**
+ * Verifies the possible enum values of FuelCutoffStatus.
+ */
+ public void testListEnum() {
+ List<FuelCutoffStatus> enumValueList = Arrays.asList(FuelCutoffStatus.values());
- List<FuelCutoffStatus> enumTestList = new ArrayList<FuelCutoffStatus>();
- enumTestList.add(FuelCutoffStatus.TERMINATE_FUEL);
- enumTestList.add(FuelCutoffStatus.NORMAL_OPERATION);
- enumTestList.add(FuelCutoffStatus.FAULT);
+ List<FuelCutoffStatus> enumTestList = new ArrayList<FuelCutoffStatus>();
+ enumTestList.add(FuelCutoffStatus.TERMINATE_FUEL);
+ enumTestList.add(FuelCutoffStatus.NORMAL_OPERATION);
+ enumTestList.add(FuelCutoffStatus.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/FuelTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelTypeTests.java
index 25c3e08d9..e6f714e26 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/FuelTypeTests.java
@@ -9,79 +9,77 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.FuelType}
*/
public class FuelTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "GASOLINE";
- FuelType enumGasoline = FuelType.valueForString(example);
- example = "DIESEL";
- FuelType enumDiesel = FuelType.valueForString(example);
- example = "CNG";
- FuelType enumCng = FuelType.valueForString(example);
- example = "LPG";
- FuelType enumLpg = FuelType.valueForString(example);
- example = "HYDROGEN";
- FuelType enumHydrogen = FuelType.valueForString(example);
- example = "BATTERY";
- FuelType enumBattery = FuelType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "GASOLINE";
+ FuelType enumGasoline = FuelType.valueForString(example);
+ example = "DIESEL";
+ FuelType enumDiesel = FuelType.valueForString(example);
+ example = "CNG";
+ FuelType enumCng = FuelType.valueForString(example);
+ example = "LPG";
+ FuelType enumLpg = FuelType.valueForString(example);
+ example = "HYDROGEN";
+ FuelType enumHydrogen = FuelType.valueForString(example);
+ example = "BATTERY";
+ FuelType enumBattery = FuelType.valueForString(example);
- assertNotNull("GASOLINE returned null", enumGasoline);
- assertNotNull("DIESEL returned null", enumDiesel);
- assertNotNull("CNG returned null", enumCng);
- assertNotNull("LPG returned null", enumLpg);
- assertNotNull("HYDROGEN returned null", enumHydrogen);
- assertNotNull("BATTERY returned null", enumBattery);
- }
+ assertNotNull("GASOLINE returned null", enumGasoline);
+ assertNotNull("DIESEL returned null", enumDiesel);
+ assertNotNull("CNG returned null", enumCng);
+ assertNotNull("LPG returned null", enumLpg);
+ assertNotNull("HYDROGEN returned null", enumHydrogen);
+ assertNotNull("BATTERY returned null", enumBattery);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "gASOLINE";
- try {
- FuelType temp = FuelType.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "gASOLINE";
+ try {
+ FuelType temp = FuelType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- FuelType temp = FuelType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ FuelType temp = FuelType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of FuelType.
- */
- public void testListEnum() {
- List<FuelType> enumValueList = Arrays.asList(FuelType.values());
+ /**
+ * Verifies the possible enum values of FuelType.
+ */
+ public void testListEnum() {
+ List<FuelType> enumValueList = Arrays.asList(FuelType.values());
- List<FuelType> enumTestList = new ArrayList<FuelType>();
- enumTestList.add(FuelType.GASOLINE);
- enumTestList.add(FuelType.DIESEL);
- enumTestList.add(FuelType.CNG);
- enumTestList.add(FuelType.LPG);
- enumTestList.add(FuelType.HYDROGEN);
- enumTestList.add(FuelType.BATTERY);
+ List<FuelType> enumTestList = new ArrayList<FuelType>();
+ enumTestList.add(FuelType.GASOLINE);
+ enumTestList.add(FuelType.DIESEL);
+ enumTestList.add(FuelType.CNG);
+ enumTestList.add(FuelType.LPG);
+ enumTestList.add(FuelType.HYDROGEN);
+ enumTestList.add(FuelType.BATTERY);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/GlobalPropertyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
index 37a20f61d..e05b364c9 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
@@ -9,87 +9,85 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.GlobalProperty}
*/
public class GlobalPropertyTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "HELPPROMPT";
- GlobalProperty enumHelpPrompt = GlobalProperty.valueForString(example);
- example = "TIMEOUTPROMPT";
- GlobalProperty enumTimeoutPrompt = GlobalProperty.valueForString(example);
- example = "VRHELPTITLE";
- GlobalProperty enumVrHelpTitle = GlobalProperty.valueForString(example);
- example = "VRHELPITEMS";
- GlobalProperty enumVrHelpItems = GlobalProperty.valueForString(example);
- example = "MENUNAME";
- GlobalProperty enumMenuName = GlobalProperty.valueForString(example);
- example = "MENUICON";
- 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);
- assertNotNull("VRHELPTITLE returned null", enumVrHelpTitle);
- assertNotNull("VRHELPITEMS returned null", enumVrHelpItems);
- assertNotNull("MENUNAME returned null", enumMenuName);
- assertNotNull("MENUICON returned null", enumMenuIcon);
- assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
- assertNotNull("USERLOCATION returned null", enumUserLocation);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "HELPPROMPT";
+ GlobalProperty enumHelpPrompt = GlobalProperty.valueForString(example);
+ example = "TIMEOUTPROMPT";
+ GlobalProperty enumTimeoutPrompt = GlobalProperty.valueForString(example);
+ example = "VRHELPTITLE";
+ GlobalProperty enumVrHelpTitle = GlobalProperty.valueForString(example);
+ example = "VRHELPITEMS";
+ GlobalProperty enumVrHelpItems = GlobalProperty.valueForString(example);
+ example = "MENUNAME";
+ GlobalProperty enumMenuName = GlobalProperty.valueForString(example);
+ example = "MENUICON";
+ GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example);
+ example = "KEYBOARDPROPERTIES";
+ GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example);
+ example = "USERLOCATION";
+ GlobalProperty enumUserLocation = GlobalProperty.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "heLp_ProMPt";
- try {
- GlobalProperty temp = GlobalProperty.valueForString(example);
+ assertNotNull("HELPPROMPT returned null", enumHelpPrompt);
+ assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt);
+ assertNotNull("VRHELPTITLE returned null", enumVrHelpTitle);
+ assertNotNull("VRHELPITEMS returned null", enumVrHelpItems);
+ assertNotNull("MENUNAME returned null", enumMenuName);
+ assertNotNull("MENUICON returned null", enumMenuIcon);
+ assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
+ assertNotNull("USERLOCATION returned null", enumUserLocation);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "heLp_ProMPt";
+ try {
+ GlobalProperty temp = GlobalProperty.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- GlobalProperty temp = GlobalProperty.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ GlobalProperty temp = GlobalProperty.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of GlobalProperty.
- */
- public void testListEnum() {
- List<GlobalProperty> enumValueList = Arrays.asList(GlobalProperty.values());
+ /**
+ * Verifies the possible enum values of GlobalProperty.
+ */
+ public void testListEnum() {
+ List<GlobalProperty> enumValueList = Arrays.asList(GlobalProperty.values());
- List<GlobalProperty> enumTestList = new ArrayList<GlobalProperty>();
- enumTestList.add(GlobalProperty.HELPPROMPT);
- enumTestList.add(GlobalProperty.TIMEOUTPROMPT);
- enumTestList.add(GlobalProperty.VRHELPTITLE);
- enumTestList.add(GlobalProperty.VRHELPITEMS);
- enumTestList.add(GlobalProperty.MENUNAME);
- enumTestList.add(GlobalProperty.MENUICON);
- enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES);
- enumTestList.add(GlobalProperty.USERLOCATION);
+ List<GlobalProperty> enumTestList = new ArrayList<GlobalProperty>();
+ enumTestList.add(GlobalProperty.HELPPROMPT);
+ enumTestList.add(GlobalProperty.TIMEOUTPROMPT);
+ enumTestList.add(GlobalProperty.VRHELPTITLE);
+ enumTestList.add(GlobalProperty.VRHELPITEMS);
+ 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));
- }
+ 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/HmiLevelTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiLevelTests.java
index 9f280bd8c..a33e4c226 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiLevelTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiLevelTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.HMILevel}
*/
public class HmiLevelTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "FULL";
- HMILevel enumFull = HMILevel.valueForString(example);
- example = "LIMITED";
- HMILevel enumLimited = HMILevel.valueForString(example);
- example = "BACKGROUND";
- HMILevel enumBackground = HMILevel.valueForString(example);
- example = "NONE";
- HMILevel enumNone = HMILevel.valueForString(example);
-
- assertNotNull("FULL returned null", enumFull);
- assertNotNull("LIMITED returned null", enumLimited);
- assertNotNull("BACKGROUND returned null", enumBackground);
- assertNotNull("NONE returned null", enumNone);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "FULL";
+ HMILevel enumFull = HMILevel.valueForString(example);
+ example = "LIMITED";
+ HMILevel enumLimited = HMILevel.valueForString(example);
+ example = "BACKGROUND";
+ HMILevel enumBackground = HMILevel.valueForString(example);
+ example = "NONE";
+ HMILevel enumNone = HMILevel.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fUlL";
- try {
- HMILevel temp = HMILevel.valueForString(example);
+ assertNotNull("FULL returned null", enumFull);
+ assertNotNull("LIMITED returned null", enumLimited);
+ assertNotNull("BACKGROUND returned null", enumBackground);
+ assertNotNull("NONE returned null", enumNone);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fUlL";
+ try {
+ HMILevel temp = HMILevel.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- HMILevel temp = HMILevel.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ HMILevel temp = HMILevel.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of HMILevel.
+ */
+ public void testListEnum() {
+ List<HMILevel> enumValueList = Arrays.asList(HMILevel.values());
- /**
- * Verifies the possible enum values of HMILevel.
- */
- public void testListEnum() {
- List<HMILevel> enumValueList = Arrays.asList(HMILevel.values());
+ List<HMILevel> enumTestList = new ArrayList<HMILevel>();
+ enumTestList.add(HMILevel.HMI_FULL);
+ enumTestList.add(HMILevel.HMI_LIMITED);
+ enumTestList.add(HMILevel.HMI_BACKGROUND);
+ enumTestList.add(HMILevel.HMI_NONE);
- List<HMILevel> enumTestList = new ArrayList<HMILevel>();
- enumTestList.add(HMILevel.HMI_FULL);
- enumTestList.add(HMILevel.HMI_LIMITED);
- enumTestList.add(HMILevel.HMI_BACKGROUND);
- enumTestList.add(HMILevel.HMI_NONE);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/HmiZoneCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiZoneCapabilitiesTests.java
index 4ff2b1abd..a9a27d3b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiZoneCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HmiZoneCapabilitiesTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities}
*/
public class HmiZoneCapabilitiesTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "FRONT";
- HmiZoneCapabilities enumFront = HmiZoneCapabilities.valueForString(example);
- example = "BACK";
- HmiZoneCapabilities enumBack = HmiZoneCapabilities.valueForString(example);
-
- assertNotNull("FRONT returned null", enumFront);
- assertNotNull("BACK returned null", enumBack);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "FRONT";
+ HmiZoneCapabilities enumFront = HmiZoneCapabilities.valueForString(example);
+ example = "BACK";
+ HmiZoneCapabilities enumBack = HmiZoneCapabilities.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fROnT";
- try {
- HmiZoneCapabilities temp = HmiZoneCapabilities.valueForString(example);
+ assertNotNull("FRONT returned null", enumFront);
+ assertNotNull("BACK returned null", enumBack);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fROnT";
+ try {
+ HmiZoneCapabilities temp = HmiZoneCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- HmiZoneCapabilities temp = HmiZoneCapabilities.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ HmiZoneCapabilities temp = HmiZoneCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of HmiZoneCapabilities.
- */
- public void testListEnum() {
- List<HmiZoneCapabilities> enumValueList = Arrays.asList(HmiZoneCapabilities.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of HmiZoneCapabilities.
+ */
+ public void testListEnum() {
+ List<HmiZoneCapabilities> enumValueList = Arrays.asList(HmiZoneCapabilities.values());
- List<HmiZoneCapabilities> enumTestList = new ArrayList<HmiZoneCapabilities>();
- enumTestList.add(HmiZoneCapabilities.FRONT);
- enumTestList.add(HmiZoneCapabilities.BACK);
+ List<HmiZoneCapabilities> enumTestList = new ArrayList<HmiZoneCapabilities>();
+ enumTestList.add(HmiZoneCapabilities.FRONT);
+ enumTestList.add(HmiZoneCapabilities.BACK);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/HybridAppPreferenceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java
index 5c601fe20..0d53a2ace 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java
@@ -14,62 +14,60 @@ import java.util.List;
*/
public class HybridAppPreferenceTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "MOBILE";
- HybridAppPreference enumMobile = HybridAppPreference.valueForString(example);
- example = "CLOUD";
- HybridAppPreference enumCloud = HybridAppPreference.valueForString(example);
- example = "BOTH";
- HybridAppPreference enumBoth = HybridAppPreference.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MOBILE";
+ HybridAppPreference enumMobile = HybridAppPreference.valueForString(example);
+ example = "CLOUD";
+ HybridAppPreference enumCloud = HybridAppPreference.valueForString(example);
+ example = "BOTH";
+ HybridAppPreference enumBoth = HybridAppPreference.valueForString(example);
- assertNotNull("MOBILE returned null", enumMobile);
- assertNotNull("CLOUD returned null", enumCloud);
- assertNotNull("BOTH returned null", enumBoth);
- }
+ assertNotNull("MOBILE returned null", enumMobile);
+ assertNotNull("CLOUD returned null", enumCloud);
+ assertNotNull("BOTH returned null", enumBoth);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "deFaUlt";
- try {
- HybridAppPreference temp = HybridAppPreference.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "deFaUlt";
+ try {
+ HybridAppPreference temp = HybridAppPreference.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 {
- HybridAppPreference temp = HybridAppPreference.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ HybridAppPreference temp = HybridAppPreference.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of HybridAppPreference.
- */
- public void testListEnum() {
- List<HybridAppPreference> enumValueList = Arrays.asList(HybridAppPreference.values());
+ /**
+ * Verifies the possible enum values of HybridAppPreference.
+ */
+ public void testListEnum() {
+ List<HybridAppPreference> enumValueList = Arrays.asList(HybridAppPreference.values());
- List<HybridAppPreference> enumTestList = new ArrayList<>();
- enumTestList.add(HybridAppPreference.MOBILE);
- enumTestList.add(HybridAppPreference.CLOUD);
- enumTestList.add(HybridAppPreference.BOTH);
+ List<HybridAppPreference> enumTestList = new ArrayList<>();
+ enumTestList.add(HybridAppPreference.MOBILE);
+ enumTestList.add(HybridAppPreference.CLOUD);
+ enumTestList.add(HybridAppPreference.BOTH);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/IgnitionStableStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStableStatusTests.java
index fdddae144..43de5fd8c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStableStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStableStatusTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus}
*/
public class IgnitionStableStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "IGNITION_SWITCH_NOT_STABLE";
- IgnitionStableStatus enumIgnitionSwitchNotStable = IgnitionStableStatus.valueForString(example);
- example = "IGNITION_SWITCH_STABLE";
- IgnitionStableStatus enumIgnitionSwitchStable = IgnitionStableStatus.valueForString(example);
- example = "MISSING_FROM_TRANSMITTER";
- IgnitionStableStatus enumMissingFromTransmitter = IgnitionStableStatus.valueForString(example);
-
- assertNotNull("IGNITION_SWITCH_NOT_STABLE returned null", enumIgnitionSwitchNotStable);
- assertNotNull("IGNITION_SWITCH_STABLE returned null", enumIgnitionSwitchStable);
- assertNotNull("MISSING_FROM_TRANSMITTER returned null", enumMissingFromTransmitter);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "IGNITION_SWITCH_NOT_STABLE";
+ IgnitionStableStatus enumIgnitionSwitchNotStable = IgnitionStableStatus.valueForString(example);
+ example = "IGNITION_SWITCH_STABLE";
+ IgnitionStableStatus enumIgnitionSwitchStable = IgnitionStableStatus.valueForString(example);
+ example = "MISSING_FROM_TRANSMITTER";
+ IgnitionStableStatus enumMissingFromTransmitter = IgnitionStableStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "iGnitIoN_SwiTch_NoT_StablE";
- try {
- IgnitionStableStatus temp = IgnitionStableStatus.valueForString(example);
+ assertNotNull("IGNITION_SWITCH_NOT_STABLE returned null", enumIgnitionSwitchNotStable);
+ assertNotNull("IGNITION_SWITCH_STABLE returned null", enumIgnitionSwitchStable);
+ assertNotNull("MISSING_FROM_TRANSMITTER returned null", enumMissingFromTransmitter);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "iGnitIoN_SwiTch_NoT_StablE";
+ try {
+ IgnitionStableStatus temp = IgnitionStableStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- IgnitionStableStatus temp = IgnitionStableStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ IgnitionStableStatus temp = IgnitionStableStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of IgnitionStableStatus.
- */
- public void testListEnum() {
- List<IgnitionStableStatus> enumValueList = Arrays.asList(IgnitionStableStatus.values());
+ /**
+ * Verifies the possible enum values of IgnitionStableStatus.
+ */
+ public void testListEnum() {
+ List<IgnitionStableStatus> enumValueList = Arrays.asList(IgnitionStableStatus.values());
- List<IgnitionStableStatus> enumTestList = new ArrayList<IgnitionStableStatus>();
- enumTestList.add(IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE);
- enumTestList.add(IgnitionStableStatus.IGNITION_SWITCH_STABLE);
- enumTestList.add(IgnitionStableStatus.MISSING_FROM_TRANSMITTER);
+ List<IgnitionStableStatus> enumTestList = new ArrayList<IgnitionStableStatus>();
+ enumTestList.add(IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE);
+ enumTestList.add(IgnitionStableStatus.IGNITION_SWITCH_STABLE);
+ enumTestList.add(IgnitionStableStatus.MISSING_FROM_TRANSMITTER);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/IgnitionStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStatusTests.java
index e76ac75cc..ba9c56c45 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/IgnitionStatusTests.java
@@ -9,79 +9,77 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.IgnitionStatus}
*/
public class IgnitionStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "UNKNOWN";
- IgnitionStatus enumUnknown = IgnitionStatus.valueForString(example);
- example = "OFF";
- IgnitionStatus enumOff = IgnitionStatus.valueForString(example);
- example = "ACCESSORY";
- IgnitionStatus enumAccessory = IgnitionStatus.valueForString(example);
- example = "RUN";
- IgnitionStatus enumRun = IgnitionStatus.valueForString(example);
- example = "START";
- IgnitionStatus enumStart = IgnitionStatus.valueForString(example);
- example = "INVALID";
- IgnitionStatus enumInvalid = IgnitionStatus.valueForString(example);
-
- assertNotNull("UNKNOWN returned null", enumUnknown);
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("ACCESSORY returned null", enumAccessory);
- assertNotNull("RUN returned null", enumRun);
- assertNotNull("START returned null", enumStart);
- assertNotNull("INVALID returned null", enumInvalid);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "UNKNOWN";
+ IgnitionStatus enumUnknown = IgnitionStatus.valueForString(example);
+ example = "OFF";
+ IgnitionStatus enumOff = IgnitionStatus.valueForString(example);
+ example = "ACCESSORY";
+ IgnitionStatus enumAccessory = IgnitionStatus.valueForString(example);
+ example = "RUN";
+ IgnitionStatus enumRun = IgnitionStatus.valueForString(example);
+ example = "START";
+ IgnitionStatus enumStart = IgnitionStatus.valueForString(example);
+ example = "INVALID";
+ IgnitionStatus enumInvalid = IgnitionStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "uNKnowN";
- try {
- IgnitionStatus temp = IgnitionStatus.valueForString(example);
+ assertNotNull("UNKNOWN returned null", enumUnknown);
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("ACCESSORY returned null", enumAccessory);
+ assertNotNull("RUN returned null", enumRun);
+ assertNotNull("START returned null", enumStart);
+ assertNotNull("INVALID returned null", enumInvalid);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "uNKnowN";
+ try {
+ IgnitionStatus temp = IgnitionStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- IgnitionStatus temp = IgnitionStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ IgnitionStatus temp = IgnitionStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of IgnitionStatus.
+ */
+ public void testListEnum() {
+ List<IgnitionStatus> enumValueList = Arrays.asList(IgnitionStatus.values());
- /**
- * Verifies the possible enum values of IgnitionStatus.
- */
- public void testListEnum() {
- List<IgnitionStatus> enumValueList = Arrays.asList(IgnitionStatus.values());
+ List<IgnitionStatus> enumTestList = new ArrayList<IgnitionStatus>();
+ enumTestList.add(IgnitionStatus.UNKNOWN);
+ enumTestList.add(IgnitionStatus.OFF);
+ enumTestList.add(IgnitionStatus.ACCESSORY);
+ enumTestList.add(IgnitionStatus.RUN);
+ enumTestList.add(IgnitionStatus.START);
+ enumTestList.add(IgnitionStatus.INVALID);
- List<IgnitionStatus> enumTestList = new ArrayList<IgnitionStatus>();
- enumTestList.add(IgnitionStatus.UNKNOWN);
- enumTestList.add(IgnitionStatus.OFF);
- enumTestList.add(IgnitionStatus.ACCESSORY);
- enumTestList.add(IgnitionStatus.RUN);
- enumTestList.add(IgnitionStatus.START);
- enumTestList.add(IgnitionStatus.INVALID);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ImageFieldNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
index c1b0b6cd7..7e4f28dde 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
@@ -9,111 +9,109 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ImageFieldName}
*/
public class ImageFieldNameTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "softButtonImage";
- ImageFieldName enumSoftButtonImage = ImageFieldName.valueForString(example);
- example = "choiceImage";
- ImageFieldName enumChoiceImage = ImageFieldName.valueForString(example);
- example = "choiceSecondaryImage";
- ImageFieldName enumSecondaryImage = ImageFieldName.valueForString(example);
- example = "vrHelpItem";
- ImageFieldName enumVrHelpItem = ImageFieldName.valueForString(example);
- example = "turnIcon";
- ImageFieldName enumTurnIcon = ImageFieldName.valueForString(example);
- example = "menuIcon";
- ImageFieldName enumMenuIcon = ImageFieldName.valueForString(example);
- example = "cmdIcon";
- ImageFieldName enumCmdIcon = ImageFieldName.valueForString(example);
- example = "appIcon";
- ImageFieldName enumAppIcon = ImageFieldName.valueForString(example);
- example = "graphic";
- ImageFieldName enumGraphicIcon = ImageFieldName.valueForString(example);
- example = "showConstantTBTIcon";
- ImageFieldName enumShowConstantTbtIcon = ImageFieldName.valueForString(example);
- example = "showConstantTBTNextTurnIcon";
- ImageFieldName enumShowConstantTbtNextTurnIcon = ImageFieldName.valueForString(example);
- example = "locationImage";
- ImageFieldName enumLocationImage = ImageFieldName.valueForString(example);
- example = "secondaryGraphic";
- ImageFieldName enumSecondaryGraphic = ImageFieldName.valueForString(example);
-
- assertNotNull("softButtonImage returned null", enumSoftButtonImage);
- assertNotNull("choiceImage returned null", enumChoiceImage);
- assertNotNull("choiceSecondaryImage returned null", enumSecondaryImage);
- assertNotNull("vrHelpItem returned null", enumVrHelpItem);
- assertNotNull("turnIcon returned null", enumTurnIcon);
- assertNotNull("menuIcon returned null", enumMenuIcon);
- assertNotNull("cmdIcon returned null", enumCmdIcon);
- assertNotNull("appIcon returned null", enumAppIcon);
- assertNotNull("graphic returned null", enumGraphicIcon);
- assertNotNull("showConstantTBTIcon returned null", enumShowConstantTbtIcon);
- assertNotNull("showConstantTBTNextTurnIcon returned null", enumShowConstantTbtNextTurnIcon);
- assertNotNull("location image returned null", enumLocationImage);
- assertNotNull("secondary graphic returned null", enumSecondaryGraphic);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "softButtonImage";
+ ImageFieldName enumSoftButtonImage = ImageFieldName.valueForString(example);
+ example = "choiceImage";
+ ImageFieldName enumChoiceImage = ImageFieldName.valueForString(example);
+ example = "choiceSecondaryImage";
+ ImageFieldName enumSecondaryImage = ImageFieldName.valueForString(example);
+ example = "vrHelpItem";
+ ImageFieldName enumVrHelpItem = ImageFieldName.valueForString(example);
+ example = "turnIcon";
+ ImageFieldName enumTurnIcon = ImageFieldName.valueForString(example);
+ example = "menuIcon";
+ ImageFieldName enumMenuIcon = ImageFieldName.valueForString(example);
+ example = "cmdIcon";
+ ImageFieldName enumCmdIcon = ImageFieldName.valueForString(example);
+ example = "appIcon";
+ ImageFieldName enumAppIcon = ImageFieldName.valueForString(example);
+ example = "graphic";
+ ImageFieldName enumGraphicIcon = ImageFieldName.valueForString(example);
+ example = "showConstantTBTIcon";
+ ImageFieldName enumShowConstantTbtIcon = ImageFieldName.valueForString(example);
+ example = "showConstantTBTNextTurnIcon";
+ ImageFieldName enumShowConstantTbtNextTurnIcon = ImageFieldName.valueForString(example);
+ example = "locationImage";
+ ImageFieldName enumLocationImage = ImageFieldName.valueForString(example);
+ example = "secondaryGraphic";
+ ImageFieldName enumSecondaryGraphic = ImageFieldName.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "sofTbUtTOnImagE";
- try {
- ImageFieldName temp = ImageFieldName.valueForString(example);
+ assertNotNull("softButtonImage returned null", enumSoftButtonImage);
+ assertNotNull("choiceImage returned null", enumChoiceImage);
+ assertNotNull("choiceSecondaryImage returned null", enumSecondaryImage);
+ assertNotNull("vrHelpItem returned null", enumVrHelpItem);
+ assertNotNull("turnIcon returned null", enumTurnIcon);
+ assertNotNull("menuIcon returned null", enumMenuIcon);
+ assertNotNull("cmdIcon returned null", enumCmdIcon);
+ assertNotNull("appIcon returned null", enumAppIcon);
+ assertNotNull("graphic returned null", enumGraphicIcon);
+ assertNotNull("showConstantTBTIcon returned null", enumShowConstantTbtIcon);
+ assertNotNull("showConstantTBTNextTurnIcon returned null", enumShowConstantTbtNextTurnIcon);
+ assertNotNull("location image returned null", enumLocationImage);
+ assertNotNull("secondary graphic returned null", enumSecondaryGraphic);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "sofTbUtTOnImagE";
+ try {
+ ImageFieldName temp = ImageFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ImageFieldName temp = ImageFieldName.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ImageFieldName temp = ImageFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of ImageFieldName.
- */
- public void testListEnum() {
- List<ImageFieldName> enumValueList = Arrays.asList(ImageFieldName.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of ImageFieldName.
+ */
+ public void testListEnum() {
+ List<ImageFieldName> enumValueList = Arrays.asList(ImageFieldName.values());
- List<ImageFieldName> enumTestList = new ArrayList<ImageFieldName>();
- enumTestList.add(ImageFieldName.softButtonImage);
- enumTestList.add(ImageFieldName.choiceImage);
- enumTestList.add(ImageFieldName.choiceSecondaryImage);
- enumTestList.add(ImageFieldName.vrHelpItem);
- enumTestList.add(ImageFieldName.turnIcon);
- enumTestList.add(ImageFieldName.menuIcon);
- enumTestList.add(ImageFieldName.cmdIcon);
- enumTestList.add(ImageFieldName.appIcon);
- enumTestList.add(ImageFieldName.graphic);
- enumTestList.add(ImageFieldName.showConstantTBTIcon);
- enumTestList.add(ImageFieldName.showConstantTBTNextTurnIcon);
- enumTestList.add(ImageFieldName.locationImage);
- enumTestList.add(ImageFieldName.secondaryGraphic);
- enumTestList.add(ImageFieldName.alertIcon);
- enumTestList.add(ImageFieldName.subtleAlertIcon);
- enumTestList.add(ImageFieldName.subMenuIcon);
+ List<ImageFieldName> enumTestList = new ArrayList<ImageFieldName>();
+ enumTestList.add(ImageFieldName.softButtonImage);
+ enumTestList.add(ImageFieldName.choiceImage);
+ enumTestList.add(ImageFieldName.choiceSecondaryImage);
+ enumTestList.add(ImageFieldName.vrHelpItem);
+ enumTestList.add(ImageFieldName.turnIcon);
+ enumTestList.add(ImageFieldName.menuIcon);
+ enumTestList.add(ImageFieldName.cmdIcon);
+ enumTestList.add(ImageFieldName.appIcon);
+ enumTestList.add(ImageFieldName.graphic);
+ enumTestList.add(ImageFieldName.showConstantTBTIcon);
+ enumTestList.add(ImageFieldName.showConstantTBTNextTurnIcon);
+ enumTestList.add(ImageFieldName.locationImage);
+ enumTestList.add(ImageFieldName.secondaryGraphic);
+ enumTestList.add(ImageFieldName.alertIcon);
+ enumTestList.add(ImageFieldName.subtleAlertIcon);
+ enumTestList.add(ImageFieldName.subMenuIcon);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ImageTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageTypeTests.java
index e31375cae..17d96b89a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageTypeTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.ImageType}
*/
public class ImageTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "STATIC";
- ImageType enumStatic = ImageType.valueForString(example);
- example = "DYNAMIC";
- ImageType enumDynamic = ImageType.valueForString(example);
-
- assertNotNull("STATIC returned null", enumStatic);
- assertNotNull("DYNAMIC returned null", enumDynamic);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "STATIC";
+ ImageType enumStatic = ImageType.valueForString(example);
+ example = "DYNAMIC";
+ ImageType enumDynamic = ImageType.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "sTatIc";
- try {
- ImageType temp = ImageType.valueForString(example);
+ assertNotNull("STATIC returned null", enumStatic);
+ assertNotNull("DYNAMIC returned null", enumDynamic);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "sTatIc";
+ try {
+ ImageType temp = ImageType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- ImageType temp = ImageType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ImageType temp = ImageType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of ImageType.
- */
- public void testListEnum() {
- List<ImageType> enumValueList = Arrays.asList(ImageType.values());
+ /**
+ * Verifies the possible enum values of ImageType.
+ */
+ public void testListEnum() {
+ List<ImageType> enumValueList = Arrays.asList(ImageType.values());
- List<ImageType> enumTestList = new ArrayList<ImageType>();
- enumTestList.add(ImageType.STATIC);
- enumTestList.add(ImageType.DYNAMIC);
+ List<ImageType> enumTestList = new ArrayList<ImageType>();
+ enumTestList.add(ImageType.STATIC);
+ enumTestList.add(ImageType.DYNAMIC);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/InteractionModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/InteractionModeTests.java
index baae35b38..c6ff9a218 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/InteractionModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/InteractionModeTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.InteractionMode}
*/
public class InteractionModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "MANUAL_ONLY";
- InteractionMode enumManualOnly = InteractionMode.valueForString(example);
- example = "VR_ONLY";
- InteractionMode enumVrOnly = InteractionMode.valueForString(example);
- example = "BOTH";
- InteractionMode enumBoth = InteractionMode.valueForString(example);
-
- assertNotNull("MANUAL_ONLY returned null", enumManualOnly);
- assertNotNull("VR_ONLY returned null", enumVrOnly);
- assertNotNull("BOTH returned null", enumBoth);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MANUAL_ONLY";
+ InteractionMode enumManualOnly = InteractionMode.valueForString(example);
+ example = "VR_ONLY";
+ InteractionMode enumVrOnly = InteractionMode.valueForString(example);
+ example = "BOTH";
+ InteractionMode enumBoth = InteractionMode.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "maNuAL_OnlY";
- try {
- InteractionMode temp = InteractionMode.valueForString(example);
+ assertNotNull("MANUAL_ONLY returned null", enumManualOnly);
+ assertNotNull("VR_ONLY returned null", enumVrOnly);
+ assertNotNull("BOTH returned null", enumBoth);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "maNuAL_OnlY";
+ try {
+ InteractionMode temp = InteractionMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- InteractionMode temp = InteractionMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ InteractionMode temp = InteractionMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of InteractionMode.
- */
- public void testListEnum() {
- List<InteractionMode> enumValueList = Arrays.asList(InteractionMode.values());
+ /**
+ * Verifies the possible enum values of InteractionMode.
+ */
+ public void testListEnum() {
+ List<InteractionMode> enumValueList = Arrays.asList(InteractionMode.values());
- List<InteractionMode> enumTestList = new ArrayList<InteractionMode>();
- enumTestList.add(InteractionMode.MANUAL_ONLY);
- enumTestList.add(InteractionMode.VR_ONLY);
- enumTestList.add(InteractionMode.BOTH);
+ List<InteractionMode> enumTestList = new ArrayList<InteractionMode>();
+ enumTestList.add(InteractionMode.MANUAL_ONLY);
+ enumTestList.add(InteractionMode.VR_ONLY);
+ enumTestList.add(InteractionMode.BOTH);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/JingleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/JingleTests.java
index c215d052b..6712bfc0d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/JingleTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/JingleTests.java
@@ -9,75 +9,75 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.Jingle}
*/
public class JingleTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
-
- String example = "POSITIVE_JINGLE";
- Jingle enumPositiveJingle = Jingle.valueForString(example);
- example = "NEGATIVE_JINGLE";
- Jingle enumNegativeJingle = Jingle.valueForString(example);
- example = "INITIAL_JINGLE";
- Jingle enumInitialJingle = Jingle.valueForString(example);
- example = "LISTEN_JINGLE";
- Jingle enumListenJingle = Jingle.valueForString(example);
- example = "HELP_JINGLE";
- Jingle enumHelpJingle = Jingle.valueForString(example);
-
- assertNotNull("POSITIVE_JINGLE returned null", enumPositiveJingle);
- assertNotNull("NEGATIVE_JINGLE returned null", enumNegativeJingle);
- assertNotNull("INITIAL_JINGLE returned null", enumInitialJingle);
- assertNotNull("LISTEN_JINGLE returned null", enumListenJingle);
- assertNotNull("HELP_JINGLE returned null", enumHelpJingle);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "posITive_JiGLE";
- try {
- Jingle temp = Jingle.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ String example = "POSITIVE_JINGLE";
+ Jingle enumPositiveJingle = Jingle.valueForString(example);
+ example = "NEGATIVE_JINGLE";
+ Jingle enumNegativeJingle = Jingle.valueForString(example);
+ example = "INITIAL_JINGLE";
+ Jingle enumInitialJingle = Jingle.valueForString(example);
+ example = "LISTEN_JINGLE";
+ Jingle enumListenJingle = Jingle.valueForString(example);
+ example = "HELP_JINGLE";
+ Jingle enumHelpJingle = Jingle.valueForString(example);
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- Jingle temp = Jingle.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ assertNotNull("POSITIVE_JINGLE returned null", enumPositiveJingle);
+ assertNotNull("NEGATIVE_JINGLE returned null", enumNegativeJingle);
+ assertNotNull("INITIAL_JINGLE returned null", enumInitialJingle);
+ assertNotNull("LISTEN_JINGLE returned null", enumListenJingle);
+ assertNotNull("HELP_JINGLE returned null", enumHelpJingle);
+ }
- /**
- * Verifies the possible enum values of Jingle.
- */
- public void testListEnums () {
- List<Jingle> enumValueList = Arrays.asList(Jingle.values());
- List<Jingle> enumTestList = new ArrayList<Jingle>();
-
- enumTestList.add(Jingle.HELP);
- enumTestList.add(Jingle.INITIAL);
- enumTestList.add(Jingle.LISTEN);
- enumTestList.add(Jingle.NEGATIVE);
- enumTestList.add(Jingle.POSITIVE);
-
- assertTrue("Enum value list does not match neum class list.",
- enumValueList.containsAll(enumTestList) &&
- enumTestList.containsAll(enumValueList));
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "posITive_JiGLE";
+ try {
+ Jingle temp = Jingle.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 {
+ Jingle temp = Jingle.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of Jingle.
+ */
+ public void testListEnums() {
+ List<Jingle> enumValueList = Arrays.asList(Jingle.values());
+ List<Jingle> enumTestList = new ArrayList<Jingle>();
+
+ enumTestList.add(Jingle.HELP);
+ enumTestList.add(Jingle.INITIAL);
+ enumTestList.add(Jingle.LISTEN);
+ enumTestList.add(Jingle.NEGATIVE);
+ enumTestList.add(Jingle.POSITIVE);
+
+ assertTrue("Enum value list does not match neum 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/KeyboardEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardEventTests.java
index 28acd853f..13a28cfda 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardEventTests.java
@@ -9,75 +9,73 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.KeyboardEvent}
*/
public class KeyboardEventTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "KEYPRESS";
- KeyboardEvent enumKeypress = KeyboardEvent.valueForString(example);
- example = "ENTRY_SUBMITTED";
- KeyboardEvent enumEntrySubmitted = KeyboardEvent.valueForString(example);
- example = "ENTRY_CANCELLED";
- KeyboardEvent enumEntryCancelled = KeyboardEvent.valueForString(example);
- example = "ENTRY_ABORTED";
- KeyboardEvent enumEntryAborted = KeyboardEvent.valueForString(example);
- example = "ENTRY_VOICE";
- KeyboardEvent enumEntryVoice = KeyboardEvent.valueForString(example);
-
- assertNotNull("KEYPRESS returned null", enumKeypress);
- assertNotNull("ENTRY_SUBMITTED returned null", enumEntrySubmitted);
- assertNotNull("ENTRY_CANCELLED returned null", enumEntryCancelled);
- assertNotNull("ENTRY_ABORTED returned null", enumEntryAborted);
- assertNotNull("ENTRY_VOICE returned null", enumEntryVoice);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "KEYPRESS";
+ KeyboardEvent enumKeypress = KeyboardEvent.valueForString(example);
+ example = "ENTRY_SUBMITTED";
+ KeyboardEvent enumEntrySubmitted = KeyboardEvent.valueForString(example);
+ example = "ENTRY_CANCELLED";
+ KeyboardEvent enumEntryCancelled = KeyboardEvent.valueForString(example);
+ example = "ENTRY_ABORTED";
+ KeyboardEvent enumEntryAborted = KeyboardEvent.valueForString(example);
+ example = "ENTRY_VOICE";
+ KeyboardEvent enumEntryVoice = KeyboardEvent.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "keyPreSS";
- try {
- KeyboardEvent temp = KeyboardEvent.valueForString(example);
+ assertNotNull("KEYPRESS returned null", enumKeypress);
+ assertNotNull("ENTRY_SUBMITTED returned null", enumEntrySubmitted);
+ assertNotNull("ENTRY_CANCELLED returned null", enumEntryCancelled);
+ assertNotNull("ENTRY_ABORTED returned null", enumEntryAborted);
+ assertNotNull("ENTRY_VOICE returned null", enumEntryVoice);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "keyPreSS";
+ try {
+ KeyboardEvent temp = KeyboardEvent.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- KeyboardEvent temp = KeyboardEvent.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ KeyboardEvent temp = KeyboardEvent.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of KeyboardEvent.
- */
- public void testListEnum() {
- List<KeyboardEvent> enumValueList = Arrays.asList(KeyboardEvent.values());
+ /**
+ * Verifies the possible enum values of KeyboardEvent.
+ */
+ public void testListEnum() {
+ List<KeyboardEvent> enumValueList = Arrays.asList(KeyboardEvent.values());
- List<KeyboardEvent> enumTestList = new ArrayList<KeyboardEvent>();
- enumTestList.add(KeyboardEvent.KEYPRESS);
- enumTestList.add(KeyboardEvent.ENTRY_SUBMITTED);
- enumTestList.add(KeyboardEvent.ENTRY_CANCELLED);
- enumTestList.add(KeyboardEvent.ENTRY_ABORTED);
- enumTestList.add(KeyboardEvent.ENTRY_VOICE);
+ List<KeyboardEvent> enumTestList = new ArrayList<KeyboardEvent>();
+ enumTestList.add(KeyboardEvent.KEYPRESS);
+ enumTestList.add(KeyboardEvent.ENTRY_SUBMITTED);
+ enumTestList.add(KeyboardEvent.ENTRY_CANCELLED);
+ enumTestList.add(KeyboardEvent.ENTRY_ABORTED);
+ enumTestList.add(KeyboardEvent.ENTRY_VOICE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/KeyboardLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardLayoutTests.java
index 5ce30904f..c75b9d7e9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeyboardLayoutTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.KeyboardLayout}
*/
public class KeyboardLayoutTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "QWERTY";
- KeyboardLayout enumQwerty = KeyboardLayout.valueForString(example);
- example = "QWERTZ";
- KeyboardLayout enumQwertz = KeyboardLayout.valueForString(example);
- example = "AZERTY";
- KeyboardLayout enumAzerty = KeyboardLayout.valueForString(example);
-
- assertNotNull("QWERTY returned null", enumQwerty);
- assertNotNull("QWERTZ returned null", enumQwertz);
- assertNotNull("AZERTY returned null", enumAzerty);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "QWERTY";
+ KeyboardLayout enumQwerty = KeyboardLayout.valueForString(example);
+ example = "QWERTZ";
+ KeyboardLayout enumQwertz = KeyboardLayout.valueForString(example);
+ example = "AZERTY";
+ KeyboardLayout enumAzerty = KeyboardLayout.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "qWerTY";
- try {
- KeyboardLayout temp = KeyboardLayout.valueForString(example);
+ assertNotNull("QWERTY returned null", enumQwerty);
+ assertNotNull("QWERTZ returned null", enumQwertz);
+ assertNotNull("AZERTY returned null", enumAzerty);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "qWerTY";
+ try {
+ KeyboardLayout temp = KeyboardLayout.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- KeyboardLayout temp = KeyboardLayout.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ KeyboardLayout temp = KeyboardLayout.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of KeyboardLayout.
- */
- public void testListEnum() {
- List<KeyboardLayout> enumValueList = Arrays.asList(KeyboardLayout.values());
+ /**
+ * Verifies the possible enum values of KeyboardLayout.
+ */
+ public void testListEnum() {
+ List<KeyboardLayout> enumValueList = Arrays.asList(KeyboardLayout.values());
- List<KeyboardLayout> enumTestList = new ArrayList<KeyboardLayout>();
- enumTestList.add(KeyboardLayout.QWERTY);
- enumTestList.add(KeyboardLayout.QWERTZ);
- enumTestList.add(KeyboardLayout.AZERTY);
+ List<KeyboardLayout> enumTestList = new ArrayList<KeyboardLayout>();
+ enumTestList.add(KeyboardLayout.QWERTY);
+ enumTestList.add(KeyboardLayout.QWERTZ);
+ enumTestList.add(KeyboardLayout.AZERTY);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/KeypressModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeypressModeTests.java
index 6384cc9f3..d432606ee 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeypressModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/KeypressModeTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.KeypressMode}
*/
public class KeypressModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "SINGLE_KEYPRESS";
- KeypressMode enumSingleKeypress = KeypressMode.valueForString(example);
- example = "QUEUE_KEYPRESSES";
- KeypressMode enumQueueKeypresses = KeypressMode.valueForString(example);
- example = "RESEND_CURRENT_ENTRY";
- KeypressMode enumResendCurrentEntry = KeypressMode.valueForString(example);
-
- assertNotNull("SINGLE_KEYPRESS returned null", enumSingleKeypress);
- assertNotNull("QUEUE_KEYPRESSES returned null", enumQueueKeypresses);
- assertNotNull("RESEND_CURRENT_ENTRY returned null", enumResendCurrentEntry);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "SINGLE_KEYPRESS";
+ KeypressMode enumSingleKeypress = KeypressMode.valueForString(example);
+ example = "QUEUE_KEYPRESSES";
+ KeypressMode enumQueueKeypresses = KeypressMode.valueForString(example);
+ example = "RESEND_CURRENT_ENTRY";
+ KeypressMode enumResendCurrentEntry = KeypressMode.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "sIngLe_KeyPrESs";
- try {
- KeypressMode temp = KeypressMode.valueForString(example);
+ assertNotNull("SINGLE_KEYPRESS returned null", enumSingleKeypress);
+ assertNotNull("QUEUE_KEYPRESSES returned null", enumQueueKeypresses);
+ assertNotNull("RESEND_CURRENT_ENTRY returned null", enumResendCurrentEntry);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "sIngLe_KeyPrESs";
+ try {
+ KeypressMode temp = KeypressMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- KeypressMode temp = KeypressMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ KeypressMode temp = KeypressMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of KeypressMode.
- */
- public void testListEnum() {
- List<KeypressMode> enumValueList = Arrays.asList(KeypressMode.values());
+ /**
+ * Verifies the possible enum values of KeypressMode.
+ */
+ public void testListEnum() {
+ List<KeypressMode> enumValueList = Arrays.asList(KeypressMode.values());
- List<KeypressMode> enumTestList = new ArrayList<KeypressMode>();
- enumTestList.add(KeypressMode.SINGLE_KEYPRESS);
- enumTestList.add(KeypressMode.QUEUE_KEYPRESSES);
- enumTestList.add(KeypressMode.RESEND_CURRENT_ENTRY);
+ List<KeypressMode> enumTestList = new ArrayList<KeypressMode>();
+ enumTestList.add(KeypressMode.SINGLE_KEYPRESS);
+ enumTestList.add(KeypressMode.QUEUE_KEYPRESSES);
+ enumTestList.add(KeypressMode.RESEND_CURRENT_ENTRY);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/LanguageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
index 61de1cfd5..88889b525 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
@@ -9,212 +9,210 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.Language}
*/
public class LanguageTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "EN-US";
- Language enumEnUs = Language.valueForString(example);
- example = "EN-SA";
- Language enumEnSa = Language.valueForString(example);
- example = "HE-IL";
- Language enumHeIl = Language.valueForString(example);
- example = "RO-RO";
- Language enumRoRo = Language.valueForString(example);
- example = "UK-UA";
- Language enumUkUa = Language.valueForString(example);
- example = "ID-ID";
- Language enumIdId = Language.valueForString(example);
- example = "VI-VN";
- Language enumViVn = Language.valueForString(example);
- example = "MS-MY";
- Language enumMsMy = Language.valueForString(example);
- example = "HI-IN";
- Language enumHiIn = Language.valueForString(example);
- example = "NL-BE";
- Language enumNlBe = Language.valueForString(example);
- example = "EL-GR";
- Language enumElGr = Language.valueForString(example);
- example = "HU-HU";
- Language enumHuHu = Language.valueForString(example);
- example = "FI-FI";
- Language enumFiFi = Language.valueForString(example);
- example = "SK-SK";
- Language enumSkSk = Language.valueForString(example);
- example = "ES-MX";
- Language enumEsMx = Language.valueForString(example);
- example = "FR-CA";
- Language enumFrCa = Language.valueForString(example);
- example = "DE-DE";
- Language enumDeDe = Language.valueForString(example);
- example = "ES-ES";
- Language enumEsEs = Language.valueForString(example);
- example = "EN-GB";
- Language enumEnGb = Language.valueForString(example);
- example = "RU-RU";
- Language enumRuRu = Language.valueForString(example);
- example = "TR-TR";
- Language enumTrTr = Language.valueForString(example);
- example = "PL-PL";
- Language enumPlPl = Language.valueForString(example);
- example = "FR-FR";
- Language enumFrFr = Language.valueForString(example);
- example = "IT-IT";
- Language enumItIt = Language.valueForString(example);
- example = "SV-SE";
- Language enumSvSe = Language.valueForString(example);
- example = "PT-PT";
- Language enumPtPt = Language.valueForString(example);
- example = "NL-NL";
- Language enumNlNl = Language.valueForString(example);
- example = "EN-AU";
- Language enumEnAu = Language.valueForString(example);
- example = "ZH-CN";
- Language enumZhCn = Language.valueForString(example);
- example = "ZH-TW";
- Language enumZhTw = Language.valueForString(example);
- example = "JA-JP";
- Language enumJaJp = Language.valueForString(example);
- example = "AR-SA";
- Language enumArSa = Language.valueForString(example);
- example = "KO-KR";
- Language enumKoKr = Language.valueForString(example);
- example = "PT-BR";
- Language enumPtBr = Language.valueForString(example);
- example = "CS-CZ";
- Language enumCsCz = Language.valueForString(example);
- example = "DA-DK";
- Language enumDaDk = Language.valueForString(example);
- example = "NO-NO";
- Language enumNoNo = Language.valueForString(example);
- example = "EN-IN";
- Language enumEnIn = Language.valueForString(example);
- example = "TH-TH";
- Language enumThTh = Language.valueForString(example);
-
- assertNotNull("EN-US returned null", enumEnUs);
- assertNotNull("EN-SA returned null", enumEnSa);
- assertNotNull("HE-IL returned null", enumHeIl);
- assertNotNull("RO-RO returned null", enumRoRo);
- assertNotNull("UK-UA returned null", enumUkUa);
- assertNotNull("ID-ID returned null", enumIdId);
- assertNotNull("VI-VN returned null", enumViVn);
- assertNotNull("MS-MY returned null", enumMsMy);
- assertNotNull("HI-IN returned null", enumHiIn);
- assertNotNull("NL-BE returned null", enumNlBe);
- assertNotNull("EL-GR returned null", enumElGr);
- assertNotNull("HU-HU returned null", enumHuHu);
- assertNotNull("FI-FI returned null", enumFiFi);
- assertNotNull("SK-SK returned null", enumSkSk);
- assertNotNull("ES-MX returned null", enumEsMx);
- assertNotNull("FR-CA returned null", enumFrCa);
- assertNotNull("DE-DE returned null", enumDeDe);
- assertNotNull("ES-ES returned null", enumEsEs);
- assertNotNull("EN-GB returned null", enumEnGb);
- assertNotNull("RU-RU returned null", enumRuRu);
- assertNotNull("TR-TR returned null", enumTrTr);
- assertNotNull("PL-PL returned null", enumPlPl);
- assertNotNull("FR-FR returned null", enumFrFr);
- assertNotNull("IT-IT returned null", enumItIt);
- assertNotNull("SV-SE returned null", enumSvSe);
- assertNotNull("PT-PT returned null", enumPtPt);
- assertNotNull("NL-NL returned null", enumNlNl);
- assertNotNull("EN-AU returned null", enumEnAu);
- assertNotNull("ZH-CN returned null", enumZhCn);
- assertNotNull("ZH-TW returned null", enumZhTw);
- assertNotNull("JA-JP returned null", enumJaJp);
- assertNotNull("AR-SA returned null", enumArSa);
- assertNotNull("KO-KR returned null", enumKoKr);
- assertNotNull("PT-BR returned null", enumPtBr);
- assertNotNull("CS-CZ returned null", enumCsCz);
- assertNotNull("DA-DK returned null", enumDaDk);
- assertNotNull("NO-NO returned null", enumNoNo);
- assertNotNull("EN-IN returned null", enumEnIn);
- assertNotNull("TH-TH returned null", enumThTh);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "EN-US";
+ Language enumEnUs = Language.valueForString(example);
+ example = "EN-SA";
+ Language enumEnSa = Language.valueForString(example);
+ example = "HE-IL";
+ Language enumHeIl = Language.valueForString(example);
+ example = "RO-RO";
+ Language enumRoRo = Language.valueForString(example);
+ example = "UK-UA";
+ Language enumUkUa = Language.valueForString(example);
+ example = "ID-ID";
+ Language enumIdId = Language.valueForString(example);
+ example = "VI-VN";
+ Language enumViVn = Language.valueForString(example);
+ example = "MS-MY";
+ Language enumMsMy = Language.valueForString(example);
+ example = "HI-IN";
+ Language enumHiIn = Language.valueForString(example);
+ example = "NL-BE";
+ Language enumNlBe = Language.valueForString(example);
+ example = "EL-GR";
+ Language enumElGr = Language.valueForString(example);
+ example = "HU-HU";
+ Language enumHuHu = Language.valueForString(example);
+ example = "FI-FI";
+ Language enumFiFi = Language.valueForString(example);
+ example = "SK-SK";
+ Language enumSkSk = Language.valueForString(example);
+ example = "ES-MX";
+ Language enumEsMx = Language.valueForString(example);
+ example = "FR-CA";
+ Language enumFrCa = Language.valueForString(example);
+ example = "DE-DE";
+ Language enumDeDe = Language.valueForString(example);
+ example = "ES-ES";
+ Language enumEsEs = Language.valueForString(example);
+ example = "EN-GB";
+ Language enumEnGb = Language.valueForString(example);
+ example = "RU-RU";
+ Language enumRuRu = Language.valueForString(example);
+ example = "TR-TR";
+ Language enumTrTr = Language.valueForString(example);
+ example = "PL-PL";
+ Language enumPlPl = Language.valueForString(example);
+ example = "FR-FR";
+ Language enumFrFr = Language.valueForString(example);
+ example = "IT-IT";
+ Language enumItIt = Language.valueForString(example);
+ example = "SV-SE";
+ Language enumSvSe = Language.valueForString(example);
+ example = "PT-PT";
+ Language enumPtPt = Language.valueForString(example);
+ example = "NL-NL";
+ Language enumNlNl = Language.valueForString(example);
+ example = "EN-AU";
+ Language enumEnAu = Language.valueForString(example);
+ example = "ZH-CN";
+ Language enumZhCn = Language.valueForString(example);
+ example = "ZH-TW";
+ Language enumZhTw = Language.valueForString(example);
+ example = "JA-JP";
+ Language enumJaJp = Language.valueForString(example);
+ example = "AR-SA";
+ Language enumArSa = Language.valueForString(example);
+ example = "KO-KR";
+ Language enumKoKr = Language.valueForString(example);
+ example = "PT-BR";
+ Language enumPtBr = Language.valueForString(example);
+ example = "CS-CZ";
+ Language enumCsCz = Language.valueForString(example);
+ example = "DA-DK";
+ Language enumDaDk = Language.valueForString(example);
+ example = "NO-NO";
+ Language enumNoNo = Language.valueForString(example);
+ example = "EN-IN";
+ Language enumEnIn = Language.valueForString(example);
+ example = "TH-TH";
+ Language enumThTh = Language.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "eN-Us";
- try {
- Language temp = Language.valueForString(example);
+ assertNotNull("EN-US returned null", enumEnUs);
+ assertNotNull("EN-SA returned null", enumEnSa);
+ assertNotNull("HE-IL returned null", enumHeIl);
+ assertNotNull("RO-RO returned null", enumRoRo);
+ assertNotNull("UK-UA returned null", enumUkUa);
+ assertNotNull("ID-ID returned null", enumIdId);
+ assertNotNull("VI-VN returned null", enumViVn);
+ assertNotNull("MS-MY returned null", enumMsMy);
+ assertNotNull("HI-IN returned null", enumHiIn);
+ assertNotNull("NL-BE returned null", enumNlBe);
+ assertNotNull("EL-GR returned null", enumElGr);
+ assertNotNull("HU-HU returned null", enumHuHu);
+ assertNotNull("FI-FI returned null", enumFiFi);
+ assertNotNull("SK-SK returned null", enumSkSk);
+ assertNotNull("ES-MX returned null", enumEsMx);
+ assertNotNull("FR-CA returned null", enumFrCa);
+ assertNotNull("DE-DE returned null", enumDeDe);
+ assertNotNull("ES-ES returned null", enumEsEs);
+ assertNotNull("EN-GB returned null", enumEnGb);
+ assertNotNull("RU-RU returned null", enumRuRu);
+ assertNotNull("TR-TR returned null", enumTrTr);
+ assertNotNull("PL-PL returned null", enumPlPl);
+ assertNotNull("FR-FR returned null", enumFrFr);
+ assertNotNull("IT-IT returned null", enumItIt);
+ assertNotNull("SV-SE returned null", enumSvSe);
+ assertNotNull("PT-PT returned null", enumPtPt);
+ assertNotNull("NL-NL returned null", enumNlNl);
+ assertNotNull("EN-AU returned null", enumEnAu);
+ assertNotNull("ZH-CN returned null", enumZhCn);
+ assertNotNull("ZH-TW returned null", enumZhTw);
+ assertNotNull("JA-JP returned null", enumJaJp);
+ assertNotNull("AR-SA returned null", enumArSa);
+ assertNotNull("KO-KR returned null", enumKoKr);
+ assertNotNull("PT-BR returned null", enumPtBr);
+ assertNotNull("CS-CZ returned null", enumCsCz);
+ assertNotNull("DA-DK returned null", enumDaDk);
+ assertNotNull("NO-NO returned null", enumNoNo);
+ assertNotNull("EN-IN returned null", enumEnIn);
+ assertNotNull("TH-TH returned null", enumThTh);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "eN-Us";
+ try {
+ Language temp = Language.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- Language temp = Language.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ Language temp = Language.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of Language.
+ */
+ public void testListEnum() {
+ List<Language> enumValueList = Arrays.asList(Language.values());
+
+ List<Language> enumTestList = new ArrayList<Language>();
- /**
- * Verifies the possible enum values of Language.
- */
- public void testListEnum() {
- List<Language> enumValueList = Arrays.asList(Language.values());
+ enumTestList.add(Language.EN_US);
+ enumTestList.add(Language.EN_SA);
+ enumTestList.add(Language.HE_IL);
+ enumTestList.add(Language.RO_RO);
+ enumTestList.add(Language.UK_UA);
+ enumTestList.add(Language.ID_ID);
+ enumTestList.add(Language.VI_VN);
+ enumTestList.add(Language.MS_MY);
+ enumTestList.add(Language.HI_IN);
+ enumTestList.add(Language.NL_BE);
+ enumTestList.add(Language.EL_GR);
+ enumTestList.add(Language.HU_HU);
+ enumTestList.add(Language.FI_FI);
+ enumTestList.add(Language.SK_SK);
+ enumTestList.add(Language.ES_MX);
+ enumTestList.add(Language.FR_CA);
+ enumTestList.add(Language.DE_DE);
+ enumTestList.add(Language.ES_ES);
+ enumTestList.add(Language.EN_GB);
+ enumTestList.add(Language.RU_RU);
+ enumTestList.add(Language.TR_TR);
+ enumTestList.add(Language.PL_PL);
+ enumTestList.add(Language.FR_FR);
+ enumTestList.add(Language.IT_IT);
+ enumTestList.add(Language.SV_SE);
+ enumTestList.add(Language.PT_PT);
+ enumTestList.add(Language.NL_NL);
+ enumTestList.add(Language.EN_AU);
+ enumTestList.add(Language.ZH_CN);
+ enumTestList.add(Language.ZH_TW);
+ enumTestList.add(Language.JA_JP);
+ enumTestList.add(Language.AR_SA);
+ enumTestList.add(Language.KO_KR);
+ enumTestList.add(Language.PT_BR);
+ enumTestList.add(Language.CS_CZ);
+ enumTestList.add(Language.DA_DK);
+ enumTestList.add(Language.NO_NO);
+ enumTestList.add(Language.EN_IN);
+ enumTestList.add(Language.TH_TH);
- List<Language> enumTestList = new ArrayList<Language>();
-
- enumTestList.add(Language.EN_US);
- enumTestList.add(Language.EN_SA);
- enumTestList.add(Language.HE_IL);
- enumTestList.add(Language.RO_RO);
- enumTestList.add(Language.UK_UA);
- enumTestList.add(Language.ID_ID);
- enumTestList.add(Language.VI_VN);
- enumTestList.add(Language.MS_MY);
- enumTestList.add(Language.HI_IN);
- enumTestList.add(Language.NL_BE);
- enumTestList.add(Language.EL_GR);
- enumTestList.add(Language.HU_HU);
- enumTestList.add(Language.FI_FI);
- enumTestList.add(Language.SK_SK);
- enumTestList.add(Language.ES_MX);
- enumTestList.add(Language.FR_CA);
- enumTestList.add(Language.DE_DE);
- enumTestList.add(Language.ES_ES);
- enumTestList.add(Language.EN_GB);
- enumTestList.add(Language.RU_RU);
- enumTestList.add(Language.TR_TR);
- enumTestList.add(Language.PL_PL);
- enumTestList.add(Language.FR_FR);
- enumTestList.add(Language.IT_IT);
- enumTestList.add(Language.SV_SE);
- enumTestList.add(Language.PT_PT);
- enumTestList.add(Language.NL_NL);
- enumTestList.add(Language.EN_AU);
- enumTestList.add(Language.ZH_CN);
- enumTestList.add(Language.ZH_TW);
- enumTestList.add(Language.JA_JP);
- enumTestList.add(Language.AR_SA);
- enumTestList.add(Language.KO_KR);
- enumTestList.add(Language.PT_BR);
- enumTestList.add(Language.CS_CZ);
- enumTestList.add(Language.DA_DK);
- enumTestList.add(Language.NO_NO);
- enumTestList.add(Language.EN_IN);
- enumTestList.add(Language.TH_TH);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/LayoutModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LayoutModeTests.java
index 8787ae602..2a04539ad 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LayoutModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LayoutModeTests.java
@@ -9,76 +9,74 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.LayoutMode}
*/
public class LayoutModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "ICON_ONLY";
- LayoutMode enumIconOnly = LayoutMode.valueForString(example);
- example = "ICON_WITH_SEARCH";
- LayoutMode enumIconWithSearch = LayoutMode.valueForString(example);
- example = "LIST_ONLY";
- LayoutMode enumListOnly = LayoutMode.valueForString(example);
- example = "LIST_WITH_SEARCH";
- LayoutMode enumListWithSearch = LayoutMode.valueForString(example);
- example = "KEYBOARD";
- LayoutMode enumKeyboard = LayoutMode.valueForString(example);
-
- assertNotNull("ICON_ONLY returned null", enumIconOnly);
- assertNotNull("ICON_WITH_SEARCH returned null", enumIconWithSearch);
- assertNotNull("LIST_ONLY returned null", enumListOnly);
- assertNotNull("LIST_WITH_SEARCH returned null", enumListWithSearch);
- assertNotNull("KEYBOARD returned null", enumKeyboard);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ICON_ONLY";
+ LayoutMode enumIconOnly = LayoutMode.valueForString(example);
+ example = "ICON_WITH_SEARCH";
+ LayoutMode enumIconWithSearch = LayoutMode.valueForString(example);
+ example = "LIST_ONLY";
+ LayoutMode enumListOnly = LayoutMode.valueForString(example);
+ example = "LIST_WITH_SEARCH";
+ LayoutMode enumListWithSearch = LayoutMode.valueForString(example);
+ example = "KEYBOARD";
+ LayoutMode enumKeyboard = LayoutMode.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "icOn_OnlY";
- try {
- LayoutMode temp = LayoutMode.valueForString(example);
+ assertNotNull("ICON_ONLY returned null", enumIconOnly);
+ assertNotNull("ICON_WITH_SEARCH returned null", enumIconWithSearch);
+ assertNotNull("LIST_ONLY returned null", enumListOnly);
+ assertNotNull("LIST_WITH_SEARCH returned null", enumListWithSearch);
+ assertNotNull("KEYBOARD returned null", enumKeyboard);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "icOn_OnlY";
+ try {
+ LayoutMode temp = LayoutMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- LayoutMode temp = LayoutMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ LayoutMode temp = LayoutMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
+ }
+ }
+
- /**
- * Verifies the possible enum values of LayoutMode.
- */
- public void testListEnum() {
- List<LayoutMode> enumValueList = Arrays.asList(LayoutMode.values());
+ /**
+ * Verifies the possible enum values of LayoutMode.
+ */
+ public void testListEnum() {
+ List<LayoutMode> enumValueList = Arrays.asList(LayoutMode.values());
- List<LayoutMode> enumTestList = new ArrayList<LayoutMode>();
- enumTestList.add(LayoutMode.ICON_ONLY);
- enumTestList.add(LayoutMode.ICON_WITH_SEARCH);
- enumTestList.add(LayoutMode.LIST_ONLY);
- enumTestList.add(LayoutMode.LIST_WITH_SEARCH);
- enumTestList.add(LayoutMode.KEYBOARD);
+ List<LayoutMode> enumTestList = new ArrayList<LayoutMode>();
+ enumTestList.add(LayoutMode.ICON_ONLY);
+ enumTestList.add(LayoutMode.ICON_WITH_SEARCH);
+ enumTestList.add(LayoutMode.LIST_ONLY);
+ enumTestList.add(LayoutMode.LIST_WITH_SEARCH);
+ enumTestList.add(LayoutMode.KEYBOARD);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/LightNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightNameTests.java
index 009a63193..c50931bb9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightNameTests.java
@@ -15,247 +15,247 @@ import java.util.List;
*/
public class LightNameTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "FRONT_LEFT_HIGH_BEAM";
- LightName enumFrontLeftHighBeam = LightName.valueForString(example);
- example = "FRONT_RIGHT_HIGH_BEAM";
- LightName enumFrontRightHighBeam = LightName.valueForString(example);
- example = "FRONT_LEFT_LOW_BEAM";
- LightName enumFrontLeftLowBeam = LightName.valueForString(example);
- example = "FRONT_RIGHT_LOW_BEAM";
- LightName enumFrontRightLowBeam = LightName.valueForString(example);
- example = "FRONT_LEFT_PARKING_LIGHT";
- LightName enumFrontLeftParkingLight = LightName.valueForString(example);
- example = "FRONT_RIGHT_PARKING_LIGHT";
- LightName enumFrontRightParkingLight = LightName.valueForString(example);
- example = "FRONT_LEFT_FOG_LIGHT";
- LightName enumFrontLeftFogLight = LightName.valueForString(example);
- example = "FRONT_RIGHT_FOG_LIGHT";
- LightName enumFrontRightFogLight = LightName.valueForString(example);
- example = "FRONT_LEFT_DAYTIME_RUNNING_LIGHT";
- LightName enumFrontLeftDaytimeRunningLight = LightName.valueForString(example);
- example = "FRONT_RIGHT_DAYTIME_RUNNING_LIGHT";
- LightName enumFrontRightDaytimeRunningLight = LightName.valueForString(example);
- example = "FRONT_LEFT_TURN_LIGHT";
- LightName enumFrontLeftTurnLight = LightName.valueForString(example);
- example = "FRONT_RIGHT_TURN_LIGHT";
- LightName enumFrontRightTurnLight = LightName.valueForString(example);
- example = "REAR_LEFT_FOG_LIGHT";
- LightName enumRearLeftFogLight = LightName.valueForString(example);
- example = "REAR_RIGHT_FOG_LIGHT";
- LightName enumRearRightFogLight = LightName.valueForString(example);
- example = "REAR_LEFT_TAIL_LIGHT";
- LightName enumRearLeftTailLight = LightName.valueForString(example);
- example = "REAR_RIGHT_TAIL_LIGHT";
- LightName enumRearRightTailLight = LightName.valueForString(example);
- example = "REAR_LEFT_BRAKE_LIGHT";
- LightName enumRearLeftBrakeLight = LightName.valueForString(example);
- example = "REAR_RIGHT_BRAKE_LIGHT";
- LightName enumRearRightBrakeLight = LightName.valueForString(example);
- example = "REAR_LEFT_TURN_LIGHT";
- LightName enumRearLeftTurnLight = LightName.valueForString(example);
- example = "REAR_RIGHT_TURN_LIGHT";
- LightName enumRearRightTurnLight = LightName.valueForString(example);
- example = "REAR_REGISTRATION_PLATE_LIGHT";
- LightName enumRearRegistrationPlateLight = LightName.valueForString(example);
- example = "HIGH_BEAMS";
- LightName enumHighBeams = LightName.valueForString(example);
- example = "LOW_BEAMS";
- LightName enumLowBeams = LightName.valueForString(example);
- example = "FOG_LIGHTS";
- LightName enumFogLights = LightName.valueForString(example);
- example = "RUNNING_LIGHTS";
- LightName enumRunningLights = LightName.valueForString(example);
- example = "PARKING_LIGHTS";
- LightName enumParkingLights = LightName.valueForString(example);
- example = "BRAKE_LIGHTS";
- LightName enumBrakeLights = LightName.valueForString(example);
- example = "REAR_REVERSING_LIGHTS";
- LightName enumRearReversingLights = LightName.valueForString(example);
- example = "SIDE_MARKER_LIGHTS";
- LightName enumSideMarkerLights = LightName.valueForString(example);
- example = "LEFT_TURN_LIGHTS";
- LightName enumLeftTurnLights = LightName.valueForString(example);
- example = "RIGHT_TURN_LIGHTS";
- LightName enumRightTurnLights = LightName.valueForString(example);
- example = "HAZARD_LIGHTS";
- LightName enumHazardLights = LightName.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "FRONT_LEFT_HIGH_BEAM";
+ LightName enumFrontLeftHighBeam = LightName.valueForString(example);
+ example = "FRONT_RIGHT_HIGH_BEAM";
+ LightName enumFrontRightHighBeam = LightName.valueForString(example);
+ example = "FRONT_LEFT_LOW_BEAM";
+ LightName enumFrontLeftLowBeam = LightName.valueForString(example);
+ example = "FRONT_RIGHT_LOW_BEAM";
+ LightName enumFrontRightLowBeam = LightName.valueForString(example);
+ example = "FRONT_LEFT_PARKING_LIGHT";
+ LightName enumFrontLeftParkingLight = LightName.valueForString(example);
+ example = "FRONT_RIGHT_PARKING_LIGHT";
+ LightName enumFrontRightParkingLight = LightName.valueForString(example);
+ example = "FRONT_LEFT_FOG_LIGHT";
+ LightName enumFrontLeftFogLight = LightName.valueForString(example);
+ example = "FRONT_RIGHT_FOG_LIGHT";
+ LightName enumFrontRightFogLight = LightName.valueForString(example);
+ example = "FRONT_LEFT_DAYTIME_RUNNING_LIGHT";
+ LightName enumFrontLeftDaytimeRunningLight = LightName.valueForString(example);
+ example = "FRONT_RIGHT_DAYTIME_RUNNING_LIGHT";
+ LightName enumFrontRightDaytimeRunningLight = LightName.valueForString(example);
+ example = "FRONT_LEFT_TURN_LIGHT";
+ LightName enumFrontLeftTurnLight = LightName.valueForString(example);
+ example = "FRONT_RIGHT_TURN_LIGHT";
+ LightName enumFrontRightTurnLight = LightName.valueForString(example);
+ example = "REAR_LEFT_FOG_LIGHT";
+ LightName enumRearLeftFogLight = LightName.valueForString(example);
+ example = "REAR_RIGHT_FOG_LIGHT";
+ LightName enumRearRightFogLight = LightName.valueForString(example);
+ example = "REAR_LEFT_TAIL_LIGHT";
+ LightName enumRearLeftTailLight = LightName.valueForString(example);
+ example = "REAR_RIGHT_TAIL_LIGHT";
+ LightName enumRearRightTailLight = LightName.valueForString(example);
+ example = "REAR_LEFT_BRAKE_LIGHT";
+ LightName enumRearLeftBrakeLight = LightName.valueForString(example);
+ example = "REAR_RIGHT_BRAKE_LIGHT";
+ LightName enumRearRightBrakeLight = LightName.valueForString(example);
+ example = "REAR_LEFT_TURN_LIGHT";
+ LightName enumRearLeftTurnLight = LightName.valueForString(example);
+ example = "REAR_RIGHT_TURN_LIGHT";
+ LightName enumRearRightTurnLight = LightName.valueForString(example);
+ example = "REAR_REGISTRATION_PLATE_LIGHT";
+ LightName enumRearRegistrationPlateLight = LightName.valueForString(example);
+ example = "HIGH_BEAMS";
+ LightName enumHighBeams = LightName.valueForString(example);
+ example = "LOW_BEAMS";
+ LightName enumLowBeams = LightName.valueForString(example);
+ example = "FOG_LIGHTS";
+ LightName enumFogLights = LightName.valueForString(example);
+ example = "RUNNING_LIGHTS";
+ LightName enumRunningLights = LightName.valueForString(example);
+ example = "PARKING_LIGHTS";
+ LightName enumParkingLights = LightName.valueForString(example);
+ example = "BRAKE_LIGHTS";
+ LightName enumBrakeLights = LightName.valueForString(example);
+ example = "REAR_REVERSING_LIGHTS";
+ LightName enumRearReversingLights = LightName.valueForString(example);
+ example = "SIDE_MARKER_LIGHTS";
+ LightName enumSideMarkerLights = LightName.valueForString(example);
+ example = "LEFT_TURN_LIGHTS";
+ LightName enumLeftTurnLights = LightName.valueForString(example);
+ example = "RIGHT_TURN_LIGHTS";
+ LightName enumRightTurnLights = LightName.valueForString(example);
+ example = "HAZARD_LIGHTS";
+ LightName enumHazardLights = LightName.valueForString(example);
- example = "REAR_CARGO_LIGHTS";
- LightName enumRearCargoLights = LightName.valueForString(example);
- example = "REAR_TRUCK_BED_LIGHTS";
- LightName enumRearTruckBedLights = LightName.valueForString(example);
- example = "REAR_TRAILER_LIGHTS";
- LightName enumRearTrailerLights = LightName.valueForString(example);
- example = "LEFT_SPOT_LIGHTS";
- LightName enumLeftSpotLights = LightName.valueForString(example);
- example = "RIGHT_SPOT_LIGHTS";
- LightName enumRightSpotLights = LightName.valueForString(example);
- example = "LEFT_PUDDLE_LIGHTS";
- LightName enumLeftPuddleLights = LightName.valueForString(example);
- example = "RIGHT_PUDDLE_LIGHTS";
- LightName enumRightPuddleLights = LightName.valueForString(example);
- example = "AMBIENT_LIGHTS";
- LightName enumAmbientLights = LightName.valueForString(example);
- example = "OVERHEAD_LIGHTS";
- LightName enumOverheadLights = LightName.valueForString(example);
- example = "READING_LIGHTS";
- LightName enumReadingLights = LightName.valueForString(example);
- example = "TRUNK_LIGHTS";
- LightName enumTrunkLights = LightName.valueForString(example);
- example = "EXTERIOR_FRONT_LIGHTS";
- LightName enumExteriorFrontLights = LightName.valueForString(example);
- example = "EXTERIOR_REAR_LIGHTS";
- LightName enumExteriorRearLights = LightName.valueForString(example);
- example = "EXTERIOR_LEFT_LIGHTS";
- LightName enumExteriorLeftLights = LightName.valueForString(example);
- example = "EXTERIOR_RIGHT_LIGHTS";
- LightName enumExteriorRightLights = LightName.valueForString(example);
- example = "EXTERIOR_ALL_LIGHTS";
- LightName enumExteriorAllLights = LightName.valueForString(example);
+ example = "REAR_CARGO_LIGHTS";
+ LightName enumRearCargoLights = LightName.valueForString(example);
+ example = "REAR_TRUCK_BED_LIGHTS";
+ LightName enumRearTruckBedLights = LightName.valueForString(example);
+ example = "REAR_TRAILER_LIGHTS";
+ LightName enumRearTrailerLights = LightName.valueForString(example);
+ example = "LEFT_SPOT_LIGHTS";
+ LightName enumLeftSpotLights = LightName.valueForString(example);
+ example = "RIGHT_SPOT_LIGHTS";
+ LightName enumRightSpotLights = LightName.valueForString(example);
+ example = "LEFT_PUDDLE_LIGHTS";
+ LightName enumLeftPuddleLights = LightName.valueForString(example);
+ example = "RIGHT_PUDDLE_LIGHTS";
+ LightName enumRightPuddleLights = LightName.valueForString(example);
+ example = "AMBIENT_LIGHTS";
+ LightName enumAmbientLights = LightName.valueForString(example);
+ example = "OVERHEAD_LIGHTS";
+ LightName enumOverheadLights = LightName.valueForString(example);
+ example = "READING_LIGHTS";
+ LightName enumReadingLights = LightName.valueForString(example);
+ example = "TRUNK_LIGHTS";
+ LightName enumTrunkLights = LightName.valueForString(example);
+ example = "EXTERIOR_FRONT_LIGHTS";
+ LightName enumExteriorFrontLights = LightName.valueForString(example);
+ example = "EXTERIOR_REAR_LIGHTS";
+ LightName enumExteriorRearLights = LightName.valueForString(example);
+ example = "EXTERIOR_LEFT_LIGHTS";
+ LightName enumExteriorLeftLights = LightName.valueForString(example);
+ example = "EXTERIOR_RIGHT_LIGHTS";
+ LightName enumExteriorRightLights = LightName.valueForString(example);
+ example = "EXTERIOR_ALL_LIGHTS";
+ LightName enumExteriorAllLights = LightName.valueForString(example);
- assertNotNull("FRONT_LEFT_HIGH_BEAM returned null", enumFrontLeftHighBeam);
- assertNotNull("FRONT_RIGHT_HIGH_BEAM returned null", enumFrontRightHighBeam);
- assertNotNull("FRONT_LEFT_LOW_BEAM returned null", enumFrontLeftLowBeam);
- assertNotNull("FRONT_RIGHT_LOW_BEAM returned null", enumFrontRightLowBeam);
- assertNotNull("FRONT_LEFT_PARKING_LIGHT returned null", enumFrontLeftParkingLight);
- assertNotNull("FRONT_RIGHT_PARKING_LIGHT returned null", enumFrontRightParkingLight);
- assertNotNull("FRONT_LEFT_FOG_LIGHT returned null", enumFrontLeftFogLight);
- assertNotNull("FRONT_RIGHT_FOG_LIGHT returned null", enumFrontRightFogLight);
- assertNotNull("FRONT_LEFT_DAYTIME_RUNNING_LIGHT returned null", enumFrontLeftDaytimeRunningLight);
- assertNotNull("FRONT_RIGHT_DAYTIME_RUNNING_LIGHT returned null", enumFrontRightDaytimeRunningLight);
+ assertNotNull("FRONT_LEFT_HIGH_BEAM returned null", enumFrontLeftHighBeam);
+ assertNotNull("FRONT_RIGHT_HIGH_BEAM returned null", enumFrontRightHighBeam);
+ assertNotNull("FRONT_LEFT_LOW_BEAM returned null", enumFrontLeftLowBeam);
+ assertNotNull("FRONT_RIGHT_LOW_BEAM returned null", enumFrontRightLowBeam);
+ assertNotNull("FRONT_LEFT_PARKING_LIGHT returned null", enumFrontLeftParkingLight);
+ assertNotNull("FRONT_RIGHT_PARKING_LIGHT returned null", enumFrontRightParkingLight);
+ assertNotNull("FRONT_LEFT_FOG_LIGHT returned null", enumFrontLeftFogLight);
+ assertNotNull("FRONT_RIGHT_FOG_LIGHT returned null", enumFrontRightFogLight);
+ assertNotNull("FRONT_LEFT_DAYTIME_RUNNING_LIGHT returned null", enumFrontLeftDaytimeRunningLight);
+ assertNotNull("FRONT_RIGHT_DAYTIME_RUNNING_LIGHT returned null", enumFrontRightDaytimeRunningLight);
- assertNotNull("FRONT_LEFT_TURN_LIGHT returned null", enumFrontLeftTurnLight);
- assertNotNull("FRONT_RIGHT_TURN_LIGHT returned null", enumFrontRightTurnLight);
- assertNotNull("REAR_LEFT_FOG_LIGHT returned null", enumRearLeftFogLight);
- assertNotNull("REAR_RIGHT_FOG_LIGHT returned null", enumRearRightFogLight);
- assertNotNull("REAR_LEFT_TAIL_LIGHT returned null", enumRearLeftTailLight);
- assertNotNull("REAR_RIGHT_TAIL_LIGHT returned null", enumRearRightTailLight);
- assertNotNull("REAR_LEFT_BRAKE_LIGHT returned null", enumRearLeftBrakeLight);
- assertNotNull("REAR_RIGHT_BRAKE_LIGHT returned null", enumRearRightBrakeLight);
- assertNotNull("REAR_LEFT_TURN_LIGHT returned null", enumRearLeftTurnLight);
- assertNotNull("REAR_RIGHT_TURN_LIGHT returned null", enumRearRightTurnLight);
- assertNotNull("REAR_REGISTRATION_PLATE_LIGHT returned null", enumRearRegistrationPlateLight);
+ assertNotNull("FRONT_LEFT_TURN_LIGHT returned null", enumFrontLeftTurnLight);
+ assertNotNull("FRONT_RIGHT_TURN_LIGHT returned null", enumFrontRightTurnLight);
+ assertNotNull("REAR_LEFT_FOG_LIGHT returned null", enumRearLeftFogLight);
+ assertNotNull("REAR_RIGHT_FOG_LIGHT returned null", enumRearRightFogLight);
+ assertNotNull("REAR_LEFT_TAIL_LIGHT returned null", enumRearLeftTailLight);
+ assertNotNull("REAR_RIGHT_TAIL_LIGHT returned null", enumRearRightTailLight);
+ assertNotNull("REAR_LEFT_BRAKE_LIGHT returned null", enumRearLeftBrakeLight);
+ assertNotNull("REAR_RIGHT_BRAKE_LIGHT returned null", enumRearRightBrakeLight);
+ assertNotNull("REAR_LEFT_TURN_LIGHT returned null", enumRearLeftTurnLight);
+ assertNotNull("REAR_RIGHT_TURN_LIGHT returned null", enumRearRightTurnLight);
+ assertNotNull("REAR_REGISTRATION_PLATE_LIGHT returned null", enumRearRegistrationPlateLight);
- assertNotNull("HIGH_BEAMS returned null", enumHighBeams);
- assertNotNull("LOW_BEAMS returned null", enumLowBeams);
- assertNotNull("FOG_LIGHTS returned null", enumFogLights);
- assertNotNull("RUNNING_LIGHTS returned null", enumRunningLights);
- assertNotNull("PARKING_LIGHTS returned null", enumParkingLights);
- assertNotNull("BRAKE_LIGHTS returned null", enumBrakeLights);
+ assertNotNull("HIGH_BEAMS returned null", enumHighBeams);
+ assertNotNull("LOW_BEAMS returned null", enumLowBeams);
+ assertNotNull("FOG_LIGHTS returned null", enumFogLights);
+ assertNotNull("RUNNING_LIGHTS returned null", enumRunningLights);
+ assertNotNull("PARKING_LIGHTS returned null", enumParkingLights);
+ assertNotNull("BRAKE_LIGHTS returned null", enumBrakeLights);
- assertNotNull("REAR_REVERSING_LIGHTS returned null", enumRearReversingLights);
- assertNotNull("SIDE_MARKER_LIGHTS returned null", enumSideMarkerLights);
- assertNotNull("LEFT_TURN_LIGHTS returned null", enumLeftTurnLights);
- assertNotNull("RIGHT_TURN_LIGHTS returned null", enumRightTurnLights);
- assertNotNull("HAZARD_LIGHTS returned null", enumHazardLights);
- assertNotNull("REAR_CARGO_LIGHTS returned null", enumRearCargoLights);
- assertNotNull("REAR_TRUCK_BED_LIGHTS returned null", enumRearTruckBedLights);
- assertNotNull("REAR_TRAILER_LIGHTS returned null", enumRearTrailerLights);
- assertNotNull("LEFT_SPOT_LIGHTS returned null", enumLeftSpotLights);
- assertNotNull("RIGHT_SPOT_LIGHTS returned null", enumRightSpotLights);
- assertNotNull("LEFT_PUDDLE_LIGHTS returned null", enumLeftPuddleLights);
- assertNotNull("RIGHT_PUDDLE_LIGHTS returned null", enumRightPuddleLights);
+ assertNotNull("REAR_REVERSING_LIGHTS returned null", enumRearReversingLights);
+ assertNotNull("SIDE_MARKER_LIGHTS returned null", enumSideMarkerLights);
+ assertNotNull("LEFT_TURN_LIGHTS returned null", enumLeftTurnLights);
+ assertNotNull("RIGHT_TURN_LIGHTS returned null", enumRightTurnLights);
+ assertNotNull("HAZARD_LIGHTS returned null", enumHazardLights);
+ assertNotNull("REAR_CARGO_LIGHTS returned null", enumRearCargoLights);
+ assertNotNull("REAR_TRUCK_BED_LIGHTS returned null", enumRearTruckBedLights);
+ assertNotNull("REAR_TRAILER_LIGHTS returned null", enumRearTrailerLights);
+ assertNotNull("LEFT_SPOT_LIGHTS returned null", enumLeftSpotLights);
+ assertNotNull("RIGHT_SPOT_LIGHTS returned null", enumRightSpotLights);
+ assertNotNull("LEFT_PUDDLE_LIGHTS returned null", enumLeftPuddleLights);
+ assertNotNull("RIGHT_PUDDLE_LIGHTS returned null", enumRightPuddleLights);
- assertNotNull("AMBIENT_LIGHTS returned null", enumAmbientLights);
- assertNotNull("OVERHEAD_LIGHTS returned null", enumOverheadLights);
- assertNotNull("READING_LIGHTS returned null", enumReadingLights);
- assertNotNull("TRUNK_LIGHTS returned null", enumTrunkLights);
+ assertNotNull("AMBIENT_LIGHTS returned null", enumAmbientLights);
+ assertNotNull("OVERHEAD_LIGHTS returned null", enumOverheadLights);
+ assertNotNull("READING_LIGHTS returned null", enumReadingLights);
+ assertNotNull("TRUNK_LIGHTS returned null", enumTrunkLights);
- assertNotNull("EXTERIOR_FRONT_LIGHTS returned null", enumExteriorFrontLights);
- assertNotNull("EXTERIOR_REAR_LIGHTS returned null", enumExteriorRearLights);
- assertNotNull("EXTERIOR_LEFT_LIGHTS returned null", enumExteriorLeftLights);
- assertNotNull("EXTERIOR_RIGHT_LIGHTS returned null", enumExteriorRightLights);
+ assertNotNull("EXTERIOR_FRONT_LIGHTS returned null", enumExteriorFrontLights);
+ assertNotNull("EXTERIOR_REAR_LIGHTS returned null", enumExteriorRearLights);
+ assertNotNull("EXTERIOR_LEFT_LIGHTS returned null", enumExteriorLeftLights);
+ assertNotNull("EXTERIOR_RIGHT_LIGHTS returned null", enumExteriorRightLights);
- assertNotNull("EXTERIOR_ALL_LIGHTS returned null", enumExteriorAllLights);
- }
+ assertNotNull("EXTERIOR_ALL_LIGHTS returned null", enumExteriorAllLights);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "fRONT_LEFT_HIGH_BEAM";
- try {
- LightName temp = LightName.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fRONT_LEFT_HIGH_BEAM";
+ try {
+ LightName temp = LightName.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 {
- LightName temp = LightName.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ LightName temp = LightName.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of LightName.
- */
- public void testListEnum() {
- List<LightName> enumValueList = Arrays.asList(LightName.values());
+ /**
+ * Verifies the possible enum values of LightName.
+ */
+ public void testListEnum() {
+ List<LightName> enumValueList = Arrays.asList(LightName.values());
- List<LightName> enumTestList = new ArrayList<LightName>();
- enumTestList.add(LightName.FRONT_LEFT_HIGH_BEAM);
- enumTestList.add(LightName.FRONT_RIGHT_HIGH_BEAM);
- enumTestList.add(LightName.FRONT_LEFT_LOW_BEAM);
- enumTestList.add(LightName.FRONT_RIGHT_LOW_BEAM);
- enumTestList.add(LightName.FRONT_LEFT_PARKING_LIGHT);
- enumTestList.add(LightName.FRONT_RIGHT_PARKING_LIGHT);
- enumTestList.add(LightName.FRONT_LEFT_FOG_LIGHT);
- enumTestList.add(LightName.FRONT_RIGHT_FOG_LIGHT);
- enumTestList.add(LightName.FRONT_LEFT_DAYTIME_RUNNING_LIGHT);
- enumTestList.add(LightName.FRONT_RIGHT_DAYTIME_RUNNING_LIGHT);
- enumTestList.add(LightName.FRONT_LEFT_TURN_LIGHT);
- enumTestList.add(LightName.FRONT_RIGHT_TURN_LIGHT);
- enumTestList.add(LightName.REAR_LEFT_FOG_LIGHT);
- enumTestList.add(LightName.REAR_RIGHT_FOG_LIGHT);
- enumTestList.add(LightName.REAR_LEFT_TAIL_LIGHT);
- enumTestList.add(LightName.REAR_RIGHT_TAIL_LIGHT);
- enumTestList.add(LightName.REAR_LEFT_BRAKE_LIGHT);
- enumTestList.add(LightName.REAR_RIGHT_BRAKE_LIGHT);
- enumTestList.add(LightName.REAR_LEFT_TURN_LIGHT);
- enumTestList.add(LightName.REAR_RIGHT_TURN_LIGHT);
- enumTestList.add(LightName.REAR_REGISTRATION_PLATE_LIGHT);
- enumTestList.add(LightName.HIGH_BEAMS);
- enumTestList.add(LightName.LOW_BEAMS);
- enumTestList.add(LightName.FOG_LIGHTS);
- enumTestList.add(LightName.RUNNING_LIGHTS);
- enumTestList.add(LightName.PARKING_LIGHTS);
- enumTestList.add(LightName.BRAKE_LIGHTS);
- enumTestList.add(LightName.REAR_REVERSING_LIGHTS);
- enumTestList.add(LightName.SIDE_MARKER_LIGHTS);
- enumTestList.add(LightName.LEFT_TURN_LIGHTS);
- enumTestList.add(LightName.RIGHT_TURN_LIGHTS);
- enumTestList.add(LightName.HAZARD_LIGHTS);
- enumTestList.add(LightName.REAR_CARGO_LIGHTS);
- enumTestList.add(LightName.REAR_TRUCK_BED_LIGHTS);
- enumTestList.add(LightName.REAR_TRAILER_LIGHTS);
- enumTestList.add(LightName.LEFT_SPOT_LIGHTS);
- enumTestList.add(LightName.RIGHT_SPOT_LIGHTS);
- enumTestList.add(LightName.LEFT_PUDDLE_LIGHTS);
- enumTestList.add(LightName.RIGHT_PUDDLE_LIGHTS);
- enumTestList.add(LightName.AMBIENT_LIGHTS);
- enumTestList.add(LightName.OVERHEAD_LIGHTS);
- enumTestList.add(LightName.READING_LIGHTS);
- enumTestList.add(LightName.TRUNK_LIGHTS);
- enumTestList.add(LightName.EXTERIOR_FRONT_LIGHTS);
- enumTestList.add(LightName.EXTERIOR_REAR_LIGHTS);
- enumTestList.add(LightName.EXTERIOR_LEFT_LIGHTS);
- enumTestList.add(LightName.EXTERIOR_RIGHT_LIGHTS);
- enumTestList.add(LightName.EXTERIOR_ALL_LIGHTS);
+ List<LightName> enumTestList = new ArrayList<LightName>();
+ enumTestList.add(LightName.FRONT_LEFT_HIGH_BEAM);
+ enumTestList.add(LightName.FRONT_RIGHT_HIGH_BEAM);
+ enumTestList.add(LightName.FRONT_LEFT_LOW_BEAM);
+ enumTestList.add(LightName.FRONT_RIGHT_LOW_BEAM);
+ enumTestList.add(LightName.FRONT_LEFT_PARKING_LIGHT);
+ enumTestList.add(LightName.FRONT_RIGHT_PARKING_LIGHT);
+ enumTestList.add(LightName.FRONT_LEFT_FOG_LIGHT);
+ enumTestList.add(LightName.FRONT_RIGHT_FOG_LIGHT);
+ enumTestList.add(LightName.FRONT_LEFT_DAYTIME_RUNNING_LIGHT);
+ enumTestList.add(LightName.FRONT_RIGHT_DAYTIME_RUNNING_LIGHT);
+ enumTestList.add(LightName.FRONT_LEFT_TURN_LIGHT);
+ enumTestList.add(LightName.FRONT_RIGHT_TURN_LIGHT);
+ enumTestList.add(LightName.REAR_LEFT_FOG_LIGHT);
+ enumTestList.add(LightName.REAR_RIGHT_FOG_LIGHT);
+ enumTestList.add(LightName.REAR_LEFT_TAIL_LIGHT);
+ enumTestList.add(LightName.REAR_RIGHT_TAIL_LIGHT);
+ enumTestList.add(LightName.REAR_LEFT_BRAKE_LIGHT);
+ enumTestList.add(LightName.REAR_RIGHT_BRAKE_LIGHT);
+ enumTestList.add(LightName.REAR_LEFT_TURN_LIGHT);
+ enumTestList.add(LightName.REAR_RIGHT_TURN_LIGHT);
+ enumTestList.add(LightName.REAR_REGISTRATION_PLATE_LIGHT);
+ enumTestList.add(LightName.HIGH_BEAMS);
+ enumTestList.add(LightName.LOW_BEAMS);
+ enumTestList.add(LightName.FOG_LIGHTS);
+ enumTestList.add(LightName.RUNNING_LIGHTS);
+ enumTestList.add(LightName.PARKING_LIGHTS);
+ enumTestList.add(LightName.BRAKE_LIGHTS);
+ enumTestList.add(LightName.REAR_REVERSING_LIGHTS);
+ enumTestList.add(LightName.SIDE_MARKER_LIGHTS);
+ enumTestList.add(LightName.LEFT_TURN_LIGHTS);
+ enumTestList.add(LightName.RIGHT_TURN_LIGHTS);
+ enumTestList.add(LightName.HAZARD_LIGHTS);
+ enumTestList.add(LightName.REAR_CARGO_LIGHTS);
+ enumTestList.add(LightName.REAR_TRUCK_BED_LIGHTS);
+ enumTestList.add(LightName.REAR_TRAILER_LIGHTS);
+ enumTestList.add(LightName.LEFT_SPOT_LIGHTS);
+ enumTestList.add(LightName.RIGHT_SPOT_LIGHTS);
+ enumTestList.add(LightName.LEFT_PUDDLE_LIGHTS);
+ enumTestList.add(LightName.RIGHT_PUDDLE_LIGHTS);
+ enumTestList.add(LightName.AMBIENT_LIGHTS);
+ enumTestList.add(LightName.OVERHEAD_LIGHTS);
+ enumTestList.add(LightName.READING_LIGHTS);
+ enumTestList.add(LightName.TRUNK_LIGHTS);
+ enumTestList.add(LightName.EXTERIOR_FRONT_LIGHTS);
+ enumTestList.add(LightName.EXTERIOR_REAR_LIGHTS);
+ enumTestList.add(LightName.EXTERIOR_LEFT_LIGHTS);
+ enumTestList.add(LightName.EXTERIOR_RIGHT_LIGHTS);
+ enumTestList.add(LightName.EXTERIOR_ALL_LIGHTS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/LightStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightStatusTests.java
index 607160e26..c95f26d78 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LightStatusTests.java
@@ -15,72 +15,72 @@ import java.util.List;
*/
public class LightStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "ON";
- LightStatus enumOn = LightStatus.valueForString(example);
- example = "OFF";
- LightStatus enumOff = LightStatus.valueForString(example);
- example = "RAMP_UP";
- LightStatus enumRampUp = LightStatus.valueForString(example);
- example = "RAMP_DOWN";
- LightStatus enumRampDown = LightStatus.valueForString(example);
- example = "UNKNOWN";
- LightStatus enumUnknown = LightStatus.valueForString(example);
- example = "INVALID";
- LightStatus enumInvalid = LightStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ON";
+ LightStatus enumOn = LightStatus.valueForString(example);
+ example = "OFF";
+ LightStatus enumOff = LightStatus.valueForString(example);
+ example = "RAMP_UP";
+ LightStatus enumRampUp = LightStatus.valueForString(example);
+ example = "RAMP_DOWN";
+ LightStatus enumRampDown = LightStatus.valueForString(example);
+ example = "UNKNOWN";
+ LightStatus enumUnknown = LightStatus.valueForString(example);
+ example = "INVALID";
+ LightStatus enumInvalid = LightStatus.valueForString(example);
- assertNotNull("ON returned null", enumOn);
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("RAMP_UP returned null", enumRampUp);
- assertNotNull("RAMP_DOWN returned null", enumRampDown);
- assertNotNull("UNKNOWN returned null", enumUnknown);
- assertNotNull("INVALID returned null", enumInvalid);
- }
+ assertNotNull("ON returned null", enumOn);
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("RAMP_UP returned null", enumRampUp);
+ assertNotNull("RAMP_DOWN returned null", enumRampDown);
+ assertNotNull("UNKNOWN returned null", enumUnknown);
+ assertNotNull("INVALID returned null", enumInvalid);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "oN";
- try {
- LightStatus temp = LightStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "oN";
+ try {
+ LightStatus temp = LightStatus.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 {
- LightStatus temp = LightStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ LightStatus temp = LightStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of LightStatus.
- */
- public void testListEnum() {
- List<LightStatus> enumValueList = Arrays.asList(LightStatus.values());
+ /**
+ * Verifies the possible enum values of LightStatus.
+ */
+ public void testListEnum() {
+ List<LightStatus> enumValueList = Arrays.asList(LightStatus.values());
- List<LightStatus> enumTestList = new ArrayList<LightStatus>();
- enumTestList.add(LightStatus.ON);
- enumTestList.add(LightStatus.OFF);
- enumTestList.add(LightStatus.RAMP_UP);
- enumTestList.add(LightStatus.RAMP_DOWN);
- enumTestList.add(LightStatus.UNKNOWN);
- enumTestList.add(LightStatus.INVALID);
+ List<LightStatus> enumTestList = new ArrayList<LightStatus>();
+ enumTestList.add(LightStatus.ON);
+ enumTestList.add(LightStatus.OFF);
+ enumTestList.add(LightStatus.RAMP_UP);
+ enumTestList.add(LightStatus.RAMP_DOWN);
+ enumTestList.add(LightStatus.UNKNOWN);
+ enumTestList.add(LightStatus.INVALID);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/LockScreenStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LockScreenStatusTests.java
index 2c9ced9b8..00e5f823d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LockScreenStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LockScreenStatusTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.LockScreenStatus}
*/
public class LockScreenStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "REQUIRED";
- LockScreenStatus enumRequired = LockScreenStatus.valueForString(example);
- example = "OPTIONAL";
- LockScreenStatus enumOptional = LockScreenStatus.valueForString(example);
- example = "OFF";
- LockScreenStatus enumOff = LockScreenStatus.valueForString(example);
-
- assertNotNull("REQUIRED returned null", enumRequired);
- assertNotNull("OPTIONAL returned null", enumOptional);
- assertNotNull("OFF returned null", enumOff);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "REQUIRED";
+ LockScreenStatus enumRequired = LockScreenStatus.valueForString(example);
+ example = "OPTIONAL";
+ LockScreenStatus enumOptional = LockScreenStatus.valueForString(example);
+ example = "OFF";
+ LockScreenStatus enumOff = LockScreenStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "ReqUireD";
- try {
- LockScreenStatus temp = LockScreenStatus.valueForString(example);
+ assertNotNull("REQUIRED returned null", enumRequired);
+ assertNotNull("OPTIONAL returned null", enumOptional);
+ assertNotNull("OFF returned null", enumOff);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "ReqUireD";
+ try {
+ LockScreenStatus temp = LockScreenStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- LockScreenStatus temp = LockScreenStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ LockScreenStatus temp = LockScreenStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of LockScreenStatus.
- */
- public void testListEnum() {
- List<LockScreenStatus> enumValueList = Arrays.asList(LockScreenStatus.values());
+ /**
+ * Verifies the possible enum values of LockScreenStatus.
+ */
+ public void testListEnum() {
+ List<LockScreenStatus> enumValueList = Arrays.asList(LockScreenStatus.values());
- List<LockScreenStatus> enumTestList = new ArrayList<LockScreenStatus>();
- enumTestList.add(LockScreenStatus.REQUIRED);
- enumTestList.add(LockScreenStatus.OPTIONAL);
- enumTestList.add(LockScreenStatus.OFF);
+ List<LockScreenStatus> enumTestList = new ArrayList<LockScreenStatus>();
+ enumTestList.add(LockScreenStatus.REQUIRED);
+ enumTestList.add(LockScreenStatus.OPTIONAL);
+ enumTestList.add(LockScreenStatus.OFF);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MaintenanceModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java
index 9254cd2b2..510d0c5d3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java
@@ -46,66 +46,64 @@ import java.util.List;
*/
public class MaintenanceModeStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NORMAL";
- MaintenanceModeStatus enumNormal = MaintenanceModeStatus.valueForString(example);
- example = "NEAR";
- MaintenanceModeStatus enumNear = MaintenanceModeStatus.valueForString(example);
- example = "ACTIVE";
- MaintenanceModeStatus enumActive = MaintenanceModeStatus.valueForString(example);
- example = "FEATURE_NOT_PRESENT";
- MaintenanceModeStatus enumFeatureNotPResent = MaintenanceModeStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NORMAL";
+ MaintenanceModeStatus enumNormal = MaintenanceModeStatus.valueForString(example);
+ example = "NEAR";
+ MaintenanceModeStatus enumNear = MaintenanceModeStatus.valueForString(example);
+ example = "ACTIVE";
+ MaintenanceModeStatus enumActive = MaintenanceModeStatus.valueForString(example);
+ example = "FEATURE_NOT_PRESENT";
+ MaintenanceModeStatus enumFeatureNotPResent = MaintenanceModeStatus.valueForString(example);
- assertNotNull("NORMAL returned null", enumNormal);
- assertNotNull("NEAR returned null", enumNear);
- assertNotNull("ACTIVE returned null", enumActive);
- assertNotNull("FEATURE_NOT_PRESENT returned null", enumFeatureNotPResent);
- }
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("NEAR returned null", enumNear);
+ assertNotNull("ACTIVE returned null", enumActive);
+ assertNotNull("FEATURE_NOT_PRESENT returned null", enumFeatureNotPResent);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "normAL";
- try {
- MaintenanceModeStatus temp = MaintenanceModeStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "normAL";
+ try {
+ MaintenanceModeStatus temp = MaintenanceModeStatus.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 {
- MaintenanceModeStatus temp = MaintenanceModeStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MaintenanceModeStatus temp = MaintenanceModeStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MaintenanceModeStatus.
- */
- public void testListEnum() {
- List<MaintenanceModeStatus> enumValueList = Arrays.asList(MaintenanceModeStatus.values());
+ /**
+ * Verifies the possible enum values of MaintenanceModeStatus.
+ */
+ public void testListEnum() {
+ List<MaintenanceModeStatus> enumValueList = Arrays.asList(MaintenanceModeStatus.values());
- List<MaintenanceModeStatus> enumTestList = new ArrayList<>();
- enumTestList.add(MaintenanceModeStatus.NORMAL);
- enumTestList.add(MaintenanceModeStatus.NEAR);
- enumTestList.add(MaintenanceModeStatus.ACTIVE);
- enumTestList.add(MaintenanceModeStatus.FEATURE_NOT_PRESENT);
+ List<MaintenanceModeStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(MaintenanceModeStatus.NORMAL);
+ enumTestList.add(MaintenanceModeStatus.NEAR);
+ enumTestList.add(MaintenanceModeStatus.ACTIVE);
+ enumTestList.add(MaintenanceModeStatus.FEATURE_NOT_PRESENT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MassageCushionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageCushionTests.java
index 8ce99f47a..31c479548 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageCushionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageCushionTests.java
@@ -14,68 +14,68 @@ import java.util.List;
*/
public class MassageCushionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "TOP_LUMBAR";
- MassageCushion enumTopLumbar = MassageCushion.valueForString(example);
- example = "MIDDLE_LUMBAR";
- MassageCushion enumMiddleLumbar = MassageCushion.valueForString(example);
- example = "BOTTOM_LUMBAR";
- MassageCushion enumBottomLumbar = MassageCushion.valueForString(example);
- example = "BACK_BOLSTERS";
- MassageCushion enumBackBolsters = MassageCushion.valueForString(example);
- example = "SEAT_BOLSTERS";
- MassageCushion enumSeatBolsters = MassageCushion.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TOP_LUMBAR";
+ MassageCushion enumTopLumbar = MassageCushion.valueForString(example);
+ example = "MIDDLE_LUMBAR";
+ MassageCushion enumMiddleLumbar = MassageCushion.valueForString(example);
+ example = "BOTTOM_LUMBAR";
+ MassageCushion enumBottomLumbar = MassageCushion.valueForString(example);
+ example = "BACK_BOLSTERS";
+ MassageCushion enumBackBolsters = MassageCushion.valueForString(example);
+ example = "SEAT_BOLSTERS";
+ MassageCushion enumSeatBolsters = MassageCushion.valueForString(example);
- assertNotNull("TOP_LUMBAR returned null", enumTopLumbar);
- assertNotNull("MIDDLE_LUMBAR returned null", enumMiddleLumbar);
- assertNotNull("BOTTOM_LUMBAR returned null", enumBottomLumbar);
- assertNotNull("BACK_BOLSTERS returned null", enumBackBolsters);
- assertNotNull("SEAT_BOLSTERS returned null", enumSeatBolsters);
- }
+ assertNotNull("TOP_LUMBAR returned null", enumTopLumbar);
+ assertNotNull("MIDDLE_LUMBAR returned null", enumMiddleLumbar);
+ assertNotNull("BOTTOM_LUMBAR returned null", enumBottomLumbar);
+ assertNotNull("BACK_BOLSTERS returned null", enumBackBolsters);
+ assertNotNull("SEAT_BOLSTERS returned null", enumSeatBolsters);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "tOP_LUMBAR";
- try {
- MassageCushion temp = MassageCushion.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "tOP_LUMBAR";
+ try {
+ MassageCushion temp = MassageCushion.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 {
- MassageCushion temp = MassageCushion.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MassageCushion temp = MassageCushion.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MassageCushion.
- */
- public void testListEnum() {
- List<MassageCushion> enumValueList = Arrays.asList(MassageCushion.values());
+ /**
+ * Verifies the possible enum values of MassageCushion.
+ */
+ public void testListEnum() {
+ List<MassageCushion> enumValueList = Arrays.asList(MassageCushion.values());
- List<MassageCushion> enumTestList = new ArrayList<MassageCushion>();
- enumTestList.add(MassageCushion.TOP_LUMBAR);
- enumTestList.add(MassageCushion.MIDDLE_LUMBAR);
- enumTestList.add(MassageCushion.BOTTOM_LUMBAR);
- enumTestList.add(MassageCushion.BACK_BOLSTERS);
- enumTestList.add(MassageCushion.SEAT_BOLSTERS);
+ List<MassageCushion> enumTestList = new ArrayList<MassageCushion>();
+ enumTestList.add(MassageCushion.TOP_LUMBAR);
+ enumTestList.add(MassageCushion.MIDDLE_LUMBAR);
+ enumTestList.add(MassageCushion.BOTTOM_LUMBAR);
+ enumTestList.add(MassageCushion.BACK_BOLSTERS);
+ enumTestList.add(MassageCushion.SEAT_BOLSTERS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MassageModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageModeTests.java
index 67b47cf7c..4d455dbbf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageModeTests.java
@@ -14,60 +14,60 @@ import java.util.List;
*/
public class MassageModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "OFF";
- MassageMode enumOff = MassageMode.valueForString(example);
- example = "LOW";
- MassageMode enumLow = MassageMode.valueForString(example);
- example = "HIGH";
- MassageMode enumHigh = MassageMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "OFF";
+ MassageMode enumOff = MassageMode.valueForString(example);
+ example = "LOW";
+ MassageMode enumLow = MassageMode.valueForString(example);
+ example = "HIGH";
+ MassageMode enumHigh = MassageMode.valueForString(example);
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("LOW returned null", enumLow);
- assertNotNull("HIGH returned null", enumHigh);
- }
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("LOW returned null", enumLow);
+ assertNotNull("HIGH returned null", enumHigh);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "oFF";
- try {
- MassageMode temp = MassageMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "oFF";
+ try {
+ MassageMode temp = MassageMode.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 {
- MassageMode temp = MassageMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MassageMode temp = MassageMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MassageMode.
- */
- public void testListEnum() {
- List<MassageMode> enumValueList = Arrays.asList(MassageMode.values());
+ /**
+ * Verifies the possible enum values of MassageMode.
+ */
+ public void testListEnum() {
+ List<MassageMode> enumValueList = Arrays.asList(MassageMode.values());
- List<MassageMode> enumTestList = new ArrayList<MassageMode>();
- enumTestList.add(MassageMode.OFF);
- enumTestList.add(MassageMode.LOW);
- enumTestList.add(MassageMode.HIGH);
+ List<MassageMode> enumTestList = new ArrayList<MassageMode>();
+ enumTestList.add(MassageMode.OFF);
+ enumTestList.add(MassageMode.LOW);
+ enumTestList.add(MassageMode.HIGH);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MassageZoneTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageZoneTests.java
index 34adada5e..7e41aec27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageZoneTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MassageZoneTests.java
@@ -14,56 +14,56 @@ import java.util.List;
*/
public class MassageZoneTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "LUMBAR";
- MassageZone enumLumbar = MassageZone.valueForString(example);
- example = "SEAT_CUSHION";
- MassageZone enumSeatCushion = MassageZone.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LUMBAR";
+ MassageZone enumLumbar = MassageZone.valueForString(example);
+ example = "SEAT_CUSHION";
+ MassageZone enumSeatCushion = MassageZone.valueForString(example);
- assertNotNull("LUMBAR returned null", enumLumbar);
- assertNotNull("SEAT_CUSHION returned null", enumSeatCushion);
- }
+ assertNotNull("LUMBAR returned null", enumLumbar);
+ assertNotNull("SEAT_CUSHION returned null", enumSeatCushion);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "lUMBAR";
- try {
- MassageZone temp = MassageZone.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "lUMBAR";
+ try {
+ MassageZone temp = MassageZone.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 {
- MassageZone temp = MassageZone.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MassageZone temp = MassageZone.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MassageZone.
- */
- public void testListEnum() {
- List<MassageZone> enumValueList = Arrays.asList(MassageZone.values());
+ /**
+ * Verifies the possible enum values of MassageZone.
+ */
+ public void testListEnum() {
+ List<MassageZone> enumValueList = Arrays.asList(MassageZone.values());
- List<MassageZone> enumTestList = new ArrayList<MassageZone>();
- enumTestList.add(MassageZone.LUMBAR);
- enumTestList.add(MassageZone.SEAT_CUSHION);
+ List<MassageZone> enumTestList = new ArrayList<MassageZone>();
+ enumTestList.add(MassageZone.LUMBAR);
+ enumTestList.add(MassageZone.SEAT_CUSHION);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MediaClockFormatTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaClockFormatTests.java
index 8c50f8d22..18bb00fb5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaClockFormatTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaClockFormatTests.java
@@ -9,83 +9,81 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.MediaClockFormat}
*/
public class MediaClockFormatTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "CLOCK1";
- MediaClockFormat enumClock1 = MediaClockFormat.valueForString(example);
- example = "CLOCK2";
- MediaClockFormat enumClock2 = MediaClockFormat.valueForString(example);
- example = "CLOCK3";
- MediaClockFormat enumClock3 = MediaClockFormat.valueForString(example);
- example = "CLOCKTEXT1";
- MediaClockFormat enumClockText1 = MediaClockFormat.valueForString(example);
- example = "CLOCKTEXT2";
- MediaClockFormat enumClockText2 = MediaClockFormat.valueForString(example);
- example = "CLOCKTEXT3";
- MediaClockFormat enumClockText3 = MediaClockFormat.valueForString(example);
- example = "CLOCKTEXT4";
- MediaClockFormat enumClockText4 = MediaClockFormat.valueForString(example);
-
- assertNotNull("CLOCK1 returned null", enumClock1);
- assertNotNull("CLOCK2 returned null", enumClock2);
- assertNotNull("CLOCK3 returned null", enumClock3);
- assertNotNull("CLOCKTEXT1 returned null", enumClockText1);
- assertNotNull("CLOCKTEXT2 returned null", enumClockText2);
- assertNotNull("CLOCKTEXT3 returned null", enumClockText3);
- assertNotNull("CLOCKTEXT4 returned null", enumClockText4);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "CLOCK1";
+ MediaClockFormat enumClock1 = MediaClockFormat.valueForString(example);
+ example = "CLOCK2";
+ MediaClockFormat enumClock2 = MediaClockFormat.valueForString(example);
+ example = "CLOCK3";
+ MediaClockFormat enumClock3 = MediaClockFormat.valueForString(example);
+ example = "CLOCKTEXT1";
+ MediaClockFormat enumClockText1 = MediaClockFormat.valueForString(example);
+ example = "CLOCKTEXT2";
+ MediaClockFormat enumClockText2 = MediaClockFormat.valueForString(example);
+ example = "CLOCKTEXT3";
+ MediaClockFormat enumClockText3 = MediaClockFormat.valueForString(example);
+ example = "CLOCKTEXT4";
+ MediaClockFormat enumClockText4 = MediaClockFormat.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "cloCK1";
- try {
- MediaClockFormat temp = MediaClockFormat.valueForString(example);
+ assertNotNull("CLOCK1 returned null", enumClock1);
+ assertNotNull("CLOCK2 returned null", enumClock2);
+ assertNotNull("CLOCK3 returned null", enumClock3);
+ assertNotNull("CLOCKTEXT1 returned null", enumClockText1);
+ assertNotNull("CLOCKTEXT2 returned null", enumClockText2);
+ assertNotNull("CLOCKTEXT3 returned null", enumClockText3);
+ assertNotNull("CLOCKTEXT4 returned null", enumClockText4);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "cloCK1";
+ try {
+ MediaClockFormat temp = MediaClockFormat.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- MediaClockFormat temp = MediaClockFormat.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MediaClockFormat temp = MediaClockFormat.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of MediaClockFormat.
- */
- public void testListEnum() {
- List<MediaClockFormat> enumValueList = Arrays.asList(MediaClockFormat.values());
+ /**
+ * Verifies the possible enum values of MediaClockFormat.
+ */
+ public void testListEnum() {
+ List<MediaClockFormat> enumValueList = Arrays.asList(MediaClockFormat.values());
- List<MediaClockFormat> enumTestList = new ArrayList<MediaClockFormat>();
- enumTestList.add(MediaClockFormat.CLOCK1);
- enumTestList.add(MediaClockFormat.CLOCK2);
- enumTestList.add(MediaClockFormat.CLOCK3);
- enumTestList.add(MediaClockFormat.CLOCKTEXT1);
- enumTestList.add(MediaClockFormat.CLOCKTEXT2);
- enumTestList.add(MediaClockFormat.CLOCKTEXT3);
- enumTestList.add(MediaClockFormat.CLOCKTEXT4);
+ List<MediaClockFormat> enumTestList = new ArrayList<MediaClockFormat>();
+ enumTestList.add(MediaClockFormat.CLOCK1);
+ enumTestList.add(MediaClockFormat.CLOCK2);
+ enumTestList.add(MediaClockFormat.CLOCK3);
+ enumTestList.add(MediaClockFormat.CLOCKTEXT1);
+ enumTestList.add(MediaClockFormat.CLOCKTEXT2);
+ enumTestList.add(MediaClockFormat.CLOCKTEXT3);
+ enumTestList.add(MediaClockFormat.CLOCKTEXT4);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MediaTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
index 835045418..42d791b97 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MediaTypeTests.java
@@ -14,64 +14,64 @@ import java.util.List;
*/
public class MediaTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "MUSIC";
- MediaType enumMusic = MediaType.valueForString(example);
- example = "PODCAST";
- MediaType enumPodcast = MediaType.valueForString(example);
- example = "AUDIOBOOK";
- MediaType enumAudioBook = MediaType.valueForString(example);
- example = "OTHER";
- MediaType enumOther = MediaType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MUSIC";
+ MediaType enumMusic = MediaType.valueForString(example);
+ example = "PODCAST";
+ MediaType enumPodcast = MediaType.valueForString(example);
+ example = "AUDIOBOOK";
+ MediaType enumAudioBook = MediaType.valueForString(example);
+ example = "OTHER";
+ MediaType enumOther = MediaType.valueForString(example);
- assertNotNull("MUSIC returned null", enumMusic);
- assertNotNull("PODCAST returned null", enumPodcast);
- assertNotNull("AUDIOBOOK returned null", enumAudioBook);
- assertNotNull("OTHER returned null", enumOther);
- }
+ assertNotNull("MUSIC returned null", enumMusic);
+ assertNotNull("PODCAST returned null", enumPodcast);
+ assertNotNull("AUDIOBOOK returned null", enumAudioBook);
+ assertNotNull("OTHER returned null", enumOther);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "PudCAsT";
- try {
- MediaType temp = MediaType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "PudCAsT";
+ try {
+ MediaType temp = MediaType.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 {
- MediaType temp = MediaType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MediaType temp = MediaType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MediaType.
- */
- public void testListEnum() {
- List<MediaType> enumValueList = Arrays.asList(MediaType.values());
+ /**
+ * Verifies the possible enum values of MediaType.
+ */
+ public void testListEnum() {
+ List<MediaType> enumValueList = Arrays.asList(MediaType.values());
- List<MediaType> enumTestList = new ArrayList<MediaType>();
- enumTestList.add(MediaType.MUSIC);
- enumTestList.add(MediaType.PODCAST);
- enumTestList.add(MediaType.AUDIOBOOK);
- enumTestList.add(MediaType.OTHER);
+ List<MediaType> enumTestList = new ArrayList<MediaType>();
+ enumTestList.add(MediaType.MUSIC);
+ enumTestList.add(MediaType.PODCAST);
+ enumTestList.add(MediaType.AUDIOBOOK);
+ enumTestList.add(MediaType.OTHER);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MenuLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java
index f92de1f94..a448be361 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java
@@ -45,56 +45,56 @@ import java.util.List;
public class MenuLayoutTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "LIST";
- MenuLayout enumList = MenuLayout.valueForString(example);
- example = "TILES";
- MenuLayout enumTiles = MenuLayout.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LIST";
+ MenuLayout enumList = MenuLayout.valueForString(example);
+ example = "TILES";
+ MenuLayout enumTiles = MenuLayout.valueForString(example);
- assertNotNull("LIST returned null", enumList);
- assertNotNull("TILES returned null", enumTiles);
- }
+ assertNotNull("LIST returned null", enumList);
+ assertNotNull("TILES returned null", enumTiles);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "TooLs";
- try {
- MenuLayout temp = MenuLayout.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "TooLs";
+ try {
+ MenuLayout temp = MenuLayout.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 {
- MenuLayout temp = MenuLayout.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MenuLayout temp = MenuLayout.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MenuLayout.
- */
- public void testListEnum() {
- List<MenuLayout> enumValueList = Arrays.asList(MenuLayout.values());
+ /**
+ * Verifies the possible enum values of MenuLayout.
+ */
+ public void testListEnum() {
+ List<MenuLayout> enumValueList = Arrays.asList(MenuLayout.values());
- List<MenuLayout> enumTestList = new ArrayList<>();
- enumTestList.add(MenuLayout.LIST);
- enumTestList.add(MenuLayout.TILES);
+ List<MenuLayout> enumTestList = new ArrayList<>();
+ enumTestList.add(MenuLayout.LIST);
+ enumTestList.add(MenuLayout.TILES);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/MetadataTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
index c381dfff3..4647550c5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
@@ -16,97 +16,97 @@ import java.util.List;
public class MetadataTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "mediaTitle";
- MetadataType enumMediaTitle = MetadataType.valueForString(example);
- example = "mediaArtist";
- MetadataType enumMediaArtist = MetadataType.valueForString(example);
- example = "mediaAlbum";
- MetadataType enumMediaAlbum = MetadataType.valueForString(example);
- example = "mediaYear";
- MetadataType enumMediaYear = MetadataType.valueForString(example);
- example = "mediaGenre";
- MetadataType enumMediaGenre = MetadataType.valueForString(example);
- example = "mediaStation";
- MetadataType enumMediaStation = MetadataType.valueForString(example);
- example = "rating";
- MetadataType enumRating = MetadataType.valueForString(example);
- example = "currentTemperature";
- MetadataType enumCurrentTemperature = MetadataType.valueForString(example);
- example = "maximumTemperature";
- MetadataType enumMaximumTemperature = MetadataType.valueForString(example);
- example = "minimumTemperature";
- MetadataType enumMinimumTemperature = MetadataType.valueForString(example);
- example = "weatherTerm";
- MetadataType enumWeatherTerm = MetadataType.valueForString(example);
- example = "humidity";
- MetadataType enumHumidity = MetadataType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "mediaTitle";
+ MetadataType enumMediaTitle = MetadataType.valueForString(example);
+ example = "mediaArtist";
+ MetadataType enumMediaArtist = MetadataType.valueForString(example);
+ example = "mediaAlbum";
+ MetadataType enumMediaAlbum = MetadataType.valueForString(example);
+ example = "mediaYear";
+ MetadataType enumMediaYear = MetadataType.valueForString(example);
+ example = "mediaGenre";
+ MetadataType enumMediaGenre = MetadataType.valueForString(example);
+ example = "mediaStation";
+ MetadataType enumMediaStation = MetadataType.valueForString(example);
+ example = "rating";
+ MetadataType enumRating = MetadataType.valueForString(example);
+ example = "currentTemperature";
+ MetadataType enumCurrentTemperature = MetadataType.valueForString(example);
+ example = "maximumTemperature";
+ MetadataType enumMaximumTemperature = MetadataType.valueForString(example);
+ example = "minimumTemperature";
+ MetadataType enumMinimumTemperature = MetadataType.valueForString(example);
+ example = "weatherTerm";
+ MetadataType enumWeatherTerm = MetadataType.valueForString(example);
+ example = "humidity";
+ MetadataType enumHumidity = MetadataType.valueForString(example);
- assertNotNull("mediaTitle returned null", enumMediaTitle);
- assertNotNull("mediaArtist returned null", enumMediaArtist);
- assertNotNull("mediaAlbum returned null", enumMediaAlbum);
- assertNotNull("mediaYear returned null", enumMediaYear);
- assertNotNull("mediaGenre returned null", enumMediaGenre);
- assertNotNull("mediaStation returned null", enumMediaStation);
- assertNotNull("rating returned null", enumRating);
- assertNotNull("currentTemperature returned null", enumCurrentTemperature);
- assertNotNull("maximumTemperature returned null", enumMaximumTemperature);
- assertNotNull("minimumTemperature returned null", enumMinimumTemperature);
- assertNotNull("weatherTerm returned null", enumWeatherTerm);
- assertNotNull("humidity returned null", enumHumidity);
- }
+ assertNotNull("mediaTitle returned null", enumMediaTitle);
+ assertNotNull("mediaArtist returned null", enumMediaArtist);
+ assertNotNull("mediaAlbum returned null", enumMediaAlbum);
+ assertNotNull("mediaYear returned null", enumMediaYear);
+ assertNotNull("mediaGenre returned null", enumMediaGenre);
+ assertNotNull("mediaStation returned null", enumMediaStation);
+ assertNotNull("rating returned null", enumRating);
+ assertNotNull("currentTemperature returned null", enumCurrentTemperature);
+ assertNotNull("maximumTemperature returned null", enumMaximumTemperature);
+ assertNotNull("minimumTemperature returned null", enumMinimumTemperature);
+ assertNotNull("weatherTerm returned null", enumWeatherTerm);
+ assertNotNull("humidity returned null", enumHumidity);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "MEDIA_TITLEZ";
- try {
- MetadataType temp = MetadataType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "MEDIA_TITLEZ";
+ try {
+ MetadataType temp = MetadataType.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 {
- MetadataType temp = MetadataType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MetadataType temp = MetadataType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of MetadataType.
- */
- public void testListEnum() {
- List<MetadataType> enumValueList = Arrays.asList(MetadataType.values());
+ /**
+ * Verifies the possible enum values of MetadataType.
+ */
+ public void testListEnum() {
+ List<MetadataType> enumValueList = Arrays.asList(MetadataType.values());
- List<MetadataType> enumTestList = new ArrayList<MetadataType>();
- enumTestList.add(MetadataType.MEDIA_TITLE);
- enumTestList.add(MetadataType.MEDIA_ARTIST);
- enumTestList.add(MetadataType.MEDIA_ALBUM);
- enumTestList.add(MetadataType.MEDIA_YEAR);
- enumTestList.add(MetadataType.MEDIA_GENRE);
- enumTestList.add(MetadataType.MEDIA_STATION);
- enumTestList.add(MetadataType.RATING);
- enumTestList.add(MetadataType.CURRENT_TEMPERATURE);
- enumTestList.add(MetadataType.MAXIMUM_TEMPERATURE);
- enumTestList.add(MetadataType.MINIMUM_TEMPERATURE);
- enumTestList.add(MetadataType.WEATHER_TERM);
- enumTestList.add(MetadataType.HUMIDITY);
+ List<MetadataType> enumTestList = new ArrayList<MetadataType>();
+ enumTestList.add(MetadataType.MEDIA_TITLE);
+ enumTestList.add(MetadataType.MEDIA_ARTIST);
+ enumTestList.add(MetadataType.MEDIA_ALBUM);
+ enumTestList.add(MetadataType.MEDIA_YEAR);
+ enumTestList.add(MetadataType.MEDIA_GENRE);
+ enumTestList.add(MetadataType.MEDIA_STATION);
+ enumTestList.add(MetadataType.RATING);
+ enumTestList.add(MetadataType.CURRENT_TEMPERATURE);
+ enumTestList.add(MetadataType.MAXIMUM_TEMPERATURE);
+ enumTestList.add(MetadataType.MINIMUM_TEMPERATURE);
+ enumTestList.add(MetadataType.WEATHER_TERM);
+ enumTestList.add(MetadataType.HUMIDITY);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ModuleTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java
index 719502cbf..8ee0706b7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java
@@ -14,72 +14,72 @@ import java.util.List;
*/
public class ModuleTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "CLIMATE";
- ModuleType enumClimate = ModuleType.valueForString(example);
- example = "RADIO";
- ModuleType enumRadio = ModuleType.valueForString(example);
- example = "SEAT";
- ModuleType enumSeat = ModuleType.valueForString(example);
- example = "AUDIO";
- ModuleType enumAudio = ModuleType.valueForString(example);
- example = "LIGHT";
- ModuleType enumLight = ModuleType.valueForString(example);
- example = "HMI_SETTINGS";
- ModuleType enumHmiSettings = ModuleType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "CLIMATE";
+ ModuleType enumClimate = ModuleType.valueForString(example);
+ example = "RADIO";
+ ModuleType enumRadio = ModuleType.valueForString(example);
+ example = "SEAT";
+ ModuleType enumSeat = ModuleType.valueForString(example);
+ example = "AUDIO";
+ ModuleType enumAudio = ModuleType.valueForString(example);
+ example = "LIGHT";
+ ModuleType enumLight = ModuleType.valueForString(example);
+ example = "HMI_SETTINGS";
+ ModuleType enumHmiSettings = ModuleType.valueForString(example);
- assertNotNull("CLIMATE returned null", enumClimate);
- assertNotNull("RADIO returned null", enumRadio);
- assertNotNull("SEAT returned null", enumSeat);
- assertNotNull("AUDIO returned null", enumAudio);
- assertNotNull("LIGHT returned null", enumLight);
- assertNotNull("HMI_SETTINGS returned null", enumHmiSettings);
- }
+ assertNotNull("CLIMATE returned null", enumClimate);
+ assertNotNull("RADIO returned null", enumRadio);
+ assertNotNull("SEAT returned null", enumSeat);
+ assertNotNull("AUDIO returned null", enumAudio);
+ assertNotNull("LIGHT returned null", enumLight);
+ assertNotNull("HMI_SETTINGS returned null", enumHmiSettings);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "cLIMATE";
- try {
- ModuleType temp = ModuleType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "cLIMATE";
+ try {
+ ModuleType temp = ModuleType.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 {
- ModuleType temp = ModuleType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ModuleType temp = ModuleType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of ModuleType.
- */
- public void testListEnum() {
- List<ModuleType> enumValueList = Arrays.asList(ModuleType.values());
+ /**
+ * Verifies the possible enum values of ModuleType.
+ */
+ public void testListEnum() {
+ List<ModuleType> enumValueList = Arrays.asList(ModuleType.values());
- List<ModuleType> enumTestList = new ArrayList<ModuleType>();
- enumTestList.add(ModuleType.CLIMATE);
- enumTestList.add(ModuleType.RADIO);
- enumTestList.add(ModuleType.SEAT);
- enumTestList.add(ModuleType.AUDIO);
- enumTestList.add(ModuleType.LIGHT);
- enumTestList.add(ModuleType.HMI_SETTINGS);
+ List<ModuleType> enumTestList = new ArrayList<ModuleType>();
+ enumTestList.add(ModuleType.CLIMATE);
+ enumTestList.add(ModuleType.RADIO);
+ enumTestList.add(ModuleType.SEAT);
+ enumTestList.add(ModuleType.AUDIO);
+ enumTestList.add(ModuleType.LIGHT);
+ enumTestList.add(ModuleType.HMI_SETTINGS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/NavigationActionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
index 5051ef337..2d225dff3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationActionTests.java
@@ -14,79 +14,77 @@ import java.util.List;
*/
public class NavigationActionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "TURN";
- NavigationAction enumTurn = NavigationAction.valueForString(example);
- example = "EXIT";
- NavigationAction enumExit = NavigationAction.valueForString(example);
- example = "STAY";
- NavigationAction enumStay = NavigationAction.valueForString(example);
- example = "MERGE";
- NavigationAction enumMerge = NavigationAction.valueForString(example);
- example = "FERRY";
- NavigationAction enumFerry = NavigationAction.valueForString(example);
- example = "CAR_SHUTTLE_TRAIN";
- NavigationAction enumCarShuttleTrain = NavigationAction.valueForString(example);
- example = "WAYPOINT";
- NavigationAction enumWaypoint = NavigationAction.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TURN";
+ NavigationAction enumTurn = NavigationAction.valueForString(example);
+ example = "EXIT";
+ NavigationAction enumExit = NavigationAction.valueForString(example);
+ example = "STAY";
+ NavigationAction enumStay = NavigationAction.valueForString(example);
+ example = "MERGE";
+ NavigationAction enumMerge = NavigationAction.valueForString(example);
+ example = "FERRY";
+ NavigationAction enumFerry = NavigationAction.valueForString(example);
+ example = "CAR_SHUTTLE_TRAIN";
+ NavigationAction enumCarShuttleTrain = NavigationAction.valueForString(example);
+ example = "WAYPOINT";
+ NavigationAction enumWaypoint = NavigationAction.valueForString(example);
- assertNotNull("TURN returned null", enumTurn);
- assertNotNull("EXIT returned null", enumExit);
- assertNotNull("STAY returned null", enumStay);
- assertNotNull("MERGE returned null", enumMerge);
- assertNotNull("FERRY returned null", enumFerry);
- assertNotNull("CAR_SHUTTLE_TRAIN returned null", enumCarShuttleTrain);
- assertNotNull("WAYPOINT returned null", enumWaypoint);
+ assertNotNull("TURN returned null", enumTurn);
+ assertNotNull("EXIT returned null", enumExit);
+ assertNotNull("STAY returned null", enumStay);
+ assertNotNull("MERGE returned null", enumMerge);
+ assertNotNull("FERRY returned null", enumFerry);
+ assertNotNull("CAR_SHUTTLE_TRAIN returned null", enumCarShuttleTrain);
+ assertNotNull("WAYPOINT returned null", enumWaypoint);
- }
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fRONT";
- try {
- NavigationAction temp = NavigationAction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fRONT";
+ try {
+ NavigationAction temp = NavigationAction.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 {
- NavigationAction temp = NavigationAction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ NavigationAction temp = NavigationAction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of NavigationAction.
- */
- public void testListEnum() {
- List<NavigationAction> enumValueList = Arrays.asList(NavigationAction.values());
+ /**
+ * Verifies the possible enum values of NavigationAction.
+ */
+ public void testListEnum() {
+ List<NavigationAction> enumValueList = Arrays.asList(NavigationAction.values());
- List<NavigationAction> enumTestList = new ArrayList<>();
- enumTestList.add(NavigationAction.TURN);
- enumTestList.add(NavigationAction.EXIT);
- enumTestList.add(NavigationAction.STAY);
- enumTestList.add(NavigationAction.MERGE);
- enumTestList.add(NavigationAction.FERRY);
- enumTestList.add(NavigationAction.CAR_SHUTTLE_TRAIN);
- enumTestList.add(NavigationAction.WAYPOINT);
+ List<NavigationAction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationAction.TURN);
+ enumTestList.add(NavigationAction.EXIT);
+ enumTestList.add(NavigationAction.STAY);
+ enumTestList.add(NavigationAction.MERGE);
+ enumTestList.add(NavigationAction.FERRY);
+ enumTestList.add(NavigationAction.CAR_SHUTTLE_TRAIN);
+ enumTestList.add(NavigationAction.WAYPOINT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/NavigationJunctionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
index 691480f78..4cab81dda 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/NavigationJunctionTests.java
@@ -14,82 +14,80 @@ import java.util.List;
*/
public class NavigationJunctionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "REGULAR";
- NavigationJunction enumRegular = NavigationJunction.valueForString(example);
- example = "BIFURCATION";
- NavigationJunction enumBifurcation = NavigationJunction.valueForString(example);
- example = "MULTI_CARRIAGEWAY";
- NavigationJunction enumMultiCarriageway = NavigationJunction.valueForString(example);
- example = "ROUNDABOUT";
- NavigationJunction enumRoundabout = NavigationJunction.valueForString(example);
- example = "TRAVERSABLE_ROUNDABOUT";
- NavigationJunction enumTraversableRoundabout = NavigationJunction.valueForString(example);
- example = "JUGHANDLE";
- NavigationJunction enumJughandle = NavigationJunction.valueForString(example);
- example = "ALL_WAY_YIELD";
- NavigationJunction enumAllWayYield = NavigationJunction.valueForString(example);
- example = "TURN_AROUND";
- NavigationJunction enumTurnAround = NavigationJunction.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "REGULAR";
+ NavigationJunction enumRegular = NavigationJunction.valueForString(example);
+ example = "BIFURCATION";
+ NavigationJunction enumBifurcation = NavigationJunction.valueForString(example);
+ example = "MULTI_CARRIAGEWAY";
+ NavigationJunction enumMultiCarriageway = NavigationJunction.valueForString(example);
+ example = "ROUNDABOUT";
+ NavigationJunction enumRoundabout = NavigationJunction.valueForString(example);
+ example = "TRAVERSABLE_ROUNDABOUT";
+ NavigationJunction enumTraversableRoundabout = NavigationJunction.valueForString(example);
+ example = "JUGHANDLE";
+ NavigationJunction enumJughandle = NavigationJunction.valueForString(example);
+ example = "ALL_WAY_YIELD";
+ NavigationJunction enumAllWayYield = NavigationJunction.valueForString(example);
+ example = "TURN_AROUND";
+ NavigationJunction enumTurnAround = NavigationJunction.valueForString(example);
- assertNotNull("REGULAR returned null", enumRegular);
- assertNotNull("BIFURCATION returned null", enumBifurcation);
- assertNotNull("MULTI_CARRIAGEWAY returned null", enumMultiCarriageway);
- assertNotNull("ROUNDABOUT returned null", enumRoundabout);
- assertNotNull("TRAVERSABLE_ROUNDABOUT returned null", enumTraversableRoundabout);
- assertNotNull("JUGHANDLE returned null", enumJughandle);
- assertNotNull("ALL_WAY_YIELD returned null", enumAllWayYield);
- assertNotNull("TURN_AROUND returned null", enumTurnAround);
- }
+ assertNotNull("REGULAR returned null", enumRegular);
+ assertNotNull("BIFURCATION returned null", enumBifurcation);
+ assertNotNull("MULTI_CARRIAGEWAY returned null", enumMultiCarriageway);
+ assertNotNull("ROUNDABOUT returned null", enumRoundabout);
+ assertNotNull("TRAVERSABLE_ROUNDABOUT returned null", enumTraversableRoundabout);
+ assertNotNull("JUGHANDLE returned null", enumJughandle);
+ assertNotNull("ALL_WAY_YIELD returned null", enumAllWayYield);
+ assertNotNull("TURN_AROUND returned null", enumTurnAround);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "fRONT";
- try {
- NavigationJunction temp = NavigationJunction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "fRONT";
+ try {
+ NavigationJunction temp = NavigationJunction.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 {
- NavigationJunction temp = NavigationJunction.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ NavigationJunction temp = NavigationJunction.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of NavigationJunction.
- */
- public void testListEnum() {
- List<NavigationJunction> enumValueList = Arrays.asList(NavigationJunction.values());
+ /**
+ * Verifies the possible enum values of NavigationJunction.
+ */
+ public void testListEnum() {
+ List<NavigationJunction> enumValueList = Arrays.asList(NavigationJunction.values());
- List<NavigationJunction> enumTestList = new ArrayList<>();
- enumTestList.add(NavigationJunction.REGULAR);
- enumTestList.add(NavigationJunction.BIFURCATION);
- enumTestList.add(NavigationJunction.MULTI_CARRIAGEWAY);
- enumTestList.add(NavigationJunction.ROUNDABOUT);
- enumTestList.add(NavigationJunction.TRAVERSABLE_ROUNDABOUT);
- enumTestList.add(NavigationJunction.JUGHANDLE);
- enumTestList.add(NavigationJunction.ALL_WAY_YIELD);
- enumTestList.add(NavigationJunction.TURN_AROUND);
+ List<NavigationJunction> enumTestList = new ArrayList<>();
+ enumTestList.add(NavigationJunction.REGULAR);
+ enumTestList.add(NavigationJunction.BIFURCATION);
+ enumTestList.add(NavigationJunction.MULTI_CARRIAGEWAY);
+ enumTestList.add(NavigationJunction.ROUNDABOUT);
+ enumTestList.add(NavigationJunction.TRAVERSABLE_ROUNDABOUT);
+ enumTestList.add(NavigationJunction.JUGHANDLE);
+ enumTestList.add(NavigationJunction.ALL_WAY_YIELD);
+ enumTestList.add(NavigationJunction.TURN_AROUND);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PermissionStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java
index 2a11db43f..74d3dc704 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java
@@ -46,66 +46,64 @@ import java.util.List;
*/
public class PermissionStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "ALLOWED";
- PermissionStatus enumAllowed = PermissionStatus.valueForString(example);
- example = "DISALLOWED";
- PermissionStatus enumDisallowed = PermissionStatus.valueForString(example);
- example = "USER_DISALLOWED";
- PermissionStatus enumUserDisallowed = PermissionStatus.valueForString(example);
- example = "USER_CONSENT_PENDING";
- PermissionStatus enumUserConsentPending = PermissionStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ALLOWED";
+ PermissionStatus enumAllowed = PermissionStatus.valueForString(example);
+ example = "DISALLOWED";
+ PermissionStatus enumDisallowed = PermissionStatus.valueForString(example);
+ example = "USER_DISALLOWED";
+ PermissionStatus enumUserDisallowed = PermissionStatus.valueForString(example);
+ example = "USER_CONSENT_PENDING";
+ PermissionStatus enumUserConsentPending = PermissionStatus.valueForString(example);
- assertNotNull("ALLOWED returned null", enumAllowed);
- assertNotNull("DISALLOWED returned null", enumDisallowed);
- assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
- assertNotNull("USER_CONSENT_PENDING returned null", enumUserConsentPending);
- }
+ assertNotNull("ALLOWED returned null", enumAllowed);
+ assertNotNull("DISALLOWED returned null", enumDisallowed);
+ assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
+ assertNotNull("USER_CONSENT_PENDING returned null", enumUserConsentPending);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "DISALLOwed";
- try {
- PermissionStatus temp = PermissionStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "DISALLOwed";
+ try {
+ PermissionStatus temp = PermissionStatus.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 {
- PermissionStatus temp = PermissionStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PermissionStatus temp = PermissionStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of PermissionStatus.
- */
- public void testListEnum() {
- List<PermissionStatus> enumValueList = Arrays.asList(PermissionStatus.values());
+ /**
+ * Verifies the possible enum values of PermissionStatus.
+ */
+ public void testListEnum() {
+ List<PermissionStatus> enumValueList = Arrays.asList(PermissionStatus.values());
- List<PermissionStatus> enumTestList = new ArrayList<>();
- enumTestList.add(PermissionStatus.ALLOWED);
- enumTestList.add(PermissionStatus.DISALLOWED);
- enumTestList.add(PermissionStatus.USER_DISALLOWED);
- enumTestList.add(PermissionStatus.USER_CONSENT_PENDING);
+ List<PermissionStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(PermissionStatus.ALLOWED);
+ enumTestList.add(PermissionStatus.DISALLOWED);
+ enumTestList.add(PermissionStatus.USER_DISALLOWED);
+ enumTestList.add(PermissionStatus.USER_CONSENT_PENDING);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PowerModeQualificationStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeQualificationStatusTests.java
index e1b56e1f5..2e7301fc3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeQualificationStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeQualificationStatusTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus}
*/
public class PowerModeQualificationStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "POWER_MODE_UNDEFINED";
- PowerModeQualificationStatus enumPowerModeUndefined = PowerModeQualificationStatus.valueForString(example);
- example = "POWER_MODE_EVALUATION_IN_PROGRESS";
- PowerModeQualificationStatus enumPowerModeEvaluationInProgress = PowerModeQualificationStatus.valueForString(example);
- example = "NOT_DEFINED";
- PowerModeQualificationStatus enumNotDefined = PowerModeQualificationStatus.valueForString(example);
- example = "POWER_MODE_OK";
- PowerModeQualificationStatus enumPowerModeOk = PowerModeQualificationStatus.valueForString(example);
-
- assertNotNull("POWER_MODE_UNDEFINED returned null", enumPowerModeUndefined);
- assertNotNull("POWER_MODE_EVALUATION_IN_PROGRESS returned null", enumPowerModeEvaluationInProgress);
- assertNotNull("NOT_DEFINED returned null", enumNotDefined);
- assertNotNull("POWER_MODE_OK returned null", enumPowerModeOk);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "POWER_MODE_UNDEFINED";
+ PowerModeQualificationStatus enumPowerModeUndefined = PowerModeQualificationStatus.valueForString(example);
+ example = "POWER_MODE_EVALUATION_IN_PROGRESS";
+ PowerModeQualificationStatus enumPowerModeEvaluationInProgress = PowerModeQualificationStatus.valueForString(example);
+ example = "NOT_DEFINED";
+ PowerModeQualificationStatus enumNotDefined = PowerModeQualificationStatus.valueForString(example);
+ example = "POWER_MODE_OK";
+ PowerModeQualificationStatus enumPowerModeOk = PowerModeQualificationStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "poweR_moDE_UndEfiNEd";
- try {
- PowerModeQualificationStatus temp = PowerModeQualificationStatus.valueForString(example);
+ assertNotNull("POWER_MODE_UNDEFINED returned null", enumPowerModeUndefined);
+ assertNotNull("POWER_MODE_EVALUATION_IN_PROGRESS returned null", enumPowerModeEvaluationInProgress);
+ assertNotNull("NOT_DEFINED returned null", enumNotDefined);
+ assertNotNull("POWER_MODE_OK returned null", enumPowerModeOk);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "poweR_moDE_UndEfiNEd";
+ try {
+ PowerModeQualificationStatus temp = PowerModeQualificationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- PowerModeQualificationStatus temp = PowerModeQualificationStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PowerModeQualificationStatus temp = PowerModeQualificationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of PowerModeQualificationStatus.
- */
- public void testListEnum() {
- List<PowerModeQualificationStatus> enumValueList = Arrays.asList(PowerModeQualificationStatus.values());
+ /**
+ * Verifies the possible enum values of PowerModeQualificationStatus.
+ */
+ public void testListEnum() {
+ List<PowerModeQualificationStatus> enumValueList = Arrays.asList(PowerModeQualificationStatus.values());
- List<PowerModeQualificationStatus> enumTestList = new ArrayList<PowerModeQualificationStatus>();
- enumTestList.add(PowerModeQualificationStatus.POWER_MODE_UNDEFINED);
- enumTestList.add(PowerModeQualificationStatus.POWER_MODE_EVALUATION_IN_PROGRESS);
- enumTestList.add(PowerModeQualificationStatus.NOT_DEFINED);
- enumTestList.add(PowerModeQualificationStatus.POWER_MODE_OK);
+ List<PowerModeQualificationStatus> enumTestList = new ArrayList<PowerModeQualificationStatus>();
+ enumTestList.add(PowerModeQualificationStatus.POWER_MODE_UNDEFINED);
+ enumTestList.add(PowerModeQualificationStatus.POWER_MODE_EVALUATION_IN_PROGRESS);
+ enumTestList.add(PowerModeQualificationStatus.NOT_DEFINED);
+ enumTestList.add(PowerModeQualificationStatus.POWER_MODE_OK);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PowerModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeStatusTests.java
index 1063b2f81..a9f029634 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PowerModeStatusTests.java
@@ -9,91 +9,89 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.PowerModeStatus}
*/
public class PowerModeStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "KEY_OUT";
- PowerModeStatus enumKeyOut = PowerModeStatus.valueForString(example);
- example = "KEY_RECENTLY_OUT";
- PowerModeStatus enumKeyRecentlyOut = PowerModeStatus.valueForString(example);
- example = "KEY_APPROVED_0";
- PowerModeStatus enumKeyApproved0 = PowerModeStatus.valueForString(example);
- example = "POST_ACCESORY_0";
- PowerModeStatus enumPostAccessory0 = PowerModeStatus.valueForString(example);
- example = "ACCESORY_1";
- PowerModeStatus enumAccessory1 = PowerModeStatus.valueForString(example);
- example = "POST_IGNITION_1";
- PowerModeStatus enumPostIgnition1 = PowerModeStatus.valueForString(example);
- example = "IGNITION_ON_2";
- PowerModeStatus enumIgnitionOn2 = PowerModeStatus.valueForString(example);
- example = "RUNNING_2";
- PowerModeStatus enumRunning2 = PowerModeStatus.valueForString(example);
- example = "CRANK_3";
- PowerModeStatus enumCrank3 = PowerModeStatus.valueForString(example);
-
- assertNotNull("KEY_OUT returned null", enumKeyOut);
- assertNotNull("KEY_RECENTLY_OUT returned null", enumKeyRecentlyOut);
- assertNotNull("KEY_APPROVED_0 returned null", enumKeyApproved0);
- assertNotNull("POST_ACCESORY_0 returned null", enumPostAccessory0);
- assertNotNull("ACCESORY_1 returned null", enumAccessory1);
- assertNotNull("POST_IGNITION_1 returned null", enumPostIgnition1);
- assertNotNull("IGNITION_ON_2 returned null", enumIgnitionOn2);
- assertNotNull("RUNNING_2 returned null", enumRunning2);
- assertNotNull("CRANK_3 returned null", enumCrank3);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "KEY_OUT";
+ PowerModeStatus enumKeyOut = PowerModeStatus.valueForString(example);
+ example = "KEY_RECENTLY_OUT";
+ PowerModeStatus enumKeyRecentlyOut = PowerModeStatus.valueForString(example);
+ example = "KEY_APPROVED_0";
+ PowerModeStatus enumKeyApproved0 = PowerModeStatus.valueForString(example);
+ example = "POST_ACCESORY_0";
+ PowerModeStatus enumPostAccessory0 = PowerModeStatus.valueForString(example);
+ example = "ACCESORY_1";
+ PowerModeStatus enumAccessory1 = PowerModeStatus.valueForString(example);
+ example = "POST_IGNITION_1";
+ PowerModeStatus enumPostIgnition1 = PowerModeStatus.valueForString(example);
+ example = "IGNITION_ON_2";
+ PowerModeStatus enumIgnitionOn2 = PowerModeStatus.valueForString(example);
+ example = "RUNNING_2";
+ PowerModeStatus enumRunning2 = PowerModeStatus.valueForString(example);
+ example = "CRANK_3";
+ PowerModeStatus enumCrank3 = PowerModeStatus.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "key_Out";
- try {
- PowerModeStatus temp = PowerModeStatus.valueForString(example);
+ assertNotNull("KEY_OUT returned null", enumKeyOut);
+ assertNotNull("KEY_RECENTLY_OUT returned null", enumKeyRecentlyOut);
+ assertNotNull("KEY_APPROVED_0 returned null", enumKeyApproved0);
+ assertNotNull("POST_ACCESORY_0 returned null", enumPostAccessory0);
+ assertNotNull("ACCESORY_1 returned null", enumAccessory1);
+ assertNotNull("POST_IGNITION_1 returned null", enumPostIgnition1);
+ assertNotNull("IGNITION_ON_2 returned null", enumIgnitionOn2);
+ assertNotNull("RUNNING_2 returned null", enumRunning2);
+ assertNotNull("CRANK_3 returned null", enumCrank3);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "key_Out";
+ try {
+ PowerModeStatus temp = PowerModeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- PowerModeStatus temp = PowerModeStatus.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PowerModeStatus temp = PowerModeStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of PowerModeStatus.
- */
- public void testListEnum() {
- List<PowerModeStatus> enumValueList = Arrays.asList(PowerModeStatus.values());
+ /**
+ * Verifies the possible enum values of PowerModeStatus.
+ */
+ public void testListEnum() {
+ List<PowerModeStatus> enumValueList = Arrays.asList(PowerModeStatus.values());
- List<PowerModeStatus> enumTestList = new ArrayList<PowerModeStatus>();
- enumTestList.add(PowerModeStatus.KEY_OUT);
- enumTestList.add(PowerModeStatus.KEY_RECENTLY_OUT);
- enumTestList.add(PowerModeStatus.KEY_APPROVED_0);
- enumTestList.add(PowerModeStatus.POST_ACCESORY_0);
- enumTestList.add(PowerModeStatus.ACCESORY_1);
- enumTestList.add(PowerModeStatus.POST_IGNITION_1);
- enumTestList.add(PowerModeStatus.IGNITION_ON_2);
- enumTestList.add(PowerModeStatus.RUNNING_2);
- enumTestList.add(PowerModeStatus.CRANK_3);
+ List<PowerModeStatus> enumTestList = new ArrayList<PowerModeStatus>();
+ enumTestList.add(PowerModeStatus.KEY_OUT);
+ enumTestList.add(PowerModeStatus.KEY_RECENTLY_OUT);
+ enumTestList.add(PowerModeStatus.KEY_APPROVED_0);
+ enumTestList.add(PowerModeStatus.POST_ACCESORY_0);
+ enumTestList.add(PowerModeStatus.ACCESORY_1);
+ enumTestList.add(PowerModeStatus.POST_IGNITION_1);
+ enumTestList.add(PowerModeStatus.IGNITION_ON_2);
+ enumTestList.add(PowerModeStatus.RUNNING_2);
+ enumTestList.add(PowerModeStatus.CRANK_3);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PredefinedLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
index 4c5526eec..d1b4c6b52 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
@@ -14,135 +14,133 @@ import java.util.List;
*/
public class PredefinedLayoutTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "DEFAULT";
- PredefinedLayout defaultenum = PredefinedLayout.valueForString(example);
- example = "MEDIA";
- PredefinedLayout media = PredefinedLayout.valueForString(example);
- example = "NON-MEDIA";
- PredefinedLayout nonmedia = PredefinedLayout.valueForString(example);
- example = "ONSCREEN_PRESETS";
- PredefinedLayout onscreen_presets = PredefinedLayout.valueForString(example);
- example = "NAV_FULLSCREEN_MAP";
- PredefinedLayout nav_fullscreen_map = PredefinedLayout.valueForString(example);
- example = "NAV_LIST";
- PredefinedLayout nav_list = PredefinedLayout.valueForString(example);
- example = "NAV_KEYBOARD";
- PredefinedLayout nav_keyboard = PredefinedLayout.valueForString(example);
- example = "GRAPHIC_WITH_TEXT";
- PredefinedLayout graphic_with_text = PredefinedLayout.valueForString(example);
- example = "TEXT_WITH_GRAPHIC";
- PredefinedLayout text_with_graphic = PredefinedLayout.valueForString(example);
- example = "TILES_ONLY";
- PredefinedLayout tiles_only = PredefinedLayout.valueForString(example);
- example = "TEXTBUTTONS_ONLY";
- PredefinedLayout textbuttons_only = PredefinedLayout.valueForString(example);
- example = "GRAPHIC_WITH_TILES";
- PredefinedLayout graphic_with_tiles = PredefinedLayout.valueForString(example);
- example = "TILES_WITH_GRAPHIC";
- PredefinedLayout tiles_with_graphic = PredefinedLayout.valueForString(example);
- example = "GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS";
- PredefinedLayout graphic_with_text_and_softbuttons = PredefinedLayout.valueForString(example);
- example = "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC";
- PredefinedLayout text_and_softbuttons_with_graphics = PredefinedLayout.valueForString(example);
- example = "GRAPHIC_WITH_TEXTBUTTONS";
- PredefinedLayout graphic_with_textbuttons = PredefinedLayout.valueForString(example);
- example = "TEXTBUTTONS_WITH_GRAPHIC";
- PredefinedLayout textbuttons_with_graphic = PredefinedLayout.valueForString(example);
- example = "LARGE_GRAPHIC_WITH_SOFTBUTTONS";
- PredefinedLayout large_graphic_with_softbuttons = PredefinedLayout.valueForString(example);
- example = "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS";
- PredefinedLayout double_graphic_with_softbuttons = PredefinedLayout.valueForString(example);
- example = "LARGE_GRAPHIC_ONLY";
- PredefinedLayout large_graphic_only = PredefinedLayout.valueForString(example);
- example = "WEB_VIEW";
- PredefinedLayout web_view = PredefinedLayout.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DEFAULT";
+ PredefinedLayout defaultenum = PredefinedLayout.valueForString(example);
+ example = "MEDIA";
+ PredefinedLayout media = PredefinedLayout.valueForString(example);
+ example = "NON-MEDIA";
+ PredefinedLayout nonmedia = PredefinedLayout.valueForString(example);
+ example = "ONSCREEN_PRESETS";
+ PredefinedLayout onscreen_presets = PredefinedLayout.valueForString(example);
+ example = "NAV_FULLSCREEN_MAP";
+ PredefinedLayout nav_fullscreen_map = PredefinedLayout.valueForString(example);
+ example = "NAV_LIST";
+ PredefinedLayout nav_list = PredefinedLayout.valueForString(example);
+ example = "NAV_KEYBOARD";
+ PredefinedLayout nav_keyboard = PredefinedLayout.valueForString(example);
+ example = "GRAPHIC_WITH_TEXT";
+ PredefinedLayout graphic_with_text = PredefinedLayout.valueForString(example);
+ example = "TEXT_WITH_GRAPHIC";
+ PredefinedLayout text_with_graphic = PredefinedLayout.valueForString(example);
+ example = "TILES_ONLY";
+ PredefinedLayout tiles_only = PredefinedLayout.valueForString(example);
+ example = "TEXTBUTTONS_ONLY";
+ PredefinedLayout textbuttons_only = PredefinedLayout.valueForString(example);
+ example = "GRAPHIC_WITH_TILES";
+ PredefinedLayout graphic_with_tiles = PredefinedLayout.valueForString(example);
+ example = "TILES_WITH_GRAPHIC";
+ PredefinedLayout tiles_with_graphic = PredefinedLayout.valueForString(example);
+ example = "GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS";
+ PredefinedLayout graphic_with_text_and_softbuttons = PredefinedLayout.valueForString(example);
+ example = "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC";
+ PredefinedLayout text_and_softbuttons_with_graphics = PredefinedLayout.valueForString(example);
+ example = "GRAPHIC_WITH_TEXTBUTTONS";
+ PredefinedLayout graphic_with_textbuttons = PredefinedLayout.valueForString(example);
+ example = "TEXTBUTTONS_WITH_GRAPHIC";
+ PredefinedLayout textbuttons_with_graphic = PredefinedLayout.valueForString(example);
+ example = "LARGE_GRAPHIC_WITH_SOFTBUTTONS";
+ PredefinedLayout large_graphic_with_softbuttons = PredefinedLayout.valueForString(example);
+ example = "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS";
+ PredefinedLayout double_graphic_with_softbuttons = PredefinedLayout.valueForString(example);
+ example = "LARGE_GRAPHIC_ONLY";
+ PredefinedLayout large_graphic_only = PredefinedLayout.valueForString(example);
+ example = "WEB_VIEW";
+ PredefinedLayout web_view = PredefinedLayout.valueForString(example);
- assertNotNull("DEFAULT returned null", defaultenum);
- assertNotNull("MEDIA returned null", media);
- assertNotNull("NON-MEDIA returned null", nonmedia);
- assertNotNull("ONSCREEN_PRESETS returned null", onscreen_presets);
- assertNotNull("NAV_FULLSCREEN_MAP returned null", nav_fullscreen_map);
- assertNotNull("NAV_LIST returned null", nav_list);
- assertNotNull("NAV_KEYBOARD returned null", nav_keyboard);
- assertNotNull("GRAPHIC_WITH_TEXT returned null", graphic_with_text);
- assertNotNull("TEXT_WITH_GRAPHIC returned null", text_with_graphic);
- assertNotNull("TILES_ONLY returned null", tiles_only);
- assertNotNull("TEXTBUTTONS_ONLY returned null", textbuttons_only);
- assertNotNull("GRAPHIC_WITH_TILES returned null", graphic_with_tiles);
- assertNotNull("TILES_WITH_GRAPHIC returned null", tiles_with_graphic);
- assertNotNull("GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS returned null", graphic_with_text_and_softbuttons);
- assertNotNull("TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC returned null", text_and_softbuttons_with_graphics);
- assertNotNull("GRAPHIC_WITH_TEXTBUTTONS returned null", graphic_with_textbuttons);
- assertNotNull("TEXTBUTTONS_WITH_GRAPHIC returned null", textbuttons_with_graphic);
- assertNotNull("LARGE_GRAPHIC_WITH_SOFTBUTTONS returned null", large_graphic_with_softbuttons);
- assertNotNull("DOUBLE_GRAPHIC_WITH_SOFTBUTTONS returned null", double_graphic_with_softbuttons);
- assertNotNull("LARGE_GRAPHIC_ONLY returned null", large_graphic_only);
- assertNotNull("WEB_VIEW returned null", web_view);
- }
+ assertNotNull("DEFAULT returned null", defaultenum);
+ assertNotNull("MEDIA returned null", media);
+ assertNotNull("NON-MEDIA returned null", nonmedia);
+ assertNotNull("ONSCREEN_PRESETS returned null", onscreen_presets);
+ assertNotNull("NAV_FULLSCREEN_MAP returned null", nav_fullscreen_map);
+ assertNotNull("NAV_LIST returned null", nav_list);
+ assertNotNull("NAV_KEYBOARD returned null", nav_keyboard);
+ assertNotNull("GRAPHIC_WITH_TEXT returned null", graphic_with_text);
+ assertNotNull("TEXT_WITH_GRAPHIC returned null", text_with_graphic);
+ assertNotNull("TILES_ONLY returned null", tiles_only);
+ assertNotNull("TEXTBUTTONS_ONLY returned null", textbuttons_only);
+ assertNotNull("GRAPHIC_WITH_TILES returned null", graphic_with_tiles);
+ assertNotNull("TILES_WITH_GRAPHIC returned null", tiles_with_graphic);
+ assertNotNull("GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS returned null", graphic_with_text_and_softbuttons);
+ assertNotNull("TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC returned null", text_and_softbuttons_with_graphics);
+ assertNotNull("GRAPHIC_WITH_TEXTBUTTONS returned null", graphic_with_textbuttons);
+ assertNotNull("TEXTBUTTONS_WITH_GRAPHIC returned null", textbuttons_with_graphic);
+ assertNotNull("LARGE_GRAPHIC_WITH_SOFTBUTTONS returned null", large_graphic_with_softbuttons);
+ assertNotNull("DOUBLE_GRAPHIC_WITH_SOFTBUTTONS returned null", double_graphic_with_softbuttons);
+ assertNotNull("LARGE_GRAPHIC_ONLY returned null", large_graphic_only);
+ assertNotNull("WEB_VIEW returned null", web_view);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "LARGE_GRApHIC_ONLY";
- try {
- PredefinedLayout temp = PredefinedLayout.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "LARGE_GRApHIC_ONLY";
+ try {
+ PredefinedLayout temp = PredefinedLayout.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 {
- PredefinedLayout temp = PredefinedLayout.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PredefinedLayout temp = PredefinedLayout.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of PredefinedLayout.
- */
- public void testListEnum() {
- List<PredefinedLayout> enumValueList = Arrays.asList(PredefinedLayout.values());
+ /**
+ * Verifies the possible enum values of PredefinedLayout.
+ */
+ public void testListEnum() {
+ List<PredefinedLayout> enumValueList = Arrays.asList(PredefinedLayout.values());
- List<PredefinedLayout> enumTestList = new ArrayList<>();
+ List<PredefinedLayout> enumTestList = new ArrayList<>();
- enumTestList.add(PredefinedLayout.DEFAULT);
- enumTestList.add(PredefinedLayout.MEDIA);
- enumTestList.add(PredefinedLayout.NON_MEDIA);
- enumTestList.add(PredefinedLayout.ONSCREEN_PRESETS);
- enumTestList.add(PredefinedLayout.NAV_FULLSCREEN_MAP);
- enumTestList.add(PredefinedLayout.NAV_LIST);
- enumTestList.add(PredefinedLayout.NAV_KEYBOARD);
- enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXT);
- enumTestList.add(PredefinedLayout.TEXT_WITH_GRAPHIC);
- enumTestList.add(PredefinedLayout.TILES_ONLY);
- enumTestList.add(PredefinedLayout.TEXTBUTTONS_ONLY);
- enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TILES);
- enumTestList.add(PredefinedLayout.TILES_WITH_GRAPHIC);
- enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS);
- enumTestList.add(PredefinedLayout.TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC);
- enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXTBUTTONS);
- enumTestList.add(PredefinedLayout.TEXTBUTTONS_WITH_GRAPHIC);
- enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_WITH_SOFTBUTTONS);
- enumTestList.add(PredefinedLayout.DOUBLE_GRAPHIC_WITH_SOFTBUTTONS);
- enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_ONLY);
- enumTestList.add(PredefinedLayout.WEB_VIEW);
+ enumTestList.add(PredefinedLayout.DEFAULT);
+ enumTestList.add(PredefinedLayout.MEDIA);
+ enumTestList.add(PredefinedLayout.NON_MEDIA);
+ enumTestList.add(PredefinedLayout.ONSCREEN_PRESETS);
+ enumTestList.add(PredefinedLayout.NAV_FULLSCREEN_MAP);
+ enumTestList.add(PredefinedLayout.NAV_LIST);
+ enumTestList.add(PredefinedLayout.NAV_KEYBOARD);
+ enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXT);
+ enumTestList.add(PredefinedLayout.TEXT_WITH_GRAPHIC);
+ enumTestList.add(PredefinedLayout.TILES_ONLY);
+ enumTestList.add(PredefinedLayout.TEXTBUTTONS_ONLY);
+ enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TILES);
+ enumTestList.add(PredefinedLayout.TILES_WITH_GRAPHIC);
+ enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS);
+ enumTestList.add(PredefinedLayout.TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC);
+ enumTestList.add(PredefinedLayout.GRAPHIC_WITH_TEXTBUTTONS);
+ enumTestList.add(PredefinedLayout.TEXTBUTTONS_WITH_GRAPHIC);
+ enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_WITH_SOFTBUTTONS);
+ enumTestList.add(PredefinedLayout.DOUBLE_GRAPHIC_WITH_SOFTBUTTONS);
+ enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_ONLY);
+ enumTestList.add(PredefinedLayout.WEB_VIEW);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PrerecordedSpeechTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrerecordedSpeechTests.java
index e8b700007..209030f3a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrerecordedSpeechTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrerecordedSpeechTests.java
@@ -9,75 +9,73 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech}
*/
public class PrerecordedSpeechTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "HELP_JINGLE";
- PrerecordedSpeech enumHelpJingle = PrerecordedSpeech.valueForString(example);
- example = "INITIAL_JINGLE";
- PrerecordedSpeech enumInitialJingle = PrerecordedSpeech.valueForString(example);
- example = "LISTEN_JINGLE";
- PrerecordedSpeech enumListenJingle = PrerecordedSpeech.valueForString(example);
- example = "POSITIVE_JINGLE";
- PrerecordedSpeech enumPositiveJingle = PrerecordedSpeech.valueForString(example);
- example = "NEGATIVE_JINGLE";
- PrerecordedSpeech enumNegativeJingle = PrerecordedSpeech.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "HELP_JINGLE";
+ PrerecordedSpeech enumHelpJingle = PrerecordedSpeech.valueForString(example);
+ example = "INITIAL_JINGLE";
+ PrerecordedSpeech enumInitialJingle = PrerecordedSpeech.valueForString(example);
+ example = "LISTEN_JINGLE";
+ PrerecordedSpeech enumListenJingle = PrerecordedSpeech.valueForString(example);
+ example = "POSITIVE_JINGLE";
+ PrerecordedSpeech enumPositiveJingle = PrerecordedSpeech.valueForString(example);
+ example = "NEGATIVE_JINGLE";
+ PrerecordedSpeech enumNegativeJingle = PrerecordedSpeech.valueForString(example);
- assertNotNull("HELP_JINGLE returned null", enumHelpJingle);
- assertNotNull("INITIAL_JINGLE returned null", enumInitialJingle);
- assertNotNull("LISTEN_JINGLE returned null", enumListenJingle);
- assertNotNull("POSITIVE_JINGLE returned null", enumPositiveJingle);
- assertNotNull("NEGATIVE_JINGLE returned null", enumNegativeJingle);
- }
+ assertNotNull("HELP_JINGLE returned null", enumHelpJingle);
+ assertNotNull("INITIAL_JINGLE returned null", enumInitialJingle);
+ assertNotNull("LISTEN_JINGLE returned null", enumListenJingle);
+ assertNotNull("POSITIVE_JINGLE returned null", enumPositiveJingle);
+ assertNotNull("NEGATIVE_JINGLE returned null", enumNegativeJingle);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "heLP_JingLE";
- try {
- PrerecordedSpeech temp = PrerecordedSpeech.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "heLP_JingLE";
+ try {
+ PrerecordedSpeech temp = PrerecordedSpeech.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- PrerecordedSpeech temp = PrerecordedSpeech.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PrerecordedSpeech temp = PrerecordedSpeech.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of PrerecordedSpeech.
- */
- public void testListEnum() {
- List<PrerecordedSpeech> enumValueList = Arrays.asList(PrerecordedSpeech.values());
+ /**
+ * Verifies the possible enum values of PrerecordedSpeech.
+ */
+ public void testListEnum() {
+ List<PrerecordedSpeech> enumValueList = Arrays.asList(PrerecordedSpeech.values());
- List<PrerecordedSpeech> enumTestList = new ArrayList<PrerecordedSpeech>();
- enumTestList.add(PrerecordedSpeech.HELP_JINGLE);
- enumTestList.add(PrerecordedSpeech.INITIAL_JINGLE);
- enumTestList.add(PrerecordedSpeech.LISTEN_JINGLE);
- enumTestList.add(PrerecordedSpeech.POSITIVE_JINGLE);
- enumTestList.add(PrerecordedSpeech.NEGATIVE_JINGLE);
+ List<PrerecordedSpeech> enumTestList = new ArrayList<PrerecordedSpeech>();
+ enumTestList.add(PrerecordedSpeech.HELP_JINGLE);
+ enumTestList.add(PrerecordedSpeech.INITIAL_JINGLE);
+ enumTestList.add(PrerecordedSpeech.LISTEN_JINGLE);
+ enumTestList.add(PrerecordedSpeech.POSITIVE_JINGLE);
+ enumTestList.add(PrerecordedSpeech.NEGATIVE_JINGLE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PrimaryAudioSourceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrimaryAudioSourceTests.java
index a0a6fc6dd..167bedec7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrimaryAudioSourceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrimaryAudioSourceTests.java
@@ -15,97 +15,97 @@ import java.util.List;
*/
public class PrimaryAudioSourceTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "NO_SOURCE_SELECTED";
- PrimaryAudioSource enumNoSourceSelected = PrimaryAudioSource.valueForString(example);
- example = "USB";
- PrimaryAudioSource enumUsb = PrimaryAudioSource.valueForString(example);
- example = "USB2";
- PrimaryAudioSource enumUsb2 = PrimaryAudioSource.valueForString(example);
- example = "BLUETOOTH_STEREO_BTST";
- PrimaryAudioSource enumBluetoothStereoBtst = PrimaryAudioSource.valueForString(example);
- example = "LINE_IN";
- PrimaryAudioSource enumLineIn = PrimaryAudioSource.valueForString(example);
- example = "IPOD";
- PrimaryAudioSource enumIpod = PrimaryAudioSource.valueForString(example);
- example = "MOBILE_APP";
- PrimaryAudioSource enumMobileApp = PrimaryAudioSource.valueForString(example);
- example = "CD";
- PrimaryAudioSource enumCd = PrimaryAudioSource.valueForString(example);
- example = "AM";
- PrimaryAudioSource enumAm = PrimaryAudioSource.valueForString(example);
- example = "FM";
- PrimaryAudioSource enumFm = PrimaryAudioSource.valueForString(example);
- example = "XM";
- PrimaryAudioSource enumXm = PrimaryAudioSource.valueForString(example);
- example = "DAB";
- PrimaryAudioSource enumDab = PrimaryAudioSource.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NO_SOURCE_SELECTED";
+ PrimaryAudioSource enumNoSourceSelected = PrimaryAudioSource.valueForString(example);
+ example = "USB";
+ PrimaryAudioSource enumUsb = PrimaryAudioSource.valueForString(example);
+ example = "USB2";
+ PrimaryAudioSource enumUsb2 = PrimaryAudioSource.valueForString(example);
+ example = "BLUETOOTH_STEREO_BTST";
+ PrimaryAudioSource enumBluetoothStereoBtst = PrimaryAudioSource.valueForString(example);
+ example = "LINE_IN";
+ PrimaryAudioSource enumLineIn = PrimaryAudioSource.valueForString(example);
+ example = "IPOD";
+ PrimaryAudioSource enumIpod = PrimaryAudioSource.valueForString(example);
+ example = "MOBILE_APP";
+ PrimaryAudioSource enumMobileApp = PrimaryAudioSource.valueForString(example);
+ example = "CD";
+ PrimaryAudioSource enumCd = PrimaryAudioSource.valueForString(example);
+ example = "AM";
+ PrimaryAudioSource enumAm = PrimaryAudioSource.valueForString(example);
+ example = "FM";
+ PrimaryAudioSource enumFm = PrimaryAudioSource.valueForString(example);
+ example = "XM";
+ PrimaryAudioSource enumXm = PrimaryAudioSource.valueForString(example);
+ example = "DAB";
+ PrimaryAudioSource enumDab = PrimaryAudioSource.valueForString(example);
- assertNotNull("NO_SOURCE_SELECTED returned null", enumNoSourceSelected);
- assertNotNull("USB returned null", enumUsb);
- assertNotNull("USB2 returned null", enumUsb2);
- assertNotNull("BLUETOOTH_STEREO_BTST returned null", enumBluetoothStereoBtst);
- assertNotNull("LINE_IN returned null", enumLineIn);
- assertNotNull("IPOD returned null", enumIpod);
- assertNotNull("MOBILE_APP returned null", enumMobileApp);
- assertNotNull("CD returned null", enumCd);
- assertNotNull("AM returned null", enumAm);
- assertNotNull("FM returned null", enumFm);
- assertNotNull("XM returned null", enumXm);
- assertNotNull("DAB returned null", enumDab);
- }
+ assertNotNull("NO_SOURCE_SELECTED returned null", enumNoSourceSelected);
+ assertNotNull("USB returned null", enumUsb);
+ assertNotNull("USB2 returned null", enumUsb2);
+ assertNotNull("BLUETOOTH_STEREO_BTST returned null", enumBluetoothStereoBtst);
+ assertNotNull("LINE_IN returned null", enumLineIn);
+ assertNotNull("IPOD returned null", enumIpod);
+ assertNotNull("MOBILE_APP returned null", enumMobileApp);
+ assertNotNull("CD returned null", enumCd);
+ assertNotNull("AM returned null", enumAm);
+ assertNotNull("FM returned null", enumFm);
+ assertNotNull("XM returned null", enumXm);
+ assertNotNull("DAB returned null", enumDab);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "no_SouRCe_SelEcteD";
- try {
- PrimaryAudioSource temp = PrimaryAudioSource.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "no_SouRCe_SelEcteD";
+ try {
+ PrimaryAudioSource temp = PrimaryAudioSource.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 {
- PrimaryAudioSource temp = PrimaryAudioSource.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PrimaryAudioSource temp = PrimaryAudioSource.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of PrimaryAudioSource.
- */
- public void testListEnum() {
- List<PrimaryAudioSource> enumValueList = Arrays.asList(PrimaryAudioSource.values());
+ /**
+ * Verifies the possible enum values of PrimaryAudioSource.
+ */
+ public void testListEnum() {
+ List<PrimaryAudioSource> enumValueList = Arrays.asList(PrimaryAudioSource.values());
- List<PrimaryAudioSource> enumTestList = new ArrayList<PrimaryAudioSource>();
- enumTestList.add(PrimaryAudioSource.NO_SOURCE_SELECTED);
- enumTestList.add(PrimaryAudioSource.USB);
- enumTestList.add(PrimaryAudioSource.USB2);
- enumTestList.add(PrimaryAudioSource.BLUETOOTH_STEREO_BTST);
- enumTestList.add(PrimaryAudioSource.LINE_IN);
- enumTestList.add(PrimaryAudioSource.IPOD);
- enumTestList.add(PrimaryAudioSource.MOBILE_APP);
- enumTestList.add(PrimaryAudioSource.CD);
- enumTestList.add(PrimaryAudioSource.AM);
- enumTestList.add(PrimaryAudioSource.FM);
- enumTestList.add(PrimaryAudioSource.XM);
- enumTestList.add(PrimaryAudioSource.DAB);
+ List<PrimaryAudioSource> enumTestList = new ArrayList<PrimaryAudioSource>();
+ enumTestList.add(PrimaryAudioSource.NO_SOURCE_SELECTED);
+ enumTestList.add(PrimaryAudioSource.USB);
+ enumTestList.add(PrimaryAudioSource.USB2);
+ enumTestList.add(PrimaryAudioSource.BLUETOOTH_STEREO_BTST);
+ enumTestList.add(PrimaryAudioSource.LINE_IN);
+ enumTestList.add(PrimaryAudioSource.IPOD);
+ enumTestList.add(PrimaryAudioSource.MOBILE_APP);
+ enumTestList.add(PrimaryAudioSource.CD);
+ enumTestList.add(PrimaryAudioSource.AM);
+ enumTestList.add(PrimaryAudioSource.FM);
+ enumTestList.add(PrimaryAudioSource.XM);
+ enumTestList.add(PrimaryAudioSource.DAB);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/PrndlTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrndlTests.java
index 215a67704..102922052 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrndlTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PrndlTests.java
@@ -10,127 +10,125 @@ import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.PRNDL}
*/
public class PrndlTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "PARK";
- PRNDL enumPark = PRNDL.valueForString(example);
- example = "REVERSE";
- PRNDL enumReverse = PRNDL.valueForString(example);
- example = "NEUTRAL";
- PRNDL enumNeutral = PRNDL.valueForString(example);
- example = "DRIVE";
- PRNDL enumDrive = PRNDL.valueForString(example);
- example = "SPORT";
- PRNDL enumSport = PRNDL.valueForString(example);
- example = "LOWGEAR";
- PRNDL enumLowGear = PRNDL.valueForString(example);
- example = "FIRST";
- PRNDL enumFirst = PRNDL.valueForString(example);
- example = "SECOND";
- PRNDL enumSecond = PRNDL.valueForString(example);
- example = "THIRD";
- PRNDL enumThird = PRNDL.valueForString(example);
- example = "FOURTH";
- PRNDL enumFourth = PRNDL.valueForString(example);
- example = "FIFTH";
- PRNDL enumFifth = PRNDL.valueForString(example);
- example = "SIXTH";
- PRNDL enumSixth = PRNDL.valueForString(example);
- example = "SEVENTH";
- PRNDL enumSeventh = PRNDL.valueForString(example);
- example = "EIGHTH";
- PRNDL enumEighth = PRNDL.valueForString(example);
- example = "NINTH";
- PRNDL enumNinth = PRNDL.valueForString(example);
- example = "TENTH";
- PRNDL enumTenth = PRNDL.valueForString(example);
- example = "UNKNOWN";
- PRNDL enumUnknown = PRNDL.valueForString(example);
- example = "FAULT";
- PRNDL enumFault = PRNDL.valueForString(example);
-
- assertNotNull("PARK returned null", enumPark);
- assertNotNull("REVERSE returned null", enumReverse);
- assertNotNull("NEUTRAL returned null", enumNeutral);
- assertNotNull("DRIVE returned null", enumDrive);
- assertNotNull("SPORT returned null", enumSport);
- assertNotNull("LOWGEAR returned null", enumLowGear);
- assertNotNull("FIRST returned null", enumFirst);
- assertNotNull("SECOND returned null", enumSecond);
- assertNotNull("THIRD returned null", enumThird);
- assertNotNull("FOURTH returned null", enumFourth);
- assertNotNull("FIFTH returned null", enumFifth);
- assertNotNull("SIXTH returned null", enumSixth);
- assertNotNull("SEVENTH returned null", enumSeventh);
- assertNotNull("EIGHTH returned null", enumEighth);
- assertNotNull("NINTH returned null", enumNinth);
- assertNotNull("TENTH returned null", enumTenth);
- assertNotNull("UNKNOWN returned null", enumUnknown);
- assertNotNull("FAULT returned null", enumFault);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "PARK";
+ PRNDL enumPark = PRNDL.valueForString(example);
+ example = "REVERSE";
+ PRNDL enumReverse = PRNDL.valueForString(example);
+ example = "NEUTRAL";
+ PRNDL enumNeutral = PRNDL.valueForString(example);
+ example = "DRIVE";
+ PRNDL enumDrive = PRNDL.valueForString(example);
+ example = "SPORT";
+ PRNDL enumSport = PRNDL.valueForString(example);
+ example = "LOWGEAR";
+ PRNDL enumLowGear = PRNDL.valueForString(example);
+ example = "FIRST";
+ PRNDL enumFirst = PRNDL.valueForString(example);
+ example = "SECOND";
+ PRNDL enumSecond = PRNDL.valueForString(example);
+ example = "THIRD";
+ PRNDL enumThird = PRNDL.valueForString(example);
+ example = "FOURTH";
+ PRNDL enumFourth = PRNDL.valueForString(example);
+ example = "FIFTH";
+ PRNDL enumFifth = PRNDL.valueForString(example);
+ example = "SIXTH";
+ PRNDL enumSixth = PRNDL.valueForString(example);
+ example = "SEVENTH";
+ PRNDL enumSeventh = PRNDL.valueForString(example);
+ example = "EIGHTH";
+ PRNDL enumEighth = PRNDL.valueForString(example);
+ example = "NINTH";
+ PRNDL enumNinth = PRNDL.valueForString(example);
+ example = "TENTH";
+ PRNDL enumTenth = PRNDL.valueForString(example);
+ example = "UNKNOWN";
+ PRNDL enumUnknown = PRNDL.valueForString(example);
+ example = "FAULT";
+ PRNDL enumFault = PRNDL.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "pARk";
- try {
- PRNDL temp = PRNDL.valueForString(example);
+ assertNotNull("PARK returned null", enumPark);
+ assertNotNull("REVERSE returned null", enumReverse);
+ assertNotNull("NEUTRAL returned null", enumNeutral);
+ assertNotNull("DRIVE returned null", enumDrive);
+ assertNotNull("SPORT returned null", enumSport);
+ assertNotNull("LOWGEAR returned null", enumLowGear);
+ assertNotNull("FIRST returned null", enumFirst);
+ assertNotNull("SECOND returned null", enumSecond);
+ assertNotNull("THIRD returned null", enumThird);
+ assertNotNull("FOURTH returned null", enumFourth);
+ assertNotNull("FIFTH returned null", enumFifth);
+ assertNotNull("SIXTH returned null", enumSixth);
+ assertNotNull("SEVENTH returned null", enumSeventh);
+ assertNotNull("EIGHTH returned null", enumEighth);
+ assertNotNull("NINTH returned null", enumNinth);
+ assertNotNull("TENTH returned null", enumTenth);
+ assertNotNull("UNKNOWN returned null", enumUnknown);
+ assertNotNull("FAULT returned null", enumFault);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "pARk";
+ try {
+ PRNDL temp = PRNDL.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- PRNDL temp = PRNDL.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ PRNDL temp = PRNDL.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of PRNDL.
- */
- public void testListEnum() {
- List<PRNDL> enumValueList = Arrays.asList(PRNDL.values());
+ /**
+ * Verifies the possible enum values of PRNDL.
+ */
+ public void testListEnum() {
+ List<PRNDL> enumValueList = Arrays.asList(PRNDL.values());
- List<PRNDL> enumTestList = new ArrayList<PRNDL>();
- enumTestList.add(PRNDL.PARK);
- enumTestList.add(PRNDL.REVERSE);
- enumTestList.add(PRNDL.NEUTRAL);
- enumTestList.add(PRNDL.DRIVE);
- enumTestList.add(PRNDL.SPORT);
- enumTestList.add(PRNDL.LOWGEAR);
- enumTestList.add(PRNDL.FIRST);
- enumTestList.add(PRNDL.SECOND);
- enumTestList.add(PRNDL.THIRD);
- enumTestList.add(PRNDL.FOURTH);
- enumTestList.add(PRNDL.FIFTH);
- enumTestList.add(PRNDL.SIXTH);
- enumTestList.add(PRNDL.SEVENTH);
- enumTestList.add(PRNDL.EIGHTH);
- enumTestList.add(PRNDL.NINTH);
- enumTestList.add(PRNDL.TENTH);
- enumTestList.add(PRNDL.UNKNOWN);
- enumTestList.add(PRNDL.FAULT);
+ List<PRNDL> enumTestList = new ArrayList<PRNDL>();
+ enumTestList.add(PRNDL.PARK);
+ enumTestList.add(PRNDL.REVERSE);
+ enumTestList.add(PRNDL.NEUTRAL);
+ enumTestList.add(PRNDL.DRIVE);
+ enumTestList.add(PRNDL.SPORT);
+ enumTestList.add(PRNDL.LOWGEAR);
+ enumTestList.add(PRNDL.FIRST);
+ enumTestList.add(PRNDL.SECOND);
+ enumTestList.add(PRNDL.THIRD);
+ enumTestList.add(PRNDL.FOURTH);
+ enumTestList.add(PRNDL.FIFTH);
+ enumTestList.add(PRNDL.SIXTH);
+ enumTestList.add(PRNDL.SEVENTH);
+ enumTestList.add(PRNDL.EIGHTH);
+ enumTestList.add(PRNDL.NINTH);
+ enumTestList.add(PRNDL.TENTH);
+ enumTestList.add(PRNDL.UNKNOWN);
+ enumTestList.add(PRNDL.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/RadioBandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java
index 52c15156e..b8001a14f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.RadioBand}
*/
public class RadioBandTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "AM";
- RadioBand enumAm = RadioBand.valueForString(example);
- example = "FM";
- RadioBand enumFm = RadioBand.valueForString(example);
- example = "XM";
- RadioBand enumXm = RadioBand.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "AM";
+ RadioBand enumAm = RadioBand.valueForString(example);
+ example = "FM";
+ RadioBand enumFm = RadioBand.valueForString(example);
+ example = "XM";
+ RadioBand enumXm = RadioBand.valueForString(example);
- assertNotNull("AM returned null", enumAm);
- assertNotNull("FM returned null", enumFm);
- assertNotNull("XM returned null", enumXm);
- }
+ assertNotNull("AM returned null", enumAm);
+ assertNotNull("FM returned null", enumFm);
+ assertNotNull("XM returned null", enumXm);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "aM";
- try {
- RadioBand temp = RadioBand.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "aM";
+ try {
+ RadioBand temp = RadioBand.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- RadioBand temp = RadioBand.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ RadioBand temp = RadioBand.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of RadioBand.
- */
- public void testListEnum() {
- List<RadioBand> enumValueList = Arrays.asList(RadioBand.values());
+ /**
+ * Verifies the possible enum values of RadioBand.
+ */
+ public void testListEnum() {
+ List<RadioBand> enumValueList = Arrays.asList(RadioBand.values());
- List<RadioBand> enumTestList = new ArrayList<RadioBand>();
- enumTestList.add(RadioBand.AM);
- enumTestList.add(RadioBand.FM);
- enumTestList.add(RadioBand.XM);
+ List<RadioBand> enumTestList = new ArrayList<RadioBand>();
+ enumTestList.add(RadioBand.AM);
+ enumTestList.add(RadioBand.FM);
+ enumTestList.add(RadioBand.XM);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/RadioStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java
index 5c7286937..fb64b29ad 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.RadioState}
*/
public class RadioStateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "ACQUIRING";
- RadioState enumAcquiring = RadioState.valueForString(example);
- example = "ACQUIRED";
- RadioState enumAcquired = RadioState.valueForString(example);
- example = "MULTICAST";
- RadioState enumMultiCast = RadioState.valueForString(example);
- example = "NOT_FOUND";
- RadioState enumNotFound = RadioState.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ACQUIRING";
+ RadioState enumAcquiring = RadioState.valueForString(example);
+ example = "ACQUIRED";
+ RadioState enumAcquired = RadioState.valueForString(example);
+ example = "MULTICAST";
+ RadioState enumMultiCast = RadioState.valueForString(example);
+ example = "NOT_FOUND";
+ RadioState enumNotFound = RadioState.valueForString(example);
- assertNotNull("ACQUIRING returned null", enumAcquiring);
- assertNotNull("ACQUIRED returned null", enumAcquired);
- assertNotNull("MULTICAST returned null", enumMultiCast);
- assertNotNull("NOT_FOUND returned null", enumNotFound);
- }
+ assertNotNull("ACQUIRING returned null", enumAcquiring);
+ assertNotNull("ACQUIRED returned null", enumAcquired);
+ assertNotNull("MULTICAST returned null", enumMultiCast);
+ assertNotNull("NOT_FOUND returned null", enumNotFound);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "aCQUIRING";
- try {
- RadioState temp = RadioState.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "aCQUIRING";
+ try {
+ RadioState temp = RadioState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- RadioState temp = RadioState.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ RadioState temp = RadioState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of RadioState.
- */
- public void testListEnum() {
- List<RadioState> enumValueList = Arrays.asList(RadioState.values());
+ /**
+ * Verifies the possible enum values of RadioState.
+ */
+ public void testListEnum() {
+ List<RadioState> enumValueList = Arrays.asList(RadioState.values());
- List<RadioState> enumTestList = new ArrayList<RadioState>();
- enumTestList.add(RadioState.ACQUIRING);
- enumTestList.add(RadioState.ACQUIRED);
- enumTestList.add(RadioState.MULTICAST);
- enumTestList.add(RadioState.NOT_FOUND);
+ List<RadioState> enumTestList = new ArrayList<RadioState>();
+ enumTestList.add(RadioState.ACQUIRING);
+ enumTestList.add(RadioState.ACQUIRED);
+ enumTestList.add(RadioState.MULTICAST);
+ enumTestList.add(RadioState.NOT_FOUND);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/RequestTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
index 54c40d69f..371c120c4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
@@ -10,144 +10,142 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.RequestType}
*/
public class RequestTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "HTTP";
- RequestType enumHttp = RequestType.valueForString(example);
- example = "FILE_RESUME";
- RequestType enumFileResume = RequestType.valueForString(example);
- example = "AUTH_REQUEST";
- RequestType enumAuthRequest = RequestType.valueForString(example);
- example = "AUTH_CHALLENGE";
- RequestType enumAuthChallenge = RequestType.valueForString(example);
- example = "AUTH_ACK";
- RequestType enumAuthAck = RequestType.valueForString(example);
- example = "PROPRIETARY";
- RequestType enumProprietary = RequestType.valueForString(example);
-
- example = "QUERY_APPS";
- RequestType enumQueryApps = RequestType.valueForString(example);
- example = "LAUNCH_APP";
- RequestType enumLaunchApp = RequestType.valueForString(example);
- example = "LOCK_SCREEN_ICON_URL";
- RequestType enumLockScreen = RequestType.valueForString(example);
- example = "TRAFFIC_MESSAGE_CHANNEL";
- RequestType enumTrafficMessage = RequestType.valueForString(example);
- example = "DRIVER_PROFILE";
- RequestType enumDriverProfile = RequestType.valueForString(example);
- example = "VOICE_SEARCH";
- RequestType enumVoiceSearch = RequestType.valueForString(example);
- example = "NAVIGATION";
- RequestType enumNavigation = RequestType.valueForString(example);
- example = "PHONE";
- RequestType enumPhone = RequestType.valueForString(example);
- example = "CLIMATE";
- RequestType enumClimate = RequestType.valueForString(example);
- example = "SETTINGS";
- RequestType enumSettings = RequestType.valueForString(example);
- example = "VEHICLE_DIAGNOSTICS";
- RequestType enumDiagnostics = RequestType.valueForString(example);
- example = "EMERGENCY";
- RequestType enumEmergency = RequestType.valueForString(example);
- example = "MEDIA";
- RequestType enumMedia = RequestType.valueForString(example);
- example = "FOTA";
- RequestType enumFota = RequestType.valueForString(example);
- example = "ICON_URL";
- RequestType enumIconURL = RequestType.valueForString(example);
-
- assertNotNull("HTTP returned null", enumHttp);
- assertNotNull("FILE_RESUME returned null", enumFileResume);
- assertNotNull("AUTH_REQUEST returned null", enumAuthRequest);
- assertNotNull("AUTH_CHALLENGE returned null", enumAuthChallenge);
- assertNotNull("AUTH_ACK returned null", enumAuthAck);
- assertNotNull("PROPRIETARY returned null", enumProprietary);
- assertNotNull("ICON_URL returned null", enumIconURL);
-
- assertNotNull(TestValues.NOT_NULL, enumQueryApps);
- assertNotNull(TestValues.NOT_NULL, enumLaunchApp);
- assertNotNull(TestValues.NOT_NULL, enumLockScreen);
- assertNotNull(TestValues.NOT_NULL, enumTrafficMessage);
- assertNotNull(TestValues.NOT_NULL, enumDriverProfile);
- assertNotNull(TestValues.NOT_NULL, enumVoiceSearch);
- assertNotNull(TestValues.NOT_NULL, enumNavigation);
- assertNotNull(TestValues.NOT_NULL, enumPhone);
- assertNotNull(TestValues.NOT_NULL, enumClimate);
- assertNotNull(TestValues.NOT_NULL, enumSettings);
- assertNotNull(TestValues.NOT_NULL, enumDiagnostics);
- assertNotNull(TestValues.NOT_NULL, enumEmergency);
- assertNotNull(TestValues.NOT_NULL, enumMedia);
- assertNotNull(TestValues.NOT_NULL, enumFota);
- assertNotNull(TestValues.NOT_NULL, enumIconURL);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "HTTP";
+ RequestType enumHttp = RequestType.valueForString(example);
+ example = "FILE_RESUME";
+ RequestType enumFileResume = RequestType.valueForString(example);
+ example = "AUTH_REQUEST";
+ RequestType enumAuthRequest = RequestType.valueForString(example);
+ example = "AUTH_CHALLENGE";
+ RequestType enumAuthChallenge = RequestType.valueForString(example);
+ example = "AUTH_ACK";
+ RequestType enumAuthAck = RequestType.valueForString(example);
+ example = "PROPRIETARY";
+ RequestType enumProprietary = RequestType.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "hTTp";
- try {
- RequestType temp = RequestType.valueForString(example);
+ example = "QUERY_APPS";
+ RequestType enumQueryApps = RequestType.valueForString(example);
+ example = "LAUNCH_APP";
+ RequestType enumLaunchApp = RequestType.valueForString(example);
+ example = "LOCK_SCREEN_ICON_URL";
+ RequestType enumLockScreen = RequestType.valueForString(example);
+ example = "TRAFFIC_MESSAGE_CHANNEL";
+ RequestType enumTrafficMessage = RequestType.valueForString(example);
+ example = "DRIVER_PROFILE";
+ RequestType enumDriverProfile = RequestType.valueForString(example);
+ example = "VOICE_SEARCH";
+ RequestType enumVoiceSearch = RequestType.valueForString(example);
+ example = "NAVIGATION";
+ RequestType enumNavigation = RequestType.valueForString(example);
+ example = "PHONE";
+ RequestType enumPhone = RequestType.valueForString(example);
+ example = "CLIMATE";
+ RequestType enumClimate = RequestType.valueForString(example);
+ example = "SETTINGS";
+ RequestType enumSettings = RequestType.valueForString(example);
+ example = "VEHICLE_DIAGNOSTICS";
+ RequestType enumDiagnostics = RequestType.valueForString(example);
+ example = "EMERGENCY";
+ RequestType enumEmergency = RequestType.valueForString(example);
+ example = "MEDIA";
+ RequestType enumMedia = RequestType.valueForString(example);
+ example = "FOTA";
+ RequestType enumFota = RequestType.valueForString(example);
+ example = "ICON_URL";
+ RequestType enumIconURL = RequestType.valueForString(example);
+
+ assertNotNull("HTTP returned null", enumHttp);
+ assertNotNull("FILE_RESUME returned null", enumFileResume);
+ assertNotNull("AUTH_REQUEST returned null", enumAuthRequest);
+ assertNotNull("AUTH_CHALLENGE returned null", enumAuthChallenge);
+ assertNotNull("AUTH_ACK returned null", enumAuthAck);
+ assertNotNull("PROPRIETARY returned null", enumProprietary);
+ assertNotNull("ICON_URL returned null", enumIconURL);
+
+ assertNotNull(TestValues.NOT_NULL, enumQueryApps);
+ assertNotNull(TestValues.NOT_NULL, enumLaunchApp);
+ assertNotNull(TestValues.NOT_NULL, enumLockScreen);
+ assertNotNull(TestValues.NOT_NULL, enumTrafficMessage);
+ assertNotNull(TestValues.NOT_NULL, enumDriverProfile);
+ assertNotNull(TestValues.NOT_NULL, enumVoiceSearch);
+ assertNotNull(TestValues.NOT_NULL, enumNavigation);
+ assertNotNull(TestValues.NOT_NULL, enumPhone);
+ assertNotNull(TestValues.NOT_NULL, enumClimate);
+ assertNotNull(TestValues.NOT_NULL, enumSettings);
+ assertNotNull(TestValues.NOT_NULL, enumDiagnostics);
+ assertNotNull(TestValues.NOT_NULL, enumEmergency);
+ assertNotNull(TestValues.NOT_NULL, enumMedia);
+ assertNotNull(TestValues.NOT_NULL, enumFota);
+ assertNotNull(TestValues.NOT_NULL, enumIconURL);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "hTTp";
+ try {
+ RequestType temp = RequestType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- RequestType temp = RequestType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ RequestType temp = RequestType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of RequestType.
+ */
+ public void testListEnum() {
+ List<RequestType> enumValueList = Arrays.asList(RequestType.values());
- /**
- * Verifies the possible enum values of RequestType.
- */
- public void testListEnum() {
- List<RequestType> enumValueList = Arrays.asList(RequestType.values());
+ List<RequestType> enumTestList = new ArrayList<RequestType>();
+ enumTestList.add(RequestType.HTTP);
+ enumTestList.add(RequestType.FILE_RESUME);
+ enumTestList.add(RequestType.AUTH_REQUEST);
+ enumTestList.add(RequestType.AUTH_CHALLENGE);
+ enumTestList.add(RequestType.AUTH_ACK);
+ enumTestList.add(RequestType.PROPRIETARY);
- List<RequestType> enumTestList = new ArrayList<RequestType>();
- enumTestList.add(RequestType.HTTP);
- enumTestList.add(RequestType.FILE_RESUME);
- enumTestList.add(RequestType.AUTH_REQUEST);
- enumTestList.add(RequestType.AUTH_CHALLENGE);
- enumTestList.add(RequestType.AUTH_ACK);
- enumTestList.add(RequestType.PROPRIETARY);
-
- enumTestList.add(RequestType.QUERY_APPS);
- enumTestList.add(RequestType.LAUNCH_APP);
- enumTestList.add(RequestType.LOCK_SCREEN_ICON_URL);
- enumTestList.add(RequestType.TRAFFIC_MESSAGE_CHANNEL);
- enumTestList.add(RequestType.DRIVER_PROFILE);
- enumTestList.add(RequestType.VOICE_SEARCH);
- enumTestList.add(RequestType.NAVIGATION);
- enumTestList.add(RequestType.PHONE);
- enumTestList.add(RequestType.CLIMATE);
- enumTestList.add(RequestType.SETTINGS);
- enumTestList.add(RequestType.VEHICLE_DIAGNOSTICS);
- enumTestList.add(RequestType.EMERGENCY);
- enumTestList.add(RequestType.MEDIA);
- enumTestList.add(RequestType.FOTA);
- enumTestList.add(RequestType.OEM_SPECIFIC);
- enumTestList.add(RequestType.ICON_URL);
+ enumTestList.add(RequestType.QUERY_APPS);
+ enumTestList.add(RequestType.LAUNCH_APP);
+ enumTestList.add(RequestType.LOCK_SCREEN_ICON_URL);
+ enumTestList.add(RequestType.TRAFFIC_MESSAGE_CHANNEL);
+ enumTestList.add(RequestType.DRIVER_PROFILE);
+ enumTestList.add(RequestType.VOICE_SEARCH);
+ enumTestList.add(RequestType.NAVIGATION);
+ enumTestList.add(RequestType.PHONE);
+ enumTestList.add(RequestType.CLIMATE);
+ enumTestList.add(RequestType.SETTINGS);
+ enumTestList.add(RequestType.VEHICLE_DIAGNOSTICS);
+ enumTestList.add(RequestType.EMERGENCY);
+ enumTestList.add(RequestType.MEDIA);
+ enumTestList.add(RequestType.FOTA);
+ enumTestList.add(RequestType.OEM_SPECIFIC);
+ enumTestList.add(RequestType.ICON_URL);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ResultTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
index 8bfec0490..a00c70cbe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
@@ -9,203 +9,201 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.Result}
*/
public class ResultTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "SUCCESS";
- Result enumSuccess = Result.valueForString(example);
- example = "INVALID_DATA";
- Result enumInvalidData = Result.valueForString(example);
- example = "UNSUPPORTED_REQUEST";
- Result enumUnsupportedRequest = Result.valueForString(example);
- example = "OUT_OF_MEMORY";
- Result enumOutOfMemory = Result.valueForString(example);
- example = "TOO_MANY_PENDING_REQUESTS";
- Result enumTooManyPendingRequests = Result.valueForString(example);
- example = "CHAR_LIMIT_EXCEEDED";
- Result enumCharLimitExceeded = Result.valueForString(example);
- example = "INVALID_ID";
- Result enumInvalidId = Result.valueForString(example);
- example = "DUPLICATE_NAME";
- Result enumDuplicateName = Result.valueForString(example);
- example = "TOO_MANY_APPLICATIONS";
- Result enumTooManyApplications = Result.valueForString(example);
- example = "APPLICATION_REGISTERED_ALREADY";
- Result enumApplicationRegisteredAlready = Result.valueForString(example);
- example = "UNSUPPORTED_VERSION";
- Result enumUnsupportedVersion = Result.valueForString(example);
- example = "WRONG_LANGUAGE";
- Result enumWrongLanguage = Result.valueForString(example);
- example = "APPLICATION_NOT_REGISTERED";
- Result enumApplicationNotRegistered = Result.valueForString(example);
- example = "IN_USE";
- Result enumInUse = Result.valueForString(example);
- example = "VEHICLE_DATA_NOT_ALLOWED";
- Result enumVehicleDataNotAllowed = Result.valueForString(example);
- example = "VEHICLE_DATA_NOT_AVAILABLE";
- Result enumVehicleDataNotAvailable = Result.valueForString(example);
- example = "REJECTED";
- Result enumRejected = Result.valueForString(example);
- example = "ABORTED";
- Result enumAborted = Result.valueForString(example);
- example = "IGNORED";
- Result enumIgnored = Result.valueForString(example);
- example = "UNSUPPORTED_RESOURCE";
- Result enumUnsupportedResource = Result.valueForString(example);
- example = "FILE_NOT_FOUND";
- Result enumFileNotFound = Result.valueForString(example);
- example = "GENERIC_ERROR";
- Result enumGenericError = Result.valueForString(example);
- example = "DISALLOWED";
- Result enumDisallowed = Result.valueForString(example);
- example = "USER_DISALLOWED";
- Result enumUserDisallowed = Result.valueForString(example);
- example = "TIMED_OUT";
- Result enumTimedOut = Result.valueForString(example);
- example = "CANCEL_ROUTE";
- Result enumCancelRoute = Result.valueForString(example);
- example = "TRUNCATED_DATA";
- Result enumTruncatedData = Result.valueForString(example);
- example = "RETRY";
- Result enumRetry = Result.valueForString(example);
- example = "WARNINGS";
- Result enumWarnings = Result.valueForString(example);
- example = "SAVED";
- Result enumSaved = Result.valueForString(example);
- example = "INVALID_CERT";
- Result enumInvalidCert = Result.valueForString(example);
- example = "EXPIRED_CERT";
- Result enumExpiredCert = Result.valueForString(example);
- example = "RESUME_FAILED";
- Result enumResumeFailed = Result.valueForString(example);
- example = "DATA_NOT_AVAILABLE";
- Result enumDataNotAvailable = Result.valueForString(example);
- example = "READ_ONLY";
- Result enumReadOnly = Result.valueForString(example);
- example = "CORRUPTED_DATA";
- Result enumCorruptData = Result.valueForString(example);
- example = "ENCRYPTION_NEEDED";
- Result enumEncryptionRequired = Result.valueForString(example);
-
- assertNotNull("SUCCESS returned null", enumSuccess);
- assertNotNull("INVALID_DATA returned null", enumInvalidData);
- assertNotNull("UNSUPPORTED_REQUEST returned null", enumUnsupportedRequest);
- assertNotNull("OUT_OF_MEMORY returned null", enumOutOfMemory);
- assertNotNull("TOO_MANY_PENDING_REQUESTS returned null", enumTooManyPendingRequests);
- assertNotNull("CHAR_LIMIT_EXCEEDED returned null", enumCharLimitExceeded);
- assertNotNull("INVALID_ID returned null", enumInvalidId);
- assertNotNull("DUPLICATE_NAME returned null", enumDuplicateName);
- assertNotNull("TOO_MANY_APPLICATIONS returned null", enumTooManyApplications);
- assertNotNull("APPLICATION_REGISTERED_ALREADY returned null", enumApplicationRegisteredAlready);
- assertNotNull("UNSUPPORTED_VERSION returned null", enumUnsupportedVersion);
- assertNotNull("WRONG_LANGUAGE returned null", enumWrongLanguage);
- assertNotNull("APPLICATION_NOT_REGISTERED returned null", enumApplicationNotRegistered);
- assertNotNull("IN_USE returned null", enumInUse);
- assertNotNull("VEHICLE_DATA_NOT_ALLOWED returned null", enumVehicleDataNotAllowed);
- assertNotNull("VEHICLE_DATA_NOT_AVAILABLE returned null", enumVehicleDataNotAvailable);
- assertNotNull("REJECTED returned null", enumRejected);
- assertNotNull("ABORTED returned null", enumAborted);
- assertNotNull("IGNORED returned null", enumIgnored);
- assertNotNull("UNSUPPORTED_RESOURCE returned null", enumUnsupportedResource);
- assertNotNull("FILE_NOT_FOUND returned null", enumFileNotFound);
- assertNotNull("GENERIC_ERROR returned null", enumGenericError);
- assertNotNull("DISALLOWED returned null", enumDisallowed);
- assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
- assertNotNull("TIMED_OUT returned null", enumTimedOut);
- assertNotNull("CANCEL_ROUTE returned null", enumCancelRoute);
- assertNotNull("TRUNCATED_DATA returned null", enumTruncatedData);
- assertNotNull("RETRY returned null", enumRetry);
- assertNotNull("WARNINGS returned null", enumWarnings);
- assertNotNull("SAVED returned null", enumSaved);
- assertNotNull("INVALID_CERT returned null", enumInvalidCert);
- assertNotNull("EXPIRED_CERT returned null", enumExpiredCert);
- assertNotNull("RESUME_FAILED returned null", enumResumeFailed);
- assertNotNull("DATA_NOT_AVAILABLE returned null", enumDataNotAvailable);
- assertNotNull("READ_ONLY returned null", enumReadOnly);
- assertNotNull("CORRUPTED_DATA", enumCorruptData);
- assertNotNull("ENCRYPTION_NEEDED", enumEncryptionRequired);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "SUCCESS";
+ Result enumSuccess = Result.valueForString(example);
+ example = "INVALID_DATA";
+ Result enumInvalidData = Result.valueForString(example);
+ example = "UNSUPPORTED_REQUEST";
+ Result enumUnsupportedRequest = Result.valueForString(example);
+ example = "OUT_OF_MEMORY";
+ Result enumOutOfMemory = Result.valueForString(example);
+ example = "TOO_MANY_PENDING_REQUESTS";
+ Result enumTooManyPendingRequests = Result.valueForString(example);
+ example = "CHAR_LIMIT_EXCEEDED";
+ Result enumCharLimitExceeded = Result.valueForString(example);
+ example = "INVALID_ID";
+ Result enumInvalidId = Result.valueForString(example);
+ example = "DUPLICATE_NAME";
+ Result enumDuplicateName = Result.valueForString(example);
+ example = "TOO_MANY_APPLICATIONS";
+ Result enumTooManyApplications = Result.valueForString(example);
+ example = "APPLICATION_REGISTERED_ALREADY";
+ Result enumApplicationRegisteredAlready = Result.valueForString(example);
+ example = "UNSUPPORTED_VERSION";
+ Result enumUnsupportedVersion = Result.valueForString(example);
+ example = "WRONG_LANGUAGE";
+ Result enumWrongLanguage = Result.valueForString(example);
+ example = "APPLICATION_NOT_REGISTERED";
+ Result enumApplicationNotRegistered = Result.valueForString(example);
+ example = "IN_USE";
+ Result enumInUse = Result.valueForString(example);
+ example = "VEHICLE_DATA_NOT_ALLOWED";
+ Result enumVehicleDataNotAllowed = Result.valueForString(example);
+ example = "VEHICLE_DATA_NOT_AVAILABLE";
+ Result enumVehicleDataNotAvailable = Result.valueForString(example);
+ example = "REJECTED";
+ Result enumRejected = Result.valueForString(example);
+ example = "ABORTED";
+ Result enumAborted = Result.valueForString(example);
+ example = "IGNORED";
+ Result enumIgnored = Result.valueForString(example);
+ example = "UNSUPPORTED_RESOURCE";
+ Result enumUnsupportedResource = Result.valueForString(example);
+ example = "FILE_NOT_FOUND";
+ Result enumFileNotFound = Result.valueForString(example);
+ example = "GENERIC_ERROR";
+ Result enumGenericError = Result.valueForString(example);
+ example = "DISALLOWED";
+ Result enumDisallowed = Result.valueForString(example);
+ example = "USER_DISALLOWED";
+ Result enumUserDisallowed = Result.valueForString(example);
+ example = "TIMED_OUT";
+ Result enumTimedOut = Result.valueForString(example);
+ example = "CANCEL_ROUTE";
+ Result enumCancelRoute = Result.valueForString(example);
+ example = "TRUNCATED_DATA";
+ Result enumTruncatedData = Result.valueForString(example);
+ example = "RETRY";
+ Result enumRetry = Result.valueForString(example);
+ example = "WARNINGS";
+ Result enumWarnings = Result.valueForString(example);
+ example = "SAVED";
+ Result enumSaved = Result.valueForString(example);
+ example = "INVALID_CERT";
+ Result enumInvalidCert = Result.valueForString(example);
+ example = "EXPIRED_CERT";
+ Result enumExpiredCert = Result.valueForString(example);
+ example = "RESUME_FAILED";
+ Result enumResumeFailed = Result.valueForString(example);
+ example = "DATA_NOT_AVAILABLE";
+ Result enumDataNotAvailable = Result.valueForString(example);
+ example = "READ_ONLY";
+ Result enumReadOnly = Result.valueForString(example);
+ example = "CORRUPTED_DATA";
+ Result enumCorruptData = Result.valueForString(example);
+ example = "ENCRYPTION_NEEDED";
+ Result enumEncryptionRequired = Result.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "suCcesS";
- try {
- Result temp = Result.valueForString(example);
+ assertNotNull("SUCCESS returned null", enumSuccess);
+ assertNotNull("INVALID_DATA returned null", enumInvalidData);
+ assertNotNull("UNSUPPORTED_REQUEST returned null", enumUnsupportedRequest);
+ assertNotNull("OUT_OF_MEMORY returned null", enumOutOfMemory);
+ assertNotNull("TOO_MANY_PENDING_REQUESTS returned null", enumTooManyPendingRequests);
+ assertNotNull("CHAR_LIMIT_EXCEEDED returned null", enumCharLimitExceeded);
+ assertNotNull("INVALID_ID returned null", enumInvalidId);
+ assertNotNull("DUPLICATE_NAME returned null", enumDuplicateName);
+ assertNotNull("TOO_MANY_APPLICATIONS returned null", enumTooManyApplications);
+ assertNotNull("APPLICATION_REGISTERED_ALREADY returned null", enumApplicationRegisteredAlready);
+ assertNotNull("UNSUPPORTED_VERSION returned null", enumUnsupportedVersion);
+ assertNotNull("WRONG_LANGUAGE returned null", enumWrongLanguage);
+ assertNotNull("APPLICATION_NOT_REGISTERED returned null", enumApplicationNotRegistered);
+ assertNotNull("IN_USE returned null", enumInUse);
+ assertNotNull("VEHICLE_DATA_NOT_ALLOWED returned null", enumVehicleDataNotAllowed);
+ assertNotNull("VEHICLE_DATA_NOT_AVAILABLE returned null", enumVehicleDataNotAvailable);
+ assertNotNull("REJECTED returned null", enumRejected);
+ assertNotNull("ABORTED returned null", enumAborted);
+ assertNotNull("IGNORED returned null", enumIgnored);
+ assertNotNull("UNSUPPORTED_RESOURCE returned null", enumUnsupportedResource);
+ assertNotNull("FILE_NOT_FOUND returned null", enumFileNotFound);
+ assertNotNull("GENERIC_ERROR returned null", enumGenericError);
+ assertNotNull("DISALLOWED returned null", enumDisallowed);
+ assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
+ assertNotNull("TIMED_OUT returned null", enumTimedOut);
+ assertNotNull("CANCEL_ROUTE returned null", enumCancelRoute);
+ assertNotNull("TRUNCATED_DATA returned null", enumTruncatedData);
+ assertNotNull("RETRY returned null", enumRetry);
+ assertNotNull("WARNINGS returned null", enumWarnings);
+ assertNotNull("SAVED returned null", enumSaved);
+ assertNotNull("INVALID_CERT returned null", enumInvalidCert);
+ assertNotNull("EXPIRED_CERT returned null", enumExpiredCert);
+ assertNotNull("RESUME_FAILED returned null", enumResumeFailed);
+ assertNotNull("DATA_NOT_AVAILABLE returned null", enumDataNotAvailable);
+ assertNotNull("READ_ONLY returned null", enumReadOnly);
+ assertNotNull("CORRUPTED_DATA", enumCorruptData);
+ assertNotNull("ENCRYPTION_NEEDED", enumEncryptionRequired);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "suCcesS";
+ try {
+ Result temp = Result.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- Result temp = Result.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ Result temp = Result.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of Result.
- */
- public void testListEnum() {
- List<Result> enumValueList = Arrays.asList(Result.values());
+ /**
+ * Verifies the possible enum values of Result.
+ */
+ public void testListEnum() {
+ List<Result> enumValueList = Arrays.asList(Result.values());
- List<Result> enumTestList = new ArrayList<Result>();
- enumTestList.add(Result.SUCCESS);
- enumTestList.add(Result.INVALID_DATA);
- enumTestList.add(Result.UNSUPPORTED_REQUEST);
- enumTestList.add(Result.OUT_OF_MEMORY);
- enumTestList.add(Result.TOO_MANY_PENDING_REQUESTS);
- enumTestList.add(Result.CHAR_LIMIT_EXCEEDED);
- enumTestList.add(Result.INVALID_ID);
- enumTestList.add(Result.DUPLICATE_NAME);
- enumTestList.add(Result.TOO_MANY_APPLICATIONS);
- enumTestList.add(Result.APPLICATION_REGISTERED_ALREADY);
- enumTestList.add(Result.UNSUPPORTED_VERSION);
- enumTestList.add(Result.WRONG_LANGUAGE);
- enumTestList.add(Result.APPLICATION_NOT_REGISTERED);
- enumTestList.add(Result.IN_USE);
- enumTestList.add(Result.VEHICLE_DATA_NOT_ALLOWED);
- enumTestList.add(Result.VEHICLE_DATA_NOT_AVAILABLE);
- enumTestList.add(Result.REJECTED);
- enumTestList.add(Result.ABORTED);
- enumTestList.add(Result.IGNORED);
- enumTestList.add(Result.UNSUPPORTED_RESOURCE);
- enumTestList.add(Result.FILE_NOT_FOUND);
- enumTestList.add(Result.GENERIC_ERROR);
- enumTestList.add(Result.DISALLOWED);
- enumTestList.add(Result.USER_DISALLOWED);
- enumTestList.add(Result.TIMED_OUT);
- enumTestList.add(Result.CANCEL_ROUTE);
- enumTestList.add(Result.TRUNCATED_DATA);
- enumTestList.add(Result.RETRY);
- enumTestList.add(Result.WARNINGS);
- enumTestList.add(Result.SAVED);
- enumTestList.add(Result.INVALID_CERT);
- enumTestList.add(Result.EXPIRED_CERT);
- enumTestList.add(Result.RESUME_FAILED);
- enumTestList.add(Result.DATA_NOT_AVAILABLE);
- enumTestList.add(Result.READ_ONLY);
- enumTestList.add(Result.CORRUPTED_DATA);
- enumTestList.add(Result.ENCRYPTION_NEEDED);
+ List<Result> enumTestList = new ArrayList<Result>();
+ enumTestList.add(Result.SUCCESS);
+ enumTestList.add(Result.INVALID_DATA);
+ enumTestList.add(Result.UNSUPPORTED_REQUEST);
+ enumTestList.add(Result.OUT_OF_MEMORY);
+ enumTestList.add(Result.TOO_MANY_PENDING_REQUESTS);
+ enumTestList.add(Result.CHAR_LIMIT_EXCEEDED);
+ enumTestList.add(Result.INVALID_ID);
+ enumTestList.add(Result.DUPLICATE_NAME);
+ enumTestList.add(Result.TOO_MANY_APPLICATIONS);
+ enumTestList.add(Result.APPLICATION_REGISTERED_ALREADY);
+ enumTestList.add(Result.UNSUPPORTED_VERSION);
+ enumTestList.add(Result.WRONG_LANGUAGE);
+ enumTestList.add(Result.APPLICATION_NOT_REGISTERED);
+ enumTestList.add(Result.IN_USE);
+ enumTestList.add(Result.VEHICLE_DATA_NOT_ALLOWED);
+ enumTestList.add(Result.VEHICLE_DATA_NOT_AVAILABLE);
+ enumTestList.add(Result.REJECTED);
+ enumTestList.add(Result.ABORTED);
+ enumTestList.add(Result.IGNORED);
+ enumTestList.add(Result.UNSUPPORTED_RESOURCE);
+ enumTestList.add(Result.FILE_NOT_FOUND);
+ enumTestList.add(Result.GENERIC_ERROR);
+ enumTestList.add(Result.DISALLOWED);
+ enumTestList.add(Result.USER_DISALLOWED);
+ enumTestList.add(Result.TIMED_OUT);
+ enumTestList.add(Result.CANCEL_ROUTE);
+ enumTestList.add(Result.TRUNCATED_DATA);
+ enumTestList.add(Result.RETRY);
+ enumTestList.add(Result.WARNINGS);
+ enumTestList.add(Result.SAVED);
+ enumTestList.add(Result.INVALID_CERT);
+ enumTestList.add(Result.EXPIRED_CERT);
+ enumTestList.add(Result.RESUME_FAILED);
+ enumTestList.add(Result.DATA_NOT_AVAILABLE);
+ enumTestList.add(Result.READ_ONLY);
+ enumTestList.add(Result.CORRUPTED_DATA);
+ enumTestList.add(Result.ENCRYPTION_NEEDED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SamplingRateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SamplingRateTests.java
index 7a73b47f8..099a8668b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SamplingRateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SamplingRateTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SamplingRate}
*/
public class SamplingRateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "8KHZ";
- SamplingRate enum8Khz = SamplingRate.valueForString(example);
- example = "16KHZ";
- SamplingRate enum16Khz = SamplingRate.valueForString(example);
- example = "22KHZ";
- SamplingRate enum22Khz = SamplingRate.valueForString(example);
- example = "44KHZ";
- SamplingRate enum44Khz = SamplingRate.valueForString(example);
-
- assertNotNull("8KHZ returned null", enum8Khz);
- assertNotNull("16KHZ returned null", enum16Khz);
- assertNotNull("22KHZ returned null", enum22Khz);
- assertNotNull("44KHZ returned null", enum44Khz);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "8KHZ";
+ SamplingRate enum8Khz = SamplingRate.valueForString(example);
+ example = "16KHZ";
+ SamplingRate enum16Khz = SamplingRate.valueForString(example);
+ example = "22KHZ";
+ SamplingRate enum22Khz = SamplingRate.valueForString(example);
+ example = "44KHZ";
+ SamplingRate enum44Khz = SamplingRate.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "8kHz";
- try {
- SamplingRate temp = SamplingRate.valueForString(example);
+ assertNotNull("8KHZ returned null", enum8Khz);
+ assertNotNull("16KHZ returned null", enum16Khz);
+ assertNotNull("22KHZ returned null", enum22Khz);
+ assertNotNull("44KHZ returned null", enum44Khz);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "8kHz";
+ try {
+ SamplingRate temp = SamplingRate.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SamplingRate temp = SamplingRate.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SamplingRate temp = SamplingRate.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of SamplingRate.
+ */
+ public void testListEnum() {
+ List<SamplingRate> enumValueList = Arrays.asList(SamplingRate.values());
- /**
- * Verifies the possible enum values of SamplingRate.
- */
- public void testListEnum() {
- List<SamplingRate> enumValueList = Arrays.asList(SamplingRate.values());
+ List<SamplingRate> enumTestList = new ArrayList<SamplingRate>();
+ enumTestList.add(SamplingRate._8KHZ);
+ enumTestList.add(SamplingRate._16KHZ);
+ enumTestList.add(SamplingRate._22KHZ);
+ enumTestList.add(SamplingRate._44KHZ);
- List<SamplingRate> enumTestList = new ArrayList<SamplingRate>();
- enumTestList.add(SamplingRate._8KHZ);
- enumTestList.add(SamplingRate._16KHZ);
- enumTestList.add(SamplingRate._22KHZ);
- enumTestList.add(SamplingRate._44KHZ);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SdlDisconnectedReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
index c55b9fc21..39a5f07c8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
@@ -11,171 +11,169 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason}
*/
public class SdlDisconnectedReasonTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "USER_EXIT";
- SdlDisconnectedReason enumUserExit = SdlDisconnectedReason.valueForString(example);
- example = "IGNITION_OFF";
- SdlDisconnectedReason enumIgnitionOff = SdlDisconnectedReason.valueForString(example);
- example = "BLUETOOTH_OFF";
- SdlDisconnectedReason enumBluetoothOff = SdlDisconnectedReason.valueForString(example);
- example = "USB_DISCONNECTED";
- SdlDisconnectedReason enumUsbDisconnected = SdlDisconnectedReason.valueForString(example);
- example = "REQUEST_WHILE_IN_NONE_HMI_LEVEL";
- SdlDisconnectedReason enumRequestWhileInNoneHmiLevel = SdlDisconnectedReason.valueForString(example);
- example = "TOO_MANY_REQUESTS";
- SdlDisconnectedReason enumTooManyRequests = SdlDisconnectedReason.valueForString(example);
- example = "DRIVER_DISTRACTION_VIOLATION";
- SdlDisconnectedReason enumDriverDistractionViolation = SdlDisconnectedReason.valueForString(example);
- example = "LANGUAGE_CHANGE";
- SdlDisconnectedReason enumLanuguageChange = SdlDisconnectedReason.valueForString(example);
- example = "MASTER_RESET";
- SdlDisconnectedReason enumMasterReset = SdlDisconnectedReason.valueForString(example);
- example = "FACTORY_DEFAULTS";
- SdlDisconnectedReason enumFactoryDefaults = SdlDisconnectedReason.valueForString(example);
- example = "TRANSPORT_ERROR";
- SdlDisconnectedReason enumTransportError = SdlDisconnectedReason.valueForString(example);
- example = "APPLICATION_REQUESTED_DISCONNECT";
- SdlDisconnectedReason enumApplicationRequestedDisconnect = SdlDisconnectedReason.valueForString(example);
- example = "DEFAULT";
- SdlDisconnectedReason enumDefault = SdlDisconnectedReason.valueForString(example);
- example = "TRANSPORT_DISCONNECT";
- SdlDisconnectedReason enumTransportDisconnect = SdlDisconnectedReason.valueForString(example);
- example = "HB_TIMEOUT";
- SdlDisconnectedReason enumHbTimeout = SdlDisconnectedReason.valueForString(example);
- example = "BLUETOOTH_DISABLED";
- SdlDisconnectedReason enumBluetoothDisabled = SdlDisconnectedReason.valueForString(example);
- example = "BLUETOOTH_ADAPTER_ERROR";
- SdlDisconnectedReason enumBluetoothAdapterError = SdlDisconnectedReason.valueForString(example);
- example = "SDL_REGISTRATION_ERROR";
- SdlDisconnectedReason enumSdlRegistrationError = SdlDisconnectedReason.valueForString(example);
- example = "APP_INTERFACE_UNREG";
- SdlDisconnectedReason enumAppInterfaceUnreg = SdlDisconnectedReason.valueForString(example);
- example = "GENERIC_ERROR";
- SdlDisconnectedReason enumGenericError = SdlDisconnectedReason.valueForString(example);
- example = "LEGACY_BLUETOOTH_MODE_ENABLED";
- SdlDisconnectedReason enumLegacyMode = SdlDisconnectedReason.valueForString(example);
- example = "RPC_SESSION_ENDED";
- SdlDisconnectedReason enumRpcSessionEnded = SdlDisconnectedReason.valueForString(example);
- example = "RESOURCE_CONSTRAINT";
- SdlDisconnectedReason resourceConstraint = SdlDisconnectedReason.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "USER_EXIT";
+ SdlDisconnectedReason enumUserExit = SdlDisconnectedReason.valueForString(example);
+ example = "IGNITION_OFF";
+ SdlDisconnectedReason enumIgnitionOff = SdlDisconnectedReason.valueForString(example);
+ example = "BLUETOOTH_OFF";
+ SdlDisconnectedReason enumBluetoothOff = SdlDisconnectedReason.valueForString(example);
+ example = "USB_DISCONNECTED";
+ SdlDisconnectedReason enumUsbDisconnected = SdlDisconnectedReason.valueForString(example);
+ example = "REQUEST_WHILE_IN_NONE_HMI_LEVEL";
+ SdlDisconnectedReason enumRequestWhileInNoneHmiLevel = SdlDisconnectedReason.valueForString(example);
+ example = "TOO_MANY_REQUESTS";
+ SdlDisconnectedReason enumTooManyRequests = SdlDisconnectedReason.valueForString(example);
+ example = "DRIVER_DISTRACTION_VIOLATION";
+ SdlDisconnectedReason enumDriverDistractionViolation = SdlDisconnectedReason.valueForString(example);
+ example = "LANGUAGE_CHANGE";
+ SdlDisconnectedReason enumLanuguageChange = SdlDisconnectedReason.valueForString(example);
+ example = "MASTER_RESET";
+ SdlDisconnectedReason enumMasterReset = SdlDisconnectedReason.valueForString(example);
+ example = "FACTORY_DEFAULTS";
+ SdlDisconnectedReason enumFactoryDefaults = SdlDisconnectedReason.valueForString(example);
+ example = "TRANSPORT_ERROR";
+ SdlDisconnectedReason enumTransportError = SdlDisconnectedReason.valueForString(example);
+ example = "APPLICATION_REQUESTED_DISCONNECT";
+ SdlDisconnectedReason enumApplicationRequestedDisconnect = SdlDisconnectedReason.valueForString(example);
+ example = "DEFAULT";
+ SdlDisconnectedReason enumDefault = SdlDisconnectedReason.valueForString(example);
+ example = "TRANSPORT_DISCONNECT";
+ SdlDisconnectedReason enumTransportDisconnect = SdlDisconnectedReason.valueForString(example);
+ example = "HB_TIMEOUT";
+ SdlDisconnectedReason enumHbTimeout = SdlDisconnectedReason.valueForString(example);
+ example = "BLUETOOTH_DISABLED";
+ SdlDisconnectedReason enumBluetoothDisabled = SdlDisconnectedReason.valueForString(example);
+ example = "BLUETOOTH_ADAPTER_ERROR";
+ SdlDisconnectedReason enumBluetoothAdapterError = SdlDisconnectedReason.valueForString(example);
+ example = "SDL_REGISTRATION_ERROR";
+ SdlDisconnectedReason enumSdlRegistrationError = SdlDisconnectedReason.valueForString(example);
+ example = "APP_INTERFACE_UNREG";
+ SdlDisconnectedReason enumAppInterfaceUnreg = SdlDisconnectedReason.valueForString(example);
+ example = "GENERIC_ERROR";
+ SdlDisconnectedReason enumGenericError = SdlDisconnectedReason.valueForString(example);
+ example = "LEGACY_BLUETOOTH_MODE_ENABLED";
+ SdlDisconnectedReason enumLegacyMode = SdlDisconnectedReason.valueForString(example);
+ example = "RPC_SESSION_ENDED";
+ SdlDisconnectedReason enumRpcSessionEnded = SdlDisconnectedReason.valueForString(example);
+ example = "RESOURCE_CONSTRAINT";
+ SdlDisconnectedReason resourceConstraint = SdlDisconnectedReason.valueForString(example);
- assertNotNull("USER_EXIT returned null", enumUserExit);
- assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
- assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
- assertNotNull("USB_DISCONNECTED returned null", enumUsbDisconnected);
- assertNotNull("REQUEST_WHILE_IN_NONE_HMI_LEVEL returned null", enumRequestWhileInNoneHmiLevel);
- assertNotNull("TOO_MANY_REQUESTS returned null", enumTooManyRequests);
- assertNotNull("DRIVER_DISTRACTION_VIOLATION returned null", enumDriverDistractionViolation);
- assertNotNull("LANGUAGE_CHANGE returned null", enumLanuguageChange);
- assertNotNull("MASTER_RESET returned null", enumMasterReset);
- assertNotNull("FACTORY_DEFAULTS returned null", enumFactoryDefaults);
- assertNotNull("TRANSPORT_ERROR returned null", enumTransportError);
- assertNotNull("APPLICATION_REQUESTED_DISCONNECT returned null", enumApplicationRequestedDisconnect);
- assertNotNull("DEFAULT returned null", enumDefault);
- assertNotNull("TRANSPORT_DISCONNECT returned null", enumTransportDisconnect);
- assertNotNull("HB_TIMEOUT returned null", enumHbTimeout);
- assertNotNull("BLUETOOTH_DISABLED returned null", enumBluetoothDisabled);
- assertNotNull("BLUETOOTH_ADAPTER_ERROR returned null", enumBluetoothAdapterError);
- assertNotNull("SDL_REGISTRATION_ERROR returned null", enumSdlRegistrationError);
- assertNotNull("APP_INTERFACE_UNREG returned null", enumAppInterfaceUnreg);
- assertNotNull("GENERIC_ERROR returned null", enumGenericError);
- assertNotNull("LEGACY_BLUETOOTH_MODE_ENABLED returned null", enumLegacyMode);
- assertNotNull("RPC_SESSION_ENDED returned null", enumRpcSessionEnded);
- assertNotNull("RESOURCE_CONSTRAINT returned null", resourceConstraint);
- }
+ assertNotNull("USER_EXIT returned null", enumUserExit);
+ assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
+ assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
+ assertNotNull("USB_DISCONNECTED returned null", enumUsbDisconnected);
+ assertNotNull("REQUEST_WHILE_IN_NONE_HMI_LEVEL returned null", enumRequestWhileInNoneHmiLevel);
+ assertNotNull("TOO_MANY_REQUESTS returned null", enumTooManyRequests);
+ assertNotNull("DRIVER_DISTRACTION_VIOLATION returned null", enumDriverDistractionViolation);
+ assertNotNull("LANGUAGE_CHANGE returned null", enumLanuguageChange);
+ assertNotNull("MASTER_RESET returned null", enumMasterReset);
+ assertNotNull("FACTORY_DEFAULTS returned null", enumFactoryDefaults);
+ assertNotNull("TRANSPORT_ERROR returned null", enumTransportError);
+ assertNotNull("APPLICATION_REQUESTED_DISCONNECT returned null", enumApplicationRequestedDisconnect);
+ assertNotNull("DEFAULT returned null", enumDefault);
+ assertNotNull("TRANSPORT_DISCONNECT returned null", enumTransportDisconnect);
+ assertNotNull("HB_TIMEOUT returned null", enumHbTimeout);
+ assertNotNull("BLUETOOTH_DISABLED returned null", enumBluetoothDisabled);
+ assertNotNull("BLUETOOTH_ADAPTER_ERROR returned null", enumBluetoothAdapterError);
+ assertNotNull("SDL_REGISTRATION_ERROR returned null", enumSdlRegistrationError);
+ assertNotNull("APP_INTERFACE_UNREG returned null", enumAppInterfaceUnreg);
+ assertNotNull("GENERIC_ERROR returned null", enumGenericError);
+ assertNotNull("LEGACY_BLUETOOTH_MODE_ENABLED returned null", enumLegacyMode);
+ assertNotNull("RPC_SESSION_ENDED returned null", enumRpcSessionEnded);
+ assertNotNull("RESOURCE_CONSTRAINT returned null", resourceConstraint);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "uSer_ExiT";
- try {
- SdlDisconnectedReason temp = SdlDisconnectedReason.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "uSer_ExiT";
+ try {
+ SdlDisconnectedReason temp = SdlDisconnectedReason.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SdlDisconnectedReason temp = SdlDisconnectedReason.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SdlDisconnectedReason temp = SdlDisconnectedReason.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of SdlDisconnectedReason.
- */
- public void testListEnum() {
- List<SdlDisconnectedReason> enumValueList = Arrays.asList(SdlDisconnectedReason.values());
+ /**
+ * Verifies the possible enum values of SdlDisconnectedReason.
+ */
+ public void testListEnum() {
+ List<SdlDisconnectedReason> enumValueList = Arrays.asList(SdlDisconnectedReason.values());
- List<SdlDisconnectedReason> enumTestList = new ArrayList<SdlDisconnectedReason>();
- enumTestList.add(SdlDisconnectedReason.USER_EXIT);
- enumTestList.add(SdlDisconnectedReason.IGNITION_OFF);
- enumTestList.add(SdlDisconnectedReason.BLUETOOTH_OFF);
- enumTestList.add(SdlDisconnectedReason.USB_DISCONNECTED);
- enumTestList.add(SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL);
- enumTestList.add(SdlDisconnectedReason.TOO_MANY_REQUESTS);
- enumTestList.add(SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION);
- enumTestList.add(SdlDisconnectedReason.LANGUAGE_CHANGE);
- enumTestList.add(SdlDisconnectedReason.MASTER_RESET);
- enumTestList.add(SdlDisconnectedReason.FACTORY_DEFAULTS);
- enumTestList.add(SdlDisconnectedReason.TRANSPORT_ERROR);
- enumTestList.add(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
- enumTestList.add(SdlDisconnectedReason.DEFAULT);
- enumTestList.add(SdlDisconnectedReason.TRANSPORT_DISCONNECT);
- enumTestList.add(SdlDisconnectedReason.HB_TIMEOUT);
- enumTestList.add(SdlDisconnectedReason.BLUETOOTH_DISABLED);
- enumTestList.add(SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
- enumTestList.add(SdlDisconnectedReason.SDL_REGISTRATION_ERROR);
- enumTestList.add(SdlDisconnectedReason.APP_INTERFACE_UNREG);
- enumTestList.add(SdlDisconnectedReason.GENERIC_ERROR);
- enumTestList.add(SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED);
- enumTestList.add(SdlDisconnectedReason.RPC_SESSION_ENDED);
- enumTestList.add(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
- enumTestList.add(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
- enumTestList.add(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
- enumTestList.add(SdlDisconnectedReason.RESOURCE_CONSTRAINT);
+ List<SdlDisconnectedReason> enumTestList = new ArrayList<SdlDisconnectedReason>();
+ enumTestList.add(SdlDisconnectedReason.USER_EXIT);
+ enumTestList.add(SdlDisconnectedReason.IGNITION_OFF);
+ enumTestList.add(SdlDisconnectedReason.BLUETOOTH_OFF);
+ enumTestList.add(SdlDisconnectedReason.USB_DISCONNECTED);
+ enumTestList.add(SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL);
+ enumTestList.add(SdlDisconnectedReason.TOO_MANY_REQUESTS);
+ enumTestList.add(SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION);
+ enumTestList.add(SdlDisconnectedReason.LANGUAGE_CHANGE);
+ enumTestList.add(SdlDisconnectedReason.MASTER_RESET);
+ enumTestList.add(SdlDisconnectedReason.FACTORY_DEFAULTS);
+ enumTestList.add(SdlDisconnectedReason.TRANSPORT_ERROR);
+ enumTestList.add(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
+ enumTestList.add(SdlDisconnectedReason.DEFAULT);
+ enumTestList.add(SdlDisconnectedReason.TRANSPORT_DISCONNECT);
+ enumTestList.add(SdlDisconnectedReason.HB_TIMEOUT);
+ enumTestList.add(SdlDisconnectedReason.BLUETOOTH_DISABLED);
+ enumTestList.add(SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
+ enumTestList.add(SdlDisconnectedReason.SDL_REGISTRATION_ERROR);
+ enumTestList.add(SdlDisconnectedReason.APP_INTERFACE_UNREG);
+ enumTestList.add(SdlDisconnectedReason.GENERIC_ERROR);
+ enumTestList.add(SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED);
+ enumTestList.add(SdlDisconnectedReason.RPC_SESSION_ENDED);
+ enumTestList.add(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
+ enumTestList.add(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
+ enumTestList.add(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
+ enumTestList.add(SdlDisconnectedReason.RESOURCE_CONSTRAINT);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+
+ /**
+ * Verifies the valid returns of the conversion method,
+ * {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason#convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason)}
+ */
+ public void testConvertMethod() {
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.DEFAULT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.BLUETOOTH_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.BLUETOOTH_OFF));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.FACTORY_DEFAULTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.IGNITION_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.IGNITION_OFF));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.LANGUAGE_CHANGE, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.MASTER_RESET, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.MASTER_RESET));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.RESOURCE_CONSTRAINT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT));
+ assertNull(TestValues.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null));
+ }
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
-
- /**
- * Verifies the valid returns of the conversion method,
- * {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason#convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason)}
- */
- public void testConvertMethod () {
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.DEFAULT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.BLUETOOTH_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.BLUETOOTH_OFF));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.DRIVER_DISTRACTION_VIOLATION));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.FACTORY_DEFAULTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.IGNITION_OFF, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.IGNITION_OFF));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.LANGUAGE_CHANGE, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.MASTER_RESET, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.MASTER_RESET));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT));
- assertEquals(TestValues.MATCH, SdlDisconnectedReason.RESOURCE_CONSTRAINT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT));
- assertNull(TestValues.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null));
- }
-
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SeatMemoryActionTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SeatMemoryActionTypeTests.java
index e2cc0294a..5b296a85f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SeatMemoryActionTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SeatMemoryActionTypeTests.java
@@ -14,60 +14,60 @@ import java.util.List;
*/
public class SeatMemoryActionTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "SAVE";
- SeatMemoryActionType enumSave = SeatMemoryActionType.valueForString(example);
- example = "RESTORE";
- SeatMemoryActionType enumRestore = SeatMemoryActionType.valueForString(example);
- example = "NONE";
- SeatMemoryActionType enumNone = SeatMemoryActionType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "SAVE";
+ SeatMemoryActionType enumSave = SeatMemoryActionType.valueForString(example);
+ example = "RESTORE";
+ SeatMemoryActionType enumRestore = SeatMemoryActionType.valueForString(example);
+ example = "NONE";
+ SeatMemoryActionType enumNone = SeatMemoryActionType.valueForString(example);
- assertNotNull("SAVE returned null", enumSave);
- assertNotNull("RESTORE returned null", enumRestore);
- assertNotNull("NONE returned null", enumNone);
- }
+ assertNotNull("SAVE returned null", enumSave);
+ assertNotNull("RESTORE returned null", enumRestore);
+ assertNotNull("NONE returned null", enumNone);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "sAVE";
- try {
- SeatMemoryActionType temp = SeatMemoryActionType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "sAVE";
+ try {
+ SeatMemoryActionType temp = SeatMemoryActionType.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 {
- SeatMemoryActionType temp = SeatMemoryActionType.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SeatMemoryActionType temp = SeatMemoryActionType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of SeatMemoryActionType.
- */
- public void testListEnum() {
- List<SeatMemoryActionType> enumValueList = Arrays.asList(SeatMemoryActionType.values());
+ /**
+ * Verifies the possible enum values of SeatMemoryActionType.
+ */
+ public void testListEnum() {
+ List<SeatMemoryActionType> enumValueList = Arrays.asList(SeatMemoryActionType.values());
- List<SeatMemoryActionType> enumTestList = new ArrayList<SeatMemoryActionType>();
- enumTestList.add(SeatMemoryActionType.SAVE);
- enumTestList.add(SeatMemoryActionType.RESTORE);
- enumTestList.add(SeatMemoryActionType.NONE);
+ List<SeatMemoryActionType> enumTestList = new ArrayList<SeatMemoryActionType>();
+ enumTestList.add(SeatMemoryActionType.SAVE);
+ enumTestList.add(SeatMemoryActionType.RESTORE);
+ enumTestList.add(SeatMemoryActionType.NONE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/ServiceUpdateReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
index f2484ff9e..670e24909 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java
@@ -14,71 +14,69 @@ import java.util.List;
*/
public class ServiceUpdateReasonTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "PUBLISHED";
- ServiceUpdateReason enumPublished = ServiceUpdateReason.valueForString(example);
- example = "REMOVED";
- ServiceUpdateReason enumRemoved = ServiceUpdateReason.valueForString(example);
- example = "ACTIVATED";
- ServiceUpdateReason enumActivated = ServiceUpdateReason.valueForString(example);
- example = "DEACTIVATED";
- ServiceUpdateReason enumDeactivated = ServiceUpdateReason.valueForString(example);
- example = "MANIFEST_UPDATE";
- ServiceUpdateReason enumManifestUpdate = ServiceUpdateReason.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "PUBLISHED";
+ ServiceUpdateReason enumPublished = ServiceUpdateReason.valueForString(example);
+ example = "REMOVED";
+ ServiceUpdateReason enumRemoved = ServiceUpdateReason.valueForString(example);
+ example = "ACTIVATED";
+ ServiceUpdateReason enumActivated = ServiceUpdateReason.valueForString(example);
+ example = "DEACTIVATED";
+ ServiceUpdateReason enumDeactivated = ServiceUpdateReason.valueForString(example);
+ example = "MANIFEST_UPDATE";
+ ServiceUpdateReason enumManifestUpdate = ServiceUpdateReason.valueForString(example);
- assertNotNull("PUBLISHED returned null", enumPublished);
- assertNotNull("REMOVED returned null", enumRemoved);
- assertNotNull("ACTIVATED returned null", enumActivated);
- assertNotNull("DEACTIVATED returned null", enumDeactivated);
- assertNotNull("MANIFEST_UPDATE returned null", enumManifestUpdate);
- }
+ assertNotNull("PUBLISHED returned null", enumPublished);
+ assertNotNull("REMOVED returned null", enumRemoved);
+ assertNotNull("ACTIVATED returned null", enumActivated);
+ assertNotNull("DEACTIVATED returned null", enumDeactivated);
+ assertNotNull("MANIFEST_UPDATE returned null", enumManifestUpdate);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "HalFActIvAted";
- try {
- ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "HalFActIvAted";
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.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 {
- ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of ServiceUpdateReason.
- */
- public void testListEnum() {
- List<ServiceUpdateReason> enumValueList = Arrays.asList(ServiceUpdateReason.values());
+ /**
+ * Verifies the possible enum values of ServiceUpdateReason.
+ */
+ public void testListEnum() {
+ List<ServiceUpdateReason> enumValueList = Arrays.asList(ServiceUpdateReason.values());
- List<ServiceUpdateReason> enumTestList = new ArrayList<>();
- enumTestList.add(ServiceUpdateReason.MANIFEST_UPDATE);
- enumTestList.add(ServiceUpdateReason.ACTIVATED);
- enumTestList.add(ServiceUpdateReason.DEACTIVATED);
- enumTestList.add(ServiceUpdateReason.PUBLISHED);
- enumTestList.add(ServiceUpdateReason.REMOVED);
+ List<ServiceUpdateReason> enumTestList = new ArrayList<>();
+ enumTestList.add(ServiceUpdateReason.MANIFEST_UPDATE);
+ enumTestList.add(ServiceUpdateReason.ACTIVATED);
+ enumTestList.add(ServiceUpdateReason.DEACTIVATED);
+ enumTestList.add(ServiceUpdateReason.PUBLISHED);
+ enumTestList.add(ServiceUpdateReason.REMOVED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SoftButtonTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SoftButtonTypeTests.java
index c41e9351a..dffae494a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SoftButtonTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SoftButtonTypeTests.java
@@ -9,68 +9,66 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SoftButtonType}
*/
public class SoftButtonTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "TEXT";
- SoftButtonType enumText = SoftButtonType.valueForString(example);
- example = "IMAGE";
- SoftButtonType enumImage = SoftButtonType.valueForString(example);
- example = "BOTH";
- SoftButtonType enumBoth = SoftButtonType.valueForString(example);
-
- assertNotNull("TEXT returned null", enumText);
- assertNotNull("IMAGE returned null", enumImage);
- assertNotNull("BOTH returned null", enumBoth);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TEXT";
+ SoftButtonType enumText = SoftButtonType.valueForString(example);
+ example = "IMAGE";
+ SoftButtonType enumImage = SoftButtonType.valueForString(example);
+ example = "BOTH";
+ SoftButtonType enumBoth = SoftButtonType.valueForString(example);
+ assertNotNull("TEXT returned null", enumText);
+ assertNotNull("IMAGE returned null", enumImage);
+ assertNotNull("BOTH returned null", enumBoth);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "teXT";
- try {
- SoftButtonType temp = SoftButtonType.valueForString(example);
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "teXT";
+ try {
+ SoftButtonType temp = SoftButtonType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SoftButtonType temp = SoftButtonType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SoftButtonType temp = SoftButtonType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of SoftButtonType.
+ */
+ public void testListEnum() {
+ List<SoftButtonType> enumValueList = Arrays.asList(SoftButtonType.values());
- /**
- * Verifies the possible enum values of SoftButtonType.
- */
- public void testListEnum() {
- List<SoftButtonType> enumValueList = Arrays.asList(SoftButtonType.values());
+ List<SoftButtonType> enumTestList = new ArrayList<SoftButtonType>();
+ enumTestList.add(SoftButtonType.SBT_TEXT);
+ enumTestList.add(SoftButtonType.SBT_IMAGE);
+ enumTestList.add(SoftButtonType.SBT_BOTH);
- List<SoftButtonType> enumTestList = new ArrayList<SoftButtonType>();
- enumTestList.add(SoftButtonType.SBT_TEXT);
- enumTestList.add(SoftButtonType.SBT_IMAGE);
- enumTestList.add(SoftButtonType.SBT_BOTH);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SpeechCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SpeechCapabilitiesTests.java
index d2da4699b..33170ea2f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SpeechCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SpeechCapabilitiesTests.java
@@ -9,76 +9,74 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities}
*/
public class SpeechCapabilitiesTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "TEXT";
- SpeechCapabilities enumText = SpeechCapabilities.valueForString(example);
- example = "SAPI_PHONEMES";
- SpeechCapabilities enumSapiPhonemes = SpeechCapabilities.valueForString(example);
- example = "LHPLUS_PHONEMES";
- SpeechCapabilities enumLhplusPhonemes = SpeechCapabilities.valueForString(example);
- example = "PRE_RECORDED";
- SpeechCapabilities enumPreRecorded = SpeechCapabilities.valueForString(example);
- example = "SILENCE";
- SpeechCapabilities enumSilence = SpeechCapabilities.valueForString(example);
-
- assertNotNull("TEXT returned null", enumText);
- assertNotNull("SAPI_PHONEMES returned null", enumSapiPhonemes);
- assertNotNull("LHPLUS_PHONEMES returned null", enumLhplusPhonemes);
- assertNotNull("PRE_RECORDED returned null", enumPreRecorded);
- assertNotNull("SILENCE returned null", enumSilence);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "TEXT";
+ SpeechCapabilities enumText = SpeechCapabilities.valueForString(example);
+ example = "SAPI_PHONEMES";
+ SpeechCapabilities enumSapiPhonemes = SpeechCapabilities.valueForString(example);
+ example = "LHPLUS_PHONEMES";
+ SpeechCapabilities enumLhplusPhonemes = SpeechCapabilities.valueForString(example);
+ example = "PRE_RECORDED";
+ SpeechCapabilities enumPreRecorded = SpeechCapabilities.valueForString(example);
+ example = "SILENCE";
+ SpeechCapabilities enumSilence = SpeechCapabilities.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "teXT";
- try {
- SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
+ assertNotNull("TEXT returned null", enumText);
+ assertNotNull("SAPI_PHONEMES returned null", enumSapiPhonemes);
+ assertNotNull("LHPLUS_PHONEMES returned null", enumLhplusPhonemes);
+ assertNotNull("PRE_RECORDED returned null", enumPreRecorded);
+ assertNotNull("SILENCE returned null", enumSilence);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "teXT";
+ try {
+ SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of SpeechCapabilities.
- */
- public void testListEnum() {
- List<SpeechCapabilities> enumValueList = Arrays.asList(SpeechCapabilities.values());
+ /**
+ * Verifies the possible enum values of SpeechCapabilities.
+ */
+ public void testListEnum() {
+ List<SpeechCapabilities> enumValueList = Arrays.asList(SpeechCapabilities.values());
- List<SpeechCapabilities> enumTestList = new ArrayList<SpeechCapabilities>();
- enumTestList.add(SpeechCapabilities.TEXT);
- enumTestList.add(SpeechCapabilities.SAPI_PHONEMES);
- enumTestList.add(SpeechCapabilities.LHPLUS_PHONEMES);
- enumTestList.add(SpeechCapabilities.PRE_RECORDED);
- enumTestList.add(SpeechCapabilities.SILENCE);
- enumTestList.add(SpeechCapabilities.FILE);
+ List<SpeechCapabilities> enumTestList = new ArrayList<SpeechCapabilities>();
+ enumTestList.add(SpeechCapabilities.TEXT);
+ enumTestList.add(SpeechCapabilities.SAPI_PHONEMES);
+ enumTestList.add(SpeechCapabilities.LHPLUS_PHONEMES);
+ enumTestList.add(SpeechCapabilities.PRE_RECORDED);
+ enumTestList.add(SpeechCapabilities.SILENCE);
+ enumTestList.add(SpeechCapabilities.FILE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/StaticIconNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/StaticIconNameTests.java
index b85905039..e4c81deea 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/StaticIconNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/StaticIconNameTests.java
@@ -14,918 +14,916 @@ import java.util.List;
*/
public class StaticIconNameTests extends TestCase {
- public void testValidEnums(){
- String example = "0x29";
- StaticIconName ACCEPT_CALL = StaticIconName.valueForString(example);
- assertNotNull("ACCEPT_CALL returned null", ACCEPT_CALL);
+ public void testValidEnums() {
+ String example = "0x29";
+ StaticIconName ACCEPT_CALL = StaticIconName.valueForString(example);
+ assertNotNull("ACCEPT_CALL returned null", ACCEPT_CALL);
- example = "0x1B";
- StaticIconName ADD_WAYPOINT = StaticIconName.valueForString(example);
- assertNotNull("ADD_WAYPOINT returned null", ADD_WAYPOINT);
+ example = "0x1B";
+ StaticIconName ADD_WAYPOINT = StaticIconName.valueForString(example);
+ assertNotNull("ADD_WAYPOINT returned null", ADD_WAYPOINT);
- example = "0x21";
- StaticIconName ALBUM = StaticIconName.valueForString(example);
- assertNotNull("ALBUM returned null", ALBUM);
+ example = "0x21";
+ StaticIconName ALBUM = StaticIconName.valueForString(example);
+ assertNotNull("ALBUM returned null", ALBUM);
- example = "0x3d";
- StaticIconName AMBIENT_LIGHTING = StaticIconName.valueForString(example);
- assertNotNull("AMBIENT_LIGHTING returned null", AMBIENT_LIGHTING);
+ example = "0x3d";
+ StaticIconName AMBIENT_LIGHTING = StaticIconName.valueForString(example);
+ assertNotNull("AMBIENT_LIGHTING returned null", AMBIENT_LIGHTING);
- example = "0x40";
- StaticIconName ARROW_NORTH = StaticIconName.valueForString(example);
- assertNotNull("ARROW_NORTH returned null", ARROW_NORTH);
+ example = "0x40";
+ StaticIconName ARROW_NORTH = StaticIconName.valueForString(example);
+ assertNotNull("ARROW_NORTH returned null", ARROW_NORTH);
- example = "0x12";
- StaticIconName AUDIO_MUTE = StaticIconName.valueForString(example);
- assertNotNull("AUDIO_MUTE returned null", AUDIO_MUTE);
+ example = "0x12";
+ StaticIconName AUDIO_MUTE = StaticIconName.valueForString(example);
+ assertNotNull("AUDIO_MUTE returned null", AUDIO_MUTE);
- example = "0x83";
- StaticIconName AUDIOBOOK_EPISODE = StaticIconName.valueForString(example);
- assertNotNull("AUDIOBOOK_EPISODE returned null", AUDIOBOOK_EPISODE);
+ example = "0x83";
+ StaticIconName AUDIOBOOK_EPISODE = StaticIconName.valueForString(example);
+ assertNotNull("AUDIOBOOK_EPISODE returned null", AUDIOBOOK_EPISODE);
- example = "0x82";
- StaticIconName AUDIOBOOK_NARRATOR = StaticIconName.valueForString(example);
- assertNotNull("AUDIOBOOK_NARRATOR returned null", AUDIOBOOK_NARRATOR);
+ example = "0x82";
+ StaticIconName AUDIOBOOK_NARRATOR = StaticIconName.valueForString(example);
+ assertNotNull("AUDIOBOOK_NARRATOR returned null", AUDIOBOOK_NARRATOR);
- example = "0x45";
- StaticIconName AUXILLARY_AUDIO = StaticIconName.valueForString(example);
- assertNotNull("AUXILLARY_AUDIO returned null", AUXILLARY_AUDIO);
+ example = "0x45";
+ StaticIconName AUXILLARY_AUDIO = StaticIconName.valueForString(example);
+ assertNotNull("AUXILLARY_AUDIO returned null", AUXILLARY_AUDIO);
- example = "0x86";
- StaticIconName BACK = StaticIconName.valueForString(example);
- assertNotNull("BACK returned null", BACK);
+ example = "0x86";
+ StaticIconName BACK = StaticIconName.valueForString(example);
+ assertNotNull("BACK returned null", BACK);
- example = "0xF7";
- StaticIconName BATTERY_CAPACITY_0_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_0_OF_5 returned null", BATTERY_CAPACITY_0_OF_5);
+ example = "0xF7";
+ StaticIconName BATTERY_CAPACITY_0_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_0_OF_5 returned null", BATTERY_CAPACITY_0_OF_5);
- example = "0xF8";
- StaticIconName BATTERY_CAPACITY_1_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_1_OF_5 returned null", BATTERY_CAPACITY_1_OF_5);
+ example = "0xF8";
+ StaticIconName BATTERY_CAPACITY_1_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_1_OF_5 returned null", BATTERY_CAPACITY_1_OF_5);
- example = "0xF9";
- StaticIconName BATTERY_CAPACITY_2_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_2_OF_5 returned null", BATTERY_CAPACITY_2_OF_5);
+ example = "0xF9";
+ StaticIconName BATTERY_CAPACITY_2_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_2_OF_5 returned null", BATTERY_CAPACITY_2_OF_5);
- example = "0xFA";
- StaticIconName BATTERY_CAPACITY_3_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_3_OF_5 returned null", BATTERY_CAPACITY_3_OF_5);
+ example = "0xFA";
+ StaticIconName BATTERY_CAPACITY_3_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_3_OF_5 returned null", BATTERY_CAPACITY_3_OF_5);
- example = "0xf6";
- StaticIconName BATTERY_CAPACITY_4_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_4_OF_5 returned null", BATTERY_CAPACITY_4_OF_5);
+ example = "0xf6";
+ StaticIconName BATTERY_CAPACITY_4_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_4_OF_5 returned null", BATTERY_CAPACITY_4_OF_5);
- example = "0xFB";
- StaticIconName BATTERY_CAPACITY_5_OF_5 = StaticIconName.valueForString(example);
- assertNotNull("BATTERY_CAPACITY_5_OF_5 returned null", BATTERY_CAPACITY_5_OF_5);
+ example = "0xFB";
+ StaticIconName BATTERY_CAPACITY_5_OF_5 = StaticIconName.valueForString(example);
+ assertNotNull("BATTERY_CAPACITY_5_OF_5 returned null", BATTERY_CAPACITY_5_OF_5);
- example = "0x09";
- StaticIconName BLUETOOTH_AUDIO_SOURCE = StaticIconName.valueForString(example);
- assertNotNull("BLUETOOTH_AUDIO_SOURCE returned null", BLUETOOTH_AUDIO_SOURCE);
+ example = "0x09";
+ StaticIconName BLUETOOTH_AUDIO_SOURCE = StaticIconName.valueForString(example);
+ assertNotNull("BLUETOOTH_AUDIO_SOURCE returned null", BLUETOOTH_AUDIO_SOURCE);
- example = "0xcc";
- StaticIconName BLUETOOTH1 = StaticIconName.valueForString(example);
- assertNotNull("BLUETOOTH1 returned null", BLUETOOTH1);
+ example = "0xcc";
+ StaticIconName BLUETOOTH1 = StaticIconName.valueForString(example);
+ assertNotNull("BLUETOOTH1 returned null", BLUETOOTH1);
- example = "0xCD";
- StaticIconName BLUETOOTH2 = StaticIconName.valueForString(example);
- assertNotNull("BLUETOOTH2 returned null", BLUETOOTH2);
+ example = "0xCD";
+ StaticIconName BLUETOOTH2 = StaticIconName.valueForString(example);
+ assertNotNull("BLUETOOTH2 returned null", BLUETOOTH2);
- example = "0x77";
- StaticIconName BROWSE = StaticIconName.valueForString(example);
- assertNotNull("BROWSE returned null", BROWSE);
+ example = "0x77";
+ StaticIconName BROWSE = StaticIconName.valueForString(example);
+ assertNotNull("BROWSE returned null", BROWSE);
- example = "0x66";
- StaticIconName CELL_PHONE_IN_ROAMING_MODE = StaticIconName.valueForString(example);
- assertNotNull("CELL_PHONE_IN_ROAMING_MODE returned null", CELL_PHONE_IN_ROAMING_MODE);
+ example = "0x66";
+ StaticIconName CELL_PHONE_IN_ROAMING_MODE = StaticIconName.valueForString(example);
+ assertNotNull("CELL_PHONE_IN_ROAMING_MODE returned null", CELL_PHONE_IN_ROAMING_MODE);
- example = "0x67";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS);
+ example = "0x67";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS);
- example = "0x68";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS);
+ example = "0x68";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS);
- example = "0x69";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS);
+ example = "0x69";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS);
- example = "0x6A";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS);
+ example = "0x6A";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS);
- example = "0x6B";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS);
+ example = "0x6B";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS);
- example = "0xd3";
- StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS = StaticIconName.valueForString(example);
- assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS);
+ example = "0xd3";
+ StaticIconName CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS = StaticIconName.valueForString(example);
+ assertNotNull("CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS returned null", CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS);
- example = "0xc3";
- StaticIconName CHANGE_LANE_LEFT = StaticIconName.valueForString(example);
- assertNotNull("CHANGE_LANE_LEFT returned null", CHANGE_LANE_LEFT);
+ example = "0xc3";
+ StaticIconName CHANGE_LANE_LEFT = StaticIconName.valueForString(example);
+ assertNotNull("CHANGE_LANE_LEFT returned null", CHANGE_LANE_LEFT);
- example = "0xc1";
- StaticIconName CHANGE_LANE_RIGHT = StaticIconName.valueForString(example);
- assertNotNull("CHANGE_LANE_RIGHT returned null", CHANGE_LANE_RIGHT);
+ example = "0xc1";
+ StaticIconName CHANGE_LANE_RIGHT = StaticIconName.valueForString(example);
+ assertNotNull("CHANGE_LANE_RIGHT returned null", CHANGE_LANE_RIGHT);
- example = "0x27";
- StaticIconName CHECK_BOX_CHECKED = StaticIconName.valueForString(example);
- assertNotNull("CHECK_BOX_CHECKED returned null", CHECK_BOX_CHECKED);
+ example = "0x27";
+ StaticIconName CHECK_BOX_CHECKED = StaticIconName.valueForString(example);
+ assertNotNull("CHECK_BOX_CHECKED returned null", CHECK_BOX_CHECKED);
- example = "0x28";
- StaticIconName CHECK_BOX_UNCHECKED = StaticIconName.valueForString(example);
- assertNotNull("CHECK_BOX_UNCHECKED returned null", CHECK_BOX_UNCHECKED);
+ example = "0x28";
+ StaticIconName CHECK_BOX_UNCHECKED = StaticIconName.valueForString(example);
+ assertNotNull("CHECK_BOX_UNCHECKED returned null", CHECK_BOX_UNCHECKED);
- example = "0xd1";
- StaticIconName CLIMATE = StaticIconName.valueForString(example);
- assertNotNull("CLIMATE returned null", CLIMATE);
+ example = "0xd1";
+ StaticIconName CLIMATE = StaticIconName.valueForString(example);
+ assertNotNull("CLIMATE returned null", CLIMATE);
- example = "0xfc";
- StaticIconName CLOCK = StaticIconName.valueForString(example);
- assertNotNull("CLOCK returned null", CLOCK);
+ example = "0xfc";
+ StaticIconName CLOCK = StaticIconName.valueForString(example);
+ assertNotNull("CLOCK returned null", CLOCK);
- example = "0x1A";
- StaticIconName COMPOSE = StaticIconName.valueForString(example);
- assertNotNull("COMPOSE returned null", COMPOSE);
+ example = "0x1A";
+ StaticIconName COMPOSE = StaticIconName.valueForString(example);
+ assertNotNull("COMPOSE returned null", COMPOSE);
- example = "0x5C";
- StaticIconName CONTACT = StaticIconName.valueForString(example);
- assertNotNull("CONTACT returned null", CONTACT);
+ example = "0x5C";
+ StaticIconName CONTACT = StaticIconName.valueForString(example);
+ assertNotNull("CONTACT returned null", CONTACT);
- example = "0x42";
- StaticIconName CONTINUE = StaticIconName.valueForString(example);
- assertNotNull("CONTINUE returned null", CONTINUE);
+ example = "0x42";
+ StaticIconName CONTINUE = StaticIconName.valueForString(example);
+ assertNotNull("CONTINUE returned null", CONTINUE);
- example = "0x7F";
- StaticIconName DASH = StaticIconName.valueForString(example);
- assertNotNull("DASH returned null", DASH);
+ example = "0x7F";
+ StaticIconName DASH = StaticIconName.valueForString(example);
+ assertNotNull("DASH returned null", DASH);
- example = "0x87";
- StaticIconName DATE = StaticIconName.valueForString(example);
- assertNotNull("DATE returned null", DATE);
+ example = "0x87";
+ StaticIconName DATE = StaticIconName.valueForString(example);
+ assertNotNull("DATE returned null", DATE);
- example = "0x0F";
- StaticIconName DELETE = StaticIconName.valueForString(example);
- assertNotNull("DELETE returned null", DELETE);
+ example = "0x0F";
+ StaticIconName DELETE = StaticIconName.valueForString(example);
+ assertNotNull("DELETE returned null", DELETE);
- example = "0x94";
- StaticIconName DESTINATION = StaticIconName.valueForString(example);
- assertNotNull("DESTINATION returned null", DESTINATION);
+ example = "0x94";
+ StaticIconName DESTINATION = StaticIconName.valueForString(example);
+ assertNotNull("DESTINATION returned null", DESTINATION);
- example = "0x4D";
- StaticIconName DESTINATION_FERRY_AHEAD = StaticIconName.valueForString(example);
- assertNotNull("DESTINATION_FERRY_AHEAD returned null", DESTINATION_FERRY_AHEAD);
+ example = "0x4D";
+ StaticIconName DESTINATION_FERRY_AHEAD = StaticIconName.valueForString(example);
+ assertNotNull("DESTINATION_FERRY_AHEAD returned null", DESTINATION_FERRY_AHEAD);
- example = "0x2B";
- StaticIconName EBOOKMARK = StaticIconName.valueForString(example);
- assertNotNull("EBOOKMARK returned null", EBOOKMARK);
+ example = "0x2B";
+ StaticIconName EBOOKMARK = StaticIconName.valueForString(example);
+ assertNotNull("EBOOKMARK returned null", EBOOKMARK);
- example = "0x2C";
- StaticIconName END_CALL = StaticIconName.valueForString(example);
- assertNotNull("END_CALL returned null", END_CALL);
+ example = "0x2C";
+ StaticIconName END_CALL = StaticIconName.valueForString(example);
+ assertNotNull("END_CALL returned null", END_CALL);
- example = "0xD6";
- StaticIconName FAIL = StaticIconName.valueForString(example);
- assertNotNull("FAIL returned null", FAIL);
+ example = "0xD6";
+ StaticIconName FAIL = StaticIconName.valueForString(example);
+ assertNotNull("FAIL returned null", FAIL);
- example = "0x08";
- StaticIconName FAST_FORWARD_30_SECS = StaticIconName.valueForString(example);
- assertNotNull("FAST_FORWARD_30_SECS returned null", FAST_FORWARD_30_SECS);
+ example = "0x08";
+ StaticIconName FAST_FORWARD_30_SECS = StaticIconName.valueForString(example);
+ assertNotNull("FAST_FORWARD_30_SECS returned null", FAST_FORWARD_30_SECS);
- example = "0x0E";
- StaticIconName FAVORITE_HEART = StaticIconName.valueForString(example);
- assertNotNull("FAVORITE_HEART returned null", FAVORITE_HEART);
+ example = "0x0E";
+ StaticIconName FAVORITE_HEART = StaticIconName.valueForString(example);
+ assertNotNull("FAVORITE_HEART returned null", FAVORITE_HEART);
- example = "0x95";
- StaticIconName FAVORITE_STAR = StaticIconName.valueForString(example);
- assertNotNull("FAVORITE_STAR returned null", FAVORITE_STAR);
+ example = "0x95";
+ StaticIconName FAVORITE_STAR = StaticIconName.valueForString(example);
+ assertNotNull("FAVORITE_STAR returned null", FAVORITE_STAR);
- example = "0x80";
- StaticIconName FAX_NUMBER = StaticIconName.valueForString(example);
- assertNotNull("FAX_NUMBER returned null", FAX_NUMBER);
+ example = "0x80";
+ StaticIconName FAX_NUMBER = StaticIconName.valueForString(example);
+ assertNotNull("FAX_NUMBER returned null", FAX_NUMBER);
- example = "0x50";
- StaticIconName FILENAME = StaticIconName.valueForString(example);
- assertNotNull("FILENAME returned null", FILENAME);
+ example = "0x50";
+ StaticIconName FILENAME = StaticIconName.valueForString(example);
+ assertNotNull("FILENAME returned null", FILENAME);
- example = "0x79";
- StaticIconName FILTER = StaticIconName.valueForString(example);
- assertNotNull("FILTER returned null", FILTER);
+ example = "0x79";
+ StaticIconName FILTER = StaticIconName.valueForString(example);
+ assertNotNull("FILTER returned null", FILTER);
- example = "0x1C";
- StaticIconName FOLDER = StaticIconName.valueForString(example);
- assertNotNull("FOLDER returned null", FOLDER);
+ example = "0x1C";
+ StaticIconName FOLDER = StaticIconName.valueForString(example);
+ assertNotNull("FOLDER returned null", FOLDER);
- example = "0xe9";
- StaticIconName FUEL_PRICES = StaticIconName.valueForString(example);
- assertNotNull("FUEL_PRICES returned null", FUEL_PRICES);
+ example = "0xe9";
+ StaticIconName FUEL_PRICES = StaticIconName.valueForString(example);
+ assertNotNull("FUEL_PRICES returned null", FUEL_PRICES);
- example = "0x0c";
- StaticIconName FULL_MAP = StaticIconName.valueForString(example);
- assertNotNull("FULL_MAP returned null", FULL_MAP);
+ example = "0x0c";
+ StaticIconName FULL_MAP = StaticIconName.valueForString(example);
+ assertNotNull("FULL_MAP returned null", FULL_MAP);
- example = "0x53";
- StaticIconName GENERIC_PHONE_NUMBER = StaticIconName.valueForString(example);
- assertNotNull("GENERIC_PHONE_NUMBER returned null", GENERIC_PHONE_NUMBER);
+ example = "0x53";
+ StaticIconName GENERIC_PHONE_NUMBER = StaticIconName.valueForString(example);
+ assertNotNull("GENERIC_PHONE_NUMBER returned null", GENERIC_PHONE_NUMBER);
- example = "0x4E";
- StaticIconName GENRE = StaticIconName.valueForString(example);
- assertNotNull("GENRE returned null", GENRE);
+ example = "0x4E";
+ StaticIconName GENRE = StaticIconName.valueForString(example);
+ assertNotNull("GENRE returned null", GENRE);
- example = "0xea";
- StaticIconName GLOBAL_KEYBOARD = StaticIconName.valueForString(example);
- assertNotNull("GLOBAL_KEYBOARD returned null", GLOBAL_KEYBOARD);
+ example = "0xea";
+ StaticIconName GLOBAL_KEYBOARD = StaticIconName.valueForString(example);
+ assertNotNull("GLOBAL_KEYBOARD returned null", GLOBAL_KEYBOARD);
- example = "0xf4";
- StaticIconName HIGHWAY_EXIT_INFORMATION = StaticIconName.valueForString(example);
- assertNotNull("HIGHWAY_EXIT_INFORMATION returned null", HIGHWAY_EXIT_INFORMATION);
+ example = "0xf4";
+ StaticIconName HIGHWAY_EXIT_INFORMATION = StaticIconName.valueForString(example);
+ assertNotNull("HIGHWAY_EXIT_INFORMATION returned null", HIGHWAY_EXIT_INFORMATION);
- example = "0x55";
- StaticIconName HOME_PHONE_NUMBER = StaticIconName.valueForString(example);
- assertNotNull("HOME_PHONE_NUMBER returned null", HOME_PHONE_NUMBER);
+ example = "0x55";
+ StaticIconName HOME_PHONE_NUMBER = StaticIconName.valueForString(example);
+ assertNotNull("HOME_PHONE_NUMBER returned null", HOME_PHONE_NUMBER);
- example = "0x78";
- StaticIconName HYPERLINK = StaticIconName.valueForString(example);
- assertNotNull("HYPERLINK returned null", HYPERLINK);
+ example = "0x78";
+ StaticIconName HYPERLINK = StaticIconName.valueForString(example);
+ assertNotNull("HYPERLINK returned null", HYPERLINK);
- example = "0x51";
- StaticIconName ID3_TAG_UNKNOWN = StaticIconName.valueForString(example);
- assertNotNull("ID3_TAG_UNKNOWN returned null", ID3_TAG_UNKNOWN);
+ example = "0x51";
+ StaticIconName ID3_TAG_UNKNOWN = StaticIconName.valueForString(example);
+ assertNotNull("ID3_TAG_UNKNOWN returned null", ID3_TAG_UNKNOWN);
- example = "0x57";
- StaticIconName INCOMING_CALLS = StaticIconName.valueForString(example);
- assertNotNull("INCOMING_CALLS returned null", INCOMING_CALLS);
+ example = "0x57";
+ StaticIconName INCOMING_CALLS = StaticIconName.valueForString(example);
+ assertNotNull("INCOMING_CALLS returned null", INCOMING_CALLS);
- example = "0x5d";
- StaticIconName INFORMATION = StaticIconName.valueForString(example);
- assertNotNull("INFORMATION returned null", INFORMATION);
+ example = "0x5d";
+ StaticIconName INFORMATION = StaticIconName.valueForString(example);
+ assertNotNull("INFORMATION returned null", INFORMATION);
- example = "0x0D";
- StaticIconName IPOD_MEDIA_SOURCE = StaticIconName.valueForString(example);
- assertNotNull("IPOD_MEDIA_SOURCE returned null", IPOD_MEDIA_SOURCE);
+ example = "0x0D";
+ StaticIconName IPOD_MEDIA_SOURCE = StaticIconName.valueForString(example);
+ assertNotNull("IPOD_MEDIA_SOURCE returned null", IPOD_MEDIA_SOURCE);
- example = "0x02";
- StaticIconName JOIN_CALLS = StaticIconName.valueForString(example);
- assertNotNull("JOIN_CALLS returned null", JOIN_CALLS);
+ example = "0x02";
+ StaticIconName JOIN_CALLS = StaticIconName.valueForString(example);
+ assertNotNull("JOIN_CALLS returned null", JOIN_CALLS);
- example = "0x46";
- StaticIconName KEEP_LEFT = StaticIconName.valueForString(example);
- assertNotNull("KEEP_LEFT returned null", KEEP_LEFT);
+ example = "0x46";
+ StaticIconName KEEP_LEFT = StaticIconName.valueForString(example);
+ assertNotNull("KEEP_LEFT returned null", KEEP_LEFT);
- example = "0x48";
- StaticIconName KEEP_RIGHT = StaticIconName.valueForString(example);
- assertNotNull("KEEP_RIGHT returned null", KEEP_RIGHT);
+ example = "0x48";
+ StaticIconName KEEP_RIGHT = StaticIconName.valueForString(example);
+ assertNotNull("KEEP_RIGHT returned null", KEEP_RIGHT);
- example = "0x7D";
- StaticIconName KEY = StaticIconName.valueForString(example);
- assertNotNull("KEY returned null", KEY);
+ example = "0x7D";
+ StaticIconName KEY = StaticIconName.valueForString(example);
+ assertNotNull("KEY returned null", KEY);
- example = "0x9f";
- StaticIconName LEFT = StaticIconName.valueForString(example);
- assertNotNull("LEFT returned null", LEFT);
+ example = "0x9f";
+ StaticIconName LEFT = StaticIconName.valueForString(example);
+ assertNotNull("LEFT returned null", LEFT);
- example = "0x4B";
- StaticIconName LEFT_ARROW = StaticIconName.valueForString(example);
- assertNotNull("LEFT_ARROW returned null", LEFT_ARROW);
+ example = "0x4B";
+ StaticIconName LEFT_ARROW = StaticIconName.valueForString(example);
+ assertNotNull("LEFT_ARROW returned null", LEFT_ARROW);
- example = "0xaf";
- StaticIconName LEFT_EXIT = StaticIconName.valueForString(example);
- assertNotNull("LEFT_EXIT returned null", LEFT_EXIT);
+ example = "0xaf";
+ StaticIconName LEFT_EXIT = StaticIconName.valueForString(example);
+ assertNotNull("LEFT_EXIT returned null", LEFT_EXIT);
- example = "0x06";
- StaticIconName LINE_IN_AUDIO_SOURCE = StaticIconName.valueForString(example);
- assertNotNull("LINE_IN_AUDIO_SOURCE returned null", LINE_IN_AUDIO_SOURCE);
+ example = "0x06";
+ StaticIconName LINE_IN_AUDIO_SOURCE = StaticIconName.valueForString(example);
+ assertNotNull("LINE_IN_AUDIO_SOURCE returned null", LINE_IN_AUDIO_SOURCE);
- example = "0x22";
- StaticIconName LOCKED = StaticIconName.valueForString(example);
- assertNotNull("LOCKED returned null", LOCKED);
+ example = "0x22";
+ StaticIconName LOCKED = StaticIconName.valueForString(example);
+ assertNotNull("LOCKED returned null", LOCKED);
- example = "0x17";
- StaticIconName MEDIA_CONTROL_LEFT_ARROW = StaticIconName.valueForString(example);
- assertNotNull("MEDIA_CONTROL_LEFT_ARROW returned null", MEDIA_CONTROL_LEFT_ARROW);
+ example = "0x17";
+ StaticIconName MEDIA_CONTROL_LEFT_ARROW = StaticIconName.valueForString(example);
+ assertNotNull("MEDIA_CONTROL_LEFT_ARROW returned null", MEDIA_CONTROL_LEFT_ARROW);
- example = "0x20";
- StaticIconName MEDIA_CONTROL_RECORDING = StaticIconName.valueForString(example);
- assertNotNull("MEDIA_CONTROL_RECORDING returned null", MEDIA_CONTROL_RECORDING);
+ example = "0x20";
+ StaticIconName MEDIA_CONTROL_RECORDING = StaticIconName.valueForString(example);
+ assertNotNull("MEDIA_CONTROL_RECORDING returned null", MEDIA_CONTROL_RECORDING);
- example = "0x15";
- StaticIconName MEDIA_CONTROL_RIGHT_ARROW = StaticIconName.valueForString(example);
- assertNotNull("MEDIA_CONTROL_RIGHT_ARROW returned null", MEDIA_CONTROL_RIGHT_ARROW);
+ example = "0x15";
+ StaticIconName MEDIA_CONTROL_RIGHT_ARROW = StaticIconName.valueForString(example);
+ assertNotNull("MEDIA_CONTROL_RIGHT_ARROW returned null", MEDIA_CONTROL_RIGHT_ARROW);
- example = "0x16";
- StaticIconName MEDIA_CONTROL_STOP = StaticIconName.valueForString(example);
- assertNotNull("MEDIA_CONTROL_STOP returned null", MEDIA_CONTROL_STOP);
+ example = "0x16";
+ StaticIconName MEDIA_CONTROL_STOP = StaticIconName.valueForString(example);
+ assertNotNull("MEDIA_CONTROL_STOP returned null", MEDIA_CONTROL_STOP);
- example = "0xe8";
- StaticIconName MICROPHONE = StaticIconName.valueForString(example);
- assertNotNull("MICROPHONE returned null", MICROPHONE);
+ example = "0xe8";
+ StaticIconName MICROPHONE = StaticIconName.valueForString(example);
+ assertNotNull("MICROPHONE returned null", MICROPHONE);
- example = "0x58";
- StaticIconName MISSED_CALLS = StaticIconName.valueForString(example);
- assertNotNull("MISSED_CALLS returned null", MISSED_CALLS);
+ example = "0x58";
+ StaticIconName MISSED_CALLS = StaticIconName.valueForString(example);
+ assertNotNull("MISSED_CALLS returned null", MISSED_CALLS);
- example = "0x54";
- StaticIconName MOBILE_PHONE_NUMBER = StaticIconName.valueForString(example);
- assertNotNull("MOBILE_PHONE_NUMBER returned null", MOBILE_PHONE_NUMBER);
+ example = "0x54";
+ StaticIconName MOBILE_PHONE_NUMBER = StaticIconName.valueForString(example);
+ assertNotNull("MOBILE_PHONE_NUMBER returned null", MOBILE_PHONE_NUMBER);
- example = "0xE5";
- StaticIconName MOVE_DOWN = StaticIconName.valueForString(example);
- assertNotNull("MOVE_DOWN returned null", MOVE_DOWN);
+ example = "0xE5";
+ StaticIconName MOVE_DOWN = StaticIconName.valueForString(example);
+ assertNotNull("MOVE_DOWN returned null", MOVE_DOWN);
- example = "0xe4";
- StaticIconName MOVE_UP = StaticIconName.valueForString(example);
- assertNotNull("MOVE_UP returned null", MOVE_UP);
+ example = "0xe4";
+ StaticIconName MOVE_UP = StaticIconName.valueForString(example);
+ assertNotNull("MOVE_UP returned null", MOVE_UP);
- example = "0x24";
- StaticIconName MP3_TAG_ARTIST = StaticIconName.valueForString(example);
- assertNotNull("MP3_TAG_ARTIST returned null", MP3_TAG_ARTIST);
+ example = "0x24";
+ StaticIconName MP3_TAG_ARTIST = StaticIconName.valueForString(example);
+ assertNotNull("MP3_TAG_ARTIST returned null", MP3_TAG_ARTIST);
- example = "0x8e";
- StaticIconName NAVIGATION = StaticIconName.valueForString(example);
- assertNotNull("NAVIGATION returned null", NAVIGATION);
+ example = "0x8e";
+ StaticIconName NAVIGATION = StaticIconName.valueForString(example);
+ assertNotNull("NAVIGATION returned null", NAVIGATION);
- example = "0x0a";
- StaticIconName NAVIGATION_CURRENT_DIRECTION = StaticIconName.valueForString(example);
- assertNotNull("NAVIGATION_CURRENT_DIRECTION returned null", NAVIGATION_CURRENT_DIRECTION);
+ example = "0x0a";
+ StaticIconName NAVIGATION_CURRENT_DIRECTION = StaticIconName.valueForString(example);
+ assertNotNull("NAVIGATION_CURRENT_DIRECTION returned null", NAVIGATION_CURRENT_DIRECTION);
- example = "0x14";
- StaticIconName NEGATIVE_RATING_THUMBS_DOWN = StaticIconName.valueForString(example);
- assertNotNull("NEGATIVE_RATING_THUMBS_DOWN returned null", NEGATIVE_RATING_THUMBS_DOWN);
+ example = "0x14";
+ StaticIconName NEGATIVE_RATING_THUMBS_DOWN = StaticIconName.valueForString(example);
+ assertNotNull("NEGATIVE_RATING_THUMBS_DOWN returned null", NEGATIVE_RATING_THUMBS_DOWN);
- example = "0x5E";
- StaticIconName NEW = StaticIconName.valueForString(example);
- assertNotNull("NEW returned null", NEW);
+ example = "0x5E";
+ StaticIconName NEW = StaticIconName.valueForString(example);
+ assertNotNull("NEW returned null", NEW);
- example = "0x56";
- StaticIconName OFFICE_PHONE_NUMBER = StaticIconName.valueForString(example);
- assertNotNull("OFFICE_PHONE_NUMBER returned null", OFFICE_PHONE_NUMBER);
+ example = "0x56";
+ StaticIconName OFFICE_PHONE_NUMBER = StaticIconName.valueForString(example);
+ assertNotNull("OFFICE_PHONE_NUMBER returned null", OFFICE_PHONE_NUMBER);
- example = "0x5F";
- StaticIconName OPENED = StaticIconName.valueForString(example);
- assertNotNull("OPENED returned null", OPENED);
+ example = "0x5F";
+ StaticIconName OPENED = StaticIconName.valueForString(example);
+ assertNotNull("OPENED returned null", OPENED);
- example = "0x96";
- StaticIconName ORIGIN = StaticIconName.valueForString(example);
- assertNotNull("ORIGIN returned null", ORIGIN);
+ example = "0x96";
+ StaticIconName ORIGIN = StaticIconName.valueForString(example);
+ assertNotNull("ORIGIN returned null", ORIGIN);
- example = "0x59";
- StaticIconName OUTGOING_CALLS = StaticIconName.valueForString(example);
- assertNotNull("OUTGOING_CALLS returned null", OUTGOING_CALLS);
+ example = "0x59";
+ StaticIconName OUTGOING_CALLS = StaticIconName.valueForString(example);
+ assertNotNull("OUTGOING_CALLS returned null", OUTGOING_CALLS);
- example = "0x1D";
- StaticIconName PHONE_CALL_1 = StaticIconName.valueForString(example);
- assertNotNull("PHONE_CALL_1 returned null", PHONE_CALL_1);
+ example = "0x1D";
+ StaticIconName PHONE_CALL_1 = StaticIconName.valueForString(example);
+ assertNotNull("PHONE_CALL_1 returned null", PHONE_CALL_1);
- example = "0x1E";
- StaticIconName PHONE_CALL_2 = StaticIconName.valueForString(example);
- assertNotNull("PHONE_CALL_2 returned null", PHONE_CALL_2);
+ example = "0x1E";
+ StaticIconName PHONE_CALL_2 = StaticIconName.valueForString(example);
+ assertNotNull("PHONE_CALL_2 returned null", PHONE_CALL_2);
- example = "0x03";
- StaticIconName PHONE_DEVICE = StaticIconName.valueForString(example);
- assertNotNull("PHONE_DEVICE returned null", PHONE_DEVICE);
+ example = "0x03";
+ StaticIconName PHONE_DEVICE = StaticIconName.valueForString(example);
+ assertNotNull("PHONE_DEVICE returned null", PHONE_DEVICE);
- example = "0x81";
- StaticIconName PHONEBOOK = StaticIconName.valueForString(example);
- assertNotNull("PHONEBOOK returned null", PHONEBOOK);
+ example = "0x81";
+ StaticIconName PHONEBOOK = StaticIconName.valueForString(example);
+ assertNotNull("PHONEBOOK returned null", PHONEBOOK);
- example = "0x88";
- StaticIconName PHOTO = StaticIconName.valueForString(example);
- assertNotNull("PHOTO returned null", PHOTO);
+ example = "0x88";
+ StaticIconName PHOTO = StaticIconName.valueForString(example);
+ assertNotNull("PHOTO returned null", PHOTO);
- example = "0xD0";
- StaticIconName PLAY = StaticIconName.valueForString(example);
- assertNotNull("PLAY returned null", PLAY);
+ example = "0xD0";
+ StaticIconName PLAY = StaticIconName.valueForString(example);
+ assertNotNull("PLAY returned null", PLAY);
- example = "0x4F";
- StaticIconName PLAYLIST = StaticIconName.valueForString(example);
- assertNotNull("PLAYLIST returned null", PLAYLIST);
+ example = "0x4F";
+ StaticIconName PLAYLIST = StaticIconName.valueForString(example);
+ assertNotNull("PLAYLIST returned null", PLAYLIST);
- example = "0x76";
- StaticIconName POPUP = StaticIconName.valueForString(example);
- assertNotNull("POPUP returned null", POPUP);
+ example = "0x76";
+ StaticIconName POPUP = StaticIconName.valueForString(example);
+ assertNotNull("POPUP returned null", POPUP);
- example = "0x13";
- StaticIconName POSITIVE_RATING_THUMBS_UP = StaticIconName.valueForString(example);
- assertNotNull("POSITIVE_RATING_THUMBS_UP returned null", POSITIVE_RATING_THUMBS_UP);
+ example = "0x13";
+ StaticIconName POSITIVE_RATING_THUMBS_UP = StaticIconName.valueForString(example);
+ assertNotNull("POSITIVE_RATING_THUMBS_UP returned null", POSITIVE_RATING_THUMBS_UP);
- example = "0x5b";
- StaticIconName POWER = StaticIconName.valueForString(example);
- assertNotNull("POWER returned null", POWER);
+ example = "0x5b";
+ StaticIconName POWER = StaticIconName.valueForString(example);
+ assertNotNull("POWER returned null", POWER);
- example = "0x1F";
- StaticIconName PRIMARY_PHONE = StaticIconName.valueForString(example);
- assertNotNull("PRIMARY_PHONE returned null", PRIMARY_PHONE);
+ example = "0x1F";
+ StaticIconName PRIMARY_PHONE = StaticIconName.valueForString(example);
+ assertNotNull("PRIMARY_PHONE returned null", PRIMARY_PHONE);
- example = "0x25";
- StaticIconName RADIO_BUTTON_CHECKED = StaticIconName.valueForString(example);
- assertNotNull("RADIO_BUTTON_CHECKED returned null", RADIO_BUTTON_CHECKED);
+ example = "0x25";
+ StaticIconName RADIO_BUTTON_CHECKED = StaticIconName.valueForString(example);
+ assertNotNull("RADIO_BUTTON_CHECKED returned null", RADIO_BUTTON_CHECKED);
- example = "0x26";
- StaticIconName RADIO_BUTTON_UNCHECKED = StaticIconName.valueForString(example);
- assertNotNull("RADIO_BUTTON_UNCHECKED returned null", RADIO_BUTTON_UNCHECKED);
+ example = "0x26";
+ StaticIconName RADIO_BUTTON_UNCHECKED = StaticIconName.valueForString(example);
+ assertNotNull("RADIO_BUTTON_UNCHECKED returned null", RADIO_BUTTON_UNCHECKED);
- example = "0xe7";
- StaticIconName RECENT_CALLS = StaticIconName.valueForString(example);
- assertNotNull("RECENT_CALLS returned null", RECENT_CALLS);
+ example = "0xe7";
+ StaticIconName RECENT_CALLS = StaticIconName.valueForString(example);
+ assertNotNull("RECENT_CALLS returned null", RECENT_CALLS);
- example = "0xf2";
- StaticIconName RECENT_DESTINATIONS = StaticIconName.valueForString(example);
- assertNotNull("RECENT_DESTINATIONS returned null", RECENT_DESTINATIONS);
+ example = "0xf2";
+ StaticIconName RECENT_DESTINATIONS = StaticIconName.valueForString(example);
+ assertNotNull("RECENT_DESTINATIONS returned null", RECENT_DESTINATIONS);
- example = "0x19";
- StaticIconName REDO = StaticIconName.valueForString(example);
- assertNotNull("REDO returned null", REDO);
+ example = "0x19";
+ StaticIconName REDO = StaticIconName.valueForString(example);
+ assertNotNull("REDO returned null", REDO);
- example = "0x97";
- StaticIconName REFRESH = StaticIconName.valueForString(example);
- assertNotNull("REFRESH returned null", REFRESH);
+ example = "0x97";
+ StaticIconName REFRESH = StaticIconName.valueForString(example);
+ assertNotNull("REFRESH returned null", REFRESH);
- example = "0x7E";
- StaticIconName REMOTE_DIAGNOSTICS_CHECK_ENGINE = StaticIconName.valueForString(example);
- assertNotNull("REMOTE_DIAGNOSTICS_CHECK_ENGINE returned null", REMOTE_DIAGNOSTICS_CHECK_ENGINE);
+ example = "0x7E";
+ StaticIconName REMOTE_DIAGNOSTICS_CHECK_ENGINE = StaticIconName.valueForString(example);
+ assertNotNull("REMOTE_DIAGNOSTICS_CHECK_ENGINE returned null", REMOTE_DIAGNOSTICS_CHECK_ENGINE);
- example = "0xac";
- StaticIconName RENDERED_911_ASSIST = StaticIconName.valueForString(example);
- assertNotNull("RENDERED_911_ASSIST returned null", RENDERED_911_ASSIST);
+ example = "0xac";
+ StaticIconName RENDERED_911_ASSIST = StaticIconName.valueForString(example);
+ assertNotNull("RENDERED_911_ASSIST returned null", RENDERED_911_ASSIST);
- example = "0xe6";
- StaticIconName REPEAT = StaticIconName.valueForString(example);
- assertNotNull("REPEAT returned null", REPEAT);
+ example = "0xe6";
+ StaticIconName REPEAT = StaticIconName.valueForString(example);
+ assertNotNull("REPEAT returned null", REPEAT);
- example = "0x73";
- StaticIconName REPEAT_PLAY = StaticIconName.valueForString(example);
- assertNotNull("REPEAT_PLAY returned null", REPEAT_PLAY);
+ example = "0x73";
+ StaticIconName REPEAT_PLAY = StaticIconName.valueForString(example);
+ assertNotNull("REPEAT_PLAY returned null", REPEAT_PLAY);
- example = "0x04";
- StaticIconName REPLY = StaticIconName.valueForString(example);
- assertNotNull("REPLY returned null", REPLY);
+ example = "0x04";
+ StaticIconName REPLY = StaticIconName.valueForString(example);
+ assertNotNull("REPLY returned null", REPLY);
- example = "0x07";
- StaticIconName REWIND_30_SECS = StaticIconName.valueForString(example);
- assertNotNull("REWIND_30_SECS returned null", REWIND_30_SECS);
+ example = "0x07";
+ StaticIconName REWIND_30_SECS = StaticIconName.valueForString(example);
+ assertNotNull("REWIND_30_SECS returned null", REWIND_30_SECS);
- example = "0xa3";
- StaticIconName RIGHT = StaticIconName.valueForString(example);
- assertNotNull("RIGHT returned null", RIGHT);
+ example = "0xa3";
+ StaticIconName RIGHT = StaticIconName.valueForString(example);
+ assertNotNull("RIGHT returned null", RIGHT);
- example = "0xb1";
- StaticIconName RIGHT_EXIT = StaticIconName.valueForString(example);
- assertNotNull("RIGHT_EXIT returned null", RIGHT_EXIT);
+ example = "0xb1";
+ StaticIconName RIGHT_EXIT = StaticIconName.valueForString(example);
+ assertNotNull("RIGHT_EXIT returned null", RIGHT_EXIT);
- example = "0x5A";
- StaticIconName RINGTONES = StaticIconName.valueForString(example);
- assertNotNull("RINGTONES returned null", RINGTONES);
+ example = "0x5A";
+ StaticIconName RINGTONES = StaticIconName.valueForString(example);
+ assertNotNull("RINGTONES returned null", RINGTONES);
- example = "0xee";
- StaticIconName ROUNDABOUT_LEFT_HAND_1 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_1 returned null", ROUNDABOUT_LEFT_HAND_1);
+ example = "0xee";
+ StaticIconName ROUNDABOUT_LEFT_HAND_1 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_1 returned null", ROUNDABOUT_LEFT_HAND_1);
- example = "0x8c";
- StaticIconName ROUNDABOUT_LEFT_HAND_2 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_2 returned null", ROUNDABOUT_LEFT_HAND_2);
+ example = "0x8c";
+ StaticIconName ROUNDABOUT_LEFT_HAND_2 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_2 returned null", ROUNDABOUT_LEFT_HAND_2);
- example = "0x84";
- StaticIconName ROUNDABOUT_LEFT_HAND_3 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_3 returned null", ROUNDABOUT_LEFT_HAND_3);
+ example = "0x84";
+ StaticIconName ROUNDABOUT_LEFT_HAND_3 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_3 returned null", ROUNDABOUT_LEFT_HAND_3);
- example = "0x72";
- StaticIconName ROUNDABOUT_LEFT_HAND_4 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_4 returned null", ROUNDABOUT_LEFT_HAND_4);
+ example = "0x72";
+ StaticIconName ROUNDABOUT_LEFT_HAND_4 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_4 returned null", ROUNDABOUT_LEFT_HAND_4);
- example = "0x6e";
- StaticIconName ROUNDABOUT_LEFT_HAND_5 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_5 returned null", ROUNDABOUT_LEFT_HAND_5);
+ example = "0x6e";
+ StaticIconName ROUNDABOUT_LEFT_HAND_5 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_5 returned null", ROUNDABOUT_LEFT_HAND_5);
- example = "0x64";
- StaticIconName ROUNDABOUT_LEFT_HAND_6 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_6 returned null", ROUNDABOUT_LEFT_HAND_6);
+ example = "0x64";
+ StaticIconName ROUNDABOUT_LEFT_HAND_6 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_6 returned null", ROUNDABOUT_LEFT_HAND_6);
- example = "0x60";
- StaticIconName ROUNDABOUT_LEFT_HAND_7 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_LEFT_HAND_7 returned null", ROUNDABOUT_LEFT_HAND_7);
+ example = "0x60";
+ StaticIconName ROUNDABOUT_LEFT_HAND_7 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_LEFT_HAND_7 returned null", ROUNDABOUT_LEFT_HAND_7);
- example = "0x62";
- StaticIconName ROUNDABOUT_RIGHT_HAND_1 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_1 returned null", ROUNDABOUT_RIGHT_HAND_1);
+ example = "0x62";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_1 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_1 returned null", ROUNDABOUT_RIGHT_HAND_1);
- example = "0x6c";
- StaticIconName ROUNDABOUT_RIGHT_HAND_2 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_2 returned null", ROUNDABOUT_RIGHT_HAND_2);
+ example = "0x6c";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_2 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_2 returned null", ROUNDABOUT_RIGHT_HAND_2);
- example = "0x70";
- StaticIconName ROUNDABOUT_RIGHT_HAND_3 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_3 returned null", ROUNDABOUT_RIGHT_HAND_3);
+ example = "0x70";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_3 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_3 returned null", ROUNDABOUT_RIGHT_HAND_3);
- example = "0x7a";
- StaticIconName ROUNDABOUT_RIGHT_HAND_4 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_4 returned null", ROUNDABOUT_RIGHT_HAND_4);
+ example = "0x7a";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_4 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_4 returned null", ROUNDABOUT_RIGHT_HAND_4);
- example = "0x8a";
- StaticIconName ROUNDABOUT_RIGHT_HAND_5 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_5 returned null", ROUNDABOUT_RIGHT_HAND_5);
+ example = "0x8a";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_5 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_5 returned null", ROUNDABOUT_RIGHT_HAND_5);
- example = "0xec";
- StaticIconName ROUNDABOUT_RIGHT_HAND_6 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_6 returned null", ROUNDABOUT_RIGHT_HAND_6);
+ example = "0xec";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_6 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_6 returned null", ROUNDABOUT_RIGHT_HAND_6);
- example = "0xf0";
- StaticIconName ROUNDABOUT_RIGHT_HAND_7 = StaticIconName.valueForString(example);
- assertNotNull("ROUNDABOUT_RIGHT_HAND_7 returned null", ROUNDABOUT_RIGHT_HAND_7);
+ example = "0xf0";
+ StaticIconName ROUNDABOUT_RIGHT_HAND_7 = StaticIconName.valueForString(example);
+ assertNotNull("ROUNDABOUT_RIGHT_HAND_7 returned null", ROUNDABOUT_RIGHT_HAND_7);
- example = "0x89";
- StaticIconName RSS = StaticIconName.valueForString(example);
- assertNotNull("RSS returned null", RSS);
+ example = "0x89";
+ StaticIconName RSS = StaticIconName.valueForString(example);
+ assertNotNull("RSS returned null", RSS);
- example = "0x49";
- StaticIconName SETTINGS = StaticIconName.valueForString(example);
- assertNotNull("SETTINGS returned null", SETTINGS);
+ example = "0x49";
+ StaticIconName SETTINGS = StaticIconName.valueForString(example);
+ assertNotNull("SETTINGS returned null", SETTINGS);
- example = "0xa5";
- StaticIconName SHARP_LEFT = StaticIconName.valueForString(example);
- assertNotNull("SHARP_LEFT returned null", SHARP_LEFT);
+ example = "0xa5";
+ StaticIconName SHARP_LEFT = StaticIconName.valueForString(example);
+ assertNotNull("SHARP_LEFT returned null", SHARP_LEFT);
- example = "0xe1";
- StaticIconName SHOW = StaticIconName.valueForString(example);
- assertNotNull("SHOW returned null", SHOW);
+ example = "0xe1";
+ StaticIconName SHOW = StaticIconName.valueForString(example);
+ assertNotNull("SHOW returned null", SHOW);
- example = "0x74";
- StaticIconName SHUFFLE_PLAY = StaticIconName.valueForString(example);
- assertNotNull("SHUFFLE_PLAY returned null", SHUFFLE_PLAY);
+ example = "0x74";
+ StaticIconName SHUFFLE_PLAY = StaticIconName.valueForString(example);
+ assertNotNull("SHUFFLE_PLAY returned null", SHUFFLE_PLAY);
- example = "0xab";
- StaticIconName SKI_PLACES = StaticIconName.valueForString(example);
- assertNotNull("SKI_PLACES returned null", SKI_PLACES);
+ example = "0xab";
+ StaticIconName SKI_PLACES = StaticIconName.valueForString(example);
+ assertNotNull("SKI_PLACES returned null", SKI_PLACES);
- example = "0x9d";
- StaticIconName SLIGHT_LEFT = StaticIconName.valueForString(example);
- assertNotNull("SLIGHT_LEFT returned null", SLIGHT_LEFT);
+ example = "0x9d";
+ StaticIconName SLIGHT_LEFT = StaticIconName.valueForString(example);
+ assertNotNull("SLIGHT_LEFT returned null", SLIGHT_LEFT);
- example = "0xa1";
- StaticIconName SLIGHT_RIGHT = StaticIconName.valueForString(example);
- assertNotNull("SLIGHT_RIGHT returned null", SLIGHT_RIGHT);
+ example = "0xa1";
+ StaticIconName SLIGHT_RIGHT = StaticIconName.valueForString(example);
+ assertNotNull("SLIGHT_RIGHT returned null", SLIGHT_RIGHT);
- example = "0x05";
- StaticIconName SMARTPHONE = StaticIconName.valueForString(example);
- assertNotNull("SMARTPHONE returned null", SMARTPHONE);
+ example = "0x05";
+ StaticIconName SMARTPHONE = StaticIconName.valueForString(example);
+ assertNotNull("SMARTPHONE returned null", SMARTPHONE);
- example = "0x7B";
- StaticIconName SORT_LIST = StaticIconName.valueForString(example);
- assertNotNull("SORT_LIST returned null", SORT_LIST);
+ example = "0x7B";
+ StaticIconName SORT_LIST = StaticIconName.valueForString(example);
+ assertNotNull("SORT_LIST returned null", SORT_LIST);
- example = "0xE0";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_0 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_0 returned null", SPEED_DIAL_NUMBERS_NUMBER_0);
+ example = "0xE0";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_0 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_0 returned null", SPEED_DIAL_NUMBERS_NUMBER_0);
- example = "0xD7";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_1 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_1 returned null", SPEED_DIAL_NUMBERS_NUMBER_1);
+ example = "0xD7";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_1 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_1 returned null", SPEED_DIAL_NUMBERS_NUMBER_1);
- example = "0xD8";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_2 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_2 returned null", SPEED_DIAL_NUMBERS_NUMBER_2);
+ example = "0xD8";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_2 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_2 returned null", SPEED_DIAL_NUMBERS_NUMBER_2);
- example = "0xD9";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_3 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_3 returned null", SPEED_DIAL_NUMBERS_NUMBER_3);
+ example = "0xD9";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_3 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_3 returned null", SPEED_DIAL_NUMBERS_NUMBER_3);
- example = "0xDA";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_4 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_4 returned null", SPEED_DIAL_NUMBERS_NUMBER_4);
+ example = "0xDA";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_4 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_4 returned null", SPEED_DIAL_NUMBERS_NUMBER_4);
- example = "0xDB";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_5 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_5 returned null", SPEED_DIAL_NUMBERS_NUMBER_5);
+ example = "0xDB";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_5 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_5 returned null", SPEED_DIAL_NUMBERS_NUMBER_5);
- example = "0xDC";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_6 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_6 returned null", SPEED_DIAL_NUMBERS_NUMBER_6);
+ example = "0xDC";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_6 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_6 returned null", SPEED_DIAL_NUMBERS_NUMBER_6);
- example = "0xDD";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_7 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_7 returned null", SPEED_DIAL_NUMBERS_NUMBER_7);
+ example = "0xDD";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_7 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_7 returned null", SPEED_DIAL_NUMBERS_NUMBER_7);
- example = "0xDE";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_8 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_8 returned null", SPEED_DIAL_NUMBERS_NUMBER_8);
+ example = "0xDE";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_8 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_8 returned null", SPEED_DIAL_NUMBERS_NUMBER_8);
- example = "0xDF";
- StaticIconName SPEED_DIAL_NUMBERS_NUMBER_9 = StaticIconName.valueForString(example);
- assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_9 returned null", SPEED_DIAL_NUMBERS_NUMBER_9);
+ example = "0xDF";
+ StaticIconName SPEED_DIAL_NUMBERS_NUMBER_9 = StaticIconName.valueForString(example);
+ assertNotNull("SPEED_DIAL_NUMBERS_NUMBER_9 returned null", SPEED_DIAL_NUMBERS_NUMBER_9);
- example = "0xD5";
- StaticIconName SUCCESS = StaticIconName.valueForString(example);
- assertNotNull("SUCCESS returned null", SUCCESS);
-
- example = "0x4C";
- StaticIconName TRACK_TITLE = StaticIconName.valueForString(example);
- assertNotNull("TRACK_TITLE returned null", TRACK_TITLE);
-
- example = "0x2A";
- StaticIconName TRAFFIC_REPORT = StaticIconName.valueForString(example);
- assertNotNull("TRAFFIC_REPORT returned null", TRAFFIC_REPORT);
-
- example = "0x10";
- StaticIconName TURN_LIST = StaticIconName.valueForString(example);
- assertNotNull("TURN_LIST returned null", TURN_LIST);
-
- example = "0xad";
- StaticIconName UTURN_LEFT_TRAFFIC = StaticIconName.valueForString(example);
- assertNotNull("UTURN_LEFT_TRAFFIC returned null", UTURN_LEFT_TRAFFIC);
-
- example = "0xa9";
- StaticIconName UTURN_RIGHT_TRAFFIC = StaticIconName.valueForString(example);
- assertNotNull("UTURN_RIGHT_TRAFFIC returned null", UTURN_RIGHT_TRAFFIC);
-
- example = "0x18";
- StaticIconName UNDO = StaticIconName.valueForString(example);
- assertNotNull("UNDO returned null", UNDO);
-
- example = "0x23";
- StaticIconName UNLOCKED = StaticIconName.valueForString(example);
- assertNotNull("UNLOCKED returned null", UNLOCKED);
-
- example = "0x0B";
- StaticIconName USB_MEDIA_AUDIO_SOURCE = StaticIconName.valueForString(example);
- assertNotNull("USB_MEDIA_AUDIO_SOURCE returned null", USB_MEDIA_AUDIO_SOURCE);
-
- example = "0xC7";
- StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1 = StaticIconName.valueForString(example);
- assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1);
-
- example = "0xC8";
- StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2 = StaticIconName.valueForString(example);
- assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2);
-
- example = "0xC9";
- StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3 = StaticIconName.valueForString(example);
- assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3);
-
- example = "0xCA";
- StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4 = StaticIconName.valueForString(example);
- assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4);
-
- example = "0x90";
- StaticIconName VOICE_RECOGNITION_FAILED = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_FAILED returned null", VOICE_RECOGNITION_FAILED);
-
- example = "0x92";
- StaticIconName VOICE_RECOGNITION_PAUSE = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_PAUSE returned null", VOICE_RECOGNITION_PAUSE);
-
- example = "0x8F";
- StaticIconName VOICE_RECOGNITION_SUCCESSFUL = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_SUCCESSFUL returned null", VOICE_RECOGNITION_SUCCESSFUL);
-
- example = "0x11";
- StaticIconName VOICE_RECOGNITION_SYSTEM_ACTIVE = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_SYSTEM_ACTIVE returned null", VOICE_RECOGNITION_SYSTEM_ACTIVE);
-
- example = "0x91";
- StaticIconName VOICE_RECOGNITION_SYSTEM_LISTENING = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_SYSTEM_LISTENING returned null", VOICE_RECOGNITION_SYSTEM_LISTENING);
-
- example = "0x93";
- StaticIconName VOICE_RECOGNITION_TRY_AGAIN = StaticIconName.valueForString(example);
- assertNotNull("VOICE_RECOGNITION_TRY_AGAIN returned null", VOICE_RECOGNITION_TRY_AGAIN);
-
- example = "0xfe";
- StaticIconName WARNING = StaticIconName.valueForString(example);
- assertNotNull("WARNING returned null", WARNING);
-
- example = "0xeb";
- StaticIconName WEATHER = StaticIconName.valueForString(example);
- assertNotNull("WEATHER returned null", WEATHER);
-
- example = "0x43";
- StaticIconName WIFI_FULL = StaticIconName.valueForString(example);
- assertNotNull("WIFI_FULL returned null", WIFI_FULL);
-
- example = "0x98";
- StaticIconName ZOOM_IN = StaticIconName.valueForString(example);
- assertNotNull("ZOOM_IN returned null", ZOOM_IN);
-
- example = "0x9a";
- StaticIconName ZOOM_OUT = StaticIconName.valueForString(example);
- assertNotNull("ZOOM_OUT returned null", ZOOM_OUT);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "SoMeThInG";
- try {
- StaticIconName SOMETHING = StaticIconName.valueForString(example);
- assertNull("Result of valueForString should be null.", SOMETHING);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- StaticIconName temp = StaticIconName.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of StaticIconNames.
- */
- public void testListEnum() {
-
- List<StaticIconName> enumValueList = Arrays.asList(StaticIconName.values());
-
- List<StaticIconName> enumTestList = new ArrayList<>();
- enumTestList.add(StaticIconName.ACCEPT_CALL);
- enumTestList.add(StaticIconName.ADD_WAYPOINT);
- enumTestList.add(StaticIconName.ALBUM);
- enumTestList.add(StaticIconName.AMBIENT_LIGHTING);
- enumTestList.add(StaticIconName.ARROW_NORTH);
- enumTestList.add(StaticIconName.AUDIO_MUTE);
- enumTestList.add(StaticIconName.AUDIOBOOK_EPISODE);
- enumTestList.add(StaticIconName.AUDIOBOOK_NARRATOR);
- enumTestList.add(StaticIconName.AUXILLARY_AUDIO);
- enumTestList.add(StaticIconName.BACK);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_0_OF_5);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_1_OF_5);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_2_OF_5);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_3_OF_5);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_4_OF_5);
- enumTestList.add(StaticIconName.BATTERY_CAPACITY_5_OF_5);
- enumTestList.add(StaticIconName.BLUETOOTH_AUDIO_SOURCE);
- enumTestList.add(StaticIconName.BLUETOOTH1);
- enumTestList.add(StaticIconName.BLUETOOTH2);
- enumTestList.add(StaticIconName.BROWSE);
- enumTestList.add(StaticIconName.CELL_PHONE_IN_ROAMING_MODE);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS);
- enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS);
- enumTestList.add(StaticIconName.CHANGE_LANE_LEFT);
- enumTestList.add(StaticIconName.CHANGE_LANE_RIGHT);
- enumTestList.add(StaticIconName.CHECK_BOX_CHECKED);
- enumTestList.add(StaticIconName.CHECK_BOX_UNCHECKED);
- enumTestList.add(StaticIconName.CLIMATE);
- enumTestList.add(StaticIconName.CLOCK);
- enumTestList.add(StaticIconName.COMPOSE);
- enumTestList.add(StaticIconName.CONTACT);
- enumTestList.add(StaticIconName.CONTINUE);
- enumTestList.add(StaticIconName.DASH);
- enumTestList.add(StaticIconName.DATE);
- enumTestList.add(StaticIconName.DELETE);
- enumTestList.add(StaticIconName.DESTINATION);
- enumTestList.add(StaticIconName.DESTINATION_FERRY_AHEAD);
- enumTestList.add(StaticIconName.EBOOKMARK);
- enumTestList.add(StaticIconName.END_CALL);
- enumTestList.add(StaticIconName.FAIL);
- enumTestList.add(StaticIconName.FAST_FORWARD_30_SECS);
- enumTestList.add(StaticIconName.FAVORITE_HEART);
- enumTestList.add(StaticIconName.FAVORITE_STAR);
- enumTestList.add(StaticIconName.FAX_NUMBER);
- enumTestList.add(StaticIconName.FILENAME);
- enumTestList.add(StaticIconName.FILTER);
- enumTestList.add(StaticIconName.FOLDER);
- enumTestList.add(StaticIconName.FUEL_PRICES);
- enumTestList.add(StaticIconName.FULL_MAP);
- enumTestList.add(StaticIconName.GENERIC_PHONE_NUMBER);
- enumTestList.add(StaticIconName.GENRE);
- enumTestList.add(StaticIconName.GLOBAL_KEYBOARD);
- enumTestList.add(StaticIconName.HIGHWAY_EXIT_INFORMATION);
- enumTestList.add(StaticIconName.HOME_PHONE_NUMBER);
- enumTestList.add(StaticIconName.HYPERLINK);
- enumTestList.add(StaticIconName.ID3_TAG_UNKNOWN);
- enumTestList.add(StaticIconName.INCOMING_CALLS);
- enumTestList.add(StaticIconName.INFORMATION);
- enumTestList.add(StaticIconName.IPOD_MEDIA_SOURCE);
- enumTestList.add(StaticIconName.JOIN_CALLS);
- enumTestList.add(StaticIconName.KEEP_LEFT);
- enumTestList.add(StaticIconName.KEEP_RIGHT);
- enumTestList.add(StaticIconName.KEY);
- enumTestList.add(StaticIconName.LEFT);
- enumTestList.add(StaticIconName.LEFT_ARROW);
- enumTestList.add(StaticIconName.LEFT_EXIT);
- enumTestList.add(StaticIconName.LINE_IN_AUDIO_SOURCE);
- enumTestList.add(StaticIconName.LOCKED);
- enumTestList.add(StaticIconName.MEDIA_CONTROL_LEFT_ARROW);
- enumTestList.add(StaticIconName.MEDIA_CONTROL_RECORDING);
- enumTestList.add(StaticIconName.MEDIA_CONTROL_RIGHT_ARROW);
- enumTestList.add(StaticIconName.MEDIA_CONTROL_STOP);
- enumTestList.add(StaticIconName.MICROPHONE);
- enumTestList.add(StaticIconName.MISSED_CALLS);
- enumTestList.add(StaticIconName.MOBILE_PHONE_NUMBER);
- enumTestList.add(StaticIconName.MOVE_DOWN);
- enumTestList.add(StaticIconName.MOVE_UP);
- enumTestList.add(StaticIconName.MP3_TAG_ARTIST);
- enumTestList.add(StaticIconName.NAVIGATION);
- enumTestList.add(StaticIconName.NAVIGATION_CURRENT_DIRECTION);
- enumTestList.add(StaticIconName.NEGATIVE_RATING_THUMBS_DOWN);
- enumTestList.add(StaticIconName.NEW);
- enumTestList.add(StaticIconName.OFFICE_PHONE_NUMBER);
- enumTestList.add(StaticIconName.OPENED);
- enumTestList.add(StaticIconName.ORIGIN);
- enumTestList.add(StaticIconName.OUTGOING_CALLS);
- enumTestList.add(StaticIconName.PHONE_CALL_1);
- enumTestList.add(StaticIconName.PHONE_CALL_2);
- enumTestList.add(StaticIconName.PHONE_DEVICE);
- enumTestList.add(StaticIconName.PHONEBOOK);
- enumTestList.add(StaticIconName.PHOTO);
- enumTestList.add(StaticIconName.PLAY);
- enumTestList.add(StaticIconName.PLAYLIST);
- enumTestList.add(StaticIconName.POPUP);
- enumTestList.add(StaticIconName.POSITIVE_RATING_THUMBS_UP);
- enumTestList.add(StaticIconName.POWER);
- enumTestList.add(StaticIconName.PRIMARY_PHONE);
- enumTestList.add(StaticIconName.RADIO_BUTTON_CHECKED);
- enumTestList.add(StaticIconName.RADIO_BUTTON_UNCHECKED);
- enumTestList.add(StaticIconName.RECENT_CALLS);
- enumTestList.add(StaticIconName.RECENT_DESTINATIONS);
- enumTestList.add(StaticIconName.REDO);
- enumTestList.add(StaticIconName.REFRESH);
- enumTestList.add(StaticIconName.REMOTE_DIAGNOSTICS_CHECK_ENGINE);
- enumTestList.add(StaticIconName.RENDERED_911_ASSIST);
- enumTestList.add(StaticIconName.REPEAT);
- enumTestList.add(StaticIconName.REPEAT_PLAY);
- enumTestList.add(StaticIconName.REPLY);
- enumTestList.add(StaticIconName.REWIND_30_SECS);
- enumTestList.add(StaticIconName.RIGHT);
- enumTestList.add(StaticIconName.RIGHT_EXIT);
- enumTestList.add(StaticIconName.RINGTONES);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_1);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_2);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_3);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_4);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_5);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_6);
- enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_7);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_1);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_2);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_3);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_4);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_5);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_6);
- enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_7);
- enumTestList.add(StaticIconName.RSS);
- enumTestList.add(StaticIconName.SETTINGS);
- enumTestList.add(StaticIconName.SHARP_LEFT);
- enumTestList.add(StaticIconName.SHARP_RIGHT);
- enumTestList.add(StaticIconName.SHOW);
- enumTestList.add(StaticIconName.SHUFFLE_PLAY);
- enumTestList.add(StaticIconName.SKI_PLACES);
- enumTestList.add(StaticIconName.SLIGHT_LEFT);
- enumTestList.add(StaticIconName.SLIGHT_RIGHT);
- enumTestList.add(StaticIconName.SMARTPHONE);
- enumTestList.add(StaticIconName.SORT_LIST);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_0);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_1);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_2);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_3);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_4);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_5);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_6);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_7);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_8);
- enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_9);
- enumTestList.add(StaticIconName.SUCCESS);
- enumTestList.add(StaticIconName.TRACK_TITLE);
- enumTestList.add(StaticIconName.TRAFFIC_REPORT);
- enumTestList.add(StaticIconName.TURN_LIST);
- enumTestList.add(StaticIconName.UTURN_LEFT_TRAFFIC);
- enumTestList.add(StaticIconName.UTURN_RIGHT_TRAFFIC);
- enumTestList.add(StaticIconName.UNDO);
- enumTestList.add(StaticIconName.UNLOCKED);
- enumTestList.add(StaticIconName.USB_MEDIA_AUDIO_SOURCE);
- enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1);
- enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2);
- enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3);
- enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_FAILED);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_PAUSE);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_SUCCESSFUL);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_SYSTEM_ACTIVE);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_SYSTEM_LISTENING);
- enumTestList.add(StaticIconName.VOICE_RECOGNITION_TRY_AGAIN);
- enumTestList.add(StaticIconName.WARNING);
- enumTestList.add(StaticIconName.WEATHER);
- enumTestList.add(StaticIconName.WIFI_FULL);
- enumTestList.add(StaticIconName.ZOOM_IN);
- enumTestList.add(StaticIconName.ZOOM_OUT);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ example = "0xD5";
+ StaticIconName SUCCESS = StaticIconName.valueForString(example);
+ assertNotNull("SUCCESS returned null", SUCCESS);
+
+ example = "0x4C";
+ StaticIconName TRACK_TITLE = StaticIconName.valueForString(example);
+ assertNotNull("TRACK_TITLE returned null", TRACK_TITLE);
+
+ example = "0x2A";
+ StaticIconName TRAFFIC_REPORT = StaticIconName.valueForString(example);
+ assertNotNull("TRAFFIC_REPORT returned null", TRAFFIC_REPORT);
+
+ example = "0x10";
+ StaticIconName TURN_LIST = StaticIconName.valueForString(example);
+ assertNotNull("TURN_LIST returned null", TURN_LIST);
+
+ example = "0xad";
+ StaticIconName UTURN_LEFT_TRAFFIC = StaticIconName.valueForString(example);
+ assertNotNull("UTURN_LEFT_TRAFFIC returned null", UTURN_LEFT_TRAFFIC);
+
+ example = "0xa9";
+ StaticIconName UTURN_RIGHT_TRAFFIC = StaticIconName.valueForString(example);
+ assertNotNull("UTURN_RIGHT_TRAFFIC returned null", UTURN_RIGHT_TRAFFIC);
+
+ example = "0x18";
+ StaticIconName UNDO = StaticIconName.valueForString(example);
+ assertNotNull("UNDO returned null", UNDO);
+
+ example = "0x23";
+ StaticIconName UNLOCKED = StaticIconName.valueForString(example);
+ assertNotNull("UNLOCKED returned null", UNLOCKED);
+
+ example = "0x0B";
+ StaticIconName USB_MEDIA_AUDIO_SOURCE = StaticIconName.valueForString(example);
+ assertNotNull("USB_MEDIA_AUDIO_SOURCE returned null", USB_MEDIA_AUDIO_SOURCE);
+
+ example = "0xC7";
+ StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1 = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1);
+
+ example = "0xC8";
+ StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2 = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2);
+
+ example = "0xC9";
+ StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3 = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3);
+
+ example = "0xCA";
+ StaticIconName VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4 = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4 returned null", VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4);
+
+ example = "0x90";
+ StaticIconName VOICE_RECOGNITION_FAILED = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_FAILED returned null", VOICE_RECOGNITION_FAILED);
+
+ example = "0x92";
+ StaticIconName VOICE_RECOGNITION_PAUSE = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_PAUSE returned null", VOICE_RECOGNITION_PAUSE);
+
+ example = "0x8F";
+ StaticIconName VOICE_RECOGNITION_SUCCESSFUL = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_SUCCESSFUL returned null", VOICE_RECOGNITION_SUCCESSFUL);
+
+ example = "0x11";
+ StaticIconName VOICE_RECOGNITION_SYSTEM_ACTIVE = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_SYSTEM_ACTIVE returned null", VOICE_RECOGNITION_SYSTEM_ACTIVE);
+
+ example = "0x91";
+ StaticIconName VOICE_RECOGNITION_SYSTEM_LISTENING = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_SYSTEM_LISTENING returned null", VOICE_RECOGNITION_SYSTEM_LISTENING);
+
+ example = "0x93";
+ StaticIconName VOICE_RECOGNITION_TRY_AGAIN = StaticIconName.valueForString(example);
+ assertNotNull("VOICE_RECOGNITION_TRY_AGAIN returned null", VOICE_RECOGNITION_TRY_AGAIN);
+
+ example = "0xfe";
+ StaticIconName WARNING = StaticIconName.valueForString(example);
+ assertNotNull("WARNING returned null", WARNING);
+
+ example = "0xeb";
+ StaticIconName WEATHER = StaticIconName.valueForString(example);
+ assertNotNull("WEATHER returned null", WEATHER);
+
+ example = "0x43";
+ StaticIconName WIFI_FULL = StaticIconName.valueForString(example);
+ assertNotNull("WIFI_FULL returned null", WIFI_FULL);
+
+ example = "0x98";
+ StaticIconName ZOOM_IN = StaticIconName.valueForString(example);
+ assertNotNull("ZOOM_IN returned null", ZOOM_IN);
+
+ example = "0x9a";
+ StaticIconName ZOOM_OUT = StaticIconName.valueForString(example);
+ assertNotNull("ZOOM_OUT returned null", ZOOM_OUT);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "SoMeThInG";
+ try {
+ StaticIconName SOMETHING = StaticIconName.valueForString(example);
+ assertNull("Result of valueForString should be null.", SOMETHING);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ StaticIconName temp = StaticIconName.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of StaticIconNames.
+ */
+ public void testListEnum() {
+
+ List<StaticIconName> enumValueList = Arrays.asList(StaticIconName.values());
+
+ List<StaticIconName> enumTestList = new ArrayList<>();
+ enumTestList.add(StaticIconName.ACCEPT_CALL);
+ enumTestList.add(StaticIconName.ADD_WAYPOINT);
+ enumTestList.add(StaticIconName.ALBUM);
+ enumTestList.add(StaticIconName.AMBIENT_LIGHTING);
+ enumTestList.add(StaticIconName.ARROW_NORTH);
+ enumTestList.add(StaticIconName.AUDIO_MUTE);
+ enumTestList.add(StaticIconName.AUDIOBOOK_EPISODE);
+ enumTestList.add(StaticIconName.AUDIOBOOK_NARRATOR);
+ enumTestList.add(StaticIconName.AUXILLARY_AUDIO);
+ enumTestList.add(StaticIconName.BACK);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_0_OF_5);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_1_OF_5);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_2_OF_5);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_3_OF_5);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_4_OF_5);
+ enumTestList.add(StaticIconName.BATTERY_CAPACITY_5_OF_5);
+ enumTestList.add(StaticIconName.BLUETOOTH_AUDIO_SOURCE);
+ enumTestList.add(StaticIconName.BLUETOOTH1);
+ enumTestList.add(StaticIconName.BLUETOOTH2);
+ enumTestList.add(StaticIconName.BROWSE);
+ enumTestList.add(StaticIconName.CELL_PHONE_IN_ROAMING_MODE);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS);
+ enumTestList.add(StaticIconName.CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS);
+ enumTestList.add(StaticIconName.CHANGE_LANE_LEFT);
+ enumTestList.add(StaticIconName.CHANGE_LANE_RIGHT);
+ enumTestList.add(StaticIconName.CHECK_BOX_CHECKED);
+ enumTestList.add(StaticIconName.CHECK_BOX_UNCHECKED);
+ enumTestList.add(StaticIconName.CLIMATE);
+ enumTestList.add(StaticIconName.CLOCK);
+ enumTestList.add(StaticIconName.COMPOSE);
+ enumTestList.add(StaticIconName.CONTACT);
+ enumTestList.add(StaticIconName.CONTINUE);
+ enumTestList.add(StaticIconName.DASH);
+ enumTestList.add(StaticIconName.DATE);
+ enumTestList.add(StaticIconName.DELETE);
+ enumTestList.add(StaticIconName.DESTINATION);
+ enumTestList.add(StaticIconName.DESTINATION_FERRY_AHEAD);
+ enumTestList.add(StaticIconName.EBOOKMARK);
+ enumTestList.add(StaticIconName.END_CALL);
+ enumTestList.add(StaticIconName.FAIL);
+ enumTestList.add(StaticIconName.FAST_FORWARD_30_SECS);
+ enumTestList.add(StaticIconName.FAVORITE_HEART);
+ enumTestList.add(StaticIconName.FAVORITE_STAR);
+ enumTestList.add(StaticIconName.FAX_NUMBER);
+ enumTestList.add(StaticIconName.FILENAME);
+ enumTestList.add(StaticIconName.FILTER);
+ enumTestList.add(StaticIconName.FOLDER);
+ enumTestList.add(StaticIconName.FUEL_PRICES);
+ enumTestList.add(StaticIconName.FULL_MAP);
+ enumTestList.add(StaticIconName.GENERIC_PHONE_NUMBER);
+ enumTestList.add(StaticIconName.GENRE);
+ enumTestList.add(StaticIconName.GLOBAL_KEYBOARD);
+ enumTestList.add(StaticIconName.HIGHWAY_EXIT_INFORMATION);
+ enumTestList.add(StaticIconName.HOME_PHONE_NUMBER);
+ enumTestList.add(StaticIconName.HYPERLINK);
+ enumTestList.add(StaticIconName.ID3_TAG_UNKNOWN);
+ enumTestList.add(StaticIconName.INCOMING_CALLS);
+ enumTestList.add(StaticIconName.INFORMATION);
+ enumTestList.add(StaticIconName.IPOD_MEDIA_SOURCE);
+ enumTestList.add(StaticIconName.JOIN_CALLS);
+ enumTestList.add(StaticIconName.KEEP_LEFT);
+ enumTestList.add(StaticIconName.KEEP_RIGHT);
+ enumTestList.add(StaticIconName.KEY);
+ enumTestList.add(StaticIconName.LEFT);
+ enumTestList.add(StaticIconName.LEFT_ARROW);
+ enumTestList.add(StaticIconName.LEFT_EXIT);
+ enumTestList.add(StaticIconName.LINE_IN_AUDIO_SOURCE);
+ enumTestList.add(StaticIconName.LOCKED);
+ enumTestList.add(StaticIconName.MEDIA_CONTROL_LEFT_ARROW);
+ enumTestList.add(StaticIconName.MEDIA_CONTROL_RECORDING);
+ enumTestList.add(StaticIconName.MEDIA_CONTROL_RIGHT_ARROW);
+ enumTestList.add(StaticIconName.MEDIA_CONTROL_STOP);
+ enumTestList.add(StaticIconName.MICROPHONE);
+ enumTestList.add(StaticIconName.MISSED_CALLS);
+ enumTestList.add(StaticIconName.MOBILE_PHONE_NUMBER);
+ enumTestList.add(StaticIconName.MOVE_DOWN);
+ enumTestList.add(StaticIconName.MOVE_UP);
+ enumTestList.add(StaticIconName.MP3_TAG_ARTIST);
+ enumTestList.add(StaticIconName.NAVIGATION);
+ enumTestList.add(StaticIconName.NAVIGATION_CURRENT_DIRECTION);
+ enumTestList.add(StaticIconName.NEGATIVE_RATING_THUMBS_DOWN);
+ enumTestList.add(StaticIconName.NEW);
+ enumTestList.add(StaticIconName.OFFICE_PHONE_NUMBER);
+ enumTestList.add(StaticIconName.OPENED);
+ enumTestList.add(StaticIconName.ORIGIN);
+ enumTestList.add(StaticIconName.OUTGOING_CALLS);
+ enumTestList.add(StaticIconName.PHONE_CALL_1);
+ enumTestList.add(StaticIconName.PHONE_CALL_2);
+ enumTestList.add(StaticIconName.PHONE_DEVICE);
+ enumTestList.add(StaticIconName.PHONEBOOK);
+ enumTestList.add(StaticIconName.PHOTO);
+ enumTestList.add(StaticIconName.PLAY);
+ enumTestList.add(StaticIconName.PLAYLIST);
+ enumTestList.add(StaticIconName.POPUP);
+ enumTestList.add(StaticIconName.POSITIVE_RATING_THUMBS_UP);
+ enumTestList.add(StaticIconName.POWER);
+ enumTestList.add(StaticIconName.PRIMARY_PHONE);
+ enumTestList.add(StaticIconName.RADIO_BUTTON_CHECKED);
+ enumTestList.add(StaticIconName.RADIO_BUTTON_UNCHECKED);
+ enumTestList.add(StaticIconName.RECENT_CALLS);
+ enumTestList.add(StaticIconName.RECENT_DESTINATIONS);
+ enumTestList.add(StaticIconName.REDO);
+ enumTestList.add(StaticIconName.REFRESH);
+ enumTestList.add(StaticIconName.REMOTE_DIAGNOSTICS_CHECK_ENGINE);
+ enumTestList.add(StaticIconName.RENDERED_911_ASSIST);
+ enumTestList.add(StaticIconName.REPEAT);
+ enumTestList.add(StaticIconName.REPEAT_PLAY);
+ enumTestList.add(StaticIconName.REPLY);
+ enumTestList.add(StaticIconName.REWIND_30_SECS);
+ enumTestList.add(StaticIconName.RIGHT);
+ enumTestList.add(StaticIconName.RIGHT_EXIT);
+ enumTestList.add(StaticIconName.RINGTONES);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_1);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_2);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_3);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_4);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_5);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_6);
+ enumTestList.add(StaticIconName.ROUNDABOUT_LEFT_HAND_7);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_1);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_2);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_3);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_4);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_5);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_6);
+ enumTestList.add(StaticIconName.ROUNDABOUT_RIGHT_HAND_7);
+ enumTestList.add(StaticIconName.RSS);
+ enumTestList.add(StaticIconName.SETTINGS);
+ enumTestList.add(StaticIconName.SHARP_LEFT);
+ enumTestList.add(StaticIconName.SHARP_RIGHT);
+ enumTestList.add(StaticIconName.SHOW);
+ enumTestList.add(StaticIconName.SHUFFLE_PLAY);
+ enumTestList.add(StaticIconName.SKI_PLACES);
+ enumTestList.add(StaticIconName.SLIGHT_LEFT);
+ enumTestList.add(StaticIconName.SLIGHT_RIGHT);
+ enumTestList.add(StaticIconName.SMARTPHONE);
+ enumTestList.add(StaticIconName.SORT_LIST);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_0);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_1);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_2);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_3);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_4);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_5);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_6);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_7);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_8);
+ enumTestList.add(StaticIconName.SPEED_DIAL_NUMBERS_NUMBER_9);
+ enumTestList.add(StaticIconName.SUCCESS);
+ enumTestList.add(StaticIconName.TRACK_TITLE);
+ enumTestList.add(StaticIconName.TRAFFIC_REPORT);
+ enumTestList.add(StaticIconName.TURN_LIST);
+ enumTestList.add(StaticIconName.UTURN_LEFT_TRAFFIC);
+ enumTestList.add(StaticIconName.UTURN_RIGHT_TRAFFIC);
+ enumTestList.add(StaticIconName.UNDO);
+ enumTestList.add(StaticIconName.UNLOCKED);
+ enumTestList.add(StaticIconName.USB_MEDIA_AUDIO_SOURCE);
+ enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1);
+ enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2);
+ enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3);
+ enumTestList.add(StaticIconName.VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_FAILED);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_PAUSE);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_SUCCESSFUL);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_SYSTEM_ACTIVE);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_SYSTEM_LISTENING);
+ enumTestList.add(StaticIconName.VOICE_RECOGNITION_TRY_AGAIN);
+ enumTestList.add(StaticIconName.WARNING);
+ enumTestList.add(StaticIconName.WEATHER);
+ enumTestList.add(StaticIconName.WIFI_FULL);
+ enumTestList.add(StaticIconName.ZOOM_IN);
+ enumTestList.add(StaticIconName.ZOOM_OUT);
+
+ 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/SupportedSeatTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SupportedSeatTests.java
index 7bea14061..44c55cb08 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SupportedSeatTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SupportedSeatTests.java
@@ -14,56 +14,56 @@ import java.util.List;
*/
public class SupportedSeatTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums() {
- String example = "DRIVER";
- SupportedSeat enumDriver = SupportedSeat.valueForString(example);
- example = "FRONT_PASSENGER";
- SupportedSeat enumFrontPassenger = SupportedSeat.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DRIVER";
+ SupportedSeat enumDriver = SupportedSeat.valueForString(example);
+ example = "FRONT_PASSENGER";
+ SupportedSeat enumFrontPassenger = SupportedSeat.valueForString(example);
- assertNotNull("DRIVER returned null", enumDriver);
- assertNotNull("FRONT_PASSENGER returned null", enumFrontPassenger);
- }
+ assertNotNull("DRIVER returned null", enumDriver);
+ assertNotNull("FRONT_PASSENGER returned null", enumFrontPassenger);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum() {
- String example = "dRIVER";
- try {
- SupportedSeat temp = SupportedSeat.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "dRIVER";
+ try {
+ SupportedSeat temp = SupportedSeat.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 {
- SupportedSeat temp = SupportedSeat.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SupportedSeat temp = SupportedSeat.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of SupportedSeat.
- */
- public void testListEnum() {
- List<SupportedSeat> enumValueList = Arrays.asList(SupportedSeat.values());
+ /**
+ * Verifies the possible enum values of SupportedSeat.
+ */
+ public void testListEnum() {
+ List<SupportedSeat> enumValueList = Arrays.asList(SupportedSeat.values());
- List<SupportedSeat> enumTestList = new ArrayList<SupportedSeat>();
- enumTestList.add(SupportedSeat.DRIVER);
- enumTestList.add(SupportedSeat.FRONT_PASSENGER);
+ List<SupportedSeat> enumTestList = new ArrayList<SupportedSeat>();
+ enumTestList.add(SupportedSeat.DRIVER);
+ enumTestList.add(SupportedSeat.FRONT_PASSENGER);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SystemActionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemActionTests.java
index 4cb1fca51..8d4fc78f8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemActionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemActionTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SystemAction}
*/
public class SystemActionTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "DEFAULT_ACTION";
- SystemAction enumDefaultAction = SystemAction.valueForString(example);
- example = "STEAL_FOCUS";
- SystemAction enumStealFocus = SystemAction.valueForString(example);
- example = "KEEP_CONTEXT";
- SystemAction enumKeepContext = SystemAction.valueForString(example);
-
- assertNotNull("DEFAULT_ACTION returned null", enumDefaultAction);
- assertNotNull("STEAL_FOCUS returned null", enumStealFocus);
- assertNotNull("KEEP_CONTEXT returned null", enumKeepContext);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "DEFAULT_ACTION";
+ SystemAction enumDefaultAction = SystemAction.valueForString(example);
+ example = "STEAL_FOCUS";
+ SystemAction enumStealFocus = SystemAction.valueForString(example);
+ example = "KEEP_CONTEXT";
+ SystemAction enumKeepContext = SystemAction.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "deFaulT_ActiON";
- try {
- SystemAction temp = SystemAction.valueForString(example);
+ assertNotNull("DEFAULT_ACTION returned null", enumDefaultAction);
+ assertNotNull("STEAL_FOCUS returned null", enumStealFocus);
+ assertNotNull("KEEP_CONTEXT returned null", enumKeepContext);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "deFaulT_ActiON";
+ try {
+ SystemAction temp = SystemAction.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SystemAction temp = SystemAction.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SystemAction temp = SystemAction.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of SystemAction.
- */
- public void testListEnum() {
- List<SystemAction> enumValueList = Arrays.asList(SystemAction.values());
+ /**
+ * Verifies the possible enum values of SystemAction.
+ */
+ public void testListEnum() {
+ List<SystemAction> enumValueList = Arrays.asList(SystemAction.values());
- List<SystemAction> enumTestList = new ArrayList<SystemAction>();
- enumTestList.add(SystemAction.DEFAULT_ACTION);
- enumTestList.add(SystemAction.STEAL_FOCUS);
- enumTestList.add(SystemAction.KEEP_CONTEXT);
+ List<SystemAction> enumTestList = new ArrayList<SystemAction>();
+ enumTestList.add(SystemAction.DEFAULT_ACTION);
+ enumTestList.add(SystemAction.STEAL_FOCUS);
+ enumTestList.add(SystemAction.KEEP_CONTEXT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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 94617493c..e5dce7185 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
@@ -9,133 +9,131 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType}
*/
public class SystemCapabilityTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NAVIGATION";
- SystemCapabilityType enumNavigation = SystemCapabilityType.valueForString(example);
- example = "PHONE_CALL";
- SystemCapabilityType enumPhoneCall = SystemCapabilityType.valueForString(example);
- example = "VIDEO_STREAMING";
- SystemCapabilityType enumVideoStreaming = SystemCapabilityType.valueForString(example);
- example = "REMOTE_CONTROL";
- SystemCapabilityType enumRemoteControl = SystemCapabilityType.valueForString(example);
- example = "HMI";
- SystemCapabilityType enumHmi = SystemCapabilityType.valueForString(example);
- example = "DISPLAY";
- SystemCapabilityType enumDisplay = SystemCapabilityType.valueForString(example);
- example = "AUDIO_PASSTHROUGH";
- SystemCapabilityType enumAudioPassThrough = SystemCapabilityType.valueForString(example);
- example = "BUTTON";
- SystemCapabilityType enumButton = SystemCapabilityType.valueForString(example);
- example = "HMI_ZONE";
- SystemCapabilityType enumHmiZone = SystemCapabilityType.valueForString(example);
- example = "PRESET_BANK";
- SystemCapabilityType enumPresetBank = SystemCapabilityType.valueForString(example);
- example = "SOFTBUTTON";
- SystemCapabilityType enumSoftButton = SystemCapabilityType.valueForString(example);
- example = "SPEECH";
- SystemCapabilityType enumSpeech = SystemCapabilityType.valueForString(example);
- example = "VOICE_RECOGNITION";
- SystemCapabilityType enumVoiceRecognition = SystemCapabilityType.valueForString(example);
- example = "PCM_STREAMING";
- 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);
- example = "DRIVER_DISTRACTION";
- SystemCapabilityType enumDriverDistraction = SystemCapabilityType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NAVIGATION";
+ SystemCapabilityType enumNavigation = SystemCapabilityType.valueForString(example);
+ example = "PHONE_CALL";
+ SystemCapabilityType enumPhoneCall = SystemCapabilityType.valueForString(example);
+ example = "VIDEO_STREAMING";
+ SystemCapabilityType enumVideoStreaming = SystemCapabilityType.valueForString(example);
+ example = "REMOTE_CONTROL";
+ SystemCapabilityType enumRemoteControl = SystemCapabilityType.valueForString(example);
+ example = "HMI";
+ SystemCapabilityType enumHmi = SystemCapabilityType.valueForString(example);
+ example = "DISPLAY";
+ SystemCapabilityType enumDisplay = SystemCapabilityType.valueForString(example);
+ example = "AUDIO_PASSTHROUGH";
+ SystemCapabilityType enumAudioPassThrough = SystemCapabilityType.valueForString(example);
+ example = "BUTTON";
+ SystemCapabilityType enumButton = SystemCapabilityType.valueForString(example);
+ example = "HMI_ZONE";
+ SystemCapabilityType enumHmiZone = SystemCapabilityType.valueForString(example);
+ example = "PRESET_BANK";
+ SystemCapabilityType enumPresetBank = SystemCapabilityType.valueForString(example);
+ example = "SOFTBUTTON";
+ SystemCapabilityType enumSoftButton = SystemCapabilityType.valueForString(example);
+ example = "SPEECH";
+ SystemCapabilityType enumSpeech = SystemCapabilityType.valueForString(example);
+ example = "VOICE_RECOGNITION";
+ SystemCapabilityType enumVoiceRecognition = SystemCapabilityType.valueForString(example);
+ example = "PCM_STREAMING";
+ 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);
+ example = "DRIVER_DISTRACTION";
+ SystemCapabilityType enumDriverDistraction = SystemCapabilityType.valueForString(example);
- assertNotNull("NAVIGATION returned null", enumNavigation);
- assertNotNull("PHONE_CALL returned null", enumPhoneCall);
- assertNotNull("VIDEO_STREAMING returned null", enumVideoStreaming);
- assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
- assertNotNull("HMI returned null", enumHmi);
- assertNotNull("DISPLAY returned null", enumDisplay);
- assertNotNull("AUDIO_PASSTHROUGH returned null", enumAudioPassThrough);
- assertNotNull("BUTTON returned null", enumButton);
- assertNotNull("HMI_ZONE returned null", enumHmiZone);
- assertNotNull("PRESET_BANK returned null", enumPresetBank);
- assertNotNull("SOFTBUTTON returned null", enumSoftButton);
- assertNotNull("SPEECH returned null", enumSpeech);
- 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);
- assertNotNull("DRIVER_DISTRACTION", enumDriverDistraction);
+ assertNotNull("NAVIGATION returned null", enumNavigation);
+ assertNotNull("PHONE_CALL returned null", enumPhoneCall);
+ assertNotNull("VIDEO_STREAMING returned null", enumVideoStreaming);
+ assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
+ assertNotNull("HMI returned null", enumHmi);
+ assertNotNull("DISPLAY returned null", enumDisplay);
+ assertNotNull("AUDIO_PASSTHROUGH returned null", enumAudioPassThrough);
+ assertNotNull("BUTTON returned null", enumButton);
+ assertNotNull("HMI_ZONE returned null", enumHmiZone);
+ assertNotNull("PRESET_BANK returned null", enumPresetBank);
+ assertNotNull("SOFTBUTTON returned null", enumSoftButton);
+ assertNotNull("SPEECH returned null", enumSpeech);
+ 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);
+ assertNotNull("DRIVER_DISTRACTION", enumDriverDistraction);
- }
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "nAVIGATION";
- try {
- SystemCapabilityType temp = SystemCapabilityType.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "nAVIGATION";
+ try {
+ SystemCapabilityType temp = SystemCapabilityType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SystemCapabilityType temp = SystemCapabilityType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SystemCapabilityType temp = SystemCapabilityType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of SystemCapabilityType.
- */
- public void testListEnum() {
- List<SystemCapabilityType> enumValueList = Arrays.asList(SystemCapabilityType.values());
+ /**
+ * Verifies the possible enum values of SystemCapabilityType.
+ */
+ public void testListEnum() {
+ List<SystemCapabilityType> enumValueList = Arrays.asList(SystemCapabilityType.values());
- List<SystemCapabilityType> enumTestList = new ArrayList<SystemCapabilityType>();
- enumTestList.add(SystemCapabilityType.NAVIGATION);
- enumTestList.add(SystemCapabilityType.PHONE_CALL);
- enumTestList.add(SystemCapabilityType.VIDEO_STREAMING);
- enumTestList.add(SystemCapabilityType.REMOTE_CONTROL);
- enumTestList.add(SystemCapabilityType.HMI);
- enumTestList.add(SystemCapabilityType.DISPLAY);
- enumTestList.add(SystemCapabilityType.AUDIO_PASSTHROUGH);
- enumTestList.add(SystemCapabilityType.BUTTON);
- enumTestList.add(SystemCapabilityType.HMI_ZONE);
- enumTestList.add(SystemCapabilityType.PRESET_BANK);
- enumTestList.add(SystemCapabilityType.SOFTBUTTON);
- enumTestList.add(SystemCapabilityType.SPEECH);
- 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);
- enumTestList.add(SystemCapabilityType.DRIVER_DISTRACTION);
+ List<SystemCapabilityType> enumTestList = new ArrayList<SystemCapabilityType>();
+ enumTestList.add(SystemCapabilityType.NAVIGATION);
+ enumTestList.add(SystemCapabilityType.PHONE_CALL);
+ enumTestList.add(SystemCapabilityType.VIDEO_STREAMING);
+ enumTestList.add(SystemCapabilityType.REMOTE_CONTROL);
+ enumTestList.add(SystemCapabilityType.HMI);
+ enumTestList.add(SystemCapabilityType.DISPLAY);
+ enumTestList.add(SystemCapabilityType.AUDIO_PASSTHROUGH);
+ enumTestList.add(SystemCapabilityType.BUTTON);
+ enumTestList.add(SystemCapabilityType.HMI_ZONE);
+ enumTestList.add(SystemCapabilityType.PRESET_BANK);
+ enumTestList.add(SystemCapabilityType.SOFTBUTTON);
+ enumTestList.add(SystemCapabilityType.SPEECH);
+ 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);
+ enumTestList.add(SystemCapabilityType.DRIVER_DISTRACTION);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/SystemContextTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemContextTests.java
index 00e8477ac..9998227bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemContextTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemContextTests.java
@@ -9,75 +9,73 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.SystemContext}
*/
public class SystemContextTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "MAIN";
- SystemContext enumMain = SystemContext.valueForString(example);
- example = "VRSESSION";
- SystemContext enumVrSession = SystemContext.valueForString(example);
- example = "MENU";
- SystemContext enumMenu = SystemContext.valueForString(example);
- example = "HMI_OBSCURED";
- SystemContext enumHmiObscured = SystemContext.valueForString(example);
- example = "ALERT";
- SystemContext enumAlert = SystemContext.valueForString(example);
-
- assertNotNull("MAIN returned null", enumMain);
- assertNotNull("VRSESSION returned null", enumVrSession);
- assertNotNull("MENU returned null", enumMenu);
- assertNotNull("HMI_OBSCURED returned null", enumHmiObscured);
- assertNotNull("ALERT returned null", enumAlert);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MAIN";
+ SystemContext enumMain = SystemContext.valueForString(example);
+ example = "VRSESSION";
+ SystemContext enumVrSession = SystemContext.valueForString(example);
+ example = "MENU";
+ SystemContext enumMenu = SystemContext.valueForString(example);
+ example = "HMI_OBSCURED";
+ SystemContext enumHmiObscured = SystemContext.valueForString(example);
+ example = "ALERT";
+ SystemContext enumAlert = SystemContext.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "mAIn";
- try {
- SystemContext temp = SystemContext.valueForString(example);
+ assertNotNull("MAIN returned null", enumMain);
+ assertNotNull("VRSESSION returned null", enumVrSession);
+ assertNotNull("MENU returned null", enumMenu);
+ assertNotNull("HMI_OBSCURED returned null", enumHmiObscured);
+ assertNotNull("ALERT returned null", enumAlert);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "mAIn";
+ try {
+ SystemContext temp = SystemContext.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- SystemContext temp = SystemContext.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ SystemContext temp = SystemContext.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of SystemContext.
+ */
+ public void testListEnum() {
+ List<SystemContext> enumValueList = Arrays.asList(SystemContext.values());
- /**
- * Verifies the possible enum values of SystemContext.
- */
- public void testListEnum() {
- List<SystemContext> enumValueList = Arrays.asList(SystemContext.values());
+ List<SystemContext> enumTestList = new ArrayList<SystemContext>();
+ enumTestList.add(SystemContext.SYSCTXT_MAIN);
+ enumTestList.add(SystemContext.SYSCTXT_VRSESSION);
+ enumTestList.add(SystemContext.SYSCTXT_MENU);
+ enumTestList.add(SystemContext.SYSCTXT_HMI_OBSCURED);
+ enumTestList.add(SystemContext.SYSCTXT_ALERT);
- List<SystemContext> enumTestList = new ArrayList<SystemContext>();
- enumTestList.add(SystemContext.SYSCTXT_MAIN);
- enumTestList.add(SystemContext.SYSCTXT_VRSESSION);
- enumTestList.add(SystemContext.SYSCTXT_MENU);
- enumTestList.add(SystemContext.SYSCTXT_HMI_OBSCURED);
- enumTestList.add(SystemContext.SYSCTXT_ALERT);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TPMSTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TPMSTests.java
index c573a0d7a..cfdf1e718 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TPMSTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TPMSTests.java
@@ -14,82 +14,80 @@ import java.util.List;
*/
public class TPMSTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "UNKNOWN";
- TPMS unknown = TPMS.valueForString(example);
- example = "SYSTEM_FAULT";
- TPMS systemFault = TPMS.valueForString(example);
- example = "SENSOR_FAULT";
- TPMS sensorFault = TPMS.valueForString(example);
- example = "LOW";
- TPMS low = TPMS.valueForString(example);
- example = "SYSTEM_ACTIVE";
- TPMS systemActive = TPMS.valueForString(example);
- example = "TRAIN";
- TPMS train = TPMS.valueForString(example);
- example = "TRAINING_COMPLETE";
- TPMS trainingComplete = TPMS.valueForString(example);
- example = "NOT_TRAINED";
- TPMS notTrained = TPMS.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "UNKNOWN";
+ TPMS unknown = TPMS.valueForString(example);
+ example = "SYSTEM_FAULT";
+ TPMS systemFault = TPMS.valueForString(example);
+ example = "SENSOR_FAULT";
+ TPMS sensorFault = TPMS.valueForString(example);
+ example = "LOW";
+ TPMS low = TPMS.valueForString(example);
+ example = "SYSTEM_ACTIVE";
+ TPMS systemActive = TPMS.valueForString(example);
+ example = "TRAIN";
+ TPMS train = TPMS.valueForString(example);
+ example = "TRAINING_COMPLETE";
+ TPMS trainingComplete = TPMS.valueForString(example);
+ example = "NOT_TRAINED";
+ TPMS notTrained = TPMS.valueForString(example);
- assertNotNull("UNKNOWN returned null", unknown);
- assertNotNull("SYSTEM_FAULT returned null", systemFault);
- assertNotNull("SENSOR_FAULT returned null", sensorFault);
- assertNotNull("LOW returned null", low);
- assertNotNull("SYSTEM_ACTIVE returned null", systemActive);
- assertNotNull("TRAIN returned null", train);
- assertNotNull("TRAINING_COMPLETE returned null", trainingComplete);
- assertNotNull("NOT_TRAINED returned null", notTrained);
- }
+ assertNotNull("UNKNOWN returned null", unknown);
+ assertNotNull("SYSTEM_FAULT returned null", systemFault);
+ assertNotNull("SENSOR_FAULT returned null", sensorFault);
+ assertNotNull("LOW returned null", low);
+ assertNotNull("SYSTEM_ACTIVE returned null", systemActive);
+ assertNotNull("TRAIN returned null", train);
+ assertNotNull("TRAINING_COMPLETE returned null", trainingComplete);
+ assertNotNull("NOT_TRAINED returned null", notTrained);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "IsHoUldBeNulL";
- try {
- TPMS temp = TPMS.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "IsHoUldBeNulL";
+ try {
+ TPMS temp = TPMS.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 {
- TPMS temp = TPMS.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TPMS temp = TPMS.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of TPMS.
- */
- public void testListEnum() {
- List<TPMS> enumValueList = Arrays.asList(TPMS.values());
+ /**
+ * Verifies the possible enum values of TPMS.
+ */
+ public void testListEnum() {
+ List<TPMS> enumValueList = Arrays.asList(TPMS.values());
- List<TPMS> enumTestList = new ArrayList<>();
- enumTestList.add(TPMS.UNKNOWN);
- enumTestList.add(TPMS.SYSTEM_FAULT);
- enumTestList.add(TPMS.SENSOR_FAULT);
- enumTestList.add(TPMS.LOW);
- enumTestList.add(TPMS.SYSTEM_ACTIVE);
- enumTestList.add(TPMS.TRAIN);
- enumTestList.add(TPMS.TRAINING_COMPLETE);
- enumTestList.add(TPMS.NOT_TRAINED);
+ List<TPMS> enumTestList = new ArrayList<>();
+ enumTestList.add(TPMS.UNKNOWN);
+ enumTestList.add(TPMS.SYSTEM_FAULT);
+ enumTestList.add(TPMS.SENSOR_FAULT);
+ enumTestList.add(TPMS.LOW);
+ enumTestList.add(TPMS.SYSTEM_ACTIVE);
+ enumTestList.add(TPMS.TRAIN);
+ enumTestList.add(TPMS.TRAINING_COMPLETE);
+ enumTestList.add(TPMS.NOT_TRAINED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TbtStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TbtStateTests.java
index ff6be4608..8d87cda82 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TbtStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TbtStateTests.java
@@ -9,95 +9,93 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.TBTState}
*/
public class TbtStateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "ROUTE_UPDATE_REQUEST";
- TBTState enumRouteUpdateRequest = TBTState.valueForString(example);
- example = "ROUTE_ACCEPTED";
- TBTState enumRouteAccepted = TBTState.valueForString(example);
- example = "ROUTE_REFUSED";
- TBTState enumRouteRefused = TBTState.valueForString(example);
- example = "ROUTE_CANCELLED";
- TBTState enumRouteCancelled = TBTState.valueForString(example);
- example = "ETA_REQUEST";
- TBTState enumEtaEquest = TBTState.valueForString(example);
- example = "NEXT_TURN_REQUEST";
- TBTState enumNextTurnRequest = TBTState.valueForString(example);
- example = "ROUTE_STATUS_REQUEST";
- TBTState enumRouteStatusRequest = TBTState.valueForString(example);
- example = "ROUTE_SUMMARY_REQUEST";
- TBTState enumRouteSummaryRequest = TBTState.valueForString(example);
- example = "TRIP_STATUS_REQUEST";
- TBTState enumTripStatusRequest = TBTState.valueForString(example);
- example = "ROUTE_UPDATE_REQUEST_TIMEOUT";
- TBTState enumRouteUpdateRequestTimeout = TBTState.valueForString(example);
-
- assertNotNull("ROUTE_UPDATE_REQUEST returned null", enumRouteUpdateRequest);
- assertNotNull("ROUTE_ACCEPTED returned null", enumRouteAccepted);
- assertNotNull("ROUTE_REFUSED returned null", enumRouteRefused);
- assertNotNull("ROUTE_CANCELLED returned null", enumRouteCancelled);
- assertNotNull("ETA_REQUEST returned null", enumEtaEquest);
- assertNotNull("NEXT_TURN_REQUEST returned null", enumNextTurnRequest);
- assertNotNull("ROUTE_STATUS_REQUEST returned null", enumRouteStatusRequest);
- assertNotNull("ROUTE_SUMMARY_REQUEST returned null", enumRouteSummaryRequest);
- assertNotNull("TRIP_STATUS_REQUEST returned null", enumTripStatusRequest);
- assertNotNull("ROUTE_UPDATE_REQUEST_TIMEOUT returned null", enumRouteUpdateRequestTimeout);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "ROUTE_UPDATE_REQUEST";
+ TBTState enumRouteUpdateRequest = TBTState.valueForString(example);
+ example = "ROUTE_ACCEPTED";
+ TBTState enumRouteAccepted = TBTState.valueForString(example);
+ example = "ROUTE_REFUSED";
+ TBTState enumRouteRefused = TBTState.valueForString(example);
+ example = "ROUTE_CANCELLED";
+ TBTState enumRouteCancelled = TBTState.valueForString(example);
+ example = "ETA_REQUEST";
+ TBTState enumEtaEquest = TBTState.valueForString(example);
+ example = "NEXT_TURN_REQUEST";
+ TBTState enumNextTurnRequest = TBTState.valueForString(example);
+ example = "ROUTE_STATUS_REQUEST";
+ TBTState enumRouteStatusRequest = TBTState.valueForString(example);
+ example = "ROUTE_SUMMARY_REQUEST";
+ TBTState enumRouteSummaryRequest = TBTState.valueForString(example);
+ example = "TRIP_STATUS_REQUEST";
+ TBTState enumTripStatusRequest = TBTState.valueForString(example);
+ example = "ROUTE_UPDATE_REQUEST_TIMEOUT";
+ TBTState enumRouteUpdateRequestTimeout = TBTState.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "rOUte_UpDAte_reQuesT";
- try {
- TBTState temp = TBTState.valueForString(example);
+ assertNotNull("ROUTE_UPDATE_REQUEST returned null", enumRouteUpdateRequest);
+ assertNotNull("ROUTE_ACCEPTED returned null", enumRouteAccepted);
+ assertNotNull("ROUTE_REFUSED returned null", enumRouteRefused);
+ assertNotNull("ROUTE_CANCELLED returned null", enumRouteCancelled);
+ assertNotNull("ETA_REQUEST returned null", enumEtaEquest);
+ assertNotNull("NEXT_TURN_REQUEST returned null", enumNextTurnRequest);
+ assertNotNull("ROUTE_STATUS_REQUEST returned null", enumRouteStatusRequest);
+ assertNotNull("ROUTE_SUMMARY_REQUEST returned null", enumRouteSummaryRequest);
+ assertNotNull("TRIP_STATUS_REQUEST returned null", enumTripStatusRequest);
+ assertNotNull("ROUTE_UPDATE_REQUEST_TIMEOUT returned null", enumRouteUpdateRequestTimeout);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "rOUte_UpDAte_reQuesT";
+ try {
+ TBTState temp = TBTState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- TBTState temp = TBTState.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TBTState temp = TBTState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of TBTState.
- */
- public void testListEnum() {
- List<TBTState> enumValueList = Arrays.asList(TBTState.values());
+ /**
+ * Verifies the possible enum values of TBTState.
+ */
+ public void testListEnum() {
+ List<TBTState> enumValueList = Arrays.asList(TBTState.values());
- List<TBTState> enumTestList = new ArrayList<TBTState>();
- enumTestList.add(TBTState.ROUTE_UPDATE_REQUEST);
- enumTestList.add(TBTState.ROUTE_ACCEPTED);
- enumTestList.add(TBTState.ROUTE_REFUSED);
- enumTestList.add(TBTState.ROUTE_CANCELLED);
- enumTestList.add(TBTState.ETA_REQUEST);
- enumTestList.add(TBTState.NEXT_TURN_REQUEST);
- enumTestList.add(TBTState.ROUTE_STATUS_REQUEST);
- enumTestList.add(TBTState.ROUTE_SUMMARY_REQUEST);
- enumTestList.add(TBTState.TRIP_STATUS_REQUEST);
- enumTestList.add(TBTState.ROUTE_UPDATE_REQUEST_TIMEOUT);
+ List<TBTState> enumTestList = new ArrayList<TBTState>();
+ enumTestList.add(TBTState.ROUTE_UPDATE_REQUEST);
+ enumTestList.add(TBTState.ROUTE_ACCEPTED);
+ enumTestList.add(TBTState.ROUTE_REFUSED);
+ enumTestList.add(TBTState.ROUTE_CANCELLED);
+ enumTestList.add(TBTState.ETA_REQUEST);
+ enumTestList.add(TBTState.NEXT_TURN_REQUEST);
+ enumTestList.add(TBTState.ROUTE_STATUS_REQUEST);
+ enumTestList.add(TBTState.ROUTE_SUMMARY_REQUEST);
+ enumTestList.add(TBTState.TRIP_STATUS_REQUEST);
+ enumTestList.add(TBTState.ROUTE_UPDATE_REQUEST_TIMEOUT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TextAlignmentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextAlignmentTests.java
index 57512eb45..7ec1e131d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextAlignmentTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextAlignmentTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.TextAlignment}
*/
public class TextAlignmentTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "LEFT_ALIGNED";
- TextAlignment enumLeftAligned = TextAlignment.valueForString(example);
- example = "RIGHT_ALIGNED";
- TextAlignment enumRightAligned = TextAlignment.valueForString(example);
- example = "CENTERED";
- TextAlignment enumCentered = TextAlignment.valueForString(example);
-
- assertNotNull("LEFT_ALIGNED returned null", enumLeftAligned);
- assertNotNull("RIGHT_ALIGNED returned null", enumRightAligned);
- assertNotNull("CENTERED returned null", enumCentered);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LEFT_ALIGNED";
+ TextAlignment enumLeftAligned = TextAlignment.valueForString(example);
+ example = "RIGHT_ALIGNED";
+ TextAlignment enumRightAligned = TextAlignment.valueForString(example);
+ example = "CENTERED";
+ TextAlignment enumCentered = TextAlignment.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "leFT_AliGned";
- try {
- TextAlignment temp = TextAlignment.valueForString(example);
+ assertNotNull("LEFT_ALIGNED returned null", enumLeftAligned);
+ assertNotNull("RIGHT_ALIGNED returned null", enumRightAligned);
+ assertNotNull("CENTERED returned null", enumCentered);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "leFT_AliGned";
+ try {
+ TextAlignment temp = TextAlignment.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- TextAlignment temp = TextAlignment.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TextAlignment temp = TextAlignment.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of TextAlignment.
- */
- public void testListEnum() {
- List<TextAlignment> enumValueList = Arrays.asList(TextAlignment.values());
+ /**
+ * Verifies the possible enum values of TextAlignment.
+ */
+ public void testListEnum() {
+ List<TextAlignment> enumValueList = Arrays.asList(TextAlignment.values());
- List<TextAlignment> enumTestList = new ArrayList<TextAlignment>();
- enumTestList.add(TextAlignment.LEFT_ALIGNED);
- enumTestList.add(TextAlignment.RIGHT_ALIGNED);
- enumTestList.add(TextAlignment.CENTERED);
+ List<TextAlignment> enumTestList = new ArrayList<TextAlignment>();
+ enumTestList.add(TextAlignment.LEFT_ALIGNED);
+ enumTestList.add(TextAlignment.RIGHT_ALIGNED);
+ enumTestList.add(TextAlignment.CENTERED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TextFieldNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
index 8c8122fd8..0eb05f848 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
@@ -10,176 +10,174 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.TextFieldName}
*/
public class TextFieldNameTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "mainField1";
- TextFieldName enumMainField1 = TextFieldName.valueForString(example);
- example = "mainField2";
- TextFieldName enumMainField2 = TextFieldName.valueForString(example);
- example = "mainField3";
- TextFieldName enumMainField3 = TextFieldName.valueForString(example);
- example = "mainField4";
- TextFieldName enumMainField4 = TextFieldName.valueForString(example);
- example = "statusBar";
- TextFieldName enumStatusBar = TextFieldName.valueForString(example);
- example = "mediaClock";
- TextFieldName enumMediaClock = TextFieldName.valueForString(example);
- example = "mediaTrack";
- TextFieldName enumMediaTrack = TextFieldName.valueForString(example);
- example = "alertText1";
- TextFieldName enumAlertText1 = TextFieldName.valueForString(example);
- example = "alertText2";
- TextFieldName enumAlertText2 = TextFieldName.valueForString(example);
- example = "alertText3";
- TextFieldName enumAlertText3 = TextFieldName.valueForString(example);
- example = "scrollableMessageBody";
- TextFieldName enumScrollableMessageBody = TextFieldName.valueForString(example);
- example = "initialInteractionText";
- TextFieldName enumInitialInteractionText = TextFieldName.valueForString(example);
- example = "navigationText1";
- TextFieldName enumNavigationText1 = TextFieldName.valueForString(example);
- example = "navigationText2";
- TextFieldName enumNavigationText2 = TextFieldName.valueForString(example);
- example = "ETA";
- TextFieldName enumEta = TextFieldName.valueForString(example);
- example = "totalDistance";
- TextFieldName enumTotalDistance = TextFieldName.valueForString(example);
- example = "audioPassThruDisplayText1";
- TextFieldName enumAudioPassThruDisplayText1 = TextFieldName.valueForString(example);
- example = "audioPassThruDisplayText2";
- TextFieldName enumAudioPassThruDisplayText2 = TextFieldName.valueForString(example);
- example = "sliderHeader";
- TextFieldName enumSliderHeader = TextFieldName.valueForString(example);
- example = "sliderFooter";
- TextFieldName enumSliderFooter = TextFieldName.valueForString(example);
- example = "menuName";
- TextFieldName enumMenuName = TextFieldName.valueForString(example);
- example = "secondaryText";
- TextFieldName enumSecondaryText = TextFieldName.valueForString(example);
- example = "tertiaryText";
- TextFieldName enumTertiaryText = TextFieldName.valueForString(example);
- example = "menuTitle";
- TextFieldName enumMenuTitle = TextFieldName.valueForString(example);
- example = "locationName";
- TextFieldName enumLocName = TextFieldName.valueForString(example);
- example = "locationDescription";
- TextFieldName enumLocDesc = TextFieldName.valueForString(example);
- example = "addressLines";
- TextFieldName enumAddLines = TextFieldName.valueForString(example);
- example = "phoneNumber";
- TextFieldName enumPhone = TextFieldName.valueForString(example);
- example = "templateTitle";
- TextFieldName templateTitle = TextFieldName.valueForString(example);
-
- assertNotNull("mainField1 returned null", enumMainField1);
- assertNotNull("mainField2 returned null", enumMainField2);
- assertNotNull("mainField3 returned null", enumMainField3);
- assertNotNull("mainField4 returned null", enumMainField4);
- assertNotNull("statusBar returned null", enumStatusBar);
- assertNotNull("mediaClock returned null", enumMediaClock);
- assertNotNull("mediaTrack returned null", enumMediaTrack);
- assertNotNull("alertText1 returned null", enumAlertText1);
- assertNotNull("alertText2 returned null", enumAlertText2);
- assertNotNull("alertText3 returned null", enumAlertText3);
- assertNotNull("scrollableMessageBody returned null", enumScrollableMessageBody);
- assertNotNull("initialInteractionText returned null", enumInitialInteractionText);
- assertNotNull("navigationText1 returned null", enumNavigationText1);
- assertNotNull("navigationText2 returned null", enumNavigationText2);
- assertNotNull("ETA returned null", enumEta);
- assertNotNull("totalDistance returned null", enumTotalDistance);
- assertNotNull("audioPassThruDisplayText1 returned null", enumAudioPassThruDisplayText1);
- assertNotNull("audioPassThruDisplayText2 returned null", enumAudioPassThruDisplayText2);
- assertNotNull("sliderHeader returned null", enumSliderHeader);
- assertNotNull("sliderFooter returned null", enumSliderFooter);
- assertNotNull("menuName returned null", enumMenuName);
- assertNotNull("secondaryText returned null", enumSecondaryText);
- assertNotNull("tertiaryText returned null", enumTertiaryText);
- assertNotNull("menuTitle returned null", enumMenuTitle);
- assertNotNull("templateTitle returned null", templateTitle);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "mainField1";
+ TextFieldName enumMainField1 = TextFieldName.valueForString(example);
+ example = "mainField2";
+ TextFieldName enumMainField2 = TextFieldName.valueForString(example);
+ example = "mainField3";
+ TextFieldName enumMainField3 = TextFieldName.valueForString(example);
+ example = "mainField4";
+ TextFieldName enumMainField4 = TextFieldName.valueForString(example);
+ example = "statusBar";
+ TextFieldName enumStatusBar = TextFieldName.valueForString(example);
+ example = "mediaClock";
+ TextFieldName enumMediaClock = TextFieldName.valueForString(example);
+ example = "mediaTrack";
+ TextFieldName enumMediaTrack = TextFieldName.valueForString(example);
+ example = "alertText1";
+ TextFieldName enumAlertText1 = TextFieldName.valueForString(example);
+ example = "alertText2";
+ TextFieldName enumAlertText2 = TextFieldName.valueForString(example);
+ example = "alertText3";
+ TextFieldName enumAlertText3 = TextFieldName.valueForString(example);
+ example = "scrollableMessageBody";
+ TextFieldName enumScrollableMessageBody = TextFieldName.valueForString(example);
+ example = "initialInteractionText";
+ TextFieldName enumInitialInteractionText = TextFieldName.valueForString(example);
+ example = "navigationText1";
+ TextFieldName enumNavigationText1 = TextFieldName.valueForString(example);
+ example = "navigationText2";
+ TextFieldName enumNavigationText2 = TextFieldName.valueForString(example);
+ example = "ETA";
+ TextFieldName enumEta = TextFieldName.valueForString(example);
+ example = "totalDistance";
+ TextFieldName enumTotalDistance = TextFieldName.valueForString(example);
+ example = "audioPassThruDisplayText1";
+ TextFieldName enumAudioPassThruDisplayText1 = TextFieldName.valueForString(example);
+ example = "audioPassThruDisplayText2";
+ TextFieldName enumAudioPassThruDisplayText2 = TextFieldName.valueForString(example);
+ example = "sliderHeader";
+ TextFieldName enumSliderHeader = TextFieldName.valueForString(example);
+ example = "sliderFooter";
+ TextFieldName enumSliderFooter = TextFieldName.valueForString(example);
+ example = "menuName";
+ TextFieldName enumMenuName = TextFieldName.valueForString(example);
+ example = "secondaryText";
+ TextFieldName enumSecondaryText = TextFieldName.valueForString(example);
+ example = "tertiaryText";
+ TextFieldName enumTertiaryText = TextFieldName.valueForString(example);
+ example = "menuTitle";
+ TextFieldName enumMenuTitle = TextFieldName.valueForString(example);
+ example = "locationName";
+ TextFieldName enumLocName = TextFieldName.valueForString(example);
+ example = "locationDescription";
+ TextFieldName enumLocDesc = TextFieldName.valueForString(example);
+ example = "addressLines";
+ TextFieldName enumAddLines = TextFieldName.valueForString(example);
+ example = "phoneNumber";
+ TextFieldName enumPhone = TextFieldName.valueForString(example);
+ example = "templateTitle";
+ TextFieldName templateTitle = TextFieldName.valueForString(example);
+ assertNotNull("mainField1 returned null", enumMainField1);
+ assertNotNull("mainField2 returned null", enumMainField2);
+ assertNotNull("mainField3 returned null", enumMainField3);
+ assertNotNull("mainField4 returned null", enumMainField4);
+ assertNotNull("statusBar returned null", enumStatusBar);
+ assertNotNull("mediaClock returned null", enumMediaClock);
+ assertNotNull("mediaTrack returned null", enumMediaTrack);
+ assertNotNull("alertText1 returned null", enumAlertText1);
+ assertNotNull("alertText2 returned null", enumAlertText2);
+ assertNotNull("alertText3 returned null", enumAlertText3);
+ assertNotNull("scrollableMessageBody returned null", enumScrollableMessageBody);
+ assertNotNull("initialInteractionText returned null", enumInitialInteractionText);
+ assertNotNull("navigationText1 returned null", enumNavigationText1);
+ assertNotNull("navigationText2 returned null", enumNavigationText2);
+ assertNotNull("ETA returned null", enumEta);
+ assertNotNull("totalDistance returned null", enumTotalDistance);
+ assertNotNull("audioPassThruDisplayText1 returned null", enumAudioPassThruDisplayText1);
+ assertNotNull("audioPassThruDisplayText2 returned null", enumAudioPassThruDisplayText2);
+ assertNotNull("sliderHeader returned null", enumSliderHeader);
+ assertNotNull("sliderFooter returned null", enumSliderFooter);
+ assertNotNull("menuName returned null", enumMenuName);
+ assertNotNull("secondaryText returned null", enumSecondaryText);
+ assertNotNull("tertiaryText returned null", enumTertiaryText);
+ assertNotNull("menuTitle returned null", enumMenuTitle);
+ assertNotNull("templateTitle returned null", templateTitle);
- assertNotNull(TestValues.NOT_NULL, enumLocName);
- assertNotNull(TestValues.NOT_NULL, enumLocDesc);
- assertNotNull(TestValues.NOT_NULL, enumAddLines);
- assertNotNull(TestValues.NOT_NULL, enumPhone);
- }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "mAinField1";
- try {
- TextFieldName temp = TextFieldName.valueForString(example);
+ assertNotNull(TestValues.NOT_NULL, enumLocName);
+ assertNotNull(TestValues.NOT_NULL, enumLocDesc);
+ assertNotNull(TestValues.NOT_NULL, enumAddLines);
+ assertNotNull(TestValues.NOT_NULL, enumPhone);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "mAinField1";
+ try {
+ TextFieldName temp = TextFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- TextFieldName temp = TextFieldName.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TextFieldName temp = TextFieldName.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of TextFieldName.
- */
- public void testListEnum() {
- List<TextFieldName> enumValueList = Arrays.asList(TextFieldName.values());
+ /**
+ * Verifies the possible enum values of TextFieldName.
+ */
+ public void testListEnum() {
+ List<TextFieldName> enumValueList = Arrays.asList(TextFieldName.values());
- List<TextFieldName> enumTestList = new ArrayList<TextFieldName>();
- enumTestList.add(TextFieldName.mainField1);
- enumTestList.add(TextFieldName.mainField2);
- enumTestList.add(TextFieldName.mainField3);
- enumTestList.add(TextFieldName.mainField4);
- enumTestList.add(TextFieldName.statusBar);
- enumTestList.add(TextFieldName.mediaClock);
- enumTestList.add(TextFieldName.mediaTrack);
- enumTestList.add(TextFieldName.alertText1);
- enumTestList.add(TextFieldName.alertText2);
- enumTestList.add(TextFieldName.alertText3);
- enumTestList.add(TextFieldName.scrollableMessageBody);
- enumTestList.add(TextFieldName.initialInteractionText);
- enumTestList.add(TextFieldName.navigationText1);
- enumTestList.add(TextFieldName.navigationText2);
- enumTestList.add(TextFieldName.ETA);
- enumTestList.add(TextFieldName.totalDistance);
- enumTestList.add(TextFieldName.audioPassThruDisplayText1);
- enumTestList.add(TextFieldName.audioPassThruDisplayText2);
- enumTestList.add(TextFieldName.sliderHeader);
- enumTestList.add(TextFieldName.sliderFooter);
- enumTestList.add(TextFieldName.menuName);
- enumTestList.add(TextFieldName.secondaryText);
- enumTestList.add(TextFieldName.tertiaryText);
- enumTestList.add(TextFieldName.menuTitle);
- enumTestList.add(TextFieldName.locationName);
- enumTestList.add(TextFieldName.locationDescription);
- enumTestList.add(TextFieldName.addressLines);
- enumTestList.add(TextFieldName.phoneNumber);
- enumTestList.add(TextFieldName.templateTitle);
- enumTestList.add(TextFieldName.subtleAlertText1);
- enumTestList.add(TextFieldName.subtleAlertText2);
- enumTestList.add(TextFieldName.subtleAlertSoftButtonText);
+ List<TextFieldName> enumTestList = new ArrayList<TextFieldName>();
+ enumTestList.add(TextFieldName.mainField1);
+ enumTestList.add(TextFieldName.mainField2);
+ enumTestList.add(TextFieldName.mainField3);
+ enumTestList.add(TextFieldName.mainField4);
+ enumTestList.add(TextFieldName.statusBar);
+ enumTestList.add(TextFieldName.mediaClock);
+ enumTestList.add(TextFieldName.mediaTrack);
+ enumTestList.add(TextFieldName.alertText1);
+ enumTestList.add(TextFieldName.alertText2);
+ enumTestList.add(TextFieldName.alertText3);
+ enumTestList.add(TextFieldName.scrollableMessageBody);
+ enumTestList.add(TextFieldName.initialInteractionText);
+ enumTestList.add(TextFieldName.navigationText1);
+ enumTestList.add(TextFieldName.navigationText2);
+ enumTestList.add(TextFieldName.ETA);
+ enumTestList.add(TextFieldName.totalDistance);
+ enumTestList.add(TextFieldName.audioPassThruDisplayText1);
+ enumTestList.add(TextFieldName.audioPassThruDisplayText2);
+ enumTestList.add(TextFieldName.sliderHeader);
+ enumTestList.add(TextFieldName.sliderFooter);
+ enumTestList.add(TextFieldName.menuName);
+ enumTestList.add(TextFieldName.secondaryText);
+ enumTestList.add(TextFieldName.tertiaryText);
+ enumTestList.add(TextFieldName.menuTitle);
+ enumTestList.add(TextFieldName.locationName);
+ enumTestList.add(TextFieldName.locationDescription);
+ enumTestList.add(TextFieldName.addressLines);
+ enumTestList.add(TextFieldName.phoneNumber);
+ enumTestList.add(TextFieldName.templateTitle);
+ enumTestList.add(TextFieldName.subtleAlertText1);
+ enumTestList.add(TextFieldName.subtleAlertText2);
+ enumTestList.add(TextFieldName.subtleAlertSoftButtonText);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TimerModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java
index 892159a0d..03f26d543 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java
@@ -46,62 +46,60 @@ import java.util.List;
*/
public class TimerModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "UP";
- TimerMode enumUp = TimerMode.valueForString(example);
- example = "DOWN";
- TimerMode enumDown = TimerMode.valueForString(example);
- example = "NONE";
- TimerMode enumNone = TimerMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "UP";
+ TimerMode enumUp = TimerMode.valueForString(example);
+ example = "DOWN";
+ TimerMode enumDown = TimerMode.valueForString(example);
+ example = "NONE";
+ TimerMode enumNone = TimerMode.valueForString(example);
- assertNotNull("UP returned null", enumUp);
- assertNotNull("DOWN returned null", enumDown);
- assertNotNull("NONE returned null", enumNone);
- }
+ assertNotNull("UP returned null", enumUp);
+ assertNotNull("DOWN returned null", enumDown);
+ assertNotNull("NONE returned null", enumNone);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "NonE";
- try {
- TimerMode temp = TimerMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "NonE";
+ try {
+ TimerMode temp = TimerMode.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 {
- TimerMode temp = TimerMode.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TimerMode temp = TimerMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of TimerMode.
- */
- public void testListEnum() {
- List<TimerMode> enumValueList = Arrays.asList(TimerMode.values());
+ /**
+ * Verifies the possible enum values of TimerMode.
+ */
+ public void testListEnum() {
+ List<TimerMode> enumValueList = Arrays.asList(TimerMode.values());
- List<TimerMode> enumTestList = new ArrayList<>();
- enumTestList.add(TimerMode.UP);
- enumTestList.add(TimerMode.DOWN);
- enumTestList.add(TimerMode.NONE);
+ List<TimerMode> enumTestList = new ArrayList<>();
+ enumTestList.add(TimerMode.UP);
+ enumTestList.add(TimerMode.DOWN);
+ enumTestList.add(TimerMode.NONE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TouchTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
index db9c417ef..a9dc4aa2b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
@@ -9,73 +9,71 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.TouchType}
*/
public class TouchTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "BEGIN";
- TouchType enumBegin = TouchType.valueForString(example);
- example = "MOVE";
- TouchType enumMove = TouchType.valueForString(example);
- example = "END";
- TouchType enumEnd = TouchType.valueForString(example);
- example = "CANCEL";
- TouchType enumCancel = TouchType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "BEGIN";
+ TouchType enumBegin = TouchType.valueForString(example);
+ example = "MOVE";
+ TouchType enumMove = TouchType.valueForString(example);
+ example = "END";
+ TouchType enumEnd = TouchType.valueForString(example);
+ example = "CANCEL";
+ TouchType enumCancel = TouchType.valueForString(example);
- assertNotNull("BEGIN returned null", enumBegin);
- assertNotNull("MOVE returned null", enumMove);
- assertNotNull("END returned null", enumEnd);
- assertNotNull("CANCEL returned null", enumCancel);
- }
+ assertNotNull("BEGIN returned null", enumBegin);
+ assertNotNull("MOVE returned null", enumMove);
+ assertNotNull("END returned null", enumEnd);
+ assertNotNull("CANCEL returned null", enumCancel);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "bEgIn";
- try {
- TouchType temp = TouchType.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "bEgIn";
+ try {
+ TouchType temp = TouchType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- TouchType temp = TouchType.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TouchType temp = TouchType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
+ }
+ }
- /**
- * Verifies the possible enum values of TouchType.
- */
- public void testListEnum() {
- List<TouchType> enumValueList = Arrays.asList(TouchType.values());
- List<TouchType> enumTestList = new ArrayList<TouchType>();
- enumTestList.add(TouchType.BEGIN);
- enumTestList.add(TouchType.MOVE);
- enumTestList.add(TouchType.END);
- enumTestList.add(TouchType.CANCEL);
+ /**
+ * Verifies the possible enum values of TouchType.
+ */
+ public void testListEnum() {
+ List<TouchType> enumValueList = Arrays.asList(TouchType.values());
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ List<TouchType> enumTestList = new ArrayList<TouchType>();
+ enumTestList.add(TouchType.BEGIN);
+ enumTestList.add(TouchType.MOVE);
+ enumTestList.add(TouchType.END);
+ enumTestList.add(TouchType.CANCEL);
+
+ 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/TransmissionTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TransmissionTypeTests.java
index 6a21c7cc2..005d57721 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TransmissionTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TransmissionTypeTests.java
@@ -12,7 +12,7 @@ public class TransmissionTypeTests extends TestCase {
/**
* Verifies that the enum values are not null upon valid assignment.
*/
- public void testValidEnums () {
+ public void testValidEnums() {
String example = "MANUAL";
TransmissionType manual = TransmissionType.valueForString(example);
example = "AUTOMATIC";
@@ -45,13 +45,12 @@ public class TransmissionTypeTests extends TestCase {
/**
* Verifies that an invalid assignment is null.
*/
- public void testInvalidEnum () {
+ public void testInvalidEnum() {
String example = "pARk";
try {
TransmissionType temp = TransmissionType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
@@ -59,13 +58,12 @@ public class TransmissionTypeTests extends TestCase {
/**
* Verifies that a null assignment is invalid.
*/
- public void testNullEnum () {
+ public void testNullEnum() {
String example = null;
try {
TransmissionType temp = TransmissionType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TriggerSourceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TriggerSourceTests.java
index b4e1c2e16..a24f3ef96 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TriggerSourceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TriggerSourceTests.java
@@ -9,68 +9,66 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.TriggerSource}
*/
public class TriggerSourceTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "MENU";
- TriggerSource enumMenu = TriggerSource.valueForString(example);
- example = "VR";
- TriggerSource enumVr = TriggerSource.valueForString(example);
- example = "KEYBOARD";
- TriggerSource enumKeyboard = TriggerSource.valueForString(example);
-
- assertNotNull("MENU returned null", enumMenu);
- assertNotNull("VR returned null", enumVr);
- assertNotNull("KEYBOARD returned null", enumKeyboard);
- }
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MENU";
+ TriggerSource enumMenu = TriggerSource.valueForString(example);
+ example = "VR";
+ TriggerSource enumVr = TriggerSource.valueForString(example);
+ example = "KEYBOARD";
+ TriggerSource enumKeyboard = TriggerSource.valueForString(example);
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "meNU";
- try {
- TriggerSource temp = TriggerSource.valueForString(example);
+ assertNotNull("MENU returned null", enumMenu);
+ assertNotNull("VR returned null", enumVr);
+ assertNotNull("KEYBOARD returned null", enumKeyboard);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "meNU";
+ try {
+ TriggerSource temp = TriggerSource.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- TriggerSource temp = TriggerSource.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TriggerSource temp = TriggerSource.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of TriggerSource.
+ */
+ public void testListEnum() {
+ List<TriggerSource> enumValueList = Arrays.asList(TriggerSource.values());
- /**
- * Verifies the possible enum values of TriggerSource.
- */
- public void testListEnum() {
- List<TriggerSource> enumValueList = Arrays.asList(TriggerSource.values());
+ List<TriggerSource> enumTestList = new ArrayList<TriggerSource>();
+ enumTestList.add(TriggerSource.TS_MENU);
+ enumTestList.add(TriggerSource.TS_VR);
+ enumTestList.add(TriggerSource.TS_KEYBOARD);
- List<TriggerSource> enumTestList = new ArrayList<TriggerSource>();
- enumTestList.add(TriggerSource.TS_MENU);
- enumTestList.add(TriggerSource.TS_VR);
- enumTestList.add(TriggerSource.TS_KEYBOARD);
-
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/TurnSignalTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TurnSignalTests.java
index a758d683e..56127dd16 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TurnSignalTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TurnSignalTests.java
@@ -14,66 +14,64 @@ import java.util.List;
*/
public class TurnSignalTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "OFF";
- TurnSignal off = TurnSignal.valueForString(example);
- example = "LEFT";
- TurnSignal left = TurnSignal.valueForString(example);
- example = "RIGHT";
- TurnSignal right = TurnSignal.valueForString(example);
- example = "BOTH";
- TurnSignal both = TurnSignal.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "OFF";
+ TurnSignal off = TurnSignal.valueForString(example);
+ example = "LEFT";
+ TurnSignal left = TurnSignal.valueForString(example);
+ example = "RIGHT";
+ TurnSignal right = TurnSignal.valueForString(example);
+ example = "BOTH";
+ TurnSignal both = TurnSignal.valueForString(example);
- assertNotNull("OFF returned null", off);
- assertNotNull("LEFT returned null", left);
- assertNotNull("RIGHT returned null", right);
- assertNotNull("BOTH returned null", both);
- }
+ assertNotNull("OFF returned null", off);
+ assertNotNull("LEFT returned null", left);
+ assertNotNull("RIGHT returned null", right);
+ assertNotNull("BOTH returned null", both);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "IsHoUldBeNulL";
- try {
- TurnSignal temp = TurnSignal.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "IsHoUldBeNulL";
+ try {
+ TurnSignal temp = TurnSignal.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 {
- TurnSignal temp = TurnSignal.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ TurnSignal temp = TurnSignal.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of TurnSignal.
- */
- public void testListEnum() {
- List<TurnSignal> enumValueList = Arrays.asList(TurnSignal.values());
+ /**
+ * Verifies the possible enum values of TurnSignal.
+ */
+ public void testListEnum() {
+ List<TurnSignal> enumValueList = Arrays.asList(TurnSignal.values());
- List<TurnSignal> enumTestList = new ArrayList<>();
- enumTestList.add(TurnSignal.OFF);
- enumTestList.add(TurnSignal.LEFT);
- enumTestList.add(TurnSignal.RIGHT);
- enumTestList.add(TurnSignal.BOTH);
+ List<TurnSignal> enumTestList = new ArrayList<>();
+ enumTestList.add(TurnSignal.OFF);
+ enumTestList.add(TurnSignal.LEFT);
+ enumTestList.add(TurnSignal.RIGHT);
+ enumTestList.add(TurnSignal.BOTH);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/UpdateModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/UpdateModeTests.java
index 508282f97..5f7c0548c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/UpdateModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/UpdateModeTests.java
@@ -9,75 +9,73 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.UpdateMode}
*/
public class UpdateModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "COUNTUP";
- UpdateMode enumCountUp = UpdateMode.valueForString(example);
- example = "COUNTDOWN";
- UpdateMode enumCountDown = UpdateMode.valueForString(example);
- example = "PAUSE";
- UpdateMode enumPause = UpdateMode.valueForString(example);
- example = "RESUME";
- UpdateMode enumResume = UpdateMode.valueForString(example);
- example = "CLEAR";
- UpdateMode enumClear = UpdateMode.valueForString(example);
-
- assertNotNull("COUNTUP returned null", enumCountUp);
- assertNotNull("COUNTDOWN returned null", enumCountDown);
- assertNotNull("PAUSE returned null", enumPause);
- assertNotNull("RESUME returned null", enumResume);
- assertNotNull("CLEAR returned null", enumClear);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "coUnTUp";
- try {
- UpdateMode temp = UpdateMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "COUNTUP";
+ UpdateMode enumCountUp = UpdateMode.valueForString(example);
+ example = "COUNTDOWN";
+ UpdateMode enumCountDown = UpdateMode.valueForString(example);
+ example = "PAUSE";
+ UpdateMode enumPause = UpdateMode.valueForString(example);
+ example = "RESUME";
+ UpdateMode enumResume = UpdateMode.valueForString(example);
+ example = "CLEAR";
+ UpdateMode enumClear = UpdateMode.valueForString(example);
+
+ assertNotNull("COUNTUP returned null", enumCountUp);
+ assertNotNull("COUNTDOWN returned null", enumCountDown);
+ assertNotNull("PAUSE returned null", enumPause);
+ assertNotNull("RESUME returned null", enumResume);
+ assertNotNull("CLEAR returned null", enumClear);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "coUnTUp";
+ try {
+ UpdateMode temp = UpdateMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- UpdateMode temp = UpdateMode.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ UpdateMode temp = UpdateMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of UpdateMode.
- */
- public void testListEnum() {
- List<UpdateMode> enumValueList = Arrays.asList(UpdateMode.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of UpdateMode.
+ */
+ public void testListEnum() {
+ List<UpdateMode> enumValueList = Arrays.asList(UpdateMode.values());
- List<UpdateMode> enumTestList = new ArrayList<UpdateMode>();
- enumTestList.add(UpdateMode.COUNTUP);
- enumTestList.add(UpdateMode.COUNTDOWN);
- enumTestList.add(UpdateMode.PAUSE);
- enumTestList.add(UpdateMode.RESUME);
- enumTestList.add(UpdateMode.CLEAR);
+ List<UpdateMode> enumTestList = new ArrayList<UpdateMode>();
+ enumTestList.add(UpdateMode.COUNTUP);
+ enumTestList.add(UpdateMode.COUNTDOWN);
+ enumTestList.add(UpdateMode.PAUSE);
+ enumTestList.add(UpdateMode.RESUME);
+ enumTestList.add(UpdateMode.CLEAR);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataActiveStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java
index b6ba15a7a..4f3c89191 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java
@@ -46,70 +46,68 @@ import java.util.List;
*/
public class VehicleDataActiveStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "INACTIVE_NOT_CONFIRMED";
- VehicleDataActiveStatus enumInactiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
- example = "INACTIVE_CONFIRMED";
- VehicleDataActiveStatus enumInactiveConfirmed = VehicleDataActiveStatus.valueForString(example);
- example = "ACTIVE_NOT_CONFIRMED";
- VehicleDataActiveStatus enumActiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
- example = "ACTIVE_CONFIRMED";
- VehicleDataActiveStatus enumActiveConfirmed = VehicleDataActiveStatus.valueForString(example);
- example = "FAULT";
- VehicleDataActiveStatus enumFault = VehicleDataActiveStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "INACTIVE_NOT_CONFIRMED";
+ VehicleDataActiveStatus enumInactiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "INACTIVE_CONFIRMED";
+ VehicleDataActiveStatus enumInactiveConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "ACTIVE_NOT_CONFIRMED";
+ VehicleDataActiveStatus enumActiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "ACTIVE_CONFIRMED";
+ VehicleDataActiveStatus enumActiveConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "FAULT";
+ VehicleDataActiveStatus enumFault = VehicleDataActiveStatus.valueForString(example);
- assertNotNull("INACTIVE_NOT_CONFIRMED returned null", enumInactiveNotConfirmed);
- assertNotNull("INACTIVE_CONFIRMED returned null", enumInactiveConfirmed);
- assertNotNull("ACTIVE_NOT_CONFIRMED returned null", enumActiveNotConfirmed);
- assertNotNull("ACTIVE_CONFIRMED returned null", enumActiveConfirmed);
- assertNotNull("FAULT returned null", enumFault);
- }
+ assertNotNull("INACTIVE_NOT_CONFIRMED returned null", enumInactiveNotConfirmed);
+ assertNotNull("INACTIVE_CONFIRMED returned null", enumInactiveConfirmed);
+ assertNotNull("ACTIVE_NOT_CONFIRMED returned null", enumActiveNotConfirmed);
+ assertNotNull("ACTIVE_CONFIRMED returned null", enumActiveConfirmed);
+ assertNotNull("FAULT returned null", enumFault);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "FauLt";
- try {
- VehicleDataActiveStatus temp = VehicleDataActiveStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "FauLt";
+ try {
+ VehicleDataActiveStatus temp = VehicleDataActiveStatus.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 {
- VehicleDataActiveStatus temp = VehicleDataActiveStatus.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataActiveStatus temp = VehicleDataActiveStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of VehicleDataActiveStatus.
- */
- public void testListEnum() {
- List<VehicleDataActiveStatus> enumValueList = Arrays.asList(VehicleDataActiveStatus.values());
+ /**
+ * Verifies the possible enum values of VehicleDataActiveStatus.
+ */
+ public void testListEnum() {
+ List<VehicleDataActiveStatus> enumValueList = Arrays.asList(VehicleDataActiveStatus.values());
- List<VehicleDataActiveStatus> enumTestList = new ArrayList<>();
- enumTestList.add(VehicleDataActiveStatus.INACTIVE_NOT_CONFIRMED);
- enumTestList.add(VehicleDataActiveStatus.INACTIVE_CONFIRMED);
- enumTestList.add(VehicleDataActiveStatus.ACTIVE_NOT_CONFIRMED);
- enumTestList.add(VehicleDataActiveStatus.ACTIVE_CONFIRMED);
- enumTestList.add(VehicleDataActiveStatus.FAULT);
+ List<VehicleDataActiveStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(VehicleDataActiveStatus.INACTIVE_NOT_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.INACTIVE_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.ACTIVE_NOT_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.ACTIVE_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataEventStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataEventStatusTests.java
index d70d20446..4cee560c0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataEventStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataEventStatusTests.java
@@ -9,75 +9,73 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus}
*/
public class VehicleDataEventStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NO_EVENT";
- VehicleDataEventStatus enumNoEvent = VehicleDataEventStatus.valueForString(example);
- example = "NO";
- VehicleDataEventStatus enumNo = VehicleDataEventStatus.valueForString(example);
- example = "YES";
- VehicleDataEventStatus enumYes = VehicleDataEventStatus.valueForString(example);
- example = "NOT_SUPPORTED";
- VehicleDataEventStatus enumNotSupported = VehicleDataEventStatus.valueForString(example);
- example = "FAULT";
- VehicleDataEventStatus enumFault = VehicleDataEventStatus.valueForString(example);
-
- assertNotNull("NO_EVENT returned null", enumNoEvent);
- assertNotNull("NO returned null", enumNo);
- assertNotNull("YES returned null", enumYes);
- assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
- assertNotNull("FAULT returned null", enumFault);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "no_EveNT";
- try {
- VehicleDataEventStatus temp = VehicleDataEventStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NO_EVENT";
+ VehicleDataEventStatus enumNoEvent = VehicleDataEventStatus.valueForString(example);
+ example = "NO";
+ VehicleDataEventStatus enumNo = VehicleDataEventStatus.valueForString(example);
+ example = "YES";
+ VehicleDataEventStatus enumYes = VehicleDataEventStatus.valueForString(example);
+ example = "NOT_SUPPORTED";
+ VehicleDataEventStatus enumNotSupported = VehicleDataEventStatus.valueForString(example);
+ example = "FAULT";
+ VehicleDataEventStatus enumFault = VehicleDataEventStatus.valueForString(example);
+
+ assertNotNull("NO_EVENT returned null", enumNoEvent);
+ assertNotNull("NO returned null", enumNo);
+ assertNotNull("YES returned null", enumYes);
+ assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
+ assertNotNull("FAULT returned null", enumFault);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "no_EveNT";
+ try {
+ VehicleDataEventStatus temp = VehicleDataEventStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VehicleDataEventStatus temp = VehicleDataEventStatus.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataEventStatus temp = VehicleDataEventStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of AmbientLightStatus.
- */
- public void testListEnum() {
- List<VehicleDataEventStatus> enumValueList = Arrays.asList(VehicleDataEventStatus.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of AmbientLightStatus.
+ */
+ public void testListEnum() {
+ List<VehicleDataEventStatus> enumValueList = Arrays.asList(VehicleDataEventStatus.values());
- List<VehicleDataEventStatus> enumTestList = new ArrayList<VehicleDataEventStatus>();
- enumTestList.add(VehicleDataEventStatus.NO_EVENT);
- enumTestList.add(VehicleDataEventStatus.NO);
- enumTestList.add(VehicleDataEventStatus.YES);
- enumTestList.add(VehicleDataEventStatus.NOT_SUPPORTED);
- enumTestList.add(VehicleDataEventStatus.FAULT);
+ List<VehicleDataEventStatus> enumTestList = new ArrayList<VehicleDataEventStatus>();
+ enumTestList.add(VehicleDataEventStatus.NO_EVENT);
+ enumTestList.add(VehicleDataEventStatus.NO);
+ enumTestList.add(VehicleDataEventStatus.YES);
+ enumTestList.add(VehicleDataEventStatus.NOT_SUPPORTED);
+ enumTestList.add(VehicleDataEventStatus.FAULT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataNotificationStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataNotificationStatusTests.java
index 622938fbf..4641d92dd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataNotificationStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataNotificationStatusTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus}
*/
public class VehicleDataNotificationStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NOT_SUPPORTED";
- VehicleDataNotificationStatus enumNotSupported = VehicleDataNotificationStatus.valueForString(example);
- example = "NORMAL";
- VehicleDataNotificationStatus enumNormal = VehicleDataNotificationStatus.valueForString(example);
- example = "ACTIVE";
- VehicleDataNotificationStatus enumActive = VehicleDataNotificationStatus.valueForString(example);
- example = "NOT_USED";
- VehicleDataNotificationStatus enumNotUsed = VehicleDataNotificationStatus.valueForString(example);
-
- assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
- assertNotNull("NORMAL returned null", enumNormal);
- assertNotNull("ACTIVE returned null", enumActive);
- assertNotNull("NOT_USED returned null", enumNotUsed);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "nOT_SuppOrTEd";
- try {
- VehicleDataNotificationStatus temp = VehicleDataNotificationStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NOT_SUPPORTED";
+ VehicleDataNotificationStatus enumNotSupported = VehicleDataNotificationStatus.valueForString(example);
+ example = "NORMAL";
+ VehicleDataNotificationStatus enumNormal = VehicleDataNotificationStatus.valueForString(example);
+ example = "ACTIVE";
+ VehicleDataNotificationStatus enumActive = VehicleDataNotificationStatus.valueForString(example);
+ example = "NOT_USED";
+ VehicleDataNotificationStatus enumNotUsed = VehicleDataNotificationStatus.valueForString(example);
+
+ assertNotNull("NOT_SUPPORTED returned null", enumNotSupported);
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("ACTIVE returned null", enumActive);
+ assertNotNull("NOT_USED returned null", enumNotUsed);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "nOT_SuppOrTEd";
+ try {
+ VehicleDataNotificationStatus temp = VehicleDataNotificationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VehicleDataNotificationStatus temp = VehicleDataNotificationStatus.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataNotificationStatus temp = VehicleDataNotificationStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of VehicleDataNotification.
- */
- public void testListEnum() {
- List<VehicleDataNotificationStatus> enumValueList = Arrays.asList(VehicleDataNotificationStatus.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VehicleDataNotification.
+ */
+ public void testListEnum() {
+ List<VehicleDataNotificationStatus> enumValueList = Arrays.asList(VehicleDataNotificationStatus.values());
- List<VehicleDataNotificationStatus> enumTestList = new ArrayList<VehicleDataNotificationStatus>();
- enumTestList.add(VehicleDataNotificationStatus.NOT_SUPPORTED);
- enumTestList.add(VehicleDataNotificationStatus.NORMAL);
- enumTestList.add(VehicleDataNotificationStatus.ACTIVE);
- enumTestList.add(VehicleDataNotificationStatus.NOT_USED);
+ List<VehicleDataNotificationStatus> enumTestList = new ArrayList<VehicleDataNotificationStatus>();
+ enumTestList.add(VehicleDataNotificationStatus.NOT_SUPPORTED);
+ enumTestList.add(VehicleDataNotificationStatus.NORMAL);
+ enumTestList.add(VehicleDataNotificationStatus.ACTIVE);
+ enumTestList.add(VehicleDataNotificationStatus.NOT_USED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataResultCodeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataResultCodeTests.java
index df926b1aa..61705d8aa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataResultCodeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataResultCodeTests.java
@@ -9,91 +9,89 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode}
*/
public class VehicleDataResultCodeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "SUCCESS";
- VehicleDataResultCode enumSuccess = VehicleDataResultCode.valueForString(example);
- example = "TRUNCATED_DATA";
- VehicleDataResultCode enumTruncData = VehicleDataResultCode.valueForString(example);
- example = "DISALLOWED";
- VehicleDataResultCode enumDisallowed = VehicleDataResultCode.valueForString(example);
- example = "USER_DISALLOWED";
- VehicleDataResultCode enumUserDisallowed = VehicleDataResultCode.valueForString(example);
- example = "INVALID_ID";
- VehicleDataResultCode enumInvalidId = VehicleDataResultCode.valueForString(example);
- example = "VEHICLE_DATA_NOT_AVAILABLE";
- VehicleDataResultCode enumVehicleDataNotAvailable = VehicleDataResultCode.valueForString(example);
- example = "DATA_ALREADY_SUBSCRIBED";
- VehicleDataResultCode enumDataAlreadySubscribed = VehicleDataResultCode.valueForString(example);
- example = "DATA_NOT_SUBSCRIBED";
- VehicleDataResultCode enumDataNotSubscribed = VehicleDataResultCode.valueForString(example);
- example = "IGNORED";
- VehicleDataResultCode enumIgnored = VehicleDataResultCode.valueForString(example);
-
- assertNotNull("SUCCESS returned null", enumSuccess);
- assertNotNull("TRUNCATED_DATA returned null", enumTruncData);
- assertNotNull("DISALLOWED returned null", enumDisallowed);
- assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
- assertNotNull("INVALID_ID returned null", enumInvalidId);
- assertNotNull("VEHICLE_DATA_NOT_AVAILABLE returned null", enumVehicleDataNotAvailable);
- assertNotNull("DATA_ALREADY_SUBSCRIBED returned null", enumDataAlreadySubscribed);
- assertNotNull("DATA_NOT_SUBSCRIBED returned null", enumDataNotSubscribed);
- assertNotNull("IGNORED returned null", enumIgnored);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "suCcesS";
- try {
- VehicleDataResultCode temp = VehicleDataResultCode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "SUCCESS";
+ VehicleDataResultCode enumSuccess = VehicleDataResultCode.valueForString(example);
+ example = "TRUNCATED_DATA";
+ VehicleDataResultCode enumTruncData = VehicleDataResultCode.valueForString(example);
+ example = "DISALLOWED";
+ VehicleDataResultCode enumDisallowed = VehicleDataResultCode.valueForString(example);
+ example = "USER_DISALLOWED";
+ VehicleDataResultCode enumUserDisallowed = VehicleDataResultCode.valueForString(example);
+ example = "INVALID_ID";
+ VehicleDataResultCode enumInvalidId = VehicleDataResultCode.valueForString(example);
+ example = "VEHICLE_DATA_NOT_AVAILABLE";
+ VehicleDataResultCode enumVehicleDataNotAvailable = VehicleDataResultCode.valueForString(example);
+ example = "DATA_ALREADY_SUBSCRIBED";
+ VehicleDataResultCode enumDataAlreadySubscribed = VehicleDataResultCode.valueForString(example);
+ example = "DATA_NOT_SUBSCRIBED";
+ VehicleDataResultCode enumDataNotSubscribed = VehicleDataResultCode.valueForString(example);
+ example = "IGNORED";
+ VehicleDataResultCode enumIgnored = VehicleDataResultCode.valueForString(example);
+
+ assertNotNull("SUCCESS returned null", enumSuccess);
+ assertNotNull("TRUNCATED_DATA returned null", enumTruncData);
+ assertNotNull("DISALLOWED returned null", enumDisallowed);
+ assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
+ assertNotNull("INVALID_ID returned null", enumInvalidId);
+ assertNotNull("VEHICLE_DATA_NOT_AVAILABLE returned null", enumVehicleDataNotAvailable);
+ assertNotNull("DATA_ALREADY_SUBSCRIBED returned null", enumDataAlreadySubscribed);
+ assertNotNull("DATA_NOT_SUBSCRIBED returned null", enumDataNotSubscribed);
+ assertNotNull("IGNORED returned null", enumIgnored);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "suCcesS";
+ try {
+ VehicleDataResultCode temp = VehicleDataResultCode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VehicleDataResultCode temp = VehicleDataResultCode.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataResultCode temp = VehicleDataResultCode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of VehicleDataResultCode.
- */
- public void testListEnum() {
- List<VehicleDataResultCode> enumValueList = Arrays.asList(VehicleDataResultCode.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VehicleDataResultCode.
+ */
+ public void testListEnum() {
+ List<VehicleDataResultCode> enumValueList = Arrays.asList(VehicleDataResultCode.values());
- List<VehicleDataResultCode> enumTestList = new ArrayList<VehicleDataResultCode>();
- enumTestList.add(VehicleDataResultCode.SUCCESS);
- enumTestList.add(VehicleDataResultCode.TRUNCATED_DATA);
- enumTestList.add(VehicleDataResultCode.DISALLOWED);
- enumTestList.add(VehicleDataResultCode.USER_DISALLOWED);
- enumTestList.add(VehicleDataResultCode.INVALID_ID);
- enumTestList.add(VehicleDataResultCode.VEHICLE_DATA_NOT_AVAILABLE);
- enumTestList.add(VehicleDataResultCode.DATA_ALREADY_SUBSCRIBED);
- enumTestList.add(VehicleDataResultCode.DATA_NOT_SUBSCRIBED);
- enumTestList.add(VehicleDataResultCode.IGNORED);
+ List<VehicleDataResultCode> enumTestList = new ArrayList<VehicleDataResultCode>();
+ enumTestList.add(VehicleDataResultCode.SUCCESS);
+ enumTestList.add(VehicleDataResultCode.TRUNCATED_DATA);
+ enumTestList.add(VehicleDataResultCode.DISALLOWED);
+ enumTestList.add(VehicleDataResultCode.USER_DISALLOWED);
+ enumTestList.add(VehicleDataResultCode.INVALID_ID);
+ enumTestList.add(VehicleDataResultCode.VEHICLE_DATA_NOT_AVAILABLE);
+ enumTestList.add(VehicleDataResultCode.DATA_ALREADY_SUBSCRIBED);
+ enumTestList.add(VehicleDataResultCode.DATA_NOT_SUBSCRIBED);
+ enumTestList.add(VehicleDataResultCode.IGNORED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataStatusTests.java
index 48f972baf..6808df33a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataStatusTests.java
@@ -9,67 +9,65 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus}
*/
public class VehicleDataStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "NO_DATA_EXISTS";
- VehicleDataStatus enumNoDataExists = VehicleDataStatus.valueForString(example);
- example = "OFF";
- VehicleDataStatus enumOff = VehicleDataStatus.valueForString(example);
- example = "ON";
- VehicleDataStatus enumOn = VehicleDataStatus.valueForString(example);
-
- assertNotNull("NO_DATA_EXISTS returned null", enumNoDataExists);
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("ON returned null", enumOn);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "No_DatA_ExiSTs";
- try {
- VehicleDataStatus temp = VehicleDataStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "NO_DATA_EXISTS";
+ VehicleDataStatus enumNoDataExists = VehicleDataStatus.valueForString(example);
+ example = "OFF";
+ VehicleDataStatus enumOff = VehicleDataStatus.valueForString(example);
+ example = "ON";
+ VehicleDataStatus enumOn = VehicleDataStatus.valueForString(example);
+
+ assertNotNull("NO_DATA_EXISTS returned null", enumNoDataExists);
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("ON returned null", enumOn);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "No_DatA_ExiSTs";
+ try {
+ VehicleDataStatus temp = VehicleDataStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VehicleDataStatus temp = VehicleDataStatus.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataStatus temp = VehicleDataStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of VehicleDataStatus.
- */
- public void testListEnum() {
- List<VehicleDataStatus> enumValueList = Arrays.asList(VehicleDataStatus.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VehicleDataStatus.
+ */
+ public void testListEnum() {
+ List<VehicleDataStatus> enumValueList = Arrays.asList(VehicleDataStatus.values());
- List<VehicleDataStatus> enumTestList = new ArrayList<VehicleDataStatus>();
- enumTestList.add(VehicleDataStatus.NO_DATA_EXISTS);
- enumTestList.add(VehicleDataStatus.OFF);
- enumTestList.add(VehicleDataStatus.ON);
+ List<VehicleDataStatus> enumTestList = new ArrayList<VehicleDataStatus>();
+ enumTestList.add(VehicleDataStatus.NO_DATA_EXISTS);
+ enumTestList.add(VehicleDataStatus.OFF);
+ enumTestList.add(VehicleDataStatus.ON);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VehicleDataTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
index a337058f9..1b270a9dd 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
@@ -9,199 +9,197 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VehicleDataType}
*/
public class VehicleDataTypeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "VEHICLEDATA_GPS";
- VehicleDataType enumVehicleDataGps = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_SPEED";
- VehicleDataType enumVehicleDataSpeed = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_RPM";
- VehicleDataType enumVehicleDataRpm = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_FUELLEVEL";
- VehicleDataType enumVehicleDataFuelLevel = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_FUELLEVEL_STATE";
- VehicleDataType enumVehicleDataFuelLevelState = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_FUELCONSUMPTION";
- VehicleDataType enumVehicleDataFuelConsumption = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_EXTERNTEMP";
- VehicleDataType enumVehicleDataExternTemp = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_VIN";
- VehicleDataType enumVehicleDataVin = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_PRNDL";
- VehicleDataType enumVehicleDataPrndl = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_TIREPRESSURE";
- VehicleDataType enumVehicleDataTirePressure = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ODOMETER";
- VehicleDataType enumVehicleDataOdometer = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_BELTSTATUS";
- VehicleDataType enumVehicleDataBeltStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_BODYINFO";
- VehicleDataType enumVehicleDataBodyInfo = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_DEVICESTATUS";
- VehicleDataType enumVehicleDataDeviceStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_BRAKING";
- VehicleDataType enumVehicleDataBraking = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_WIPERSTATUS";
- VehicleDataType enumVehicleDataWiperStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_HEADLAMPSTATUS";
- VehicleDataType enumVehicleDataHeadlampStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_BATTVOLTAGE";
- VehicleDataType enumVehicleDataBattVoltage = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ENGINETORQUE";
- VehicleDataType enumVehicleDataEngineTorque = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ENGINEOILLIFE";
- VehicleDataType enumVehicleDataEngineOilLife = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ACCPEDAL";
- VehicleDataType enumVehicleDataAccPedal = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_STEERINGWHEEL";
- VehicleDataType enumVehicleDataSteeringWheel = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ECALLINFO";
- VehicleDataType enumVehicleDataECallInfo = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_AIRBAGSTATUS";
- VehicleDataType enumVehicleDataAirbagStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_EMERGENCYEVENT";
- VehicleDataType enumVehicleDataEmergencyEvent = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_CLUSTERMODESTATUS";
- VehicleDataType enumVehicleDataClusterModeStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_MYKEY";
- VehicleDataType enumVehicleDataMyKey = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_FUELRANGE";
- VehicleDataType enumVehicleDataFuelRange = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_TURNSIGNAL";
- VehicleDataType enumVehicleDataTurnSignal = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_ELECTRONICPARKBRAKESTATUS";
- VehicleDataType enumVehicleDataElectronicParkBrakeStatus = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_CLOUDAPPVEHICLEID";
- VehicleDataType enumVehicleCloudAppVehicleId = VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_OEM_CUSTOM_DATA";
- VehicleDataType enumVehicleDataOemVehicleDataType= VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_HANDSOFFSTEERING";
- VehicleDataType enumVehicleDataHandsOffSteeringType= VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_GEARSTATUS";
- VehicleDataType enumVehicleDataGearStatus= VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_WINDOWSTATUS";
- VehicleDataType enumVehicleDataTypeWindowStatus= VehicleDataType.valueForString(example);
- example = "VEHICLEDATA_STABILITYCONTROLSSTATUS";
- VehicleDataType enumVehicleDataStabilityControlsStatus = VehicleDataType.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "VEHICLEDATA_GPS";
+ VehicleDataType enumVehicleDataGps = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_SPEED";
+ VehicleDataType enumVehicleDataSpeed = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_RPM";
+ VehicleDataType enumVehicleDataRpm = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_FUELLEVEL";
+ VehicleDataType enumVehicleDataFuelLevel = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_FUELLEVEL_STATE";
+ VehicleDataType enumVehicleDataFuelLevelState = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_FUELCONSUMPTION";
+ VehicleDataType enumVehicleDataFuelConsumption = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_EXTERNTEMP";
+ VehicleDataType enumVehicleDataExternTemp = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_VIN";
+ VehicleDataType enumVehicleDataVin = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_PRNDL";
+ VehicleDataType enumVehicleDataPrndl = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_TIREPRESSURE";
+ VehicleDataType enumVehicleDataTirePressure = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ODOMETER";
+ VehicleDataType enumVehicleDataOdometer = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_BELTSTATUS";
+ VehicleDataType enumVehicleDataBeltStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_BODYINFO";
+ VehicleDataType enumVehicleDataBodyInfo = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_DEVICESTATUS";
+ VehicleDataType enumVehicleDataDeviceStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_BRAKING";
+ VehicleDataType enumVehicleDataBraking = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_WIPERSTATUS";
+ VehicleDataType enumVehicleDataWiperStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_HEADLAMPSTATUS";
+ VehicleDataType enumVehicleDataHeadlampStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_BATTVOLTAGE";
+ VehicleDataType enumVehicleDataBattVoltage = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ENGINETORQUE";
+ VehicleDataType enumVehicleDataEngineTorque = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ENGINEOILLIFE";
+ VehicleDataType enumVehicleDataEngineOilLife = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ACCPEDAL";
+ VehicleDataType enumVehicleDataAccPedal = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_STEERINGWHEEL";
+ VehicleDataType enumVehicleDataSteeringWheel = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ECALLINFO";
+ VehicleDataType enumVehicleDataECallInfo = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_AIRBAGSTATUS";
+ VehicleDataType enumVehicleDataAirbagStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_EMERGENCYEVENT";
+ VehicleDataType enumVehicleDataEmergencyEvent = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_CLUSTERMODESTATUS";
+ VehicleDataType enumVehicleDataClusterModeStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_MYKEY";
+ VehicleDataType enumVehicleDataMyKey = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_FUELRANGE";
+ VehicleDataType enumVehicleDataFuelRange = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_TURNSIGNAL";
+ VehicleDataType enumVehicleDataTurnSignal = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_ELECTRONICPARKBRAKESTATUS";
+ VehicleDataType enumVehicleDataElectronicParkBrakeStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_CLOUDAPPVEHICLEID";
+ VehicleDataType enumVehicleCloudAppVehicleId = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_OEM_CUSTOM_DATA";
+ VehicleDataType enumVehicleDataOemVehicleDataType = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_HANDSOFFSTEERING";
+ VehicleDataType enumVehicleDataHandsOffSteeringType = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_GEARSTATUS";
+ VehicleDataType enumVehicleDataGearStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_WINDOWSTATUS";
+ VehicleDataType enumVehicleDataTypeWindowStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_STABILITYCONTROLSSTATUS";
+ VehicleDataType enumVehicleDataStabilityControlsStatus = VehicleDataType.valueForString(example);
- assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
- assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
- assertNotNull("VEHICLEDATA_RPM returned null", enumVehicleDataRpm);
- assertNotNull("VEHICLEDATA_FUELLEVEL returned null", enumVehicleDataFuelLevel);
- assertNotNull("VEHICLEDATA_FUELLEVEL_STATE returned null", enumVehicleDataFuelLevelState);
- assertNotNull("VEHICLEDATA_FUELCONSUMPTION returned null", enumVehicleDataFuelConsumption);
- assertNotNull("VEHICLEDATA_EXTERNTEMP returned null", enumVehicleDataExternTemp);
- assertNotNull("VEHICLEDATA_VIN returned null", enumVehicleDataVin);
- assertNotNull("VEHICLEDATA_PRNDL returned null", enumVehicleDataPrndl);
- assertNotNull("VEHICLEDATA_TIREPRESSURE returned null", enumVehicleDataTirePressure);
- assertNotNull("VEHICLEDATA_ODOMETER returned null", enumVehicleDataOdometer);
- assertNotNull("VEHICLEDATA_BELTSTATUS returned null", enumVehicleDataBeltStatus);
- assertNotNull("VEHICLEDATA_BODYINFO returned null", enumVehicleDataBodyInfo);
- assertNotNull("VEHICLEDATA_DEVICESTATUS returned null", enumVehicleDataDeviceStatus);
- assertNotNull("VEHICLEDATA_BRAKING returned null", enumVehicleDataBraking);
- assertNotNull("VEHICLEDATA_WIPERSTATUS returned null", enumVehicleDataWiperStatus);
- assertNotNull("VEHICLEDATA_HEADLAMPSTATUS returned null", enumVehicleDataHeadlampStatus);
- assertNotNull("VEHICLEDATA_BATTVOLTAGE returned null", enumVehicleDataBattVoltage);
- assertNotNull("VEHICLEDATA_ENGINETORQUE returned null", enumVehicleDataEngineTorque);
- assertNotNull("VEHICLEDATA_ENGINEOILLIFE returned null", enumVehicleDataEngineOilLife);
- assertNotNull("VEHICLEDATA_ACCPEDAL returned null", enumVehicleDataAccPedal);
- assertNotNull("VEHICLEDATA_STEERINGWHEEL returned null", enumVehicleDataSteeringWheel);
- assertNotNull("VEHICLEDATA_ECALLINFO returned null", enumVehicleDataECallInfo);
- assertNotNull("VEHICLEDATA_AIRBAGSTATUS returned null", enumVehicleDataAirbagStatus);
- assertNotNull("VEHICLEDATA_EMERGENCYEVENT returned null", enumVehicleDataEmergencyEvent);
- assertNotNull("VEHICLEDATA_CLUSTERMODESTATUS returned null", enumVehicleDataClusterModeStatus);
- assertNotNull("VEHICLEDATA_MYKEY returned null", enumVehicleDataMyKey);
- assertNotNull("VEHICLEDATA_FUELRANGE returned null", enumVehicleDataFuelRange);
- 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);
- assertNotNull("VEHICLEDATA_HANDSOFFSTEERING returned null", enumVehicleDataHandsOffSteeringType);
- assertNotNull("VEHICLEDATA_WINDOWSTATUS returned null", enumVehicleDataTypeWindowStatus);
- assertNotNull("VEHICLEDATA_GEARSTATUS returned null", enumVehicleDataGearStatus);
- assertNotNull("VEHICLEDATA_STABILITYCONTROLSSTATUS returned null", enumVehicleDataStabilityControlsStatus);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "VeHIcLEDatA_GPs";
- try {
- VehicleDataType temp = VehicleDataType.valueForString(example);
+ assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
+ assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
+ assertNotNull("VEHICLEDATA_RPM returned null", enumVehicleDataRpm);
+ assertNotNull("VEHICLEDATA_FUELLEVEL returned null", enumVehicleDataFuelLevel);
+ assertNotNull("VEHICLEDATA_FUELLEVEL_STATE returned null", enumVehicleDataFuelLevelState);
+ assertNotNull("VEHICLEDATA_FUELCONSUMPTION returned null", enumVehicleDataFuelConsumption);
+ assertNotNull("VEHICLEDATA_EXTERNTEMP returned null", enumVehicleDataExternTemp);
+ assertNotNull("VEHICLEDATA_VIN returned null", enumVehicleDataVin);
+ assertNotNull("VEHICLEDATA_PRNDL returned null", enumVehicleDataPrndl);
+ assertNotNull("VEHICLEDATA_TIREPRESSURE returned null", enumVehicleDataTirePressure);
+ assertNotNull("VEHICLEDATA_ODOMETER returned null", enumVehicleDataOdometer);
+ assertNotNull("VEHICLEDATA_BELTSTATUS returned null", enumVehicleDataBeltStatus);
+ assertNotNull("VEHICLEDATA_BODYINFO returned null", enumVehicleDataBodyInfo);
+ assertNotNull("VEHICLEDATA_DEVICESTATUS returned null", enumVehicleDataDeviceStatus);
+ assertNotNull("VEHICLEDATA_BRAKING returned null", enumVehicleDataBraking);
+ assertNotNull("VEHICLEDATA_WIPERSTATUS returned null", enumVehicleDataWiperStatus);
+ assertNotNull("VEHICLEDATA_HEADLAMPSTATUS returned null", enumVehicleDataHeadlampStatus);
+ assertNotNull("VEHICLEDATA_BATTVOLTAGE returned null", enumVehicleDataBattVoltage);
+ assertNotNull("VEHICLEDATA_ENGINETORQUE returned null", enumVehicleDataEngineTorque);
+ assertNotNull("VEHICLEDATA_ENGINEOILLIFE returned null", enumVehicleDataEngineOilLife);
+ assertNotNull("VEHICLEDATA_ACCPEDAL returned null", enumVehicleDataAccPedal);
+ assertNotNull("VEHICLEDATA_STEERINGWHEEL returned null", enumVehicleDataSteeringWheel);
+ assertNotNull("VEHICLEDATA_ECALLINFO returned null", enumVehicleDataECallInfo);
+ assertNotNull("VEHICLEDATA_AIRBAGSTATUS returned null", enumVehicleDataAirbagStatus);
+ assertNotNull("VEHICLEDATA_EMERGENCYEVENT returned null", enumVehicleDataEmergencyEvent);
+ assertNotNull("VEHICLEDATA_CLUSTERMODESTATUS returned null", enumVehicleDataClusterModeStatus);
+ assertNotNull("VEHICLEDATA_MYKEY returned null", enumVehicleDataMyKey);
+ assertNotNull("VEHICLEDATA_FUELRANGE returned null", enumVehicleDataFuelRange);
+ 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);
+ assertNotNull("VEHICLEDATA_HANDSOFFSTEERING returned null", enumVehicleDataHandsOffSteeringType);
+ assertNotNull("VEHICLEDATA_WINDOWSTATUS returned null", enumVehicleDataTypeWindowStatus);
+ assertNotNull("VEHICLEDATA_GEARSTATUS returned null", enumVehicleDataGearStatus);
+ assertNotNull("VEHICLEDATA_STABILITYCONTROLSSTATUS returned null", enumVehicleDataStabilityControlsStatus);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "VeHIcLEDatA_GPs";
+ try {
+ VehicleDataType temp = VehicleDataType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VehicleDataType temp = VehicleDataType.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VehicleDataType temp = VehicleDataType.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of VehicleDataType.
- */
- public void testListEnum() {
- List<VehicleDataType> enumValueList = Arrays.asList(VehicleDataType.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VehicleDataType.
+ */
+ public void testListEnum() {
+ List<VehicleDataType> enumValueList = Arrays.asList(VehicleDataType.values());
- List<VehicleDataType> enumTestList = new ArrayList<VehicleDataType>();
- enumTestList.add(VehicleDataType.VEHICLEDATA_GPS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_SPEED);
- enumTestList.add(VehicleDataType.VEHICLEDATA_RPM);
- enumTestList.add(VehicleDataType.VEHICLEDATA_FUELLEVEL);
- enumTestList.add(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION);
- enumTestList.add(VehicleDataType.VEHICLEDATA_EXTERNTEMP);
- enumTestList.add(VehicleDataType.VEHICLEDATA_VIN);
- enumTestList.add(VehicleDataType.VEHICLEDATA_PRNDL);
- enumTestList.add(VehicleDataType.VEHICLEDATA_TIREPRESSURE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ODOMETER);
- enumTestList.add(VehicleDataType.VEHICLEDATA_BELTSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_BODYINFO);
- enumTestList.add(VehicleDataType.VEHICLEDATA_DEVICESTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_BRAKING);
- enumTestList.add(VehicleDataType.VEHICLEDATA_WIPERSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_BATTVOLTAGE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ENGINETORQUE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ACCPEDAL);
- enumTestList.add(VehicleDataType.VEHICLEDATA_STEERINGWHEEL);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ECALLINFO);
- enumTestList.add(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT);
- enumTestList.add(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_MYKEY);
- enumTestList.add(VehicleDataType.VEHICLEDATA_FUELRANGE);
- enumTestList.add(VehicleDataType.VEHICLEDATA_TURNSIGNAL);
- enumTestList.add(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_CLOUDAPPVEHICLEID);
- enumTestList.add(VehicleDataType.VEHICLEDATA_OEM_CUSTOM_DATA);
- enumTestList.add(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING);
- enumTestList.add(VehicleDataType.VEHICLEDATA_WINDOWSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_GEARSTATUS);
- enumTestList.add(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS);
+ List<VehicleDataType> enumTestList = new ArrayList<VehicleDataType>();
+ enumTestList.add(VehicleDataType.VEHICLEDATA_GPS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_SPEED);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_RPM);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_FUELLEVEL);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_EXTERNTEMP);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_VIN);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_PRNDL);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_TIREPRESSURE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ODOMETER);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_BELTSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_BODYINFO);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_DEVICESTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_BRAKING);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_WIPERSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_BATTVOLTAGE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ENGINETORQUE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ACCPEDAL);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_STEERINGWHEEL);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ECALLINFO);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_MYKEY);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_FUELRANGE);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_TURNSIGNAL);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_CLOUDAPPVEHICLEID);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_OEM_CUSTOM_DATA);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_WINDOWSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_GEARSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VentilationModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java
index 3cd7b4038..359b6fd2c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VentilationMode}
*/
public class VentilationModeTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "UPPER";
- VentilationMode enumUpper = VentilationMode.valueForString(example);
- example = "LOWER";
- VentilationMode enumLower = VentilationMode.valueForString(example);
- example = "BOTH";
- VentilationMode enumBoth = VentilationMode.valueForString(example);
- example = "NONE";
- VentilationMode enumNone = VentilationMode.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "UPPER";
+ VentilationMode enumUpper = VentilationMode.valueForString(example);
+ example = "LOWER";
+ VentilationMode enumLower = VentilationMode.valueForString(example);
+ example = "BOTH";
+ VentilationMode enumBoth = VentilationMode.valueForString(example);
+ example = "NONE";
+ VentilationMode enumNone = VentilationMode.valueForString(example);
- assertNotNull("UPPER returned null", enumUpper);
- assertNotNull("LOWER returned null", enumLower);
- assertNotNull("BOTH returned null", enumBoth);
- assertNotNull("NONE returned null", enumNone);
- }
+ assertNotNull("UPPER returned null", enumUpper);
+ assertNotNull("LOWER returned null", enumLower);
+ assertNotNull("BOTH returned null", enumBoth);
+ assertNotNull("NONE returned null", enumNone);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "uPPER";
- try {
- VentilationMode temp = VentilationMode.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "uPPER";
+ try {
+ VentilationMode temp = VentilationMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VentilationMode temp = VentilationMode.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VentilationMode temp = VentilationMode.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of VentilationMode.
- */
- public void testListEnum() {
- List<VentilationMode> enumValueList = Arrays.asList(VentilationMode.values());
+ /**
+ * Verifies the possible enum values of VentilationMode.
+ */
+ public void testListEnum() {
+ List<VentilationMode> enumValueList = Arrays.asList(VentilationMode.values());
- List<VentilationMode> enumTestList = new ArrayList<VentilationMode>();
- enumTestList.add(VentilationMode.UPPER);
- enumTestList.add(VentilationMode.LOWER);
- enumTestList.add(VentilationMode.BOTH);
- enumTestList.add(VentilationMode.NONE);
+ List<VentilationMode> enumTestList = new ArrayList<VentilationMode>();
+ enumTestList.add(VentilationMode.UPPER);
+ enumTestList.add(VentilationMode.LOWER);
+ enumTestList.add(VentilationMode.BOTH);
+ enumTestList.add(VentilationMode.NONE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VideoStreamingCodecTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java
index b4aa8fd97..641fc5dd9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java
@@ -1,4 +1,5 @@
package com.smartdevicelink.test.rpc.enums;
+
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
import junit.framework.TestCase;
@@ -9,71 +10,69 @@ import java.util.List;
public class VideoStreamingCodecTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "H264";
- VideoStreamingCodec enumH264 = VideoStreamingCodec.valueForString(example);
- example = "H265";
- VideoStreamingCodec enumH265 = VideoStreamingCodec.valueForString(example);
- example = "Theora";
- VideoStreamingCodec enumTheora = VideoStreamingCodec.valueForString(example);
- example = "VP8";
- VideoStreamingCodec enumVP8 = VideoStreamingCodec.valueForString(example);
- example = "VP9";
- VideoStreamingCodec enumVP9 = VideoStreamingCodec.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "H264";
+ VideoStreamingCodec enumH264 = VideoStreamingCodec.valueForString(example);
+ example = "H265";
+ VideoStreamingCodec enumH265 = VideoStreamingCodec.valueForString(example);
+ example = "Theora";
+ VideoStreamingCodec enumTheora = VideoStreamingCodec.valueForString(example);
+ example = "VP8";
+ VideoStreamingCodec enumVP8 = VideoStreamingCodec.valueForString(example);
+ example = "VP9";
+ VideoStreamingCodec enumVP9 = VideoStreamingCodec.valueForString(example);
- assertNotNull("H264 returned null", enumH264);
- assertNotNull("H265 returned null", enumH265);
- assertNotNull("Theora returned null", enumTheora);
- assertNotNull("VP8 returned null", enumVP8);
- assertNotNull("VP9 returned null", enumVP9);
- }
+ assertNotNull("H264 returned null", enumH264);
+ assertNotNull("H265 returned null", enumH265);
+ assertNotNull("Theora returned null", enumTheora);
+ assertNotNull("VP8 returned null", enumVP8);
+ assertNotNull("VP9 returned null", enumVP9);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "H234";
- try {
- VideoStreamingCodec temp = VideoStreamingCodec.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "H234";
+ try {
+ VideoStreamingCodec temp = VideoStreamingCodec.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 {
- VideoStreamingCodec temp = VideoStreamingCodec.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VideoStreamingCodec temp = VideoStreamingCodec.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of TouchType.
- */
- public void testListEnum() {
- List<VideoStreamingCodec> enumValueList = Arrays.asList(VideoStreamingCodec.values());
+ /**
+ * Verifies the possible enum values of TouchType.
+ */
+ public void testListEnum() {
+ List<VideoStreamingCodec> enumValueList = Arrays.asList(VideoStreamingCodec.values());
- List<VideoStreamingCodec> enumTestList = new ArrayList<VideoStreamingCodec>();
- enumTestList.add(VideoStreamingCodec.H264);
- enumTestList.add(VideoStreamingCodec.H265);
- enumTestList.add(VideoStreamingCodec.Theora);
- enumTestList.add(VideoStreamingCodec.VP8);
- enumTestList.add(VideoStreamingCodec.VP9);
+ List<VideoStreamingCodec> enumTestList = new ArrayList<VideoStreamingCodec>();
+ enumTestList.add(VideoStreamingCodec.H264);
+ enumTestList.add(VideoStreamingCodec.H265);
+ enumTestList.add(VideoStreamingCodec.Theora);
+ enumTestList.add(VideoStreamingCodec.VP8);
+ enumTestList.add(VideoStreamingCodec.VP9);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VideoStreamingProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java
index 36dba5b6f..090017aca 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java
@@ -10,72 +10,70 @@ import java.util.List;
public class VideoStreamingProtocolTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "RAW";
- VideoStreamingProtocol enumRAW = VideoStreamingProtocol.valueForString(example);
- example = "RTP";
- VideoStreamingProtocol enumRTP = VideoStreamingProtocol.valueForString(example);
- example = "RTSP";
- VideoStreamingProtocol enumRTSP = VideoStreamingProtocol.valueForString(example);
- example = "RTMP";
- VideoStreamingProtocol enumRTMP = VideoStreamingProtocol.valueForString(example);
- example = "WEBM";
- VideoStreamingProtocol enumWEBM = VideoStreamingProtocol.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "RAW";
+ VideoStreamingProtocol enumRAW = VideoStreamingProtocol.valueForString(example);
+ example = "RTP";
+ VideoStreamingProtocol enumRTP = VideoStreamingProtocol.valueForString(example);
+ example = "RTSP";
+ VideoStreamingProtocol enumRTSP = VideoStreamingProtocol.valueForString(example);
+ example = "RTMP";
+ VideoStreamingProtocol enumRTMP = VideoStreamingProtocol.valueForString(example);
+ example = "WEBM";
+ VideoStreamingProtocol enumWEBM = VideoStreamingProtocol.valueForString(example);
- assertNotNull("RAW returned null", enumRAW);
- assertNotNull("RTP returned null", enumRTP);
- assertNotNull("RTSP returned null", enumRTSP);
- assertNotNull("RTMP returned null", enumRTMP);
- assertNotNull("WEBM returned null", enumWEBM);
- }
+ assertNotNull("RAW returned null", enumRAW);
+ assertNotNull("RTP returned null", enumRTP);
+ assertNotNull("RTSP returned null", enumRTSP);
+ assertNotNull("RTMP returned null", enumRTMP);
+ assertNotNull("WEBM returned null", enumWEBM);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "RAAW";
- try {
- VideoStreamingProtocol temp = VideoStreamingProtocol.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "RAAW";
+ try {
+ VideoStreamingProtocol temp = VideoStreamingProtocol.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 {
- VideoStreamingProtocol temp = VideoStreamingProtocol.valueForString(example);
- assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VideoStreamingProtocol temp = VideoStreamingProtocol.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
- /**
- * Verifies the possible enum values of TouchType.
- */
- public void testListEnum() {
- List<VideoStreamingProtocol> enumValueList = Arrays.asList(VideoStreamingProtocol.values());
+ /**
+ * Verifies the possible enum values of TouchType.
+ */
+ public void testListEnum() {
+ List<VideoStreamingProtocol> enumValueList = Arrays.asList(VideoStreamingProtocol.values());
- List<VideoStreamingProtocol> enumTestList = new ArrayList<VideoStreamingProtocol>();
- enumTestList.add(VideoStreamingProtocol.RAW);
- enumTestList.add(VideoStreamingProtocol.RTP);
- enumTestList.add(VideoStreamingProtocol.RTSP);
- enumTestList.add(VideoStreamingProtocol.RTMP);
- enumTestList.add(VideoStreamingProtocol.WEBM);
+ List<VideoStreamingProtocol> enumTestList = new ArrayList<VideoStreamingProtocol>();
+ enumTestList.add(VideoStreamingProtocol.RAW);
+ enumTestList.add(VideoStreamingProtocol.RTP);
+ enumTestList.add(VideoStreamingProtocol.RTSP);
+ enumTestList.add(VideoStreamingProtocol.RTMP);
+ enumTestList.add(VideoStreamingProtocol.WEBM);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VideoStreamingStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingStateTests.java
index 2074efe47..bf0858464 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingStateTests.java
@@ -9,63 +9,61 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VideoStreamingState}
*/
public class VideoStreamingStateTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "STREAMABLE";
- VideoStreamingState enumStreamable = VideoStreamingState.valueForString(example);
- example = "NOT_STREAMABLE";
- VideoStreamingState enumNotStreamable = VideoStreamingState.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "STREAMABLE";
+ VideoStreamingState enumStreamable = VideoStreamingState.valueForString(example);
+ example = "NOT_STREAMABLE";
+ VideoStreamingState enumNotStreamable = VideoStreamingState.valueForString(example);
- assertNotNull("STREAMABLE returned null", enumStreamable);
- assertNotNull("NOT_STREAMABLE returned null", enumNotStreamable);
- }
+ assertNotNull("STREAMABLE returned null", enumStreamable);
+ assertNotNull("NOT_STREAMABLE returned null", enumNotStreamable);
+ }
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "StrEAmaBlE";
- try {
- VideoStreamingState temp = VideoStreamingState.valueForString(example);
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "StrEAmaBlE";
+ try {
+ VideoStreamingState temp = VideoStreamingState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
+ }
+ }
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VideoStreamingState temp = VideoStreamingState.valueForString(example);
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VideoStreamingState temp = VideoStreamingState.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
+ }
+ }
- /**
- * Verifies the possible enum values of VideoStreamingState.
- */
- public void testListEnum() {
- List<VideoStreamingState> enumValueList = Arrays.asList(VideoStreamingState.values());
+ /**
+ * Verifies the possible enum values of VideoStreamingState.
+ */
+ public void testListEnum() {
+ List<VideoStreamingState> enumValueList = Arrays.asList(VideoStreamingState.values());
- List<VideoStreamingState> enumTestList = new ArrayList<VideoStreamingState>();
- enumTestList.add(VideoStreamingState.STREAMABLE);
- enumTestList.add(VideoStreamingState.NOT_STREAMABLE);
+ List<VideoStreamingState> enumTestList = new ArrayList<VideoStreamingState>();
+ enumTestList.add(VideoStreamingState.STREAMABLE);
+ enumTestList.add(VideoStreamingState.NOT_STREAMABLE);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/VrCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VrCapabilitiesTests.java
index 611798683..de8bd5ac3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VrCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VrCapabilitiesTests.java
@@ -9,60 +9,58 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.VrCapabilities}
*/
public class VrCapabilitiesTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "Text";
- VrCapabilities enumText = VrCapabilities.valueForString(example);
-
- assertNotNull("Text returned null", enumText);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "tExTx";
- try {
- VrCapabilities temp = VrCapabilities.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "Text";
+ VrCapabilities enumText = VrCapabilities.valueForString(example);
+
+ assertNotNull("Text returned null", enumText);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "tExTx";
+ try {
+ VrCapabilities temp = VrCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- VrCapabilities temp = VrCapabilities.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ VrCapabilities temp = VrCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of VrCapabilities.
- */
- @SuppressWarnings("deprecation")
- public void testListEnum() {
- List<VrCapabilities> enumValueList = Arrays.asList(VrCapabilities.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VrCapabilities.
+ */
+ @SuppressWarnings("deprecation")
+ public void testListEnum() {
+ List<VrCapabilities> enumValueList = Arrays.asList(VrCapabilities.values());
- List<VrCapabilities> enumTestList = new ArrayList<VrCapabilities>();
- enumTestList.add(VrCapabilities.TEXT);
+ List<VrCapabilities> enumTestList = new ArrayList<VrCapabilities>();
+ enumTestList.add(VrCapabilities.TEXT);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/WarningLightStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WarningLightStatusTests.java
index bf3433f61..278c263df 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WarningLightStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WarningLightStatusTests.java
@@ -9,71 +9,69 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.WarningLightStatus}
*/
public class WarningLightStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "OFF";
- WarningLightStatus enumOff = WarningLightStatus.valueForString(example);
- example = "ON";
- WarningLightStatus enumOn = WarningLightStatus.valueForString(example);
- example = "FLASH";
- WarningLightStatus enumFlash = WarningLightStatus.valueForString(example);
- example = "NOT_USED";
- WarningLightStatus enumNotUsed = WarningLightStatus.valueForString(example);
-
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("ON returned null", enumOn);
- assertNotNull("FLASH returned null", enumFlash);
- assertNotNull("NOT_USED returned null", enumNotUsed);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "OfF";
- try {
- WarningLightStatus temp = WarningLightStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "OFF";
+ WarningLightStatus enumOff = WarningLightStatus.valueForString(example);
+ example = "ON";
+ WarningLightStatus enumOn = WarningLightStatus.valueForString(example);
+ example = "FLASH";
+ WarningLightStatus enumFlash = WarningLightStatus.valueForString(example);
+ example = "NOT_USED";
+ WarningLightStatus enumNotUsed = WarningLightStatus.valueForString(example);
+
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("ON returned null", enumOn);
+ assertNotNull("FLASH returned null", enumFlash);
+ assertNotNull("NOT_USED returned null", enumNotUsed);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "OfF";
+ try {
+ WarningLightStatus temp = WarningLightStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- WarningLightStatus temp = WarningLightStatus.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ WarningLightStatus temp = WarningLightStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of WarningLightStatus.
- */
- public void testListEnum() {
- List<WarningLightStatus> enumValueList = Arrays.asList(WarningLightStatus.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of WarningLightStatus.
+ */
+ public void testListEnum() {
+ List<WarningLightStatus> enumValueList = Arrays.asList(WarningLightStatus.values());
- List<WarningLightStatus> enumTestList = new ArrayList<WarningLightStatus>();
- enumTestList.add(WarningLightStatus.OFF);
- enumTestList.add(WarningLightStatus.ON);
- enumTestList.add(WarningLightStatus.FLASH);
- enumTestList.add(WarningLightStatus.NOT_USED);
+ List<WarningLightStatus> enumTestList = new ArrayList<WarningLightStatus>();
+ enumTestList.add(WarningLightStatus.OFF);
+ enumTestList.add(WarningLightStatus.ON);
+ enumTestList.add(WarningLightStatus.FLASH);
+ enumTestList.add(WarningLightStatus.NOT_USED);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/WiperStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WiperStatusTests.java
index 918bfa207..b38030ef4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WiperStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WiperStatusTests.java
@@ -9,115 +9,113 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.enums.WiperStatus}
*/
public class WiperStatusTests extends TestCase {
- /**
- * Verifies that the enum values are not null upon valid assignment.
- */
- public void testValidEnums () {
- String example = "OFF";
- WiperStatus enumOff = WiperStatus.valueForString(example);
- example = "AUTO_OFF";
- WiperStatus enumAutoOff = WiperStatus.valueForString(example);
- example = "OFF_MOVING";
- WiperStatus enumOffMoving = WiperStatus.valueForString(example);
- example = "MAN_INT_OFF";
- WiperStatus enumManIntOff = WiperStatus.valueForString(example);
- example = "MAN_INT_ON";
- WiperStatus enumManIntOn = WiperStatus.valueForString(example);
- example = "MAN_LOW";
- WiperStatus enumManLow = WiperStatus.valueForString(example);
- example = "MAN_HIGH";
- WiperStatus enumManHigh = WiperStatus.valueForString(example);
- example = "MAN_FLICK";
- WiperStatus enumManFlick = WiperStatus.valueForString(example);
- example = "WASH";
- WiperStatus enumWash = WiperStatus.valueForString(example);
- example = "AUTO_LOW";
- WiperStatus enumAutoLow = WiperStatus.valueForString(example);
- example = "AUTO_HIGH";
- WiperStatus enumAutoHigh = WiperStatus.valueForString(example);
- example = "COURTESYWIPE";
- WiperStatus enumCourtesyWipe = WiperStatus.valueForString(example);
- example = "AUTO_ADJUST";
- WiperStatus enumAutoAdjust = WiperStatus.valueForString(example);
- example = "STALLED";
- WiperStatus enumStalled = WiperStatus.valueForString(example);
- example = "NO_DATA_EXISTS";
- WiperStatus enumNoDataExists = WiperStatus.valueForString(example);
-
- assertNotNull("OFF returned null", enumOff);
- assertNotNull("AUTO_OFF returned null", enumAutoOff);
- assertNotNull("OFF_MOVING returned null", enumOffMoving);
- assertNotNull("MAN_INT_OFF returned null", enumManIntOff);
- assertNotNull("MAN_INT_ON returned null", enumManIntOn);
- assertNotNull("MAN_LOW returned null", enumManLow);
- assertNotNull("MAN_HIGH returned null", enumManHigh);
- assertNotNull("MAN_FLICK returned null", enumManFlick);
- assertNotNull("WASH returned null", enumWash);
- assertNotNull("AUTO_LOW returned null", enumAutoLow);
- assertNotNull("AUTO_HIGH returned null", enumAutoHigh);
- assertNotNull("COURTESYWIPE returned null", enumCourtesyWipe);
- assertNotNull("AUTO_ADJUST returned null", enumAutoAdjust);
- assertNotNull("STALLED returned null", enumStalled);
- assertNotNull("NO_DATA_EXISTS returned null", enumNoDataExists);
- }
-
- /**
- * Verifies that an invalid assignment is null.
- */
- public void testInvalidEnum () {
- String example = "OFf";
- try {
- WiperStatus temp = WiperStatus.valueForString(example);
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "OFF";
+ WiperStatus enumOff = WiperStatus.valueForString(example);
+ example = "AUTO_OFF";
+ WiperStatus enumAutoOff = WiperStatus.valueForString(example);
+ example = "OFF_MOVING";
+ WiperStatus enumOffMoving = WiperStatus.valueForString(example);
+ example = "MAN_INT_OFF";
+ WiperStatus enumManIntOff = WiperStatus.valueForString(example);
+ example = "MAN_INT_ON";
+ WiperStatus enumManIntOn = WiperStatus.valueForString(example);
+ example = "MAN_LOW";
+ WiperStatus enumManLow = WiperStatus.valueForString(example);
+ example = "MAN_HIGH";
+ WiperStatus enumManHigh = WiperStatus.valueForString(example);
+ example = "MAN_FLICK";
+ WiperStatus enumManFlick = WiperStatus.valueForString(example);
+ example = "WASH";
+ WiperStatus enumWash = WiperStatus.valueForString(example);
+ example = "AUTO_LOW";
+ WiperStatus enumAutoLow = WiperStatus.valueForString(example);
+ example = "AUTO_HIGH";
+ WiperStatus enumAutoHigh = WiperStatus.valueForString(example);
+ example = "COURTESYWIPE";
+ WiperStatus enumCourtesyWipe = WiperStatus.valueForString(example);
+ example = "AUTO_ADJUST";
+ WiperStatus enumAutoAdjust = WiperStatus.valueForString(example);
+ example = "STALLED";
+ WiperStatus enumStalled = WiperStatus.valueForString(example);
+ example = "NO_DATA_EXISTS";
+ WiperStatus enumNoDataExists = WiperStatus.valueForString(example);
+
+ assertNotNull("OFF returned null", enumOff);
+ assertNotNull("AUTO_OFF returned null", enumAutoOff);
+ assertNotNull("OFF_MOVING returned null", enumOffMoving);
+ assertNotNull("MAN_INT_OFF returned null", enumManIntOff);
+ assertNotNull("MAN_INT_ON returned null", enumManIntOn);
+ assertNotNull("MAN_LOW returned null", enumManLow);
+ assertNotNull("MAN_HIGH returned null", enumManHigh);
+ assertNotNull("MAN_FLICK returned null", enumManFlick);
+ assertNotNull("WASH returned null", enumWash);
+ assertNotNull("AUTO_LOW returned null", enumAutoLow);
+ assertNotNull("AUTO_HIGH returned null", enumAutoHigh);
+ assertNotNull("COURTESYWIPE returned null", enumCourtesyWipe);
+ assertNotNull("AUTO_ADJUST returned null", enumAutoAdjust);
+ assertNotNull("STALLED returned null", enumStalled);
+ assertNotNull("NO_DATA_EXISTS returned null", enumNoDataExists);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "OFf";
+ try {
+ WiperStatus temp = WiperStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (IllegalArgumentException exception) {
+ } catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- /**
- * Verifies that a null assignment is invalid.
- */
- public void testNullEnum () {
- String example = null;
- try {
- WiperStatus temp = WiperStatus.valueForString(example);
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ WiperStatus temp = WiperStatus.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
- }
- catch (NullPointerException exception) {
+ } catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
- }
- }
-
- /**
- * Verifies the possible enum values of WiperStatus.
- */
- public void testListEnum() {
- List<WiperStatus> enumValueList = Arrays.asList(WiperStatus.values());
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of WiperStatus.
+ */
+ public void testListEnum() {
+ List<WiperStatus> enumValueList = Arrays.asList(WiperStatus.values());
- List<WiperStatus> enumTestList = new ArrayList<WiperStatus>();
- enumTestList.add(WiperStatus.OFF);
- enumTestList.add(WiperStatus.AUTO_OFF);
- enumTestList.add(WiperStatus.OFF_MOVING);
- enumTestList.add(WiperStatus.MAN_INT_OFF);
- enumTestList.add(WiperStatus.MAN_INT_ON);
- enumTestList.add(WiperStatus.MAN_LOW);
- enumTestList.add(WiperStatus.MAN_HIGH);
- enumTestList.add(WiperStatus.MAN_FLICK);
- enumTestList.add(WiperStatus.WASH);
- enumTestList.add(WiperStatus.AUTO_LOW);
- enumTestList.add(WiperStatus.AUTO_HIGH);
- enumTestList.add(WiperStatus.COURTESYWIPE);
- enumTestList.add(WiperStatus.AUTO_ADJUST);
- enumTestList.add(WiperStatus.STALLED);
- enumTestList.add(WiperStatus.NO_DATA_EXISTS);
+ List<WiperStatus> enumTestList = new ArrayList<WiperStatus>();
+ enumTestList.add(WiperStatus.OFF);
+ enumTestList.add(WiperStatus.AUTO_OFF);
+ enumTestList.add(WiperStatus.OFF_MOVING);
+ enumTestList.add(WiperStatus.MAN_INT_OFF);
+ enumTestList.add(WiperStatus.MAN_INT_ON);
+ enumTestList.add(WiperStatus.MAN_LOW);
+ enumTestList.add(WiperStatus.MAN_HIGH);
+ enumTestList.add(WiperStatus.MAN_FLICK);
+ enumTestList.add(WiperStatus.WASH);
+ enumTestList.add(WiperStatus.AUTO_LOW);
+ enumTestList.add(WiperStatus.AUTO_HIGH);
+ enumTestList.add(WiperStatus.COURTESYWIPE);
+ enumTestList.add(WiperStatus.AUTO_ADJUST);
+ enumTestList.add(WiperStatus.STALLED);
+ enumTestList.add(WiperStatus.NO_DATA_EXISTS);
- assertTrue("Enum value list does not match enum class list",
- enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
- }
+ 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/OnAppInterfaceUnregisteredTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
index 464d67017..84ef75450 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppInterfaceUnregisteredTests.java
@@ -17,13 +17,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered}
*/
-public class OnAppInterfaceUnregisteredTests extends BaseRpcTests{
+public class OnAppInterfaceUnregisteredTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered();
msg.setReason(TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON);
@@ -32,39 +32,39 @@ public class OnAppInterfaceUnregisteredTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnAppInterfaceUnregistered.KEY_REASON, TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- AppInterfaceUnregisteredReason reason = ( (OnAppInterfaceUnregistered) msg ).getReason();
-
+ public void testRpcValues() {
+ // Test Values
+ AppInterfaceUnregisteredReason reason = ((OnAppInterfaceUnregistered) msg).getReason();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_APPINTERFACEUNREGISTEREDREASON, reason);
-
+
// Invalid/Null tests
OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
index 10affe5f0..9ea416632 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAppServiceDataTests.java
@@ -23,59 +23,59 @@ import static junit.framework.TestCase.fail;
*/
public class OnAppServiceDataTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- OnAppServiceData msg = new OnAppServiceData();
-
- msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_NOTIFICATION;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.ON_APP_SERVICE_DATA.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- try{
- result.put(OnAppServiceData.KEY_SERVICE_DATA, TestValues.GENERAL_APPSERVICEDATA.serializeJSON());
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- AppServiceData cmdId = ( (OnAppServiceData) msg ).getServiceData();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_APPSERVICEDATA, cmdId);
-
- // Invalid/Null Tests
- OnAppServiceData msg = new OnAppServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getServiceData());
-
- // test constructor with param
- msg = new OnAppServiceData(TestValues.GENERAL_APPSERVICEDATA);
- AppServiceData serviceData = msg.getServiceData();
- assertEquals(serviceData, TestValues.GENERAL_APPSERVICEDATA);
- }
+ @Override
+ protected RPCMessage createMessage() {
+ OnAppServiceData msg = new OnAppServiceData();
+
+ msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.ON_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(OnAppServiceData.KEY_SERVICE_DATA, TestValues.GENERAL_APPSERVICEDATA.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ AppServiceData cmdId = ((OnAppServiceData) msg).getServiceData();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APPSERVICEDATA, cmdId);
+
+ // Invalid/Null Tests
+ OnAppServiceData msg = new OnAppServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getServiceData());
+
+ // test constructor with param
+ msg = new OnAppServiceData(TestValues.GENERAL_APPSERVICEDATA);
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(serviceData, TestValues.GENERAL_APPSERVICEDATA);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
index 28b7aaeae..ce5392a48 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnAudioPassThruTests.java
@@ -12,37 +12,37 @@ import org.junit.Test;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnAudioPassThru}
*/
-public class OnAudioPassThruTests extends BaseRpcTests{
+public class OnAudioPassThruTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new OnAudioPassThru();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_AUDIO_PASS_THRU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
OnAudioPassThru msg = new OnAudioPassThru();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
index 3570c33e5..dbad77232 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonEventTests.java
@@ -18,13 +18,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnButtonEvent}
*/
-public class OnButtonEventTests extends BaseRpcTests{
+public class OnButtonEventTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnButtonEvent msg = new OnButtonEvent();
msg.setButtonEventMode(TestValues.GENERAL_BUTTONEVENTMODE);
@@ -35,45 +35,45 @@ public class OnButtonEventTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_BUTTON_EVENT.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnButtonEvent.KEY_BUTTON_EVENT_MODE, TestValues.GENERAL_BUTTONEVENTMODE);
result.put(OnButtonEvent.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
result.put(OnButtonEvent.KEY_CUSTOM_BUTTON_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int cmdId = ( (OnButtonEvent) msg ).getCustomButtonID();
- ButtonEventMode mode = ( (OnButtonEvent) msg ).getButtonEventMode();
- ButtonName name = ( (OnButtonEvent) msg ).getButtonName();
-
+ public void testRpcValues() {
+ // Test Values
+ int cmdId = ((OnButtonEvent) msg).getCustomButtonID();
+ ButtonEventMode mode = ((OnButtonEvent) msg).getButtonEventMode();
+ ButtonName name = ((OnButtonEvent) msg).getButtonName();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, cmdId);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONEVENTMODE, mode);
assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, name);
-
+
// Invalid/Null Tests
OnButtonEvent msg = new OnButtonEvent();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
index d5ee08486..db7ebdccf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnButtonPressTests.java
@@ -18,13 +18,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnButtonPress}
*/
-public class OnButtonPressTests extends BaseRpcTests{
+public class OnButtonPressTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnButtonPress msg = new OnButtonPress();
msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
@@ -35,45 +35,45 @@ public class OnButtonPressTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_BUTTON_PRESS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnButtonPress.KEY_CUSTOM_BUTTON_ID, TestValues.GENERAL_INT);
result.put(OnButtonPress.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
result.put(OnButtonPress.KEY_BUTTON_PRESS_MODE, TestValues.GENERAL_BUTTONPRESSMODE);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int customName = ( (OnButtonPress) msg ).getCustomButtonID();
- ButtonName buttonName = ( (OnButtonPress) msg ).getButtonName();
- ButtonPressMode buttonPressMode = ( (OnButtonPress) msg ).getButtonPressMode();
-
+ public void testRpcValues() {
+ // Test Values
+ int customName = ((OnButtonPress) msg).getCustomButtonID();
+ ButtonName buttonName = ((OnButtonPress) msg).getButtonName();
+ ButtonPressMode buttonPressMode = ((OnButtonPress) msg).getButtonPressMode();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, customName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, buttonName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONPRESSMODE, buttonPressMode);
-
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONPRESSMODE, buttonPressMode);
+
// Invalid/Null Tests
OnButtonPress msg = new OnButtonPress();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
index dcc4d8029..e492442d0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnCommandTests.java
@@ -17,13 +17,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnCommand}
*/
-public class OnCommandTests extends BaseRpcTests{
+public class OnCommandTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnCommand msg = new OnCommand();
msg.setCmdID(TestValues.GENERAL_INT);
@@ -33,42 +33,42 @@ public class OnCommandTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_COMMAND.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
result.put(OnCommand.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int cmdId = ( (OnCommand) msg ).getCmdID();
- TriggerSource triggerSource = ( (OnCommand) msg ).getTriggerSource();
-
+ public void testRpcValues() {
+ // Test Values
+ int cmdId = ((OnCommand) msg).getCmdID();
+ TriggerSource triggerSource = ((OnCommand) msg).getTriggerSource();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, cmdId);
assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, triggerSource);
-
+
// Invalid/Null Tests
OnCommand msg = new OnCommand();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
index 88432d2ba..8f640e3cc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnDriverDistractionTests.java
@@ -17,15 +17,15 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnDriverDistraction}
*/
-public class OnDriverDistractionTests extends BaseRpcTests{
+public class OnDriverDistractionTests extends BaseRpcTests {
private static final DriverDistractionState STATUS = DriverDistractionState.DD_ON;
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnDriverDistraction msg = new OnDriverDistraction();
msg.setState(STATUS);
@@ -34,44 +34,44 @@ public class OnDriverDistractionTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_DRIVER_DISTRACTION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnDriverDistraction.KEY_STATE, STATUS);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- DriverDistractionState cmdId = ( (OnDriverDistraction) msg ).getState();
-
+ public void testRpcValues() {
+ // Test Values
+ DriverDistractionState cmdId = ((OnDriverDistraction) msg).getState();
+
// Valid Tests
assertEquals(TestValues.MATCH, STATUS, cmdId);
-
+
// Invalid/Null Tests
OnDriverDistraction msg = new OnDriverDistraction();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- assertNull(TestValues.NULL, msg.getState());
+ assertNull(TestValues.NULL, msg.getState());
}
} \ 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 c0206c960..ea1c8f7dd 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
@@ -21,13 +21,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnHMIStatus}
*/
-public class OnHMIStatusTests extends BaseRpcTests{
+public class OnHMIStatusTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
OnHMIStatus msg = new OnHMIStatus();
msg.setAudioStreamingState(TestValues.GENERAL_AUDIOSTREAMINGSTATE);
@@ -41,51 +41,51 @@ public class OnHMIStatusTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_HMI_STATUS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnHMIStatus.KEY_AUDIO_STREAMING_STATE, TestValues.GENERAL_AUDIOSTREAMINGSTATE);
result.put(OnHMIStatus.KEY_VIDEO_STREAMING_STATE, TestValues.GENERAL_VIDEOSTREAMINGSTATE);
result.put(OnHMIStatus.KEY_HMI_LEVEL, TestValues.GENERAL_HMILEVEL);
result.put(OnHMIStatus.KEY_SYSTEM_CONTEXT, TestValues.GENERAL_SYSTEMCONTEXT);
result.put(OnHMIStatus.KEY_WINDOW_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- AudioStreamingState audioStreamingState = ( (OnHMIStatus) msg ).getAudioStreamingState();
- VideoStreamingState videoStreamingState = ( (OnHMIStatus) msg ).getVideoStreamingState();
- HMILevel hmiLevel = ( (OnHMIStatus) msg ).getHmiLevel();
- SystemContext context = ( (OnHMIStatus) msg ).getSystemContext();
- int testWindowID = ( (OnHMIStatus) msg ).getWindowID();
-
+ public void testRpcValues() {
+ // Test Values
+ AudioStreamingState audioStreamingState = ((OnHMIStatus) msg).getAudioStreamingState();
+ VideoStreamingState videoStreamingState = ((OnHMIStatus) msg).getVideoStreamingState();
+ HMILevel hmiLevel = ((OnHMIStatus) msg).getHmiLevel();
+ SystemContext context = ((OnHMIStatus) msg).getSystemContext();
+ int testWindowID = ((OnHMIStatus) msg).getWindowID();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOSTREAMINGSTATE, audioStreamingState);
assertEquals(TestValues.MATCH, TestValues.GENERAL_VIDEOSTREAMINGSTATE, videoStreamingState);
assertEquals(TestValues.MATCH, TestValues.GENERAL_HMILEVEL, hmiLevel);
assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCONTEXT, context);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testWindowID);
-
+
// Invalid/Null Tests
OnHMIStatus msg = new OnHMIStatus();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -94,7 +94,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getAudioStreamingState());
assertNull(TestValues.NULL, msg.getVideoStreamingState());
- msg.format(new Version(4,5,0),true);
+ msg.format(new Version(4, 5, 0), true);
assertEquals(TestValues.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
assertNull(TestValues.NULL, msg.getHmiLevel());
assertNull(TestValues.NULL, msg.getSystemContext());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
index 45db05e25..52406f2e1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHashChangeTests.java
@@ -16,15 +16,15 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnHashChange}
*/
-public class OnHashChangeTests extends BaseRpcTests{
+public class OnHashChangeTests extends BaseRpcTests {
private static final String HASH_ID = "agh4lg2hb1g9gq3";
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnHashChange msg = new OnHashChange();
msg.setHashID(HASH_ID);
@@ -33,39 +33,39 @@ public class OnHashChangeTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_HASH_CHANGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnHashChange.KEY_HASH_ID, HASH_ID);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- String hashId = ( (OnHashChange) msg ).getHashID();
-
+ public void testRpcValues() {
+ // Test Values
+ String hashId = ((OnHashChange) msg).getHashID();
+
// Valid Tests
assertEquals(TestValues.MATCH, HASH_ID, hashId);
-
+
// Invalid/Null Tests
OnHashChange msg = new OnHashChange();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
index c111e740b..31faf7679 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
@@ -19,13 +19,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnInteriorVehicleData}
*/
-public class OnInteriorVehicleDataTests extends BaseRpcTests{
+public class OnInteriorVehicleDataTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnInteriorVehicleData msg = new OnInteriorVehicleData();
msg.setModuleData(TestValues.GENERAL_MODULEDATA);
@@ -33,35 +33,35 @@ public class OnInteriorVehicleDataTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_INTERIOR_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- ModuleData moduleData = ( (OnInteriorVehicleData) msg ).getModuleData();
+ public void testRpcValues() {
+ // Test Values
+ ModuleData moduleData = ((OnInteriorVehicleData) msg).getModuleData();
// Valid Tests
assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, moduleData));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
index 0d99c07d9..ee3bb686c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnKeyboardInputTests.java
@@ -17,13 +17,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnKeyboardInput}
*/
-public class OnKeyboardInputTests extends BaseRpcTests{
+public class OnKeyboardInputTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnKeyboardInput msg = new OnKeyboardInput();
msg.setData(TestValues.GENERAL_STRING);
@@ -33,42 +33,42 @@ public class OnKeyboardInputTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_KEYBOARD_INPUT.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnKeyboardInput.KEY_DATA, TestValues.GENERAL_STRING);
result.put(OnKeyboardInput.KEY_EVENT, TestValues.GENERAL_KEYBOARDEVENT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- KeyboardEvent event = ( (OnKeyboardInput) msg ).getEvent();
- String data = ( (OnKeyboardInput) msg ).getData();
-
+ public void testRpcValues() {
+ // Test Values
+ KeyboardEvent event = ((OnKeyboardInput) msg).getEvent();
+ String data = ((OnKeyboardInput) msg).getData();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_KEYBOARDEVENT, event);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, data);
-
+
// Invalid/Null Tests
OnKeyboardInput msg = new OnKeyboardInput();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
index ddcdd7201..042d4c4a6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnLanguageChangeTests.java
@@ -17,13 +17,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnLanguageChange}
*/
-public class OnLanguageChangeTests extends BaseRpcTests{
+public class OnLanguageChangeTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnLanguageChange msg = new OnLanguageChange();
msg.setLanguage(TestValues.GENERAL_LANGUAGE);
@@ -33,42 +33,42 @@ public class OnLanguageChangeTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_LANGUAGE_CHANGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnLanguageChange.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
result.put(OnLanguageChange.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- Language lang = ( (OnLanguageChange) msg ).getLanguage();
- Language hmiLang = ( (OnLanguageChange) msg ).getHmiDisplayLanguage();
-
+ public void testRpcValues() {
+ // Test Values
+ Language lang = ((OnLanguageChange) msg).getLanguage();
+ Language hmiLang = ((OnLanguageChange) msg).getHmiDisplayLanguage();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, lang);
assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, hmiLang);
-
+
// Invalid/Null Tests
OnLanguageChange msg = new OnLanguageChange();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
index 97a9e14ec..02b3b2a82 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
@@ -21,60 +21,60 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnPermissionsChange}
*/
-public class OnPermissionsChangeTests extends BaseRpcTests{
+public class OnPermissionsChangeTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnPermissionsChange msg = new OnPermissionsChange();
msg.setPermissionItem(TestValues.GENERAL_PERMISSIONITEM_LIST);
msg.setRequireEncryption(TestValues.GENERAL_BOOLEAN);
-
+
return msg;
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_PERMISSIONS_CHANGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnPermissionsChange.KEY_PERMISSION_ITEM, TestValues.JSON_PERMISSIONITEMS);
result.put(OnPermissionsChange.KEY_REQUIRE_ENCRYPTION, TestValues.GENERAL_BOOLEAN);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<PermissionItem> data = ( (OnPermissionsChange) msg ).getPermissionItem();
- boolean isRequired = ((OnPermissionsChange)msg).getRequireEncryption();
+ public void testRpcValues() {
+ // Test Values
+ List<PermissionItem> data = ((OnPermissionsChange) msg).getPermissionItem();
+ boolean isRequired = ((OnPermissionsChange) msg).getRequireEncryption();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_PERMISSIONITEM_LIST.size(), data.size());
- for(int i=0; i<data.size(); i++){
+ for (int i = 0; i < data.size(); i++) {
assertTrue(TestValues.TRUE, Validator.validatePermissionItem(TestValues.GENERAL_PERMISSIONITEM_LIST.get(i), data.get(i)));
}
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, isRequired);
-
+
// Invalid/Null Tests
OnPermissionsChange msg = new OnPermissionsChange();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
index c292756e6..2bd2ebc50 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnRCStatusTests.java
@@ -21,78 +21,78 @@ import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNull;
public class OnRCStatusTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- OnRCStatus msg = new OnRCStatus();
-
- List<ModuleData> listAllocatedModules = TestValues.GENERAL_MODULEDATA_LIST;
-
- msg.setAllocatedModules(listAllocatedModules);
-
- List<ModuleData> listFreeModules = new ArrayList<>();
- listFreeModules.add(TestValues.GENERAL_MODULEDATA);
- msg.setFreeModules(listFreeModules);
-
- msg.setAllowed(TestValues.GENERAL_BOOLEAN);
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_NOTIFICATION;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.ON_RC_STATUS.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- JSONArray jsonArrayAllocatedModules = new JSONArray();
- JSONArray jsonArrayFreeModules = new JSONArray();
- try {
- jsonArrayAllocatedModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- jsonArrayFreeModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- try {
- result.put(OnRCStatus.KEY_ALLOCATED_MODULES, jsonArrayAllocatedModules);
- result.put(OnRCStatus.KEY_FREE_MODULES, jsonArrayFreeModules);
- result.put(OnRCStatus.KEY_ALLOWED, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues() {
- // Test Values
- List<ModuleData> listAllocatedModules = ((OnRCStatus) msg).getAllocatedModules();
- List<ModuleData> listFreeModules = ((OnRCStatus) msg).getFreeModules();
- Boolean allowed = ((OnRCStatus) msg).getAllowed();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listAllocatedModules.get(0));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listFreeModules.get(0));
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, allowed);
-
- // Invalid/Null Tests
- OnRCStatus msg = new OnRCStatus();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getAllocatedModules());
- assertNull(TestValues.NULL, msg.getFreeModules());
- assertNull(TestValues.NULL, msg.getAllowed());
- }
+ @Override
+ protected RPCMessage createMessage() {
+ OnRCStatus msg = new OnRCStatus();
+
+ List<ModuleData> listAllocatedModules = TestValues.GENERAL_MODULEDATA_LIST;
+
+ msg.setAllocatedModules(listAllocatedModules);
+
+ List<ModuleData> listFreeModules = new ArrayList<>();
+ listFreeModules.add(TestValues.GENERAL_MODULEDATA);
+ msg.setFreeModules(listFreeModules);
+
+ msg.setAllowed(TestValues.GENERAL_BOOLEAN);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.ON_RC_STATUS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ JSONArray jsonArrayAllocatedModules = new JSONArray();
+ JSONArray jsonArrayFreeModules = new JSONArray();
+ try {
+ jsonArrayAllocatedModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
+ jsonArrayFreeModules.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ result.put(OnRCStatus.KEY_ALLOCATED_MODULES, jsonArrayAllocatedModules);
+ result.put(OnRCStatus.KEY_FREE_MODULES, jsonArrayFreeModules);
+ result.put(OnRCStatus.KEY_ALLOWED, TestValues.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<ModuleData> listAllocatedModules = ((OnRCStatus) msg).getAllocatedModules();
+ List<ModuleData> listFreeModules = ((OnRCStatus) msg).getFreeModules();
+ Boolean allowed = ((OnRCStatus) msg).getAllowed();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listAllocatedModules.get(0));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULEDATA, listFreeModules.get(0));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, allowed);
+
+ // Invalid/Null Tests
+ OnRCStatus msg = new OnRCStatus();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getAllocatedModules());
+ assertNull(TestValues.NULL, msg.getFreeModules());
+ assertNull(TestValues.NULL, msg.getAllowed());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
index 37fa2e570..a2f4f3c71 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemCapabilityUpdatedTests.java
@@ -22,59 +22,59 @@ import static junit.framework.TestCase.fail;
*/
public class OnSystemCapabilityUpdatedTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
-
- msg.setSystemCapability(TestValues.GENERAL_SYSTEMCAPABILITY);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_NOTIFICATION;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- try{
- result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, TestValues.GENERAL_SYSTEMCAPABILITY.serializeJSON());
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- SystemCapability cmdId = ( (OnSystemCapabilityUpdated) msg ).getSystemCapability();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITY, cmdId);
-
- // Invalid/Null Tests
- OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSystemCapability());
-
- // test constructor with param
- msg = new OnSystemCapabilityUpdated(TestValues.GENERAL_SYSTEMCAPABILITY);
- SystemCapability systemCapability = msg.getSystemCapability();
- assertEquals(systemCapability, TestValues.GENERAL_SYSTEMCAPABILITY);
- }
+ @Override
+ protected RPCMessage createMessage() {
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+
+ msg.setSystemCapability(TestValues.GENERAL_SYSTEMCAPABILITY);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(OnSystemCapabilityUpdated.KEY_SYSTEM_CAPABILITY, TestValues.GENERAL_SYSTEMCAPABILITY.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ SystemCapability cmdId = ((OnSystemCapabilityUpdated) msg).getSystemCapability();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITY, cmdId);
+
+ // Invalid/Null Tests
+ OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSystemCapability());
+
+ // test constructor with param
+ msg = new OnSystemCapabilityUpdated(TestValues.GENERAL_SYSTEMCAPABILITY);
+ SystemCapability systemCapability = msg.getSystemCapability();
+ assertEquals(systemCapability, TestValues.GENERAL_SYSTEMCAPABILITY);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
index 580cbd9a7..b481615c8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnSystemRequestTests.java
@@ -21,13 +21,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnSystemRequest}
*/
-public class OnSystemRequestTests extends BaseRpcTests{
-
+public class OnSystemRequestTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnSystemRequest msg = new OnSystemRequest();
msg.setFileType(TestValues.GENERAL_FILETYPE);
@@ -42,20 +42,20 @@ public class OnSystemRequestTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_SYSTEM_REQUEST.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnSystemRequest.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
result.put(OnSystemRequest.KEY_LENGTH, TestValues.GENERAL_LONG);
result.put(OnSystemRequest.KEY_TIMEOUT, TestValues.GENERAL_INT);
@@ -63,28 +63,28 @@ public class OnSystemRequestTests extends BaseRpcTests{
result.put(OnSystemRequest.KEY_URL, TestValues.GENERAL_STRING);
result.put(OnSystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
result.put(OnSystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
- } catch(JSONException e) {
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- FileType fileType = ( (OnSystemRequest) msg ).getFileType();
- Long length = ( (OnSystemRequest) msg ).getLength();
- int timeout = ( (OnSystemRequest) msg ).getTimeout();
- Long offset = ( (OnSystemRequest) msg ).getOffset();
- String url = ( (OnSystemRequest) msg ).getUrl();
- RequestType requestType = ( (OnSystemRequest) msg ).getRequestType();
- String requestSubType = ( (OnSystemRequest) msg ).getRequestSubType();
-
-
+ public void testRpcValues() {
+ // Test Values
+ FileType fileType = ((OnSystemRequest) msg).getFileType();
+ Long length = ((OnSystemRequest) msg).getLength();
+ int timeout = ((OnSystemRequest) msg).getTimeout();
+ Long offset = ((OnSystemRequest) msg).getOffset();
+ String url = ((OnSystemRequest) msg).getUrl();
+ RequestType requestType = ((OnSystemRequest) msg).getRequestType();
+ String requestSubType = ((OnSystemRequest) msg).getRequestSubType();
+
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, length);
@@ -93,22 +93,22 @@ public class OnSystemRequestTests extends BaseRpcTests{
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, url);
assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, requestType);
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, requestSubType);
-
+
// Test Body
OnSystemRequest osr = (OnSystemRequest) msg;
String body = osr.getBody();
assertNull(TestValues.NULL, body);
-
- String testBody = "123ABC";
+
+ String testBody = "123ABC";
osr.setBody(testBody);
-
+
String readBody = osr.getBody();
assertEquals(TestValues.MATCH, testBody, readBody);
-
+
// Test Headers
Headers headers = osr.getHeader();
assertNull(TestValues.NULL, headers);
-
+
Headers testHeaders = new Headers();
testHeaders.setCharset("ASCII");
testHeaders.setConnectTimeout(1000);
@@ -119,12 +119,12 @@ public class OnSystemRequestTests extends BaseRpcTests{
testHeaders.setInstanceFollowRedirects(true);
testHeaders.setReadTimeout(800);
testHeaders.setRequestMethod("POST");
- testHeaders.setUseCaches(false);
+ testHeaders.setUseCaches(false);
osr.setHeaders(testHeaders);
-
+
Headers readHeaders = osr.getHeader();
assertTrue(TestValues.TRUE, Validator.validateHeaders(testHeaders, readHeaders));
-
+
// Invalid/Null Tests
OnSystemRequest msg = new OnSystemRequest();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -140,7 +140,7 @@ public class OnSystemRequestTests extends BaseRpcTests{
}
@Test
- public void testUrlParam(){
+ public void testUrlParam() {
OnSystemRequest msg = new OnSystemRequest();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
index 0de7a5745..f21f7f1f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTBTClientStateTests.java
@@ -17,13 +17,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnTBTClientState}
*/
-public class OnTBTClientStateTests extends BaseRpcTests{
+public class OnTBTClientStateTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnTBTClientState msg = new OnTBTClientState();
msg.setState(TestValues.GENERAL_TBTSTATE);
@@ -32,39 +32,39 @@ public class OnTBTClientStateTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_TBT_CLIENT_STATE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnTBTClientState.KEY_STATE, TestValues.GENERAL_TBTSTATE);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- TBTState data = ( (OnTBTClientState) msg ).getState();
-
+ public void testRpcValues() {
+ // Test Values
+ TBTState data = ((OnTBTClientState) msg).getState();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_TBTSTATE, data);
-
+
// Invalid/Null Tests
OnTBTClientState msg = new OnTBTClientState();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
index 2c2379550..5ff64b285 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnTouchEventTests.java
@@ -22,62 +22,62 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnTouchEvent}
*/
-public class OnTouchEventTests extends BaseRpcTests{
+public class OnTouchEventTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
OnTouchEvent msg = new OnTouchEvent();
msg.setType(TestValues.GENERAL_TOUCHTYPE);
msg.setEvent(TestValues.GENERAL_TOUCHEVENT_LIST);
return msg;
- }
+ }
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_TOUCH_EVENT.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnTouchEvent.KEY_TYPE, TestValues.GENERAL_TOUCHTYPE);
- result.put(OnTouchEvent.KEY_EVENT, TestValues.JSON_TOUCHEVENTS);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ result.put(OnTouchEvent.KEY_EVENT, TestValues.JSON_TOUCHEVENTS);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- TouchType type = ( (OnTouchEvent) msg ).getType();
- List<TouchEvent> event = ( (OnTouchEvent) msg ).getEvent();
-
+ public void testRpcValues() {
+ // Test Values
+ TouchType type = ((OnTouchEvent) msg).getType();
+ List<TouchEvent> event = ((OnTouchEvent) msg).getEvent();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHTYPE, type);
assertEquals(TestValues.MATCH, TestValues.GENERAL_TOUCHEVENT_LIST.size(), event.size());
- for(int i = 0; i< TestValues.GENERAL_TOUCHEVENT_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_TOUCHEVENT_LIST.size(); i++) {
TouchEvent referenceEvent = TestValues.GENERAL_TOUCHEVENT_LIST.get(i);
TouchEvent dataEvent = event.get(i);
assertTrue(TestValues.TRUE, Validator.validateTouchEvent(referenceEvent, dataEvent));
}
-
+
// Invalid/Null Tests
OnTouchEvent msg = new OnTouchEvent();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateFileTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateFileTest.java
index 03dc524a1..4a955a3c3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateFileTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateFileTest.java
@@ -43,9 +43,9 @@ public class OnUpdateFileTest extends BaseRpcTests {
protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnUpdateFile.KEY_FILE_NAME, TestValues.GENERAL_STRING);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -56,9 +56,9 @@ public class OnUpdateFileTest extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- String fileName = ( (OnUpdateFile) msg).getFileName();
+ String fileName = ((OnUpdateFile) msg).getFileName();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, fileName);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateSubMenuTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateSubMenuTest.java
index afcaf1310..9099d085f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateSubMenuTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnUpdateSubMenuTest.java
@@ -44,10 +44,10 @@ public class OnUpdateSubMenuTest extends BaseRpcTests {
protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnUpdateSubMenu.KEY_MENU_ID, TestValues.GENERAL_INT);
result.put(OnUpdateSubMenu.KEY_UPDATE_SUB_CELLS, TestValues.GENERAL_BOOLEAN);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -58,10 +58,10 @@ public class OnUpdateSubMenuTest extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- int menuId = ( (OnUpdateSubMenu) msg ).getMenuID();
- boolean updateSubCells = ( (OnUpdateSubMenu) msg ).getUpdateSubCells();
+ int menuId = ((OnUpdateSubMenu) msg).getMenuID();
+ boolean updateSubCells = ((OnUpdateSubMenu) msg).getUpdateSubCells();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, menuId);
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 409ad1dd1..cb60f7572 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
@@ -49,31 +49,31 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.OnVehicleData}
*/
-public class OnVehicleDataTests extends BaseRpcTests{
-
+public class OnVehicleDataTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
- return VehicleDataHelper.VEHICLE_DATA;
+ protected RPCMessage createMessage() {
+ return VehicleDataHelper.VEHICLE_DATA;
}
@Override
- protected String getMessageType(){
- return RPCMessage.KEY_NOTIFICATION;
+ protected String getMessageType() {
+ return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
- return FunctionID.ON_VEHICLE_DATA.toString();
+ protected String getCommandType() {
+ return FunctionID.ON_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(OnVehicleData.KEY_SPEED, VehicleDataHelper.SPEED);
result.put(OnVehicleData.KEY_RPM, VehicleDataHelper.RPM);
result.put(OnVehicleData.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
@@ -101,96 +101,96 @@ public class OnVehicleDataTests extends BaseRpcTests{
result.put(OnVehicleData.KEY_CLUSTER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS.serializeJSON());
result.put(OnVehicleData.KEY_MY_KEY, VehicleDataHelper.MY_KEY.serializeJSON());
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(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
- result.put(OnVehicleData.KEY_GEAR_STATUS, VehicleDataHelper.GEAR_STATUS);
- result.put(OnVehicleData.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
- result.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
- } catch(JSONException e) {
- fail(TestValues.JSON_FAIL);
+ result.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
+ result.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ result.put(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
+ result.put(OnVehicleData.KEY_GEAR_STATUS, VehicleDataHelper.GEAR_STATUS);
+ result.put(OnVehicleData.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
+ result.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- Double speed = ( (OnVehicleData) msg).getSpeed();
- int rpm = ( (OnVehicleData) msg).getRpm();
- Double external = ( (OnVehicleData) msg).getExternalTemperature();
- Double fuelLevel = ( (OnVehicleData) msg).getFuelLevel();
- String vin = ( (OnVehicleData) msg).getVin();
- PRNDL prndl = ( (OnVehicleData) msg).getPrndl();
- TireStatus pressure = ( (OnVehicleData) msg).getTirePressure();
- Double torque = ( (OnVehicleData) msg).getEngineTorque();
- Float engineOilLife = ( (OnVehicleData) msg).getEngineOilLife();
- int odometer = ( (OnVehicleData) msg).getOdometer();
- GPSData gps = ( (OnVehicleData) msg).getGps();
- ComponentVolumeStatus state = ( (OnVehicleData) msg).getFuelLevelState();
- Double consumption = ( (OnVehicleData) msg).getInstantFuelConsumption();
- BeltStatus belt = ( (OnVehicleData) msg).getBeltStatus();
- BodyInformation body = ( (OnVehicleData) msg).getBodyInformation();
- DeviceStatus device = ( (OnVehicleData) msg).getDeviceStatus();
- VehicleDataEventStatus brake = ( (OnVehicleData) msg).getDriverBraking();
- WiperStatus wiper = ( (OnVehicleData) msg).getWiperStatus();
- HeadLampStatus lamp = ( (OnVehicleData) msg).getHeadLampStatus();
- Double pedal = ( (OnVehicleData) msg).getAccPedalPosition();
- Double wheel = ( (OnVehicleData) msg).getSteeringWheelAngle();
- ECallInfo ecall = ( (OnVehicleData) msg).getECallInfo();
- AirbagStatus airbag = ( (OnVehicleData) msg).getAirbagStatus();
- EmergencyEvent event = ( (OnVehicleData) msg).getEmergencyEvent();
- ClusterModeStatus cluster = ( (OnVehicleData) msg).getClusterModeStatus();
- MyKey key = ( (OnVehicleData) msg).getMyKey();
- List<FuelRange> fuelRangeList = ( (OnVehicleData) msg).getFuelRange();
- List<WindowStatus> windowStatusList = ( (OnVehicleData) msg).getWindowStatus();
- TurnSignal turnSignal = ( (OnVehicleData) msg).getTurnSignal();
- ElectronicParkBrakeStatus electronicParkBrakeStatus = ( (OnVehicleData) msg).getElectronicParkBrakeStatus();
- GearStatus gearStatus = ( (OnVehicleData) msg).getGearStatus();
- StabilityControlsStatus stabilityControlsStatus = ( (OnVehicleData) msg).getStabilityControlsStatus();
- Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
- Boolean handsOffSteering = ( (OnVehicleData) msg).getHandsOffSteering();
- // Valid Tests
- assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, speed);
- assertEquals(TestValues.MATCH, VehicleDataHelper.RPM, rpm);
- assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, external);
- assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, fuelLevel);
- assertEquals(TestValues.MATCH, VehicleDataHelper.VIN, vin);
- assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, prndl);
- assertTrue(TestValues.MATCH, Validator.validateTireStatus(VehicleDataHelper.TIRE_PRESSURE, pressure));
- assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, torque);
- assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, engineOilLife);
- assertEquals(TestValues.MATCH, VehicleDataHelper.ODOMETER, odometer);
- assertTrue(TestValues.MATCH, Validator.validateGpsData(VehicleDataHelper.GPS, gps));
- assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, state);
- assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, consumption);
- assertTrue(TestValues.TRUE, Validator.validateBeltStatus(VehicleDataHelper.BELT_STATUS, belt));
- assertTrue(TestValues.TRUE, Validator.validateBodyInformation(VehicleDataHelper.BODY_INFORMATION, body));
- assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(VehicleDataHelper.DEVICE_STATUS, device));
- assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, brake);
- assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, wiper);
- assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(VehicleDataHelper.HEAD_LAMP_STATUS, lamp));
- assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, pedal);
- assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, wheel);
- assertTrue(TestValues.TRUE, Validator.validateECallInfo(VehicleDataHelper.E_CALL_INFO, ecall));
- assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(VehicleDataHelper.AIRBAG_STATUS, airbag));
- assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(VehicleDataHelper.EMERGENCY_EVENT, event));
- assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(VehicleDataHelper.CLUSTER_MODE_STATUS, cluster));
- assertTrue(TestValues.TRUE, Validator.validateMyKey(VehicleDataHelper.MY_KEY, key));
- assertTrue(TestValues.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
- assertTrue(TestValues.TRUE, Validator.validateWindowStatuses(VehicleDataHelper.WINDOW_STATUS_LIST, windowStatusList));
- assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
- assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
- assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, gearStatus);
- assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
- assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
- assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, handsOffSteering);
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Test Values
+ Double speed = ((OnVehicleData) msg).getSpeed();
+ int rpm = ((OnVehicleData) msg).getRpm();
+ Double external = ((OnVehicleData) msg).getExternalTemperature();
+ Double fuelLevel = ((OnVehicleData) msg).getFuelLevel();
+ String vin = ((OnVehicleData) msg).getVin();
+ PRNDL prndl = ((OnVehicleData) msg).getPrndl();
+ TireStatus pressure = ((OnVehicleData) msg).getTirePressure();
+ Double torque = ((OnVehicleData) msg).getEngineTorque();
+ Float engineOilLife = ((OnVehicleData) msg).getEngineOilLife();
+ int odometer = ((OnVehicleData) msg).getOdometer();
+ GPSData gps = ((OnVehicleData) msg).getGps();
+ ComponentVolumeStatus state = ((OnVehicleData) msg).getFuelLevelState();
+ Double consumption = ((OnVehicleData) msg).getInstantFuelConsumption();
+ BeltStatus belt = ((OnVehicleData) msg).getBeltStatus();
+ BodyInformation body = ((OnVehicleData) msg).getBodyInformation();
+ DeviceStatus device = ((OnVehicleData) msg).getDeviceStatus();
+ VehicleDataEventStatus brake = ((OnVehicleData) msg).getDriverBraking();
+ WiperStatus wiper = ((OnVehicleData) msg).getWiperStatus();
+ HeadLampStatus lamp = ((OnVehicleData) msg).getHeadLampStatus();
+ Double pedal = ((OnVehicleData) msg).getAccPedalPosition();
+ Double wheel = ((OnVehicleData) msg).getSteeringWheelAngle();
+ ECallInfo ecall = ((OnVehicleData) msg).getECallInfo();
+ AirbagStatus airbag = ((OnVehicleData) msg).getAirbagStatus();
+ EmergencyEvent event = ((OnVehicleData) msg).getEmergencyEvent();
+ ClusterModeStatus cluster = ((OnVehicleData) msg).getClusterModeStatus();
+ MyKey key = ((OnVehicleData) msg).getMyKey();
+ List<FuelRange> fuelRangeList = ((OnVehicleData) msg).getFuelRange();
+ List<WindowStatus> windowStatusList = ((OnVehicleData) msg).getWindowStatus();
+ TurnSignal turnSignal = ((OnVehicleData) msg).getTurnSignal();
+ ElectronicParkBrakeStatus electronicParkBrakeStatus = ((OnVehicleData) msg).getElectronicParkBrakeStatus();
+ GearStatus gearStatus = ((OnVehicleData) msg).getGearStatus();
+ StabilityControlsStatus stabilityControlsStatus = ((OnVehicleData) msg).getStabilityControlsStatus();
+ Object oemCustomVehicleData = ((OnVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ Boolean handsOffSteering = ((OnVehicleData) msg).getHandsOffSteering();
+ // Valid Tests
+ assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, speed);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.RPM, rpm);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, external);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, fuelLevel);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.VIN, vin);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, prndl);
+ assertTrue(TestValues.MATCH, Validator.validateTireStatus(VehicleDataHelper.TIRE_PRESSURE, pressure));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, torque);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, engineOilLife);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ODOMETER, odometer);
+ assertTrue(TestValues.MATCH, Validator.validateGpsData(VehicleDataHelper.GPS, gps));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, state);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, consumption);
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(VehicleDataHelper.BELT_STATUS, belt));
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(VehicleDataHelper.BODY_INFORMATION, body));
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(VehicleDataHelper.DEVICE_STATUS, device));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, brake);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, wiper);
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(VehicleDataHelper.HEAD_LAMP_STATUS, lamp));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, pedal);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, wheel);
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(VehicleDataHelper.E_CALL_INFO, ecall));
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(VehicleDataHelper.AIRBAG_STATUS, airbag));
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(VehicleDataHelper.EMERGENCY_EVENT, event));
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(VehicleDataHelper.CLUSTER_MODE_STATUS, cluster));
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(VehicleDataHelper.MY_KEY, key));
+ assertTrue(TestValues.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
+ assertTrue(TestValues.TRUE, Validator.validateWindowStatuses(VehicleDataHelper.WINDOW_STATUS_LIST, windowStatusList));
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, gearStatus);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, handsOffSteering);
+ // Invalid/Null Tests
OnVehicleData msg = new OnVehicleData();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -229,374 +229,365 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getGearStatus());
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- }
+ }
- @Test
+ @Test
public void testJson() {
- JSONObject reference = new JSONObject();
-
- //Objects needed on the first level.
- JSONObject tireStatusObj = new JSONObject();
- JSONObject GPSDataObj = new JSONObject();
- JSONObject beltStatusObj = new JSONObject();
- JSONObject bodyInformationObj = new JSONObject();
- JSONObject deviceStatusObj = new JSONObject();
- JSONObject headLampStatusObj = new JSONObject();
- JSONObject ECallInfoObj = new JSONObject();
- JSONObject airbagStatusObj = new JSONObject();
- JSONObject emergencyEventObj = new JSONObject();
- JSONObject clusterModeStatusObj = new JSONObject();
- JSONObject myKeyObj = new JSONObject();
- JSONObject fuelRangeObj = new JSONObject();
- JSONObject windowStatusObj = new JSONObject();
- JSONObject gearStatusObj = new JSONObject();
- JSONObject stabilityControlStatusObj = new JSONObject();
- JSONArray fuelRangeArrayObj = new JSONArray();
- JSONArray windowStatusArrayObj = new JSONArray();
-
- try {
- //Set up the JSONObject to represent OnVehicleData:
-
- //TIRE_PRESSURE
- tireStatusObj.put(TireStatus.KEY_PRESSURE_TELL_TALE, VehicleDataHelper.TIRE_PRESSURE_TELL_TALE);
- JSONObject tireLeftFront = new JSONObject();
- tireLeftFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_FRONT);
- tireStatusObj.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
- JSONObject tireRightFront = new JSONObject();
- tireRightFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_FRONT);
- tireStatusObj.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
- JSONObject tireLeftRear = new JSONObject();
- tireLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_REAR);
- tireStatusObj.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
- JSONObject tireRightRear = new JSONObject();
- tireRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_REAR);
- tireStatusObj.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
- JSONObject tireInnerLeftRear = new JSONObject();
- tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_LEFT_REAR);
- tireStatusObj.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
- JSONObject tireInnerRightRear = new JSONObject();
- tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_RIGHT_REAR);
- tireStatusObj.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
-
- //GPS
- GPSDataObj.put(GPSData.KEY_LONGITUDE_DEGREES, VehicleDataHelper.GPS_LONGITUDE);
- GPSDataObj.put(GPSData.KEY_LATITUDE_DEGREES, VehicleDataHelper.GPS_LATITUDE);
- GPSDataObj.put(GPSData.KEY_UTC_YEAR, VehicleDataHelper.GPS_YEAR);
- GPSDataObj.put(GPSData.KEY_UTC_MONTH, VehicleDataHelper.GPS_MONTH);
- GPSDataObj.put(GPSData.KEY_UTC_DAY, VehicleDataHelper.GPS_DAY);
- GPSDataObj.put(GPSData.KEY_UTC_HOURS, VehicleDataHelper.GPS_HOURS);
- GPSDataObj.put(GPSData.KEY_UTC_MINUTES, VehicleDataHelper.GPS_MINUTES);
- GPSDataObj.put(GPSData.KEY_UTC_SECONDS, VehicleDataHelper.GPS_SECONDS);
- GPSDataObj.put(GPSData.KEY_COMPASS_DIRECTION, VehicleDataHelper.GPS_DIRECTION);
- GPSDataObj.put(GPSData.KEY_PDOP, VehicleDataHelper.GPS_PDOP);
- GPSDataObj.put(GPSData.KEY_VDOP, VehicleDataHelper.GPS_VDOP);
- GPSDataObj.put(GPSData.KEY_HDOP, VehicleDataHelper.GPS_HDOP);
- GPSDataObj.put(GPSData.KEY_ACTUAL, VehicleDataHelper.GPS_ACTUAL);
- GPSDataObj.put(GPSData.KEY_SATELLITES, VehicleDataHelper.GPS_SATELLITES);
- GPSDataObj.put(GPSData.KEY_DIMENSION, VehicleDataHelper.GPS_DIMENSION);
- GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
- GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
- GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
- GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
-
- //BELT_STATUS
- beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_PASSENGER_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_PASSENGER_BELTED);
- beltStatusObj.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_DRIVER_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, VehicleDataHelper.BELT_STATUS_PASSENGER_CHILD);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_BELTED);
-
- //BODY_INFORMATION
- bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE);
- bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS);
- bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS);
- bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR);
-
- //DEVICE_STATUS
- deviceStatusObj.put(DeviceStatus.KEY_VOICE_REC_ON, VehicleDataHelper.DEVICE_STATUS_VOICE_REC);
- deviceStatusObj.put(DeviceStatus.KEY_BT_ICON_ON, VehicleDataHelper.DEVICE_STATUS_BT_ICON);
- deviceStatusObj.put(DeviceStatus.KEY_CALL_ACTIVE, VehicleDataHelper.DEVICE_STATUS_CALL_ACTIVE);
- deviceStatusObj.put(DeviceStatus.KEY_PHONE_ROAMING, VehicleDataHelper.DEVICE_STATUS_PHONE_ROAMING);
- deviceStatusObj.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, VehicleDataHelper.DEVICE_STATUS_TEXT_MSG_AVAILABLE);
- deviceStatusObj.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_BATT_LEVEL_STATUS);
- deviceStatusObj.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_STEREO_MUTED);
- deviceStatusObj.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_MONO_MUTED);
- deviceStatusObj.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
- deviceStatusObj.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, VehicleDataHelper.DEVICE_STATUS_PRIMARY_AUDIO);
- deviceStatusObj.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, VehicleDataHelper.DEVICE_STATUS_E_CALL_ACTIVE);
-
- //HEAD_LAMP_STATUS
- headLampStatusObj.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, VehicleDataHelper.HEAD_LAMP_STATUS_AMBIENT_STATUS);
- headLampStatusObj.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_HIGH_BEAMS);
- headLampStatusObj.put(HeadLampStatus.KEY_LOW_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_LOW_BEAMS);
-
- //E_CALL_INFO
- ECallInfoObj.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
- ECallInfoObj.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
- ECallInfoObj.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, VehicleDataHelper.E_CALL_INFO_CONFIRMATION_STATUS);
-
- //AIRBAG_STATUS
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
-
- //EMERGENCY_EVENT
- emergencyEventObj.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, VehicleDataHelper.EMERGENCY_EVENT_TYPE);
- emergencyEventObj.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, VehicleDataHelper.EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
- emergencyEventObj.put(EmergencyEvent.KEY_ROLLOVER_EVENT, VehicleDataHelper.EMERGENCY_EVENT_ROLLOVER_EVENT);
- emergencyEventObj.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, VehicleDataHelper.EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
- emergencyEventObj.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, VehicleDataHelper.EMERGENCY_EVENT_MULTIPLE_EVENTS);
-
- //CLUSTER_MODE_STATUS
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
-
- //MY_KEY
- myKeyObj.put(MyKey.KEY_E_911_OVERRIDE, VehicleDataHelper.MY_KEY_E_911_OVERRIDE);
-
- // FUEL_RANGE
- fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
- fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
- fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
- fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
- fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
- fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
- fuelRangeArrayObj.put(fuelRangeObj);
-
- // STABILITY_CONTROLS_STATU
- stabilityControlStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
- stabilityControlStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
-
- // WINDOW_STATUS
- windowStatusObj.put(WindowStatus.KEY_LOCATION, VehicleDataHelper.LOCATION_GRID);
- windowStatusObj.put(WindowStatus.KEY_STATE, VehicleDataHelper.WINDOW_STATE);
- windowStatusArrayObj.put(windowStatusObj);
-
- // GEAR STATUS
- gearStatusObj.put(GearStatus.KEY_USER_SELECTED_GEAR, VehicleDataHelper.USER_SELECTED_GEAR);
- gearStatusObj.put(GearStatus.KEY_TRANSMISSION_TYPE, VehicleDataHelper.TRANSMISSION_TYPE);
- gearStatusObj.put(GearStatus.KEY_ACTUAL_GEAR, VehicleDataHelper.ACTUAL_GEAR);
-
- reference.put(OnVehicleData.KEY_SPEED, VehicleDataHelper.SPEED);
- reference.put(OnVehicleData.KEY_RPM, VehicleDataHelper.RPM);
- reference.put(OnVehicleData.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
- reference.put(OnVehicleData.KEY_FUEL_LEVEL, VehicleDataHelper.FUEL_LEVEL);
- reference.put(OnVehicleData.KEY_VIN, VehicleDataHelper.VIN);
- reference.put(OnVehicleData.KEY_PRNDL, VehicleDataHelper.PRNDL_FINAL);
- reference.put(OnVehicleData.KEY_TIRE_PRESSURE, tireStatusObj);
- reference.put(OnVehicleData.KEY_ENGINE_TORQUE, VehicleDataHelper.ENGINE_TORQUE);
- reference.put(OnVehicleData.KEY_ENGINE_OIL_LIFE, VehicleDataHelper.ENGINE_OIL_LIFE);
- reference.put(OnVehicleData.KEY_ODOMETER, VehicleDataHelper.ODOMETER);
- reference.put(OnVehicleData.KEY_GPS, GPSDataObj);
- reference.put(OnVehicleData.KEY_FUEL_LEVEL_STATE, VehicleDataHelper.FUEL_LEVEL_STATE);
- reference.put(OnVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION);
- reference.put(OnVehicleData.KEY_BELT_STATUS, beltStatusObj);
- reference.put(OnVehicleData.KEY_BODY_INFORMATION, bodyInformationObj);
- reference.put(OnVehicleData.KEY_DEVICE_STATUS, deviceStatusObj);
- reference.put(OnVehicleData.KEY_DRIVER_BRAKING, VehicleDataHelper.DRIVER_BRAKING);
- reference.put(OnVehicleData.KEY_WIPER_STATUS, VehicleDataHelper.WIPER_STATUS);
- reference.put(OnVehicleData.KEY_HEAD_LAMP_STATUS, headLampStatusObj);
- reference.put(OnVehicleData.KEY_ACC_PEDAL_POSITION, VehicleDataHelper.ACC_PEDAL_POSITION);
- reference.put(OnVehicleData.KEY_STEERING_WHEEL_ANGLE, VehicleDataHelper.STEERING_WHEEL_ANGLE);
- reference.put(OnVehicleData.KEY_E_CALL_INFO, ECallInfoObj);
- reference.put(OnVehicleData.KEY_AIRBAG_STATUS, airbagStatusObj);
- reference.put(OnVehicleData.KEY_EMERGENCY_EVENT, emergencyEventObj);
- reference.put(OnVehicleData.KEY_CLUSTER_MODE_STATUS, clusterModeStatusObj);
- reference.put(OnVehicleData.KEY_MY_KEY, myKeyObj);
- 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(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
- reference.put(OnVehicleData.KEY_WINDOW_STATUS, windowStatusArrayObj);
- reference.put(OnVehicleData.KEY_GEAR_STATUS, gearStatusObj);
- reference.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, stabilityControlStatusObj);
- reference.put(TestValues.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
- underTest = underTest.getJSONObject("notification").getJSONObject("parameters");
-
- assertEquals(TestValues.MATCH, reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
-
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(OnVehicleData.KEY_TIRE_PRESSURE)) {
- JSONObject tirePressureReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject tirePressureTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateTireStatus(
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureReference)),
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureTest))));
-
- } else if (key.equals(OnVehicleData.KEY_GPS)) {
- JSONObject GPSObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject GPSObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateGpsData(
- new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjReference)),
- new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjTest))));
- } else if (key.equals(OnVehicleData.KEY_BELT_STATUS)) {
- JSONObject beltObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject beltObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateBeltStatus(
- new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjReference)),
- new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjTest))));
- } else if (key.equals(OnVehicleData.KEY_BODY_INFORMATION)) {
- JSONObject bodyInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject bodyInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateBodyInformation(
- new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjReference)),
- new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjTest))));
- } else if (key.equals(OnVehicleData.KEY_DEVICE_STATUS)) {
- JSONObject deviceObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject deviceObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(
- new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjReference)),
- new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjTest))));
- } else if (key.equals(OnVehicleData.KEY_HEAD_LAMP_STATUS)) {
- JSONObject headLampObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject headLampObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(
- new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjReference)),
- new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjTest))));
- } else if (key.equals(OnVehicleData.KEY_E_CALL_INFO)) {
- JSONObject callInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject callInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateECallInfo(
- new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjReference)),
- new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjTest))));
- } else if (key.equals(OnVehicleData.KEY_AIRBAG_STATUS)) {
- JSONObject airbagObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject airbagObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(
- new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjReference)),
- new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjTest))));
- }
- else if (key.equals(OnVehicleData.KEY_EMERGENCY_EVENT)) {
- JSONObject emergencyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject emergencyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(
- new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjReference)),
- new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjTest))));
- }
- else if (key.equals(OnVehicleData.KEY_CLUSTER_MODE_STATUS)) {
- JSONObject clusterModeObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject clusterModeObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(
- new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjReference)),
- new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjTest))));
- }
- else if (key.equals(OnVehicleData.KEY_MY_KEY)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateMyKey(
- new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
- new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
- }
- else if (key.equals(OnVehicleData.KEY_GEAR_STATUS)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateGearStatuses(
- new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
- new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
- }
- else if (key.equals(OnVehicleData.KEY_ENGINE_OIL_LIFE)) {
- assertEquals(JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key));
- }
- else if (key.equals(OnVehicleData.KEY_HANDS_OFF_STEERING)) {
- assertEquals(JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
- }
- else if (key.equals(OnVehicleData.KEY_FUEL_RANGE)) {
- JSONArray fuelRangeArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- List<FuelRange> fuelRangeRefereceList = new ArrayList<FuelRange>();
- for (int index = 0; index < fuelRangeArrayObjReference.length(); index++) {
- FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)fuelRangeArrayObjReference.get(index) ));
- fuelRangeRefereceList.add(fuelRange);
- }
-
- JSONArray fuelRangeArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<FuelRange> fuelRangeUnderTestList = new ArrayList<FuelRange>();
- for (int index = 0; index < fuelRangeArrayObjTest.length(); index++) {
- FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)fuelRangeArrayObjTest.get(index) ));
- fuelRangeUnderTestList.add(fuelRange);
- }
-
- assertTrue(TestValues.TRUE, Validator.validateFuelRange(
- fuelRangeRefereceList,
- fuelRangeUnderTestList));
- } else if (key.equals(OnVehicleData.KEY_WINDOW_STATUS)) {
- JSONArray windowStatusArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- List<WindowStatus> windowStatusReferenceList = new ArrayList<>();
- for (int index = 0; index < windowStatusArrayObjReference.length(); index++) {
- WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)windowStatusArrayObjReference.get(index) ));
- windowStatusReferenceList.add(windowStatus);
- }
-
- JSONArray windowStatusArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<WindowStatus> windowStatusUnderTestList = new ArrayList<>();
- for (int index = 0; index < windowStatusArrayObjTest.length(); index++) {
- WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)windowStatusArrayObjTest.get(index) ));
- windowStatusUnderTestList.add(windowStatus);
- }
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWindowStatuses(
- windowStatusReferenceList,
- windowStatusUnderTestList));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
- StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateStabilityControlStatus(
- status1,
- status2
- )
- );
- }
- else {
- assertEquals(TestValues.TRUE, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
- }
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ JSONObject reference = new JSONObject();
+
+ //Objects needed on the first level.
+ JSONObject tireStatusObj = new JSONObject();
+ JSONObject GPSDataObj = new JSONObject();
+ JSONObject beltStatusObj = new JSONObject();
+ JSONObject bodyInformationObj = new JSONObject();
+ JSONObject deviceStatusObj = new JSONObject();
+ JSONObject headLampStatusObj = new JSONObject();
+ JSONObject ECallInfoObj = new JSONObject();
+ JSONObject airbagStatusObj = new JSONObject();
+ JSONObject emergencyEventObj = new JSONObject();
+ JSONObject clusterModeStatusObj = new JSONObject();
+ JSONObject myKeyObj = new JSONObject();
+ JSONObject fuelRangeObj = new JSONObject();
+ JSONObject windowStatusObj = new JSONObject();
+ JSONObject gearStatusObj = new JSONObject();
+ JSONObject stabilityControlStatusObj = new JSONObject();
+ JSONArray fuelRangeArrayObj = new JSONArray();
+ JSONArray windowStatusArrayObj = new JSONArray();
+
+ try {
+ //Set up the JSONObject to represent OnVehicleData:
+
+ //TIRE_PRESSURE
+ tireStatusObj.put(TireStatus.KEY_PRESSURE_TELL_TALE, VehicleDataHelper.TIRE_PRESSURE_TELL_TALE);
+ JSONObject tireLeftFront = new JSONObject();
+ tireLeftFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_FRONT);
+ tireStatusObj.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
+ JSONObject tireRightFront = new JSONObject();
+ tireRightFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_FRONT);
+ tireStatusObj.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
+ JSONObject tireLeftRear = new JSONObject();
+ tireLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_REAR);
+ tireStatusObj.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
+ JSONObject tireRightRear = new JSONObject();
+ tireRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_REAR);
+ tireStatusObj.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
+ JSONObject tireInnerLeftRear = new JSONObject();
+ tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_LEFT_REAR);
+ tireStatusObj.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
+ JSONObject tireInnerRightRear = new JSONObject();
+ tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_RIGHT_REAR);
+ tireStatusObj.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
+
+ //GPS
+ GPSDataObj.put(GPSData.KEY_LONGITUDE_DEGREES, VehicleDataHelper.GPS_LONGITUDE);
+ GPSDataObj.put(GPSData.KEY_LATITUDE_DEGREES, VehicleDataHelper.GPS_LATITUDE);
+ GPSDataObj.put(GPSData.KEY_UTC_YEAR, VehicleDataHelper.GPS_YEAR);
+ GPSDataObj.put(GPSData.KEY_UTC_MONTH, VehicleDataHelper.GPS_MONTH);
+ GPSDataObj.put(GPSData.KEY_UTC_DAY, VehicleDataHelper.GPS_DAY);
+ GPSDataObj.put(GPSData.KEY_UTC_HOURS, VehicleDataHelper.GPS_HOURS);
+ GPSDataObj.put(GPSData.KEY_UTC_MINUTES, VehicleDataHelper.GPS_MINUTES);
+ GPSDataObj.put(GPSData.KEY_UTC_SECONDS, VehicleDataHelper.GPS_SECONDS);
+ GPSDataObj.put(GPSData.KEY_COMPASS_DIRECTION, VehicleDataHelper.GPS_DIRECTION);
+ GPSDataObj.put(GPSData.KEY_PDOP, VehicleDataHelper.GPS_PDOP);
+ GPSDataObj.put(GPSData.KEY_VDOP, VehicleDataHelper.GPS_VDOP);
+ GPSDataObj.put(GPSData.KEY_HDOP, VehicleDataHelper.GPS_HDOP);
+ GPSDataObj.put(GPSData.KEY_ACTUAL, VehicleDataHelper.GPS_ACTUAL);
+ GPSDataObj.put(GPSData.KEY_SATELLITES, VehicleDataHelper.GPS_SATELLITES);
+ GPSDataObj.put(GPSData.KEY_DIMENSION, VehicleDataHelper.GPS_DIMENSION);
+ GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
+ GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
+ GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
+
+ //BELT_STATUS
+ beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_PASSENGER_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_PASSENGER_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_DRIVER_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, VehicleDataHelper.BELT_STATUS_PASSENGER_CHILD);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_BELTED);
+
+ //BODY_INFORMATION
+ bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE);
+ bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS);
+ bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS);
+ bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR);
+
+ //DEVICE_STATUS
+ deviceStatusObj.put(DeviceStatus.KEY_VOICE_REC_ON, VehicleDataHelper.DEVICE_STATUS_VOICE_REC);
+ deviceStatusObj.put(DeviceStatus.KEY_BT_ICON_ON, VehicleDataHelper.DEVICE_STATUS_BT_ICON);
+ deviceStatusObj.put(DeviceStatus.KEY_CALL_ACTIVE, VehicleDataHelper.DEVICE_STATUS_CALL_ACTIVE);
+ deviceStatusObj.put(DeviceStatus.KEY_PHONE_ROAMING, VehicleDataHelper.DEVICE_STATUS_PHONE_ROAMING);
+ deviceStatusObj.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, VehicleDataHelper.DEVICE_STATUS_TEXT_MSG_AVAILABLE);
+ deviceStatusObj.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_BATT_LEVEL_STATUS);
+ deviceStatusObj.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_STEREO_MUTED);
+ deviceStatusObj.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_MONO_MUTED);
+ deviceStatusObj.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
+ deviceStatusObj.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, VehicleDataHelper.DEVICE_STATUS_PRIMARY_AUDIO);
+ deviceStatusObj.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, VehicleDataHelper.DEVICE_STATUS_E_CALL_ACTIVE);
+
+ //HEAD_LAMP_STATUS
+ headLampStatusObj.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, VehicleDataHelper.HEAD_LAMP_STATUS_AMBIENT_STATUS);
+ headLampStatusObj.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_HIGH_BEAMS);
+ headLampStatusObj.put(HeadLampStatus.KEY_LOW_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_LOW_BEAMS);
+
+ //E_CALL_INFO
+ ECallInfoObj.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
+ ECallInfoObj.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
+ ECallInfoObj.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, VehicleDataHelper.E_CALL_INFO_CONFIRMATION_STATUS);
+
+ //AIRBAG_STATUS
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
+
+ //EMERGENCY_EVENT
+ emergencyEventObj.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, VehicleDataHelper.EMERGENCY_EVENT_TYPE);
+ emergencyEventObj.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, VehicleDataHelper.EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
+ emergencyEventObj.put(EmergencyEvent.KEY_ROLLOVER_EVENT, VehicleDataHelper.EMERGENCY_EVENT_ROLLOVER_EVENT);
+ emergencyEventObj.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, VehicleDataHelper.EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
+ emergencyEventObj.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, VehicleDataHelper.EMERGENCY_EVENT_MULTIPLE_EVENTS);
+
+ //CLUSTER_MODE_STATUS
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
+
+ //MY_KEY
+ myKeyObj.put(MyKey.KEY_E_911_OVERRIDE, VehicleDataHelper.MY_KEY_E_911_OVERRIDE);
+
+ // FUEL_RANGE
+ fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
+ fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
+ fuelRangeArrayObj.put(fuelRangeObj);
+
+ // STABILITY_CONTROLS_STATU
+ stabilityControlStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
+ stabilityControlStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
+
+ // WINDOW_STATUS
+ windowStatusObj.put(WindowStatus.KEY_LOCATION, VehicleDataHelper.LOCATION_GRID);
+ windowStatusObj.put(WindowStatus.KEY_STATE, VehicleDataHelper.WINDOW_STATE);
+ windowStatusArrayObj.put(windowStatusObj);
+
+ // GEAR STATUS
+ gearStatusObj.put(GearStatus.KEY_USER_SELECTED_GEAR, VehicleDataHelper.USER_SELECTED_GEAR);
+ gearStatusObj.put(GearStatus.KEY_TRANSMISSION_TYPE, VehicleDataHelper.TRANSMISSION_TYPE);
+ gearStatusObj.put(GearStatus.KEY_ACTUAL_GEAR, VehicleDataHelper.ACTUAL_GEAR);
+
+ reference.put(OnVehicleData.KEY_SPEED, VehicleDataHelper.SPEED);
+ reference.put(OnVehicleData.KEY_RPM, VehicleDataHelper.RPM);
+ reference.put(OnVehicleData.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
+ reference.put(OnVehicleData.KEY_FUEL_LEVEL, VehicleDataHelper.FUEL_LEVEL);
+ reference.put(OnVehicleData.KEY_VIN, VehicleDataHelper.VIN);
+ reference.put(OnVehicleData.KEY_PRNDL, VehicleDataHelper.PRNDL_FINAL);
+ reference.put(OnVehicleData.KEY_TIRE_PRESSURE, tireStatusObj);
+ reference.put(OnVehicleData.KEY_ENGINE_TORQUE, VehicleDataHelper.ENGINE_TORQUE);
+ reference.put(OnVehicleData.KEY_ENGINE_OIL_LIFE, VehicleDataHelper.ENGINE_OIL_LIFE);
+ reference.put(OnVehicleData.KEY_ODOMETER, VehicleDataHelper.ODOMETER);
+ reference.put(OnVehicleData.KEY_GPS, GPSDataObj);
+ reference.put(OnVehicleData.KEY_FUEL_LEVEL_STATE, VehicleDataHelper.FUEL_LEVEL_STATE);
+ reference.put(OnVehicleData.KEY_INSTANT_FUEL_CONSUMPTION, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION);
+ reference.put(OnVehicleData.KEY_BELT_STATUS, beltStatusObj);
+ reference.put(OnVehicleData.KEY_BODY_INFORMATION, bodyInformationObj);
+ reference.put(OnVehicleData.KEY_DEVICE_STATUS, deviceStatusObj);
+ reference.put(OnVehicleData.KEY_DRIVER_BRAKING, VehicleDataHelper.DRIVER_BRAKING);
+ reference.put(OnVehicleData.KEY_WIPER_STATUS, VehicleDataHelper.WIPER_STATUS);
+ reference.put(OnVehicleData.KEY_HEAD_LAMP_STATUS, headLampStatusObj);
+ reference.put(OnVehicleData.KEY_ACC_PEDAL_POSITION, VehicleDataHelper.ACC_PEDAL_POSITION);
+ reference.put(OnVehicleData.KEY_STEERING_WHEEL_ANGLE, VehicleDataHelper.STEERING_WHEEL_ANGLE);
+ reference.put(OnVehicleData.KEY_E_CALL_INFO, ECallInfoObj);
+ reference.put(OnVehicleData.KEY_AIRBAG_STATUS, airbagStatusObj);
+ reference.put(OnVehicleData.KEY_EMERGENCY_EVENT, emergencyEventObj);
+ reference.put(OnVehicleData.KEY_CLUSTER_MODE_STATUS, clusterModeStatusObj);
+ reference.put(OnVehicleData.KEY_MY_KEY, myKeyObj);
+ 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(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
+ reference.put(OnVehicleData.KEY_WINDOW_STATUS, windowStatusArrayObj);
+ reference.put(OnVehicleData.KEY_GEAR_STATUS, gearStatusObj);
+ reference.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, stabilityControlStatusObj);
+ reference.put(TestValues.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
+ underTest = underTest.getJSONObject("notification").getJSONObject("parameters");
+
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(OnVehicleData.KEY_TIRE_PRESSURE)) {
+ JSONObject tirePressureReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject tirePressureTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureReference)),
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureTest))));
+
+ } else if (key.equals(OnVehicleData.KEY_GPS)) {
+ JSONObject GPSObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject GPSObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateGpsData(
+ new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjReference)),
+ new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_BELT_STATUS)) {
+ JSONObject beltObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject beltObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(
+ new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjReference)),
+ new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_BODY_INFORMATION)) {
+ JSONObject bodyInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject bodyInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(
+ new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjReference)),
+ new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_DEVICE_STATUS)) {
+ JSONObject deviceObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject deviceObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(
+ new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjReference)),
+ new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_HEAD_LAMP_STATUS)) {
+ JSONObject headLampObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject headLampObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(
+ new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjReference)),
+ new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_E_CALL_INFO)) {
+ JSONObject callInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject callInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(
+ new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjReference)),
+ new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_AIRBAG_STATUS)) {
+ JSONObject airbagObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject airbagObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(
+ new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjReference)),
+ new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_EMERGENCY_EVENT)) {
+ JSONObject emergencyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject emergencyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(
+ new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjReference)),
+ new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_CLUSTER_MODE_STATUS)) {
+ JSONObject clusterModeObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject clusterModeObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(
+ new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjReference)),
+ new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_MY_KEY)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(
+ new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
+ new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_GEAR_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateGearStatuses(
+ new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
+ new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
+ } else if (key.equals(OnVehicleData.KEY_ENGINE_OIL_LIFE)) {
+ assertEquals(JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key));
+ } else if (key.equals(OnVehicleData.KEY_HANDS_OFF_STEERING)) {
+ assertEquals(JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
+ } else if (key.equals(OnVehicleData.KEY_FUEL_RANGE)) {
+ JSONArray fuelRangeArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ List<FuelRange> fuelRangeRefereceList = new ArrayList<FuelRange>();
+ for (int index = 0; index < fuelRangeArrayObjReference.length(); index++) {
+ FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject((JSONObject) fuelRangeArrayObjReference.get(index)));
+ fuelRangeRefereceList.add(fuelRange);
+ }
+
+ JSONArray fuelRangeArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<FuelRange> fuelRangeUnderTestList = new ArrayList<FuelRange>();
+ for (int index = 0; index < fuelRangeArrayObjTest.length(); index++) {
+ FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject((JSONObject) fuelRangeArrayObjTest.get(index)));
+ fuelRangeUnderTestList.add(fuelRange);
+ }
+
+ assertTrue(TestValues.TRUE, Validator.validateFuelRange(
+ fuelRangeRefereceList,
+ fuelRangeUnderTestList));
+ } else if (key.equals(OnVehicleData.KEY_WINDOW_STATUS)) {
+ JSONArray windowStatusArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ List<WindowStatus> windowStatusReferenceList = new ArrayList<>();
+ for (int index = 0; index < windowStatusArrayObjReference.length(); index++) {
+ WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject((JSONObject) windowStatusArrayObjReference.get(index)));
+ windowStatusReferenceList.add(windowStatus);
+ }
+
+ JSONArray windowStatusArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WindowStatus> windowStatusUnderTestList = new ArrayList<>();
+ for (int index = 0; index < windowStatusArrayObjTest.length(); index++) {
+ WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject((JSONObject) windowStatusArrayObjTest.get(index)));
+ windowStatusUnderTestList.add(windowStatus);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWindowStatuses(
+ windowStatusReferenceList,
+ windowStatusUnderTestList));
+ } else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
+ StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateStabilityControlStatus(
+ status1,
+ status2
+ )
+ );
+ } else {
+ assertEquals(TestValues.TRUE, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
index efdd3eba0..0a263ac56 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnWayPointChangeTests.java
@@ -27,7 +27,7 @@ import static junit.framework.TestCase.assertNull;
public class OnWayPointChangeTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
OnWayPointChange msg = new OnWayPointChange();
List<LocationDetails> list = new ArrayList<>();
@@ -40,17 +40,17 @@ public class OnWayPointChangeTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_NOTIFICATION;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ON_WAY_POINT_CHANGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
JSONArray jsonArray = new JSONArray();
@@ -74,7 +74,7 @@ public class OnWayPointChangeTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
List<LocationDetails> list = ((OnWayPointChange) msg).getWayPoints();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
index a1c1de3fc..ebcb09943 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddCommandTests.java
@@ -27,13 +27,13 @@ import static junit.framework.TestCase.fail;
import static org.junit.Assert.assertNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AddCommand}
*/
-public class AddCommandTests extends BaseRpcTests{
+public class AddCommandTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
AddCommand msg = new AddCommand();
msg.setCmdIcon(TestValues.GENERAL_IMAGE);
@@ -45,103 +45,103 @@ public class AddCommandTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ADD_COMMAND.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(AddCommand.KEY_CMD_ICON, TestValues.JSON_IMAGE);
result.put(AddCommand.KEY_MENU_PARAMS, TestValues.JSON_MENUPARAMS);
result.put(AddCommand.KEY_VR_COMMANDS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
result.put(AddCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testCmdId = ( (AddCommand) msg ).getCmdID();
- Image testImage = ( (AddCommand) msg ).getCmdIcon();
- MenuParams testMenuParams = ( (AddCommand) msg ).getMenuParams();
- List<String> testVrCommands = ( (AddCommand) msg ).getVrCommands();
-
- // Valid Tests
- assertNotNull(TestValues.NOT_NULL, testMenuParams);
- assertNotNull(TestValues.NOT_NULL, testImage);
- assertNotNull(TestValues.NOT_NULL, testVrCommands);
-
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testCmdId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testVrCommands.size());
-
- assertTrue(TestValues.TRUE, Validator.validateMenuParams(TestValues.GENERAL_MENUPARAMS, testMenuParams));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testVrCommands));
-
- // Invalid/Null Tests
- AddCommand msg = new AddCommand();
- assertNotNull(TestValues.NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getCmdIcon());
+ public void testRpcValues() {
+ // Test Values
+ int testCmdId = ((AddCommand) msg).getCmdID();
+ Image testImage = ((AddCommand) msg).getCmdIcon();
+ MenuParams testMenuParams = ((AddCommand) msg).getMenuParams();
+ List<String> testVrCommands = ((AddCommand) msg).getVrCommands();
+
+ // Valid Tests
+ assertNotNull(TestValues.NOT_NULL, testMenuParams);
+ assertNotNull(TestValues.NOT_NULL, testImage);
+ assertNotNull(TestValues.NOT_NULL, testVrCommands);
+
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testCmdId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testVrCommands.size());
+
+ assertTrue(TestValues.TRUE, Validator.validateMenuParams(TestValues.GENERAL_MENUPARAMS, testMenuParams));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testVrCommands));
+
+ // Invalid/Null Tests
+ AddCommand msg = new AddCommand();
+ assertNotNull(TestValues.NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getCmdIcon());
assertNull(TestValues.NULL, msg.getCmdID());
assertNull(TestValues.NULL, msg.getMenuParams());
assertNull(TestValues.NULL, msg.getVrCommands());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AddCommand cmd = new AddCommand(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- List<String> vrCommandsList = JsonUtils.readStringListFromJsonObject(parameters, AddCommand.KEY_VR_COMMANDS);
- List<String> testCommandsList = cmd.getVrCommands();
- assertEquals(TestValues.MATCH, vrCommandsList.size(), testCommandsList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(vrCommandsList, testCommandsList));
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddCommand.KEY_CMD_ID), cmd.getCmdID());
-
- JSONObject menuParams = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_MENU_PARAMS);
- MenuParams referenceMenuParams = new MenuParams(JsonRPCMarshaller.deserializeJSONObject(menuParams));
- assertTrue(TestValues.TRUE, Validator.validateMenuParams(referenceMenuParams, cmd.getMenuParams()));
-
- JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_CMD_ICON);
- Image referenceCmdIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceCmdIcon, cmd.getCmdIcon()));
-
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AddCommand cmd = new AddCommand(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ List<String> vrCommandsList = JsonUtils.readStringListFromJsonObject(parameters, AddCommand.KEY_VR_COMMANDS);
+ List<String> testCommandsList = cmd.getVrCommands();
+ assertEquals(TestValues.MATCH, vrCommandsList.size(), testCommandsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(vrCommandsList, testCommandsList));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddCommand.KEY_CMD_ID), cmd.getCmdID());
+
+ JSONObject menuParams = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_MENU_PARAMS);
+ MenuParams referenceMenuParams = new MenuParams(JsonRPCMarshaller.deserializeJSONObject(menuParams));
+ assertTrue(TestValues.TRUE, Validator.validateMenuParams(referenceMenuParams, cmd.getMenuParams()));
+
+ JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddCommand.KEY_CMD_ICON);
+ Image referenceCmdIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceCmdIcon, cmd.getCmdIcon()));
+
+ } 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/AddSubmenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
index 01ebf5f8c..e135d3217 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
@@ -26,13 +26,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AddSubMenu}
*/
-public class AddSubmenuTests extends BaseRpcTests{
+public class AddSubmenuTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
AddSubMenu msg = new AddSubMenu();
msg.setMenuID(TestValues.GENERAL_INT);
@@ -46,46 +46,46 @@ public class AddSubmenuTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ADD_SUB_MENU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(AddSubMenu.KEY_MENU_ID, TestValues.GENERAL_INT);
result.put(AddSubMenu.KEY_MENU_NAME, TestValues.GENERAL_STRING);
result.put(AddSubMenu.KEY_POSITION, TestValues.GENERAL_INT);
result.put(AddSubMenu.KEY_MENU_ICON, TestValues.JSON_IMAGE);
result.put(AddSubMenu.KEY_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
result.put(AddSubMenu.KEY_PARENT_ID, TestValues.GENERAL_MENU_MAX_ID);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
+ public void testRpcValues() {
+ // Test Values
int testMenuId = ((AddSubMenu) msg).getMenuID();
int testPosition = ((AddSubMenu) msg).getPosition();
String testMenuName = ((AddSubMenu) msg).getMenuName();
Image testMenuIcon = ((AddSubMenu) msg).getMenuIcon();
MenuLayout testMenuLayout = ((AddSubMenu) msg).getMenuLayout();
int testParentID = ((AddSubMenu) msg).getParentID();
-
+
// Valid Tests
assertEquals("Menu ID didn't match input menu ID.", TestValues.GENERAL_INT, testMenuId);
assertEquals("Menu name didn't match input menu name.", TestValues.GENERAL_STRING, testMenuName);
@@ -107,39 +107,39 @@ public class AddSubmenuTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getMenuLayout());
assertNull(TestValues.NULL, msg.getParentID());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AddSubMenu cmd = new AddSubMenu(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_MENU_ID), cmd.getMenuID());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_POSITION), cmd.getPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, AddSubMenu.KEY_MENU_NAME), cmd.getMenuName());
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_LAYOUT), cmd.getMenuLayout());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_PARENT_ID), cmd.getParentID());
-
- JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_ICON);
- Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AddSubMenu cmd = new AddSubMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_MENU_ID), cmd.getMenuID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_POSITION), cmd.getPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, AddSubMenu.KEY_MENU_NAME), cmd.getMenuName());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_LAYOUT), cmd.getMenuLayout());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_PARENT_ID), cmd.getParentID());
+
+ JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_ICON);
+ Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
index 0a50a3562..c33e4d4eb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertManeuverTests.java
@@ -29,59 +29,59 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AlertManeuver}
*/
public class AlertManeuverTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- AlertManeuver msg = new AlertManeuver();
-
- msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
+ @Override
+ protected RPCMessage createMessage() {
+ AlertManeuver msg = new AlertManeuver();
+
+ msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.ALERT_MANEUVER.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.ALERT_MANEUVER.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
try {
- result.put(AlertManeuver.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
+ result.put(AlertManeuver.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
result.put(AlertManeuver.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
-
+
return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- List<TTSChunk> testTtsChunks = ( (AlertManeuver) msg ).getTtsChunks();
- List<SoftButton> testSoftButtons = ( (AlertManeuver) msg ).getSoftButtons();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
-
- // Invalid/Null Tests
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<TTSChunk> testTtsChunks = ((AlertManeuver) msg).getTtsChunks();
+ List<SoftButton> testSoftButtons = ((AlertManeuver) msg).getSoftButtons();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+
+ // Invalid/Null Tests
AlertManeuver msg = new AlertManeuver();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -89,45 +89,45 @@ public class AlertManeuverTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getTtsChunks());
assertNull(TestValues.NULL, msg.getSoftButtons());
}
-
- /**
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AlertManeuver cmd = new AlertManeuver(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_TTS_CHUNKS);
-
- List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
- for (int index = 0; index < ttsChunkArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)));
- ttsChunkList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
-
- JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_SOFT_BUTTONS);
- List<SoftButton> softButtonList = new ArrayList<SoftButton>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject)softButtonArray.get(index)));
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AlertManeuver cmd = new AlertManeuver(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_TTS_CHUNKS);
+
+ List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < ttsChunkArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsChunkArray.get(index)));
+ ttsChunkList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+
+ JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, AlertManeuver.KEY_SOFT_BUTTONS);
+ List<SoftButton> softButtonList = new ArrayList<SoftButton>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
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 525fae442..bde00db0c 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
@@ -30,13 +30,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Alert}
*/
-public class AlertTests extends BaseRpcTests{
+public class AlertTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
Alert msg = new Alert();
msg.setDuration(TestValues.GENERAL_INT);
@@ -49,25 +49,25 @@ public class AlertTests extends BaseRpcTests{
msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
msg.setCancelID(TestValues.GENERAL_INTEGER);
msg.setAlertIcon(TestValues.GENERAL_IMAGE);
-
+
return msg;
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ALERT.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
-
- try{
+
+ try {
result.put(Alert.KEY_DURATION, TestValues.GENERAL_INT);
result.put(Alert.KEY_ALERT_TEXT_1, TestValues.GENERAL_STRING);
result.put(Alert.KEY_ALERT_TEXT_2, TestValues.GENERAL_STRING);
@@ -78,43 +78,43 @@ public class AlertTests extends BaseRpcTests{
result.put(Alert.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
result.put(Alert.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
result.put(Alert.KEY_ALERT_ICON, TestValues.JSON_IMAGE);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testDuration = ( (Alert) msg ).getDuration();
- String testAlertText1 = ( (Alert) msg ).getAlertText1();
- String testAlertText2 = ( (Alert) msg ).getAlertText2();
- String testAlertText3 = ( (Alert) msg ).getAlertText3();
- boolean testPlayTone = ( (Alert) msg ).getPlayTone();
- 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
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDuration);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText1);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText2);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText3);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPlayTone);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testProgressIndicator);
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, alertIcon));
-
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Test Values
+ int testDuration = ((Alert) msg).getDuration();
+ String testAlertText1 = ((Alert) msg).getAlertText1();
+ String testAlertText2 = ((Alert) msg).getAlertText2();
+ String testAlertText3 = ((Alert) msg).getAlertText3();
+ boolean testPlayTone = ((Alert) msg).getPlayTone();
+ 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
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDuration);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testAlertText3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPlayTone);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testProgressIndicator);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, alertIcon));
+
+ // Invalid/Null Tests
Alert msg = new Alert();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -130,55 +130,55 @@ public class AlertTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getCancelID());
assertNull(TestValues.NULL, msg.getAlertIcon());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- Alert cmd = new Alert(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PLAY_TONE), cmd.getPlayTone());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_DURATION), cmd.getDuration());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_1), cmd.getAlertText1());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
- assertEquals(TestValues.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>();
- for (int index = 0; index < ttsChunkArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
- ttsChunkList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
-
- JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_SOFT_BUTTONS);
- List<SoftButton> softButtonList = new ArrayList<SoftButton>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
-
- JSONObject alertIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, Alert.KEY_ALERT_ICON);
- Image referenceAlertIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(alertIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceAlertIcon, cmd.getAlertIcon()));
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ Alert cmd = new Alert(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PLAY_TONE), cmd.getPlayTone());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_DURATION), cmd.getDuration());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_1), cmd.getAlertText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
+ assertEquals(TestValues.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>();
+ for (int index = 0; index < ttsChunkArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsChunkArray.get(index)));
+ ttsChunkList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+
+ JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_SOFT_BUTTONS);
+ List<SoftButton> softButtonList = new ArrayList<SoftButton>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+
+ JSONObject alertIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, Alert.KEY_ALERT_ICON);
+ Image referenceAlertIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(alertIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceAlertIcon, cmd.getAlertIcon()));
} catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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 6ac0a3663..f235e32e2 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
@@ -31,7 +31,7 @@ import static junit.framework.TestCase.fail;
public class ButtonPressTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
ButtonPress msg = new ButtonPress();
msg.setModuleType(TestValues.GENERAL_MODULETYPE);
@@ -43,25 +43,25 @@ public class ButtonPressTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.BUTTON_PRESS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(ButtonPress.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
result.put(ButtonPress.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, TestValues.GENERAL_BUTTONPRESSMODE);
result.put(ButtonPress.KEY_MODULE_ID, TestValues.GENERAL_STRING);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -72,11 +72,11 @@ public class ButtonPressTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
- ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName();
- ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode();
+ ModuleType testModuleType = ((ButtonPress) msg).getModuleType();
+ ButtonName testButtonName = ((ButtonPress) msg).getButtonName();
+ ButtonPressMode testButtonPressMode = ((ButtonPress) msg).getButtonPressMode();
String testButtonId = ((ButtonPress) msg).getModuleId();
// Valid Tests
@@ -100,7 +100,7 @@ public class ButtonPressTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -121,7 +121,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
- }catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.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
index 26ddbf7b5..cf5d3bda6 100644
--- 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
@@ -70,12 +70,12 @@ public class CancelInteractionTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CANCEL_INTERACTION.toString();
}
@@ -97,10 +97,10 @@ public class CancelInteractionTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
- Integer testCancelID = ((CancelInteraction) msg).getCancelID();
+ Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
+ Integer testCancelID = ((CancelInteraction) msg).getCancelID();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testFunctionID);
@@ -119,7 +119,7 @@ public class CancelInteractionTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -136,8 +136,7 @@ public class CancelInteractionTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
- }
- catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
index 34375ee39..d3a711f07 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ChangeRegistrationTests.java
@@ -23,13 +23,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ChangeRegistration}
*/
-public class ChangeRegistrationTests extends BaseRpcTests{
-
+public class ChangeRegistrationTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
ChangeRegistration msg = new ChangeRegistration();
msg.setLanguage(TestValues.GENERAL_LANGUAGE);
@@ -39,43 +39,43 @@ public class ChangeRegistrationTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CHANGE_REGISTRATION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(ChangeRegistration.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
result.put(ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- Language testLanguage = ( (ChangeRegistration) msg ).getLanguage();
- Language testHmiLanguage = ( (ChangeRegistration) msg ).getHmiDisplayLanguage();
-
+ public void testRpcValues() {
+ // Test Values
+ Language testLanguage = ((ChangeRegistration) msg).getLanguage();
+ Language testHmiLanguage = ((ChangeRegistration) msg).getHmiDisplayLanguage();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLanguage);
assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLanguage);
-
- // Invalid/Null Tests
+
+ // Invalid/Null Tests
ChangeRegistration msg = new ChangeRegistration();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -83,31 +83,31 @@ public class ChangeRegistrationTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getLanguage());
assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ChangeRegistration cmd = new ChangeRegistration(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_LANGUAGE), cmd.getLanguage().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ChangeRegistration cmd = new ChangeRegistration(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_LANGUAGE), cmd.getLanguage().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ChangeRegistration.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
index 02cc2d718..35c1d363e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
@@ -61,22 +61,22 @@ import static junit.framework.TestCase.fail;
public class CloseApplicationTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new CloseApplication();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CLOSE_APPLICATION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -84,7 +84,7 @@ public class CloseApplicationTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
CloseApplication msg = new CloseApplication();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -95,7 +95,7 @@ public class CloseApplicationTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -109,8 +109,7 @@ public class CloseApplicationTests extends BaseRpcTests {
// Test everything in the json body.
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- }
- catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
index f5ae2fbd3..d0b470e71 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateInteractionChoiceSetTests.java
@@ -27,13 +27,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet}
*/
-public class CreateInteractionChoiceSetTests extends BaseRpcTests{
-
+public class CreateInteractionChoiceSetTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet();
msg.setInteractionChoiceSetID(TestValues.GENERAL_INT);
@@ -43,45 +43,45 @@ public class CreateInteractionChoiceSetTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CREATE_INTERACTION_CHOICE_SET.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, TestValues.GENERAL_INT);
result.put(CreateInteractionChoiceSet.KEY_CHOICE_SET, TestValues.JSON_CHOICES);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testCmdId = ( (CreateInteractionChoiceSet) msg ).getInteractionChoiceSetID();
- List<Choice> testChoices = ( (CreateInteractionChoiceSet) msg ).getChoiceSet();
-
+ public void testRpcValues() {
+ // Test Values
+ int testCmdId = ((CreateInteractionChoiceSet) msg).getInteractionChoiceSetID();
+ List<Choice> testChoices = ((CreateInteractionChoiceSet) msg).getChoiceSet();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testCmdId);
assertEquals(TestValues.MATCH, TestValues.GENERAL_CHOICE_LIST.size(), testChoices.size());
- for(int i = 0; i < testChoices.size(); i++){
+ for (int i = 0; i < testChoices.size(); i++) {
assertTrue(TestValues.TRUE, Validator.validateChoice(TestValues.GENERAL_CHOICE_LIST.get(i), testChoices.get(i)));
}
-
+
// Invalid/Null Tests
CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -95,31 +95,31 @@ public class CreateInteractionChoiceSetTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- CreateInteractionChoiceSet cmd = new CreateInteractionChoiceSet(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
-
- JSONArray choiceSetArray = JsonUtils.readJsonArrayFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_CHOICE_SET);
- for (int index = 0; index < choiceSetArray.length(); index++) {
- Choice chunk = new Choice(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)choiceSetArray.get(index)) );
- assertTrue(TestValues.TRUE, Validator.validateChoice(chunk, cmd.getChoiceSet().get(index)) );
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CreateInteractionChoiceSet cmd = new CreateInteractionChoiceSet(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
+
+ JSONArray choiceSetArray = JsonUtils.readJsonArrayFromJsonObject(parameters, CreateInteractionChoiceSet.KEY_CHOICE_SET);
+ for (int index = 0; index < choiceSetArray.length(); index++) {
+ Choice chunk = new Choice(JsonRPCMarshaller.deserializeJSONObject((JSONObject) choiceSetArray.get(index)));
+ assertTrue(TestValues.TRUE, Validator.validateChoice(chunk, cmd.getChoiceSet().get(index)));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
index 72401b9b1..74cfa67ae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteCommandTests.java
@@ -22,13 +22,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteCommand}
*/
-public class DeleteCommandTests extends BaseRpcTests{
+public class DeleteCommandTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DeleteCommand msg = new DeleteCommand();
msg.setCmdID(TestValues.GENERAL_INT);
@@ -37,39 +37,39 @@ public class DeleteCommandTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_COMMAND.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DeleteCommand.KEY_CMD_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int cmdId = ( (DeleteCommand) msg ).getCmdID();
-
- // Valid Tests
+ public void testRpcValues() {
+ // Test Values
+ int cmdId = ((DeleteCommand) msg).getCmdID();
+
+ // Valid Tests
assertEquals("Command ID didn't match input command ID.", TestValues.GENERAL_INT, cmdId);
-
+
// Invalid/Null Tests
DeleteCommand msg = new DeleteCommand();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -77,31 +77,30 @@ public class DeleteCommandTests extends BaseRpcTests{
assertNull(TestValues.MATCH, msg.getCmdID());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteCommand cmd = new DeleteCommand(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteCommand.KEY_CMD_ID), cmd.getCmdID());
- }
- catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteCommand cmd = new DeleteCommand(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteCommand.KEY_CMD_ID), cmd.getCmdID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
index d4af2d0da..54d806e08 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteFileTests.java
@@ -22,85 +22,85 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteFile}
*/
-public class DeleteFileTests extends BaseRpcTests{
-
+public class DeleteFileTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DeleteFile msg = new DeleteFile();
- msg.setSdlFileName(TestValues.GENERAL_STRING);
+ msg.setSdlFileName(TestValues.GENERAL_STRING);
return msg;
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_FILE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
- result.put(DeleteFile.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ try {
+ result.put(DeleteFile.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- String testFilename = ( (DeleteFile) msg ).getSdlFileName();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFilename);
-
- // Invalid/Null Tests
- DeleteFile msg = new DeleteFile();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSdlFileName());
+ public void testRpcValues() {
+ // Test Values
+ String testFilename = ((DeleteFile) msg).getSdlFileName();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFilename);
+
+ // Invalid/Null Tests
+ DeleteFile msg = new DeleteFile();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSdlFileName());
}
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteFile cmd = new DeleteFile(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, DeleteFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteFile cmd = new DeleteFile(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, DeleteFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
index 7aea9c784..7f6aebbfc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteInteractionChoiceSetTests.java
@@ -22,13 +22,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet}
*/
-public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
+public class DeleteInteractionChoiceSetTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet();
msg.setInteractionChoiceSetID(TestValues.GENERAL_INT);
@@ -37,40 +37,40 @@ public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_INTERACTION_CHOICE_SET.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testChoiceSetId = ( (DeleteInteractionChoiceSet) msg ).getInteractionChoiceSetID();
-
+ public void testRpcValues() {
+ // Test Values
+ int testChoiceSetId = ((DeleteInteractionChoiceSet) msg).getInteractionChoiceSetID();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testChoiceSetId);
-
- // Invalid/Null Tests
+
+ // Invalid/Null Tests
DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -82,25 +82,25 @@ public class DeleteInteractionChoiceSetTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteInteractionChoiceSet cmd = new DeleteInteractionChoiceSet(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteInteractionChoiceSet cmd = new DeleteInteractionChoiceSet(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteInteractionChoiceSet.KEY_INTERACTION_CHOICE_SET_ID), cmd.getInteractionChoiceSetID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
index 326bb2175..a2d5391f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteSubMenuTests.java
@@ -22,13 +22,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteSubMenu}
*/
-public class DeleteSubMenuTests extends BaseRpcTests{
+public class DeleteSubMenuTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DeleteSubMenu msg = new DeleteSubMenu();
msg.setMenuID(TestValues.GENERAL_INT);
@@ -37,39 +37,39 @@ public class DeleteSubMenuTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_SUB_MENU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DeleteSubMenu.KEY_MENU_ID, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testMenuId = ( (DeleteSubMenu) msg ).getMenuID();
-
+ public void testRpcValues() {
+ // Test Values
+ int testMenuId = ((DeleteSubMenu) msg).getMenuID();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMenuId);
-
+
// Invalid/Null Tests
DeleteSubMenu msg = new DeleteSubMenu();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -82,25 +82,25 @@ public class DeleteSubMenuTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteSubMenu cmd = new DeleteSubMenu(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteSubMenu.KEY_MENU_ID), cmd.getMenuID());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteSubMenu cmd = new DeleteSubMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteSubMenu.KEY_MENU_ID), cmd.getMenuID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
index 755a3dfb0..a075b887d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DiagnosticMessageTests.java
@@ -25,13 +25,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DiagnosticMessage}
*/
-public class DiagnosticMessageTests extends BaseRpcTests{
+public class DiagnosticMessageTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DiagnosticMessage msg = new DiagnosticMessage();
msg.setMessageLength(TestValues.GENERAL_INT);
@@ -42,49 +42,49 @@ public class DiagnosticMessageTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DIAGNOSTIC_MESSAGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DiagnosticMessage.KEY_TARGET_ID, TestValues.GENERAL_INT);
result.put(DiagnosticMessage.KEY_MESSAGE_LENGTH, TestValues.GENERAL_INT);
result.put(DiagnosticMessage.KEY_MESSAGE_DATA, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testTargetId = ( (DiagnosticMessage) msg ).getTargetID();
- int testMessageLength = ( (DiagnosticMessage) msg ).getMessageLength();
- List<Integer> testMessageData = ( (DiagnosticMessage) msg ).getMessageData();
+ public void testRpcValues() {
+ // Test Values
+ int testTargetId = ((DiagnosticMessage) msg).getTargetID();
+ int testMessageLength = ((DiagnosticMessage) msg).getMessageLength();
+ List<Integer> testMessageData = ((DiagnosticMessage) msg).getMessageData();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testTargetId);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMessageLength);
assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.size(), testMessageData.size());
- for(int i = 0; i < testMessageData.size(); i++){
+ for (int i = 0; i < testMessageData.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.get(i), testMessageData.get(i));
}
-
+
// Invalid/Null Tests
DiagnosticMessage msg = new DiagnosticMessage();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -99,31 +99,31 @@ public class DiagnosticMessageTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DiagnosticMessage cmd = new DiagnosticMessage(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_TARGET_ID), cmd.getTargetID());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_LENGTH), cmd.getMessageLength());
-
- List<Integer> messageDataList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_DATA);
- List<Integer> testDataList = cmd.getMessageData();
- assertEquals(TestValues.MATCH, messageDataList.size(), testDataList.size());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(messageDataList, testDataList));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DiagnosticMessage cmd = new DiagnosticMessage(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_TARGET_ID), cmd.getTargetID());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_LENGTH), cmd.getMessageLength());
+
+ List<Integer> messageDataList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessage.KEY_MESSAGE_DATA);
+ List<Integer> testDataList = cmd.getMessageData();
+ assertEquals(TestValues.MATCH, messageDataList.size(), testDataList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(messageDataList, testDataList));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
index 7e6cd3991..b22dd002d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DialNumberTests.java
@@ -30,7 +30,7 @@ public class DialNumberTests extends BaseRpcTests {
private final String TEST_NUMBER = "5558675309";
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DialNumber msg = new DialNumber();
msg.setNumber(TEST_NUMBER);
@@ -39,22 +39,22 @@ public class DialNumberTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DIAL_NUMBER.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DialNumber.KEY_NUMBER, TEST_NUMBER);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -65,7 +65,7 @@ public class DialNumberTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
String testNumber = ((DialNumber) msg).getNumber();
@@ -83,7 +83,7 @@ public class DialNumberTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
index f226c0630..398a23b0e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/EndAudioPassThruTests.java
@@ -21,37 +21,37 @@ import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.EndAudioPassThru}
*/
-public class EndAudioPassThruTests extends BaseRpcTests{
+public class EndAudioPassThruTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new EndAudioPassThru();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.END_AUDIO_PASS_THRU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
EndAudioPassThru msg = new EndAudioPassThru();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -61,22 +61,22 @@ public class EndAudioPassThruTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- EndAudioPassThru cmd = new EndAudioPassThru(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ EndAudioPassThru cmd = new EndAudioPassThru(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
index 02e7fb5ff..53acb1c28 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetAppServiceDataTests.java
@@ -23,95 +23,95 @@ import static junit.framework.TestCase.fail;
public class GetAppServiceDataTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- GetAppServiceData msg = new GetAppServiceData();
- msg.setServiceType(TestValues.GENERAL_STRING);
- msg.setSubscribe(TestValues.GENERAL_BOOLEAN);
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.GET_APP_SERVICE_DATA.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(GetAppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
- result.put(GetAppServiceData.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String serviceType = ( (GetAppServiceData) msg ).getServiceType();
- boolean subscribe = ( (GetAppServiceData) msg ).getSubscribe();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, subscribe);
-
- // Invalid/Null Tests
- GetAppServiceData msg = new GetAppServiceData();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(msg.getServiceType());
- assertNull(msg.getSubscribe());
- }
-
- /**
- * Tests constructor with required params
- */
- @Test
- public void testRequiredParamsConstructor () {
-
- GetAppServiceData msg = new GetAppServiceData(TestValues.GENERAL_STRING);
- assertNotNull(TestValues.NOT_NULL, msg);
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceType());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetAppServiceData cmd = new GetAppServiceData(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetAppServiceData.KEY_SUBSCRIBE), cmd.getSubscribe());
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetAppServiceData.KEY_SERVICE_TYPE).toString(), cmd.getServiceType().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ GetAppServiceData msg = new GetAppServiceData();
+ msg.setServiceType(TestValues.GENERAL_STRING);
+ msg.setSubscribe(TestValues.GENERAL_BOOLEAN);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetAppServiceData.KEY_SERVICE_TYPE, TestValues.GENERAL_STRING);
+ result.put(GetAppServiceData.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String serviceType = ((GetAppServiceData) msg).getServiceType();
+ boolean subscribe = ((GetAppServiceData) msg).getSubscribe();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, subscribe);
+
+ // Invalid/Null Tests
+ GetAppServiceData msg = new GetAppServiceData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(msg.getServiceType());
+ assertNull(msg.getSubscribe());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ @Test
+ public void testRequiredParamsConstructor() {
+
+ GetAppServiceData msg = new GetAppServiceData(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceType());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetAppServiceData cmd = new GetAppServiceData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetAppServiceData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetAppServiceData.KEY_SERVICE_TYPE).toString(), cmd.getServiceType().toString());
+ } 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/GetCloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
index ad8238056..0def46997 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
@@ -13,36 +13,36 @@ import static junit.framework.TestCase.fail;
public class GetCloudAppPropertiesTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- GetCloudAppProperties msg = new GetCloudAppProperties();
+ @Override
+ protected RPCMessage createMessage() {
+ GetCloudAppProperties msg = new GetCloudAppProperties();
- msg.setAppID(TestValues.GENERAL_STRING);
+ msg.setAppID(TestValues.GENERAL_STRING);
- return msg;
- }
+ return msg;
+ }
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_REQUEST;
- }
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
- @Override
- protected String getCommandType(){
- return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
- try{
- result.put(GetCloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
+ try {
+ result.put(GetCloudAppProperties.KEY_APP_ID, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
- return result;
- }
+ return result;
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
index 05b8c1994..cf9cf6527 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetDTCsTests.java
@@ -22,13 +22,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetDTCs}
*/
-public class GetDTCsTests extends BaseRpcTests{
+public class GetDTCsTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetDTCs msg = new GetDTCs();
msg.setEcuName(TestValues.GENERAL_INT);
@@ -38,43 +38,43 @@ public class GetDTCsTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_DTCS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetDTCs.KEY_ECU_NAME, TestValues.GENERAL_INT);
result.put(GetDTCs.KEY_DTC_MASK, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int testDtcMask = ( (GetDTCs) msg ).getDtcMask();
- int testEcuName = ( (GetDTCs) msg ).getEcuName();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDtcMask);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testEcuName);
-
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Test Values
+ int testDtcMask = ((GetDTCs) msg).getDtcMask();
+ int testEcuName = ((GetDTCs) msg).getEcuName();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testDtcMask);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testEcuName);
+
+ // Invalid/Null Tests
GetDTCs msg = new GetDTCs();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -82,33 +82,32 @@ public class GetDTCsTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getEcuName());
assertNull(TestValues.NULL, msg.getDtcMask());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetDTCs cmd = new GetDTCs(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_DTC_MASK), cmd.getDtcMask());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_ECU_NAME), cmd.getEcuName());
- }
- catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetDTCs cmd = new GetDTCs(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_DTC_MASK), cmd.getDtcMask());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetDTCs.KEY_ECU_NAME), cmd.getEcuName());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
index 9d358cc8a..55e620950 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetFileTests.java
@@ -25,118 +25,118 @@ import static junit.framework.TestCase.fail;
public class GetFileTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- GetFile msg = new GetFile();
-
- msg.setFileName(TestValues.GENERAL_STRING);
- msg.setAppServiceId(TestValues.GENERAL_STRING);
- msg.setFileType(TestValues.GENERAL_FILETYPE);
- msg.setOffset(TestValues.GENERAL_INT);
- msg.setLength(TestValues.GENERAL_INT);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.GET_FILE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(GetFile.KEY_FILE_NAME, TestValues.GENERAL_STRING);
- result.put(GetFile.KEY_APP_SERVICE_ID, TestValues.GENERAL_STRING);
- result.put(GetFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
- result.put(GetFile.KEY_OFFSET, TestValues.GENERAL_INTEGER);
- result.put(GetFile.KEY_LENGTH, TestValues.GENERAL_INTEGER);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String fileName = ( (GetFile) msg ).getFileName();
- String appServiceId = ( (GetFile) msg ).getAppServiceId();
- FileType fileType = ( (GetFile) msg ).getFileType();
- Integer offset = ( (GetFile) msg ).getOffset();
- Integer length = ( (GetFile) msg ).getLength();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, fileName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
-
- // Invalid/Null Tests
- GetFile msg = new GetFile();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getFileName());
- assertNull(TestValues.NULL, msg.getAppServiceId());
- assertNull(TestValues.NULL, msg.getFileType());
- assertNull(TestValues.NULL, msg.getOffset());
- assertNull(TestValues.NULL, msg.getLength());
- }
-
- /**
- * Tests constructor with required params
- */
- @Test
- public void testRequiredParamsConstructor () {
-
- GetFile msg = new GetFile(TestValues.GENERAL_STRING);
- assertNotNull(TestValues.NOT_NULL, msg);
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getFileName());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetFile cmd = new GetFile(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_APP_SERVICE_ID), cmd.getAppServiceId());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_FILE_NAME), cmd.getFileName());
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFile.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_LENGTH), cmd.getLength());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_OFFSET), cmd.getOffset());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ GetFile msg = new GetFile();
+
+ msg.setFileName(TestValues.GENERAL_STRING);
+ msg.setAppServiceId(TestValues.GENERAL_STRING);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setOffset(TestValues.GENERAL_INT);
+ msg.setLength(TestValues.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetFile.KEY_FILE_NAME, TestValues.GENERAL_STRING);
+ result.put(GetFile.KEY_APP_SERVICE_ID, TestValues.GENERAL_STRING);
+ result.put(GetFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(GetFile.KEY_OFFSET, TestValues.GENERAL_INTEGER);
+ result.put(GetFile.KEY_LENGTH, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String fileName = ((GetFile) msg).getFileName();
+ String appServiceId = ((GetFile) msg).getAppServiceId();
+ FileType fileType = ((GetFile) msg).getFileType();
+ Integer offset = ((GetFile) msg).getOffset();
+ Integer length = ((GetFile) msg).getLength();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, fileName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
+
+ // Invalid/Null Tests
+ GetFile msg = new GetFile();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getFileName());
+ assertNull(TestValues.NULL, msg.getAppServiceId());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ @Test
+ public void testRequiredParamsConstructor() {
+
+ GetFile msg = new GetFile(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getFileName());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetFile cmd = new GetFile(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_APP_SERVICE_ID), cmd.getAppServiceId());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetFile.KEY_FILE_NAME), cmd.getFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFile.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_LENGTH), cmd.getLength());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFile.KEY_OFFSET), cmd.getOffset());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
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
index 6d9bc2283..f1f96a701 100644
--- 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
@@ -25,79 +25,79 @@ import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
- msg.setModuleType(TestValues.GENERAL_MODULETYPE);
- msg.setModuleIds(TestValues.GENERAL_STRING_LIST);
- return msg;
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
- try {
- result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
- result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- return result;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_REQUEST;
- }
-
- @Test
- public void testRpcValues() {
- ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
- List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
-
- //valid tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, ids);
-
- //null tests
- GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
- assertNull(TestValues.NULL, msg.getModuleType());
- assertNull(TestValues.NULL, msg.getModuleIds());
-
- //test require param constructor
- GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(TestValues.GENERAL_MODULETYPE, TestValues.GENERAL_STRING_LIST);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, msg2.getModuleIds());
-
- }
-
- @Test
- public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setModuleIds(TestValues.GENERAL_STRING_LIST);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Test
+ public void testRpcValues() {
+ ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
+ List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
+
+ //valid tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, ids);
+
+ //null tests
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getModuleIds());
+
+ //test require param constructor
+ GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(TestValues.GENERAL_MODULETYPE, TestValues.GENERAL_STRING_LIST);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, msg2.getModuleIds());
+
+ }
+
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
+ } catch (JSONException e) {
+ fail(TestValues.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 615851917..9ae36b479 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
@@ -29,7 +29,7 @@ import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetInteriorVehicleData msg = new GetInteriorVehicleData();
msg.setModuleType(TestValues.GENERAL_MODULETYPE);
@@ -40,24 +40,24 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
result.put(GetInteriorVehicleData.KEY_MODULE_ID, TestValues.GENERAL_STRING);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -68,10 +68,10 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
- boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe();
+ ModuleType testModuleType = ((GetInteriorVehicleData) msg).getModuleType();
+ boolean testSubscribed = ((GetInteriorVehicleData) msg).getSubscribe();
String testModuleId = ((GetInteriorVehicleData) msg).getModuleId();
// Valid Tests
@@ -93,7 +93,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -113,7 +113,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
- }catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
index 6eb55d90f..0fc757ccb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
@@ -25,7 +25,7 @@ import static junit.framework.TestCase.fail;
public class GetSystemCapabilityTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetSystemCapability msg = new GetSystemCapability();
msg.setSystemCapabilityType(TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
@@ -35,23 +35,23 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_SYSTEM_CAPABILITY.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, TestValues.GENERAL_SYSTEMCAPABILITYTYPE);
result.put(GetSystemCapability.KEY_SUBSCRIBE, TestValues.GENERAL_BOOLEAN);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -62,10 +62,10 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- SystemCapabilityType testType = ( (GetSystemCapability) msg ).getSystemCapabilityType();
- boolean testSubscribe = ( (GetSystemCapability) msg ).getSubscribe();
+ SystemCapabilityType testType = ((GetSystemCapability) msg).getSystemCapabilityType();
+ boolean testSubscribe = ((GetSystemCapability) msg).getSubscribe();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITYTYPE, testType);
@@ -84,7 +84,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -103,7 +103,7 @@ public class GetSystemCapabilityTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE).toString(), cmd.getSystemCapabilityType().toString());
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SUBSCRIBE), cmd.getSubscribe());
- }catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.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 637445ac7..fe726018f 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
@@ -23,68 +23,68 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetVehicleData}
*/
public class GetVehicleDataTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage(){
+
+ @Override
+ protected RPCMessage createMessage() {
GetVehicleData msg = new GetVehicleData();
- msg.setSpeed(TestValues.GENERAL_BOOLEAN);
- msg.setRpm(TestValues.GENERAL_BOOLEAN);
- msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
- msg.setPrndl(TestValues.GENERAL_BOOLEAN);
- msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
- msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
- msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
- msg.setOdometer(TestValues.GENERAL_BOOLEAN);
- msg.setGps(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
- msg.setVin(TestValues.GENERAL_BOOLEAN);
- msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
- msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
- msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
- msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
- msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
- msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
- msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setMyKey(TestValues.GENERAL_BOOLEAN);
- msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
- msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
- msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
- msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
- msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setVin(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
+ msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
@@ -119,56 +119,56 @@ public class GetVehicleDataTests extends BaseRpcTests {
result.put(GetVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Valid Tests
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getSpeed());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getRpm());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getExternalTemperature());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelLevel());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getPrndl());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getTirePressure());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEngineTorque());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEngineOilLife());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getOdometer());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getGps());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelLevelState());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getVin());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getBeltStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getBodyInformation());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getVin());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getDeviceStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getDriverBraking());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getWiperStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getHeadLampStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getAccPedalPosition());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getECallInfo());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getAirbagStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getEmergencyEvent());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getClusterModeStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getMyKey());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getFuelRange());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getTurnSignal());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getHandsOffSteering());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getWindowStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getGearStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getStabilityControlsStatus());
- assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
-
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Valid Tests
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getSpeed());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getRpm());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getExternalTemperature());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getFuelLevel());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getPrndl());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getTirePressure());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getEngineTorque());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getEngineOilLife());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getOdometer());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getGps());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getFuelLevelState());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getVin());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getBeltStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getBodyInformation());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getVin());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getDeviceStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getDriverBraking());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getWiperStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getHeadLampStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getAccPedalPosition());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getSteeringWheelAngle());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getECallInfo());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getAirbagStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getEmergencyEvent());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getClusterModeStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getMyKey());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getFuelRange());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getTurnSignal());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getHandsOffSteering());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getWindowStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getGearStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getStabilityControlsStatus());
+ assertTrue(TestValues.TRUE, ((GetVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+
+ // Invalid/Null Tests
GetVehicleData msg = new GetVehicleData();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -208,63 +208,63 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetVehicleData cmd = new GetVehicleData(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals("Command name doesn't match input name", JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetVehicleData cmd = new GetVehicleData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_VIN), cmd.getVin());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ // Test everything in the json body.
+ assertEquals("Command name doesn't match input name", JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_VIN), cmd.getVin());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
index 8a9586a93..1e27cbdec 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetWayPointsTests.java
@@ -28,7 +28,7 @@ import static junit.framework.TestCase.fail;
public class GetWayPointsTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetWayPoints msg = new GetWayPoints();
msg.setWayPointType(WayPointType.DESTINATION);
@@ -37,22 +37,22 @@ public class GetWayPointsTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_WAY_POINTS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetWayPoints.KEY_WAY_POINT_TYPE, WayPointType.DESTINATION);
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -63,9 +63,9 @@ public class GetWayPointsTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- WayPointType testType = ( (GetWayPoints) msg ).getWayPointType();
+ WayPointType testType = ((GetWayPoints) msg).getWayPointType();
// Valid Tests
assertEquals(TestValues.MATCH, WayPointType.DESTINATION, testType);
@@ -82,7 +82,7 @@ public class GetWayPointsTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
index 60d2394b8..c7dd46b65 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ListFilesTests.java
@@ -21,37 +21,37 @@ import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ListFiles}
*/
-public class ListFilesTests extends BaseRpcTests{
+public class ListFilesTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new ListFiles();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.LIST_FILES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
ListFiles msg = new ListFiles();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -61,22 +61,22 @@ public class ListFilesTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ListFiles cmd = new ListFiles(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ListFiles cmd = new ListFiles(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
index bdc8bb9ac..e49999176 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAppServiceInteractionTests.java
@@ -24,115 +24,115 @@ import static junit.framework.TestCase.fail;
public class PerformAppServiceInteractionTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
-
- msg.setServiceUri(TestValues.GENERAL_STRING);
- msg.setServiceID(TestValues.GENERAL_STRING);
- msg.setOriginApp(TestValues.GENERAL_STRING);
- msg.setRequestServiceActive(TestValues.GENERAL_BOOLEAN);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PerformAppServiceInteraction.KEY_SERVICE_URI, TestValues.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_ORIGIN_APP, TestValues.GENERAL_STRING);
- result.put(PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String serviceUri = ( (PerformAppServiceInteraction) msg ).getServiceUri();
- String appServiceId = ( (PerformAppServiceInteraction) msg ).getServiceID();
- String originApp = ( (PerformAppServiceInteraction) msg ).getOriginApp();
- boolean requestServiceActive = ( (PerformAppServiceInteraction) msg ).getRequestServiceActive();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, requestServiceActive);
-
- // Invalid/Null Tests
- PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getServiceUri());
- assertNull(TestValues.NULL, msg.getServiceID());
- assertNull(TestValues.NULL, msg.getOriginApp());
- assertNull(TestValues.NULL, msg.getRequestServiceActive());
- }
-
- /**
- * Tests constructor with required params
- */
- @Test
- public void testRequiredParamsConstructor () {
- // test with param in constructor
- PerformAppServiceInteraction msg = new PerformAppServiceInteraction(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
- String serviceUri = msg.getServiceUri();
- String appServiceId = msg.getServiceID();
- String originApp = msg.getOriginApp();
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformAppServiceInteraction cmd = new PerformAppServiceInteraction(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getServiceID());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_URI), cmd.getServiceUri());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_ORIGIN_APP), cmd.getOriginApp());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE), cmd.getRequestServiceActive());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+
+ msg.setServiceUri(TestValues.GENERAL_STRING);
+ msg.setServiceID(TestValues.GENERAL_STRING);
+ msg.setOriginApp(TestValues.GENERAL_STRING);
+ msg.setRequestServiceActive(TestValues.GENERAL_BOOLEAN);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_URI, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_ORIGIN_APP, TestValues.GENERAL_STRING);
+ result.put(PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE, TestValues.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String serviceUri = ((PerformAppServiceInteraction) msg).getServiceUri();
+ String appServiceId = ((PerformAppServiceInteraction) msg).getServiceID();
+ String originApp = ((PerformAppServiceInteraction) msg).getOriginApp();
+ boolean requestServiceActive = ((PerformAppServiceInteraction) msg).getRequestServiceActive();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, requestServiceActive);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getServiceUri());
+ assertNull(TestValues.NULL, msg.getServiceID());
+ assertNull(TestValues.NULL, msg.getOriginApp());
+ assertNull(TestValues.NULL, msg.getRequestServiceActive());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ @Test
+ public void testRequiredParamsConstructor() {
+ // test with param in constructor
+ PerformAppServiceInteraction msg = new PerformAppServiceInteraction(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, TestValues.GENERAL_STRING);
+ String serviceUri = msg.getServiceUri();
+ String appServiceId = msg.getServiceID();
+ String originApp = msg.getOriginApp();
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceUri);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, appServiceId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, originApp);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAppServiceInteraction cmd = new PerformAppServiceInteraction(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_ID), cmd.getServiceID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_SERVICE_URI), cmd.getServiceUri());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteraction.KEY_ORIGIN_APP), cmd.getOriginApp());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAppServiceInteraction.KEY_REQUEST_SERVICE_ACTIVE), cmd.getRequestServiceActive());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
index d1bc966c5..bee27cb47 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformAudioPassThruTests.java
@@ -31,137 +31,137 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PerformAudioPassThru}
*/
public class PerformAudioPassThruTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- PerformAudioPassThru msg = new PerformAudioPassThru();
-
- msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setAudioPassThruDisplayText1(TestValues.GENERAL_STRING);
- msg.setAudioPassThruDisplayText2(TestValues.GENERAL_STRING);
- msg.setSamplingRate(TestValues.GENERAL_SAMPLINGRATE);
- msg.setAudioType(TestValues.GENERAL_AUDIOTYPE);
- msg.setBitsPerSample(TestValues.GENERAL_BITSPERSAMPLE);
- msg.setMaxDuration(TestValues.GENERAL_INT);
- msg.setMuteAudio(TestValues.GENERAL_BOOLEAN);
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PERFORM_AUDIO_PASS_THRU.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1, TestValues.GENERAL_STRING);
- result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2, TestValues.GENERAL_STRING);
- result.put(PerformAudioPassThru.KEY_MUTE_AUDIO, TestValues.GENERAL_BOOLEAN);
- result.put(PerformAudioPassThru.KEY_MAX_DURATION, TestValues.GENERAL_INT);
- result.put(PerformAudioPassThru.KEY_AUDIO_TYPE, TestValues.GENERAL_AUDIOTYPE);
- result.put(PerformAudioPassThru.KEY_SAMPLING_RATE, TestValues.GENERAL_SAMPLINGRATE);
- result.put(PerformAudioPassThru.KEY_BITS_PER_SAMPLE, TestValues.GENERAL_BITSPERSAMPLE);
- result.put(PerformAudioPassThru.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- boolean testMuteAudio = ( (PerformAudioPassThru) msg ).getMuteAudio();
- int testMaxDuration = ( (PerformAudioPassThru) msg ).getMaxDuration();
- String testText2 = ( (PerformAudioPassThru) msg ).getAudioPassThruDisplayText2();
- String testText1 = ( (PerformAudioPassThru) msg ).getAudioPassThruDisplayText1();
- SamplingRate testSamplingRate = ( (PerformAudioPassThru) msg ).getSamplingRate();
- AudioType testAudioType = ( (PerformAudioPassThru) msg ).getAudioType();
- BitsPerSample testBitsPerSample = ( (PerformAudioPassThru) msg ).getBitsPerSample();
- List<TTSChunk> testInitialPrompt = ( (PerformAudioPassThru) msg ).getInitialPrompt();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.size(), testInitialPrompt.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SAMPLINGRATE, testSamplingRate);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BITSPERSAMPLE, testBitsPerSample);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOTYPE, testAudioType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMaxDuration);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testMuteAudio);
- for (int i = 0; i < TestValues.GENERAL_TTSCHUNK_LIST.size(); i++) {
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.get(i), testInitialPrompt.get(i));
- }
-
- // Invalid/Null Tests
- PerformAudioPassThru msg = new PerformAudioPassThru();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getInitialPrompt());
- assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText1());
- assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText2());
- assertNull(TestValues.NULL, msg.getSamplingRate());
- assertNull(TestValues.NULL, msg.getBitsPerSample());
- assertNull(TestValues.NULL, msg.getAudioType());
- assertNull(TestValues.NULL, msg.getMaxDuration());
- assertNull(TestValues.NULL, msg.getMuteAudio());
- }
+ @Override
+ protected RPCMessage createMessage() {
+ PerformAudioPassThru msg = new PerformAudioPassThru();
+
+ msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setAudioPassThruDisplayText1(TestValues.GENERAL_STRING);
+ msg.setAudioPassThruDisplayText2(TestValues.GENERAL_STRING);
+ msg.setSamplingRate(TestValues.GENERAL_SAMPLINGRATE);
+ msg.setAudioType(TestValues.GENERAL_AUDIOTYPE);
+ msg.setBitsPerSample(TestValues.GENERAL_BITSPERSAMPLE);
+ msg.setMaxDuration(TestValues.GENERAL_INT);
+ msg.setMuteAudio(TestValues.GENERAL_BOOLEAN);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_AUDIO_PASS_THRU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1, TestValues.GENERAL_STRING);
+ result.put(PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2, TestValues.GENERAL_STRING);
+ result.put(PerformAudioPassThru.KEY_MUTE_AUDIO, TestValues.GENERAL_BOOLEAN);
+ result.put(PerformAudioPassThru.KEY_MAX_DURATION, TestValues.GENERAL_INT);
+ result.put(PerformAudioPassThru.KEY_AUDIO_TYPE, TestValues.GENERAL_AUDIOTYPE);
+ result.put(PerformAudioPassThru.KEY_SAMPLING_RATE, TestValues.GENERAL_SAMPLINGRATE);
+ result.put(PerformAudioPassThru.KEY_BITS_PER_SAMPLE, TestValues.GENERAL_BITSPERSAMPLE);
+ result.put(PerformAudioPassThru.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ boolean testMuteAudio = ((PerformAudioPassThru) msg).getMuteAudio();
+ int testMaxDuration = ((PerformAudioPassThru) msg).getMaxDuration();
+ String testText2 = ((PerformAudioPassThru) msg).getAudioPassThruDisplayText2();
+ String testText1 = ((PerformAudioPassThru) msg).getAudioPassThruDisplayText1();
+ SamplingRate testSamplingRate = ((PerformAudioPassThru) msg).getSamplingRate();
+ AudioType testAudioType = ((PerformAudioPassThru) msg).getAudioType();
+ BitsPerSample testBitsPerSample = ((PerformAudioPassThru) msg).getBitsPerSample();
+ List<TTSChunk> testInitialPrompt = ((PerformAudioPassThru) msg).getInitialPrompt();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.size(), testInitialPrompt.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SAMPLINGRATE, testSamplingRate);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BITSPERSAMPLE, testBitsPerSample);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIOTYPE, testAudioType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, testMaxDuration);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testMuteAudio);
+ for (int i = 0; i < TestValues.GENERAL_TTSCHUNK_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TTSCHUNK_LIST.get(i), testInitialPrompt.get(i));
+ }
+
+ // Invalid/Null Tests
+ PerformAudioPassThru msg = new PerformAudioPassThru();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getInitialPrompt());
+ assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText1());
+ assertNull(TestValues.NULL, msg.getAudioPassThruDisplayText2());
+ assertNull(TestValues.NULL, msg.getSamplingRate());
+ assertNull(TestValues.NULL, msg.getBitsPerSample());
+ assertNull(TestValues.NULL, msg.getAudioType());
+ assertNull(TestValues.NULL, msg.getMaxDuration());
+ assertNull(TestValues.NULL, msg.getMuteAudio());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformAudioPassThru cmd = new PerformAudioPassThru(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformAudioPassThru.KEY_MAX_DURATION), (Integer)cmd.getMaxDuration());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1), cmd.getAudioPassThruDisplayText1());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2), cmd.getAudioPassThruDisplayText2());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAudioPassThru.KEY_MUTE_AUDIO), cmd.getMuteAudio());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_SAMPLING_RATE), cmd.getSamplingRate().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_TYPE), cmd.getAudioType().toString());
-
- JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformAudioPassThru.KEY_INITIAL_PROMPT);
- List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
- for (int index = 0; index < ttsChunkArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
- ttsChunkList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getInitialPrompt()));
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_BITS_PER_SAMPLE), cmd.getBitsPerSample().toString());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAudioPassThru cmd = new PerformAudioPassThru(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformAudioPassThru.KEY_MAX_DURATION), (Integer) cmd.getMaxDuration());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1), cmd.getAudioPassThruDisplayText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2), cmd.getAudioPassThruDisplayText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PerformAudioPassThru.KEY_MUTE_AUDIO), cmd.getMuteAudio());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_SAMPLING_RATE), cmd.getSamplingRate().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_AUDIO_TYPE), cmd.getAudioType().toString());
+
+ JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformAudioPassThru.KEY_INITIAL_PROMPT);
+ List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < ttsChunkArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsChunkArray.get(index)));
+ ttsChunkList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getInitialPrompt()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAudioPassThru.KEY_BITS_PER_SAMPLE), cmd.getBitsPerSample().toString());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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 89afaa843..6ed75c104 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
@@ -31,173 +31,173 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PerformInteraction}
*/
public class PerformInteractionTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- PerformInteraction msg = new PerformInteraction();
-
- msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
- msg.setInteractionChoiceSetIDList(TestValues.GENERAL_INTEGER_LIST);
- msg.setInteractionLayout(TestValues.GENERAL_LAYOUTMODE);
- msg.setInitialText(TestValues.GENERAL_STRING);
- msg.setInteractionMode(TestValues.GENERAL_INTERACTIONMODE);
- msg.setTimeout(TestValues.GENERAL_INT);
- msg.setCancelID(TestValues.GENERAL_INTEGER);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PERFORM_INTERACTION.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PerformInteraction.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
- result.put(PerformInteraction.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
- result.put(PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
- result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, TestValues.GENERAL_LAYOUTMODE);
- result.put(PerformInteraction.KEY_INITIAL_TEXT, TestValues.GENERAL_STRING);
- result.put(PerformInteraction.KEY_INTERACTION_MODE, TestValues.GENERAL_INTERACTIONMODE);
- result.put(PerformInteraction.KEY_TIMEOUT, TestValues.GENERAL_INT);
- result.put(PerformInteraction.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ PerformInteraction msg = new PerformInteraction();
+
+ msg.setInitialPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
+ msg.setInteractionChoiceSetIDList(TestValues.GENERAL_INTEGER_LIST);
+ msg.setInteractionLayout(TestValues.GENERAL_LAYOUTMODE);
+ msg.setInitialText(TestValues.GENERAL_STRING);
+ msg.setInteractionMode(TestValues.GENERAL_INTERACTIONMODE);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformInteraction.KEY_INITIAL_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(PerformInteraction.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
+ result.put(PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
+ result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, TestValues.GENERAL_LAYOUTMODE);
+ result.put(PerformInteraction.KEY_INITIAL_TEXT, TestValues.GENERAL_STRING);
+ result.put(PerformInteraction.KEY_INTERACTION_MODE, TestValues.GENERAL_INTERACTIONMODE);
+ result.put(PerformInteraction.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(PerformInteraction.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<TTSChunk> testInitialPrompt = ( (PerformInteraction) msg).getInitialPrompt();
- List<TTSChunk> testHelpPrompt = ( (PerformInteraction) msg).getHelpPrompt();
- List<TTSChunk> testTimeoutPrompt = ( (PerformInteraction) msg).getTimeoutPrompt();
- List<VrHelpItem> testVrHelpItems = ( (PerformInteraction) msg).getVrHelp();
- List<Integer> testChoiceSetIds = ( (PerformInteraction) msg).getInteractionChoiceSetIDList();
- LayoutMode testLayout = ( (PerformInteraction) msg).getInteractionLayout();
- String testInitialText = ( (PerformInteraction) msg).getInitialText();
- InteractionMode testMode = ( (PerformInteraction) msg).getInteractionMode();
- Integer testTimeout = ( (PerformInteraction) msg).getTimeout();
- Integer testCancelID = ( (PerformInteraction) msg ).getCancelID();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeoutPrompt));
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testChoiceSetIds);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LAYOUTMODE, testLayout);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testInitialText);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTERACTIONMODE, testMode);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
-
- // Invald/Null Tests
- PerformInteraction msg = new PerformInteraction();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getInitialPrompt());
- assertNull(TestValues.NULL, msg.getHelpPrompt());
- assertNull(TestValues.NULL, msg.getTimeoutPrompt());
- assertNull(TestValues.NULL, msg.getVrHelp());
- assertNull(TestValues.NULL, msg.getInteractionChoiceSetIDList());
- assertNull(TestValues.NULL, msg.getInteractionLayout());
- assertNull(TestValues.NULL, msg.getInitialText());
- assertNull(TestValues.NULL, msg.getInteractionMode());
- assertNull(TestValues.NULL, msg.getTimeout());
- assertNull(TestValues.NULL, msg.getCancelID());
- }
+ public void testRpcValues() {
+ // Test Values
+ List<TTSChunk> testInitialPrompt = ((PerformInteraction) msg).getInitialPrompt();
+ List<TTSChunk> testHelpPrompt = ((PerformInteraction) msg).getHelpPrompt();
+ List<TTSChunk> testTimeoutPrompt = ((PerformInteraction) msg).getTimeoutPrompt();
+ List<VrHelpItem> testVrHelpItems = ((PerformInteraction) msg).getVrHelp();
+ List<Integer> testChoiceSetIds = ((PerformInteraction) msg).getInteractionChoiceSetIDList();
+ LayoutMode testLayout = ((PerformInteraction) msg).getInteractionLayout();
+ String testInitialText = ((PerformInteraction) msg).getInitialText();
+ InteractionMode testMode = ((PerformInteraction) msg).getInteractionMode();
+ Integer testTimeout = ((PerformInteraction) msg).getTimeout();
+ Integer testCancelID = ((PerformInteraction) msg).getCancelID();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeoutPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testChoiceSetIds);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LAYOUTMODE, testLayout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testInitialText);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTERACTIONMODE, testMode);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
+
+ // Invald/Null Tests
+ PerformInteraction msg = new PerformInteraction();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getInitialPrompt());
+ assertNull(TestValues.NULL, msg.getHelpPrompt());
+ assertNull(TestValues.NULL, msg.getTimeoutPrompt());
+ assertNull(TestValues.NULL, msg.getVrHelp());
+ assertNull(TestValues.NULL, msg.getInteractionChoiceSetIDList());
+ assertNull(TestValues.NULL, msg.getInteractionLayout());
+ assertNull(TestValues.NULL, msg.getInitialText());
+ assertNull(TestValues.NULL, msg.getInteractionMode());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getCancelID());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformInteraction cmd = new PerformInteraction(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
- assertEquals(TestValues.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();
- assertEquals(TestValues.MATCH, interactionIDList.size(), testIDList.size());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(interactionIDList, testIDList));
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_LAYOUT), cmd.getInteractionLayout().toString());
-
- JSONArray initalPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_PROMPT);
- List<TTSChunk> initalPromptList = new ArrayList<TTSChunk>();
- for (int index = 0; index < initalPromptArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)initalPromptArray.get(index)) );
- initalPromptList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(initalPromptList, cmd.getInitialPrompt()));
-
- JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_HELP_PROMPT);
- List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
- for (int index = 0; index < helpPromptArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)helpPromptArray.get(index)) );
- helpPromptList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
-
- JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT_PROMPT);
- List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
- for (int index = 0; index < timeoutPromptArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)timeoutPromptArray.get(index)) );
- timeoutPromptList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT), cmd.getTimeout());
-
- JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_VR_HELP);
- List<VrHelpItem> vrHelpList= new ArrayList<VrHelpItem>();
- for (int index = 0; index < vrHelpArray.length(); index++) {
- VrHelpItem vrHelpItem = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)vrHelpArray.get(index)) );
- vrHelpList.add(vrHelpItem);
- }
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()) );
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformInteraction cmd = new PerformInteraction(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
+ assertEquals(TestValues.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();
+ assertEquals(TestValues.MATCH, interactionIDList.size(), testIDList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(interactionIDList, testIDList));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_LAYOUT), cmd.getInteractionLayout().toString());
+
+ JSONArray initalPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_PROMPT);
+ List<TTSChunk> initalPromptList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < initalPromptArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) initalPromptArray.get(index)));
+ initalPromptList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(initalPromptList, cmd.getInitialPrompt()));
+
+ JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_HELP_PROMPT);
+ List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < helpPromptArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) helpPromptArray.get(index)));
+ helpPromptList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
+
+ JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT_PROMPT);
+ List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < timeoutPromptArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) timeoutPromptArray.get(index)));
+ timeoutPromptList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_TIMEOUT), cmd.getTimeout());
+
+ JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, PerformInteraction.KEY_VR_HELP);
+ List<VrHelpItem> vrHelpList = new ArrayList<VrHelpItem>();
+ for (int index = 0; index < vrHelpArray.length(); index++) {
+ VrHelpItem vrHelpItem = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject((JSONObject) vrHelpArray.get(index)));
+ vrHelpList.add(vrHelpItem);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
index e999cb6d1..2bdd7d613 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PublishAppServiceTests.java
@@ -26,93 +26,93 @@ import static junit.framework.TestCase.fail;
public class PublishAppServiceTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- PublishAppService msg = new PublishAppService();
- msg.setAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PUBLISH_APP_SERVICE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICEMANIFEST.getStore()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- AppServiceManifest copy = ( (PublishAppService) msg ).getAppServiceManifest();
-
- // Valid Tests
- assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, copy));
-
- // Invalid/Null Tests
- PublishAppService msg = new PublishAppService();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.MATCH, msg.getAppServiceManifest());
- }
-
- /**
- * Tests constructor with required params
- */
- @Test
- public void testRequiredParamsConstructor () {
-
- PublishAppService msg = new PublishAppService(TestValues.GENERAL_APPSERVICEMANIFEST);
- assertNotNull(TestValues.NOT_NULL, msg);
- // Valid Tests
- assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, msg.getAppServiceManifest()));
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PublishAppService cmd = new PublishAppService(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject appServiceManifestObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppService.KEY_APP_SERVICE_MANIFEST);
- AppServiceManifest manifestTest = new AppServiceManifest(JsonRPCMarshaller.deserializeJSONObject(appServiceManifestObject));
- assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest(manifestTest, cmd.getAppServiceManifest()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ PublishAppService msg = new PublishAppService();
+ msg.setAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PublishAppService.KEY_APP_SERVICE_MANIFEST, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICEMANIFEST.getStore()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ AppServiceManifest copy = ((PublishAppService) msg).getAppServiceManifest();
+
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, copy));
+
+ // Invalid/Null Tests
+ PublishAppService msg = new PublishAppService();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.MATCH, msg.getAppServiceManifest());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ @Test
+ public void testRequiredParamsConstructor() {
+
+ PublishAppService msg = new PublishAppService(TestValues.GENERAL_APPSERVICEMANIFEST);
+ assertNotNull(TestValues.NOT_NULL, msg);
+ // Valid Tests
+ assertTrue(Validator.validateAppServiceManifest(TestValues.GENERAL_APPSERVICEMANIFEST, msg.getAppServiceManifest()));
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PublishAppService cmd = new PublishAppService(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject appServiceManifestObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppService.KEY_APP_SERVICE_MANIFEST);
+ AppServiceManifest manifestTest = new AppServiceManifest(JsonRPCMarshaller.deserializeJSONObject(appServiceManifestObject));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceManifest(manifestTest, cmd.getAppServiceManifest()));
+ } 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/PutFileTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
index 0e3b39aab..9ca62481e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PutFileTests.java
@@ -24,136 +24,135 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PutFile}
*/
public class PutFileTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- PutFile msg = new PutFile();
-
- msg.setFileType(TestValues.GENERAL_FILETYPE);
- msg.setPersistentFile(TestValues.GENERAL_BOOLEAN);
- msg.setSystemFile(TestValues.GENERAL_BOOLEAN);
- msg.setOffset(TestValues.GENERAL_LONG);
- msg.setLength(TestValues.GENERAL_LONG);
- msg.setCRC(TestValues.GENERAL_BYTE_ARRAY);
- msg.setCRC(TestValues.GENERAL_LONG);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PUT_FILE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PutFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
- result.put(PutFile.KEY_PERSISTENT_FILE, TestValues.GENERAL_BOOLEAN);
- result.put(PutFile.KEY_SYSTEM_FILE, TestValues.GENERAL_BOOLEAN);
- result.put(PutFile.KEY_OFFSET, TestValues.GENERAL_LONG);
- result.put(PutFile.KEY_LENGTH, TestValues.GENERAL_LONG);
- result.put(PutFile.KEY_CRC, TestValues.GENERAL_LONG);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- FileType testFileType = ( (PutFile) msg ).getFileType();
- boolean testPersistentFile = ( (PutFile) msg ).getPersistentFile();
- boolean testSystemFile = ( (PutFile) msg ).getSystemFile();
- Long testOffset = ( (PutFile) msg ).getOffset();
- Long testLength = ( (PutFile) msg ).getLength();
- Long testCRC = ( (PutFile) msg ).getCRC();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, testFileType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPersistentFile);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testSystemFile);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testOffset);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testLength);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testCRC);
-
- // Invalid/Null Tests
- PutFile msg = new PutFile();
- assertNotNull("Null object creation failed.", msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getFileType());
- assertNull(TestValues.NULL, msg.getPersistentFile());
- assertNull(TestValues.NULL, msg.getSystemFile());
- assertNull(TestValues.NULL, msg.getOffset());
- assertNull(TestValues.NULL, msg.getLength());
- assertNull(TestValues.NULL, msg.getCRC());
- }
-
- /**
- * Tests the expected values of the CRC checksum.
- */
- @Test
- public void testByteArrayCheckSum () {
- // Test Values
- PutFile msgCRC = new PutFile();
- msgCRC.setCRC(TestValues.GENERAL_BYTE_ARRAY);
- Long testCRCByteArray = msgCRC.getCRC();
-
- CRC32 crc = new CRC32();
- crc.update(TestValues.GENERAL_BYTE_ARRAY);
- Long crcValue = crc.getValue();
-
- assertEquals(TestValues.MATCH, crcValue, testCRCByteArray);
- }
+ @Override
+ protected RPCMessage createMessage() {
+ PutFile msg = new PutFile();
+
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setPersistentFile(TestValues.GENERAL_BOOLEAN);
+ msg.setSystemFile(TestValues.GENERAL_BOOLEAN);
+ msg.setOffset(TestValues.GENERAL_LONG);
+ msg.setLength(TestValues.GENERAL_LONG);
+ msg.setCRC(TestValues.GENERAL_BYTE_ARRAY);
+ msg.setCRC(TestValues.GENERAL_LONG);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUT_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PutFile.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(PutFile.KEY_PERSISTENT_FILE, TestValues.GENERAL_BOOLEAN);
+ result.put(PutFile.KEY_SYSTEM_FILE, TestValues.GENERAL_BOOLEAN);
+ result.put(PutFile.KEY_OFFSET, TestValues.GENERAL_LONG);
+ result.put(PutFile.KEY_LENGTH, TestValues.GENERAL_LONG);
+ result.put(PutFile.KEY_CRC, TestValues.GENERAL_LONG);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ FileType testFileType = ((PutFile) msg).getFileType();
+ boolean testPersistentFile = ((PutFile) msg).getPersistentFile();
+ boolean testSystemFile = ((PutFile) msg).getSystemFile();
+ Long testOffset = ((PutFile) msg).getOffset();
+ Long testLength = ((PutFile) msg).getLength();
+ Long testCRC = ((PutFile) msg).getCRC();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, testFileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testPersistentFile);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testSystemFile);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testOffset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testLength);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, testCRC);
+
+ // Invalid/Null Tests
+ PutFile msg = new PutFile();
+ assertNotNull("Null object creation failed.", msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getPersistentFile());
+ assertNull(TestValues.NULL, msg.getSystemFile());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
+ assertNull(TestValues.NULL, msg.getCRC());
+ }
+
+ /**
+ * Tests the expected values of the CRC checksum.
+ */
+ @Test
+ public void testByteArrayCheckSum() {
+ // Test Values
+ PutFile msgCRC = new PutFile();
+ msgCRC.setCRC(TestValues.GENERAL_BYTE_ARRAY);
+ Long testCRCByteArray = msgCRC.getCRC();
+
+ CRC32 crc = new CRC32();
+ crc.update(TestValues.GENERAL_BYTE_ARRAY);
+ Long crcValue = crc.getValue();
+
+ assertEquals(TestValues.MATCH, crcValue, testCRCByteArray);
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PutFile cmd = new PutFile(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_PERSISTENT_FILE), cmd.getPersistentFile());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_SYSTEM_FILE), cmd.getSystemFile());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_FILE_TYPE), cmd.getFileType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
- assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_OFFSET).longValue(), cmd.getOffset());
- assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_LENGTH).longValue(), cmd.getLength());
- assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_CRC).longValue(), cmd.getCRC());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PutFile cmd = new PutFile(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_PERSISTENT_FILE), cmd.getPersistentFile());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, PutFile.KEY_SYSTEM_FILE), cmd.getSystemFile());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_FILE_TYPE), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PutFile.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_OFFSET).longValue(), cmd.getOffset());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_LENGTH).longValue(), cmd.getLength());
+ assertEquals(TestValues.MATCH, (Long) JsonUtils.readIntegerFromJsonObject(parameters, PutFile.KEY_CRC).longValue(), cmd.getCRC());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
index 7045f7434..761cfc304 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReadDidTests.java
@@ -25,95 +25,95 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ReadDID}
*/
public class ReadDidTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- ReadDID msg = new ReadDID();
-
- msg.setEcuName(TestValues.GENERAL_INT);
- msg.setDidLocation(TestValues.GENERAL_INTEGER_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.READ_DID.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(ReadDID.KEY_ECU_NAME, TestValues.GENERAL_INT);
- result.put(ReadDID.KEY_DID_LOCATION, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer testEcuName = ( (ReadDID) msg ).getEcuName();
- List<Integer> testDidLocation = ( (ReadDID) msg ).getDidLocation();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testEcuName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testDidLocation);
-
- // Invalid/Null Tests
- ReadDID msg = new ReadDID();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getEcuName());
- assertNull(TestValues.NULL, msg.getDidLocation());
- }
-
- /**
+
+ @Override
+ protected RPCMessage createMessage() {
+ ReadDID msg = new ReadDID();
+
+ msg.setEcuName(TestValues.GENERAL_INT);
+ msg.setDidLocation(TestValues.GENERAL_INTEGER_LIST);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.READ_DID.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ReadDID.KEY_ECU_NAME, TestValues.GENERAL_INT);
+ result.put(ReadDID.KEY_DID_LOCATION, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer testEcuName = ((ReadDID) msg).getEcuName();
+ List<Integer> testDidLocation = ((ReadDID) msg).getDidLocation();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testEcuName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testDidLocation);
+
+ // Invalid/Null Tests
+ ReadDID msg = new ReadDID();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getEcuName());
+ assertNull(TestValues.NULL, msg.getDidLocation());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ReadDID cmd = new ReadDID(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ReadDID.KEY_ECU_NAME), cmd.getEcuName());
-
- List<Integer> didLocationList = JsonUtils.readIntegerListFromJsonObject(parameters, ReadDID.KEY_DID_LOCATION);
- List<Integer> testLocationList = cmd.getDidLocation();
- assertEquals(TestValues.MATCH, didLocationList.size(), testLocationList.size());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(didLocationList, testLocationList));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReadDID cmd = new ReadDID(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ReadDID.KEY_ECU_NAME), cmd.getEcuName());
+
+ List<Integer> didLocationList = JsonUtils.readIntegerListFromJsonObject(parameters, ReadDID.KEY_DID_LOCATION);
+ List<Integer> testLocationList = cmd.getDidLocation();
+ assertEquals(TestValues.MATCH, didLocationList.size(), testLocationList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(didLocationList, testLocationList));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
index b61687bd7..a4957183b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/RegisterAppInterfaceTests.java
@@ -34,205 +34,205 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RegisterAppInterface}
*/
public class RegisterAppInterfaceTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- RegisterAppInterface msg = new RegisterAppInterface();
-
- msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
- msg.setAppName(TestValues.GENERAL_STRING);
- msg.setNgnMediaScreenAppName(TestValues.GENERAL_STRING);
- msg.setFullAppID(TestValues.GENERAL_FULL_APP_ID);
- msg.setLanguageDesired(TestValues.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguageDesired(TestValues.GENERAL_LANGUAGE);
- msg.setHashID(TestValues.GENERAL_STRING);
- msg.setTtsName(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setVrSynonyms(TestValues.GENERAL_STRING_LIST);
- msg.setAppHMIType(TestValues.GENERAL_APPHMITYPE_LIST);
- msg.setIsMediaApplication(TestValues.GENERAL_BOOLEAN);
- msg.setDeviceInfo(TestValues.GENERAL_DEVICEINFO);
- msg.setAppInfo(TestValues.GENERAL_APPINFO);
- msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
- msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.REGISTER_APP_INTERFACE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(RegisterAppInterface.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
- result.put(RegisterAppInterface.KEY_APP_NAME, TestValues.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME, TestValues.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_APP_ID, TestValues.GENERAL_APP_ID);
- result.put(RegisterAppInterface.KEY_FULL_APP_ID, TestValues.GENERAL_FULL_APP_ID);
- result.put(RegisterAppInterface.KEY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
- result.put(RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
- result.put(RegisterAppInterface.KEY_HASH_ID, TestValues.GENERAL_STRING);
- result.put(RegisterAppInterface.KEY_TTS_NAME, TestValues.JSON_TTSCHUNKS);
- result.put(RegisterAppInterface.KEY_VR_SYNONYMS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- result.put(RegisterAppInterface.KEY_APP_HMI_TYPE, JsonUtils.createJsonArrayOfJsonNames(TestValues.GENERAL_APPHMITYPE_LIST, SDL_VERSION_UNDER_TEST));
- result.put(RegisterAppInterface.KEY_IS_MEDIA_APPLICATION, TestValues.GENERAL_BOOLEAN);
- result.put(RegisterAppInterface.KEY_DEVICE_INFO, TestValues.JSON_DEVICEINFO);
- result.put(RegisterAppInterface.KEY_APP_INFO, TestValues.JSON_APPINFO);
- result.put(RegisterAppInterface.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
- result.put(RegisterAppInterface.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- SdlMsgVersion testVersion = ( (RegisterAppInterface) msg).getSdlMsgVersion();
- String testName = ( (RegisterAppInterface) msg).getAppName();
- String testNgnName = ( (RegisterAppInterface) msg).getNgnMediaScreenAppName();
- String testAppId = ( (RegisterAppInterface) msg).getAppID();
- String testFullAppId = ( (RegisterAppInterface) msg).getFullAppID();
- Language testLang = ( (RegisterAppInterface) msg).getLanguageDesired();
- Language testHmiLang = ( (RegisterAppInterface) msg).getHmiDisplayLanguageDesired();
- String testHashId = ( (RegisterAppInterface) msg).getHashID();
- List<TTSChunk> testTts = ( (RegisterAppInterface) msg).getTtsName();
- List<String> testSynonyms = ( (RegisterAppInterface) msg).getVrSynonyms();
- List<AppHMIType> testApps = ( (RegisterAppInterface) msg).getAppHMIType();
- Boolean testMedia = ( (RegisterAppInterface) msg).getIsMediaApplication();
- DeviceInfo testDeviceInfo = ( (RegisterAppInterface) msg).getDeviceInfo();
- AppInfo testAppInfo = ( (RegisterAppInterface) msg).getAppInfo();
- TemplateColorScheme testDayColorScheme = ( (RegisterAppInterface) msg).getDayColorScheme();
- TemplateColorScheme testNightColorScheme = ( (RegisterAppInterface) msg).getNightColorScheme();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testVersion));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNgnName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_APP_ID, testAppId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FULL_APP_ID, testFullAppId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testHashId);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTts));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, testSynonyms);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_APPHMITYPE_LIST, testApps);
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testMedia);
- assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(TestValues.GENERAL_DEVICEINFO, testDeviceInfo));
- assertTrue(TestValues.TRUE, Validator.validateAppInfo(TestValues.GENERAL_APPINFO, testAppInfo));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
-
- // Invalid/Null Tests
- RegisterAppInterface msg = new RegisterAppInterface();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSdlMsgVersion());
- assertNull(TestValues.NULL, msg.getAppName());
- assertNull(TestValues.NULL, msg.getNgnMediaScreenAppName());
- assertNull(TestValues.NULL, msg.getAppID());
- assertNull(TestValues.NULL, msg.getFullAppID());
- assertNull(TestValues.NULL, msg.getLanguageDesired());
- assertNull(TestValues.NULL, msg.getHmiDisplayLanguageDesired());
- assertNull(TestValues.NULL, msg.getHashID());
- assertNull(TestValues.NULL, msg.getTtsName());
- assertNull(TestValues.NULL, msg.getVrSynonyms());
- assertNull(TestValues.NULL, msg.getAppHMIType());
- assertNull(TestValues.NULL, msg.getIsMediaApplication());
- assertNull(TestValues.NULL, msg.getDeviceInfo());
- assertNull(TestValues.NULL, msg.getAppInfo());
- assertNull(TestValues.NULL, msg.getDayColorScheme());
- assertNull(TestValues.NULL, msg.getNightColorScheme());
- }
+ @Override
+ protected RPCMessage createMessage() {
+ RegisterAppInterface msg = new RegisterAppInterface();
+
+ msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setAppName(TestValues.GENERAL_STRING);
+ msg.setNgnMediaScreenAppName(TestValues.GENERAL_STRING);
+ msg.setFullAppID(TestValues.GENERAL_FULL_APP_ID);
+ msg.setLanguageDesired(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguageDesired(TestValues.GENERAL_LANGUAGE);
+ msg.setHashID(TestValues.GENERAL_STRING);
+ msg.setTtsName(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setVrSynonyms(TestValues.GENERAL_STRING_LIST);
+ msg.setAppHMIType(TestValues.GENERAL_APPHMITYPE_LIST);
+ msg.setIsMediaApplication(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceInfo(TestValues.GENERAL_DEVICEINFO);
+ msg.setAppInfo(TestValues.GENERAL_APPINFO);
+ msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.REGISTER_APP_INTERFACE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(RegisterAppInterface.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
+ result.put(RegisterAppInterface.KEY_APP_NAME, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_APP_ID, TestValues.GENERAL_APP_ID);
+ result.put(RegisterAppInterface.KEY_FULL_APP_ID, TestValues.GENERAL_FULL_APP_ID);
+ result.put(RegisterAppInterface.KEY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterface.KEY_HASH_ID, TestValues.GENERAL_STRING);
+ result.put(RegisterAppInterface.KEY_TTS_NAME, TestValues.JSON_TTSCHUNKS);
+ result.put(RegisterAppInterface.KEY_VR_SYNONYMS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(RegisterAppInterface.KEY_APP_HMI_TYPE, JsonUtils.createJsonArrayOfJsonNames(TestValues.GENERAL_APPHMITYPE_LIST, SDL_VERSION_UNDER_TEST));
+ result.put(RegisterAppInterface.KEY_IS_MEDIA_APPLICATION, TestValues.GENERAL_BOOLEAN);
+ result.put(RegisterAppInterface.KEY_DEVICE_INFO, TestValues.JSON_DEVICEINFO);
+ result.put(RegisterAppInterface.KEY_APP_INFO, TestValues.JSON_APPINFO);
+ result.put(RegisterAppInterface.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
+ result.put(RegisterAppInterface.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ SdlMsgVersion testVersion = ((RegisterAppInterface) msg).getSdlMsgVersion();
+ String testName = ((RegisterAppInterface) msg).getAppName();
+ String testNgnName = ((RegisterAppInterface) msg).getNgnMediaScreenAppName();
+ String testAppId = ((RegisterAppInterface) msg).getAppID();
+ String testFullAppId = ((RegisterAppInterface) msg).getFullAppID();
+ Language testLang = ((RegisterAppInterface) msg).getLanguageDesired();
+ Language testHmiLang = ((RegisterAppInterface) msg).getHmiDisplayLanguageDesired();
+ String testHashId = ((RegisterAppInterface) msg).getHashID();
+ List<TTSChunk> testTts = ((RegisterAppInterface) msg).getTtsName();
+ List<String> testSynonyms = ((RegisterAppInterface) msg).getVrSynonyms();
+ List<AppHMIType> testApps = ((RegisterAppInterface) msg).getAppHMIType();
+ Boolean testMedia = ((RegisterAppInterface) msg).getIsMediaApplication();
+ DeviceInfo testDeviceInfo = ((RegisterAppInterface) msg).getDeviceInfo();
+ AppInfo testAppInfo = ((RegisterAppInterface) msg).getAppInfo();
+ TemplateColorScheme testDayColorScheme = ((RegisterAppInterface) msg).getDayColorScheme();
+ TemplateColorScheme testNightColorScheme = ((RegisterAppInterface) msg).getNightColorScheme();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testVersion));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNgnName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APP_ID, testAppId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FULL_APP_ID, testFullAppId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testHashId);
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTts));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST, testSynonyms);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_APPHMITYPE_LIST, testApps);
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testMedia);
+ assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(TestValues.GENERAL_DEVICEINFO, testDeviceInfo));
+ assertTrue(TestValues.TRUE, Validator.validateAppInfo(TestValues.GENERAL_APPINFO, testAppInfo));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
+
+ // Invalid/Null Tests
+ RegisterAppInterface msg = new RegisterAppInterface();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSdlMsgVersion());
+ assertNull(TestValues.NULL, msg.getAppName());
+ assertNull(TestValues.NULL, msg.getNgnMediaScreenAppName());
+ assertNull(TestValues.NULL, msg.getAppID());
+ assertNull(TestValues.NULL, msg.getFullAppID());
+ assertNull(TestValues.NULL, msg.getLanguageDesired());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguageDesired());
+ assertNull(TestValues.NULL, msg.getHashID());
+ assertNull(TestValues.NULL, msg.getTtsName());
+ assertNull(TestValues.NULL, msg.getVrSynonyms());
+ assertNull(TestValues.NULL, msg.getAppHMIType());
+ assertNull(TestValues.NULL, msg.getIsMediaApplication());
+ assertNull(TestValues.NULL, msg.getDeviceInfo());
+ assertNull(TestValues.NULL, msg.getAppInfo());
+ assertNull(TestValues.NULL, msg.getDayColorScheme());
+ assertNull(TestValues.NULL, msg.getNightColorScheme());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- RegisterAppInterface cmd = new RegisterAppInterface(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- JSONArray ttsNameArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_TTS_NAME);
- List<TTSChunk> ttsNameList = new ArrayList<TTSChunk>();
- for (int index = 0; index < ttsNameArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsNameArray.get(index)) );
- ttsNameList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsNameList, cmd.getTtsName()));
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED), cmd.getHmiDisplayLanguageDesired().toString());
-
- JSONArray appHmiTypeArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_APP_HMI_TYPE);
- for (int index = 0; index < appHmiTypeArray.length(); index++) {
- AppHMIType appHmiTypeItem = AppHMIType.valueForString( appHmiTypeArray.get(index).toString() );
- assertEquals(TestValues.MATCH, appHmiTypeItem, cmd.getAppHMIType().get(index) );
- }
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_ID), cmd.getAppID());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_FULL_APP_ID), cmd.getFullAppID());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_LANGUAGE_DESIRED), cmd.getLanguageDesired().toString());
-
- JSONObject deviceInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DEVICE_INFO);
- DeviceInfo deviceInfo = new DeviceInfo(JsonRPCMarshaller.deserializeJSONObject(deviceInfoObj));
- assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(deviceInfo, cmd.getDeviceInfo()) );
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_NAME), cmd.getAppName());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());
-
- JSONObject appInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_APP_INFO);
- AppInfo appInfo = new AppInfo(JsonRPCMarshaller.deserializeJSONObject(appInfoObj));
- assertTrue(TestValues.TRUE, Validator.validateAppInfo(appInfo, cmd.getAppInfo()));
-
- List<String> vrSynonymsList = JsonUtils.readStringListFromJsonObject(parameters, RegisterAppInterface.KEY_VR_SYNONYMS);
- List<String> testSynonymsList = cmd.getVrSynonyms();
- assertEquals(TestValues.MATCH, vrSynonymsList.size(), testSynonymsList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(vrSynonymsList, testSynonymsList));
-
- JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_SDL_MSG_VERSION);
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
- assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HASH_ID), cmd.getHashID());
-
- JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
- TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
-
- JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
- TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ RegisterAppInterface cmd = new RegisterAppInterface(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ JSONArray ttsNameArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_TTS_NAME);
+ List<TTSChunk> ttsNameList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < ttsNameArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsNameArray.get(index)));
+ ttsNameList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsNameList, cmd.getTtsName()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HMI_DISPLAY_LANGUAGE_DESIRED), cmd.getHmiDisplayLanguageDesired().toString());
+
+ JSONArray appHmiTypeArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterface.KEY_APP_HMI_TYPE);
+ for (int index = 0; index < appHmiTypeArray.length(); index++) {
+ AppHMIType appHmiTypeItem = AppHMIType.valueForString(appHmiTypeArray.get(index).toString());
+ assertEquals(TestValues.MATCH, appHmiTypeItem, cmd.getAppHMIType().get(index));
+ }
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_ID), cmd.getAppID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_FULL_APP_ID), cmd.getFullAppID());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_LANGUAGE_DESIRED), cmd.getLanguageDesired().toString());
+
+ JSONObject deviceInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DEVICE_INFO);
+ DeviceInfo deviceInfo = new DeviceInfo(JsonRPCMarshaller.deserializeJSONObject(deviceInfoObj));
+ assertTrue(TestValues.TRUE, Validator.validateDeviceInfo(deviceInfo, cmd.getDeviceInfo()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_APP_NAME), cmd.getAppName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_NGN_MEDIA_SCREEN_APP_NAME), cmd.getNgnMediaScreenAppName());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterface.KEY_IS_MEDIA_APPLICATION), cmd.getIsMediaApplication());
+
+ JSONObject appInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_APP_INFO);
+ AppInfo appInfo = new AppInfo(JsonRPCMarshaller.deserializeJSONObject(appInfoObj));
+ assertTrue(TestValues.TRUE, Validator.validateAppInfo(appInfo, cmd.getAppInfo()));
+
+ List<String> vrSynonymsList = JsonUtils.readStringListFromJsonObject(parameters, RegisterAppInterface.KEY_VR_SYNONYMS);
+ List<String> testSynonymsList = cmd.getVrSynonyms();
+ assertEquals(TestValues.MATCH, vrSynonymsList.size(), testSynonymsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(vrSynonymsList, testSynonymsList));
+
+ JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_SDL_MSG_VERSION);
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterface.KEY_HASH_ID), cmd.getHashID());
+
+ JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
+ TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()));
+
+ JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterface.KEY_DAY_COLOR_SCHEME);
+ TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()));
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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
index 840eb246d..0514fa8cf 100644
--- 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
@@ -24,75 +24,75 @@ import static junit.framework.TestCase.fail;
public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
- msg.setModuleType(TestValues.GENERAL_MODULETYPE);
- msg.setModuleId(TestValues.GENERAL_STRING);
- return msg;
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
- try {
- result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
- result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, TestValues.GENERAL_STRING);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- return result;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Test
- public void testRpcValues() {
- ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
- String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
-
- //valid tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
-
- //null tests
- ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
- assertNull(TestValues.NULL, msg.getModuleType());
- assertNull(TestValues.NULL, msg.getModuleId());
-
- // required param tests
- ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(TestValues.GENERAL_MODULETYPE);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
- }
-
- @Test
- public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ msg.setModuleType(TestValues.GENERAL_MODULETYPE);
+ msg.setModuleId(TestValues.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, TestValues.GENERAL_MODULETYPE);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Test
+ public void testRpcValues() {
+ ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
+ String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
+
+ //valid tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, type);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, id);
+
+ //null tests
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ assertNull(TestValues.NULL, msg.getModuleType());
+ assertNull(TestValues.NULL, msg.getModuleId());
+
+ // required param tests
+ ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(TestValues.GENERAL_MODULETYPE);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MODULETYPE, msg2.getModuleType());
+ }
+
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
index 3a2f6eeb4..71351c611 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ResetGlobalPropertiesTests.java
@@ -25,93 +25,93 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ResetGlobalProperties}
*/
public class ResetGlobalPropertiesTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ResetGlobalProperties msg = new ResetGlobalProperties();
-
- msg.setProperties(TestValues.GENERAL_GLOBALPROPERTY_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.RESET_GLOBAL_PROPERTIES.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(ResetGlobalProperties.KEY_PROPERTIES, JsonUtils.createJsonArray(TestValues.GENERAL_GLOBALPROPERTY_LIST));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- List<GlobalProperty> copy = ( (ResetGlobalProperties) msg ).getProperties();
-
- // Valid Tests
+ @Override
+ protected RPCMessage createMessage() {
+ ResetGlobalProperties msg = new ResetGlobalProperties();
+
+ msg.setProperties(TestValues.GENERAL_GLOBALPROPERTY_LIST);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RESET_GLOBAL_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ResetGlobalProperties.KEY_PROPERTIES, JsonUtils.createJsonArray(TestValues.GENERAL_GLOBALPROPERTY_LIST));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<GlobalProperty> copy = ((ResetGlobalProperties) msg).getProperties();
+
+ // Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_GLOBALPROPERTY_LIST.size(), copy.size());
- for(int i = 0; i < TestValues.GENERAL_GLOBALPROPERTY_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_GLOBALPROPERTY_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_GLOBALPROPERTY_LIST.get(i), copy.get(i));
}
-
+
// Invalid/Null Tests
- ResetGlobalProperties msg = new ResetGlobalProperties();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
+ ResetGlobalProperties msg = new ResetGlobalProperties();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
- assertNull(TestValues.NULL, msg.getProperties());
- }
+ assertNull(TestValues.NULL, msg.getProperties());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ResetGlobalProperties cmd = new ResetGlobalProperties(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONArray propertiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ResetGlobalProperties.KEY_PROPERTIES);
- for (int index = 0; index < propertiesArray.length(); index++) {
- GlobalProperty property = GlobalProperty.valueOf(propertiesArray.get(index).toString());
- assertEquals(TestValues.MATCH, property, cmd.getProperties().get(index));
- }
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ResetGlobalProperties cmd = new ResetGlobalProperties(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONArray propertiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ResetGlobalProperties.KEY_PROPERTIES);
+ for (int index = 0; index < propertiesArray.length(); index++) {
+ GlobalProperty property = GlobalProperty.valueOf(propertiesArray.get(index).toString());
+ assertEquals(TestValues.MATCH, property, cmd.getProperties().get(index));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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 40d4eb33e..e18fb5896 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
@@ -28,114 +28,114 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ScrollableMessage}
*/
public class ScrollableMessageTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- ScrollableMessage msg = new ScrollableMessage();
-
- msg.setTimeout(TestValues.GENERAL_INT);
- msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
- msg.setScrollableMessageBody(TestValues.GENERAL_STRING);
- msg.setCancelID(TestValues.GENERAL_INTEGER);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SCROLLABLE_MESSAGE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, TestValues.GENERAL_STRING);
- result.put(ScrollableMessage.KEY_TIMEOUT, TestValues.GENERAL_INT);
- result.put(ScrollableMessage.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
- result.put(ScrollableMessage.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String testBody = ( (ScrollableMessage) msg ).getScrollableMessageBody();
- Integer testTimeout = ( (ScrollableMessage) msg ).getTimeout();
- List<SoftButton> testSoftButtons = ( (ScrollableMessage) msg ).getSoftButtons();
- Integer testCancelID = ( (ScrollableMessage) msg ).getCancelID();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testBody);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.size(), testSoftButtons.size());
- for (int i = 0; i < TestValues.GENERAL_SOFTBUTTON_LIST.size(); i++) {
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
- }
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
-
- // Invalid/Null Tests
- ScrollableMessage msg = new ScrollableMessage();
- assertNotNull(TestValues.NOT_NULL, msg);
-
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getScrollableMessageBody());
- assertNull(TestValues.NULL, msg.getTimeout());
- assertNull(TestValues.NULL, msg.getSoftButtons());
- assertNull(TestValues.NULL, msg.getCancelID());
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ ScrollableMessage msg = new ScrollableMessage();
+
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setScrollableMessageBody(TestValues.GENERAL_STRING);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SCROLLABLE_MESSAGE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, TestValues.GENERAL_STRING);
+ result.put(ScrollableMessage.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(ScrollableMessage.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String testBody = ((ScrollableMessage) msg).getScrollableMessageBody();
+ Integer testTimeout = ((ScrollableMessage) msg).getTimeout();
+ List<SoftButton> testSoftButtons = ((ScrollableMessage) msg).getSoftButtons();
+ Integer testCancelID = ((ScrollableMessage) msg).getCancelID();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testBody);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.size(), testSoftButtons.size());
+ for (int i = 0; i < TestValues.GENERAL_SOFTBUTTON_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
+ }
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
+
+ // Invalid/Null Tests
+ ScrollableMessage msg = new ScrollableMessage();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getScrollableMessageBody());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getCancelID());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ScrollableMessage cmd = new ScrollableMessage(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
- assertEquals(TestValues.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>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ScrollableMessage cmd = new ScrollableMessage(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(TestValues.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>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
index 090818308..e31ab22bf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
@@ -26,67 +26,67 @@ import static junit.framework.TestCase.assertNull;
public class SendHapticDataTests extends BaseRpcTests {
- private SendHapticData msg;
-
- @Override
- protected RPCMessage createMessage(){
- msg = new SendHapticData();
-
- List<HapticRect> list = new ArrayList<>();
- list.add(TestValues.GENERAL_HAPTIC_RECT);
-
- msg.setHapticRectData(list);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.SEND_HAPTIC_DATA.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- JSONArray jsonArray = new JSONArray();
- try {
- jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HAPTIC_RECT.getStore()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- try {
- result.put(SendHapticData.KEY_HAPTIC_RECT_DATA, jsonArray);
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- List<HapticRect> list = msg.getHapticRectData();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_HAPTIC_RECT, list.get(0));
-
- // Invalid/Null Tests
- SendHapticData msg = new SendHapticData();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getHapticRectData());
- }
+ private SendHapticData msg;
+
+ @Override
+ protected RPCMessage createMessage() {
+ msg = new SendHapticData();
+
+ List<HapticRect> list = new ArrayList<>();
+ list.add(TestValues.GENERAL_HAPTIC_RECT);
+
+ msg.setHapticRectData(list);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SEND_HAPTIC_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ JSONArray jsonArray = new JSONArray();
+ try {
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_HAPTIC_RECT.getStore()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ result.put(SendHapticData.KEY_HAPTIC_RECT_DATA, jsonArray);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<HapticRect> list = msg.getHapticRectData();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HAPTIC_RECT, list.get(0));
+
+ // Invalid/Null Tests
+ SendHapticData msg = new SendHapticData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getHapticRectData());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
index 14867c7f6..0120d8279 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendLocationTests.java
@@ -26,81 +26,81 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SendLocation}
*/
public class SendLocationTests extends BaseRpcTests {
-
+
@Override
- protected RPCMessage createMessage(){
- SendLocation msg = new SendLocation();
-
- msg.setLatitudeDegrees(TestValues.GENERAL_DOUBLE);
- msg.setLongitudeDegrees(TestValues.GENERAL_DOUBLE);
- msg.setLocationName(TestValues.GENERAL_STRING);
- msg.setLocationDescription(TestValues.GENERAL_STRING);
- msg.setPhoneNumber(TestValues.GENERAL_STRING);
- msg.setAddressLines(TestValues.GENERAL_STRING_LIST);
- msg.setLocationImage(TestValues.GENERAL_IMAGE);
-
- return msg;
+ protected RPCMessage createMessage() {
+ SendLocation msg = new SendLocation();
+
+ msg.setLatitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setLongitudeDegrees(TestValues.GENERAL_DOUBLE);
+ msg.setLocationName(TestValues.GENERAL_STRING);
+ msg.setLocationDescription(TestValues.GENERAL_STRING);
+ msg.setPhoneNumber(TestValues.GENERAL_STRING);
+ msg.setAddressLines(TestValues.GENERAL_STRING_LIST);
+ msg.setLocationImage(TestValues.GENERAL_IMAGE);
+
+ return msg;
}
-
+
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
-
+
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SEND_LOCATION.toString();
}
-
+
@Override
- protected JSONObject getExpectedParameters (int sdlVersion){
- JSONObject result = new JSONObject();
-
- try {
- result.put(SendLocation.KEY_LAT_DEGREES, TestValues.GENERAL_DOUBLE);
- result.put(SendLocation.KEY_LON_DEGREES, TestValues.GENERAL_DOUBLE);
- result.put(SendLocation.KEY_LOCATION_NAME, TestValues.GENERAL_STRING);
- result.put(SendLocation.KEY_LOCATION_DESCRIPTION, TestValues.GENERAL_STRING);
- result.put(SendLocation.KEY_PHONE_NUMBER, TestValues.GENERAL_STRING);
- result.put(SendLocation.KEY_LOCATION_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
- result.put(SendLocation.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SendLocation.KEY_LAT_DEGREES, TestValues.GENERAL_DOUBLE);
+ result.put(SendLocation.KEY_LON_DEGREES, TestValues.GENERAL_DOUBLE);
+ result.put(SendLocation.KEY_LOCATION_NAME, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_LOCATION_DESCRIPTION, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_PHONE_NUMBER, TestValues.GENERAL_STRING);
+ result.put(SendLocation.KEY_LOCATION_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
+ result.put(SendLocation.KEY_ADDRESS_LINES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
-
- return result;
+
+ return result;
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- Double latitude = ((SendLocation) msg).getLatitudeDegrees();
+ public void testRpcValues() {
+ // Test Values
+ Double latitude = ((SendLocation) msg).getLatitudeDegrees();
Double longitude = ((SendLocation) msg).getLongitudeDegrees();
String locationName = ((SendLocation) msg).getLocationName();
- String locationDesc = ((SendLocation) msg).getLocationDescription();
- String phoneNumber = ((SendLocation) msg).getPhoneNumber();
- List<String> addressLines = ((SendLocation) msg).getAddressLines();
- Image locationImage = ((SendLocation) msg).getLocationImage();
-
- // Valid Tests
+ String locationDesc = ((SendLocation) msg).getLocationDescription();
+ String phoneNumber = ((SendLocation) msg).getPhoneNumber();
+ List<String> addressLines = ((SendLocation) msg).getAddressLines();
+ Image locationImage = ((SendLocation) msg).getLocationImage();
+
+ // Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, longitude);
assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, latitude);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationDesc);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationName);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, phoneNumber);
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, addressLines));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, locationImage));
-
- // Invalid/Null Tests
- SendLocation msg = new SendLocation();
- assertNotNull(TestValues.NOT_NULL, msg);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationDesc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, locationName);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, phoneNumber);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, addressLines));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, locationImage));
+
+ // Invalid/Null Tests
+ SendLocation msg = new SendLocation();
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
assertNull(TestValues.NULL, msg.getLatitudeDegrees());
@@ -116,40 +116,40 @@ public class SendLocationTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull("Command object is null", commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SendLocation cmd = new SendLocation(hash);
- assertNotNull(TestValues.NOT_NULL, cmd);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LAT_DEGREES), cmd.getLatitudeDegrees());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LON_DEGREES), cmd.getLongitudeDegrees());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_NAME), cmd.getLocationName());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_DESCRIPTION), cmd.getLocationDescription());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_PHONE_NUMBER), cmd.getPhoneNumber());
-
- List<String> addressList = JsonUtils.readStringListFromJsonObject(parameters, SendLocation.KEY_ADDRESS_LINES);
- List<String> testList = cmd.getAddressLines();
- assertEquals(TestValues.MATCH, addressList.size(), testList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(addressList, testList));
-
- JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SendLocation.KEY_LOCATION_IMAGE);
- Image reference = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(reference, cmd.getLocationImage()));
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull("Command object is null", commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SendLocation cmd = new SendLocation(hash);
+ assertNotNull(TestValues.NOT_NULL, cmd);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LAT_DEGREES), cmd.getLatitudeDegrees());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, SendLocation.KEY_LON_DEGREES), cmd.getLongitudeDegrees());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_NAME), cmd.getLocationName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_LOCATION_DESCRIPTION), cmd.getLocationDescription());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SendLocation.KEY_PHONE_NUMBER), cmd.getPhoneNumber());
+
+ List<String> addressList = JsonUtils.readStringListFromJsonObject(parameters, SendLocation.KEY_ADDRESS_LINES);
+ List<String> testList = cmd.getAddressLines();
+ assertEquals(TestValues.MATCH, addressList.size(), testList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(addressList, testList));
+
+ JSONObject cmdIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SendLocation.KEY_LOCATION_IMAGE);
+ Image reference = new Image(JsonRPCMarshaller.deserializeJSONObject(cmdIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(reference, cmd.getLocationImage()));
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
index 2b47f7837..7430f4174 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetAppIconTests.java
@@ -22,86 +22,86 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetAppIcon}
*/
public class SetAppIconTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- SetAppIcon msg = new SetAppIcon();
-
- msg.setSdlFileName(TestValues.GENERAL_STRING);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SET_APP_ICON.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SetAppIcon.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String copy = ( (SetAppIcon) msg ).getSdlFileName();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
-
- // Invalid/Null Tests
- SetAppIcon msg = new SetAppIcon();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSdlFileName());
- }
+ @Override
+ protected RPCMessage createMessage() {
+ SetAppIcon msg = new SetAppIcon();
+
+ msg.setSdlFileName(TestValues.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SET_APP_ICON.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SetAppIcon.KEY_SDL_FILE_NAME, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String copy = ((SetAppIcon) msg).getSdlFileName();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
+
+ // Invalid/Null Tests
+ SetAppIcon msg = new SetAppIcon();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSdlFileName());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetAppIcon cmd = new SetAppIcon(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetAppIcon.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetAppIcon cmd = new SetAppIcon(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetAppIcon.KEY_SDL_FILE_NAME), cmd.getSdlFileName());
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
index 2db06fa01..fb71fda20 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
@@ -14,7 +14,7 @@ import static junit.framework.TestCase.fail;
public class SetCloudAppPropertiesTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
SetCloudAppProperties msg = new SetCloudAppProperties();
msg.setProperties(TestValues.GENERAL_CLOUDAPPPROPERTIES);
@@ -23,22 +23,22 @@ public class SetCloudAppPropertiesTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_CLOUD_APP_PROPERTIES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(SetCloudAppProperties.KEY_PROPERTIES, TestValues.GENERAL_CLOUDAPPPROPERTIES.serializeJSON());
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
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 f5a080295..97607f56c 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
@@ -26,106 +26,106 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetDisplayLayout}
*/
public class SetDisplayLayoutTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SetDisplayLayout msg = new SetDisplayLayout();
-
- msg.setDisplayLayout(TestValues.GENERAL_STRING);
- msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
- msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SET_DISPLAY_LAYOUT.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SetDisplayLayout.KEY_DISPLAY_LAYOUT, TestValues.GENERAL_STRING);
- result.put(SetDisplayLayout.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
- result.put(SetDisplayLayout.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String testDisplayLayout = ( (SetDisplayLayout) msg ).getDisplayLayout();
- TemplateColorScheme testDayColorScheme = ( (SetDisplayLayout) msg).getDayColorScheme();
- TemplateColorScheme testNightColorScheme = ( (SetDisplayLayout) msg).getNightColorScheme();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testDisplayLayout);
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
-
- // Invalid/Null Tests
- SetDisplayLayout msg = new SetDisplayLayout();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getDisplayLayout());
- assertNull(TestValues.NULL, msg.getDayColorScheme());
- assertNull(TestValues.NULL, msg.getNightColorScheme());
- }
-
- /**
+
+ @Override
+ protected RPCMessage createMessage() {
+ SetDisplayLayout msg = new SetDisplayLayout();
+
+ msg.setDisplayLayout(TestValues.GENERAL_STRING);
+ msg.setDayColorScheme(TestValues.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SET_DISPLAY_LAYOUT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SetDisplayLayout.KEY_DISPLAY_LAYOUT, TestValues.GENERAL_STRING);
+ result.put(SetDisplayLayout.KEY_DAY_COLOR_SCHEME, TestValues.JSON_DAYCOLORSCHEME);
+ result.put(SetDisplayLayout.KEY_NIGHT_COLOR_SCHEME, TestValues.JSON_NIGHTCOLORSCHEME);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String testDisplayLayout = ((SetDisplayLayout) msg).getDisplayLayout();
+ TemplateColorScheme testDayColorScheme = ((SetDisplayLayout) msg).getDayColorScheme();
+ TemplateColorScheme testNightColorScheme = ((SetDisplayLayout) msg).getNightColorScheme();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testDisplayLayout);
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_DAYCOLORSCHEME, testDayColorScheme));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(TestValues.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme));
+
+ // Invalid/Null Tests
+ SetDisplayLayout msg = new SetDisplayLayout();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getDisplayLayout());
+ assertNull(TestValues.NULL, msg.getDayColorScheme());
+ assertNull(TestValues.NULL, msg.getNightColorScheme());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetDisplayLayout cmd = new SetDisplayLayout(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.MATCH, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetDisplayLayout.KEY_DISPLAY_LAYOUT), cmd.getDisplayLayout());
-
-
- JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
- TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()) );
-
- JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
- TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
- assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()) );
-
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetDisplayLayout cmd = new SetDisplayLayout(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.MATCH, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetDisplayLayout.KEY_DISPLAY_LAYOUT), cmd.getDisplayLayout());
+
+
+ JSONObject dayColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
+ TemplateColorScheme dayColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(dayColorSchemeObj));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(dayColorScheme, cmd.getDayColorScheme()));
+
+ JSONObject nightColorSchemeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayout.KEY_DAY_COLOR_SCHEME);
+ TemplateColorScheme nightColorScheme = new TemplateColorScheme(JsonRPCMarshaller.deserializeJSONObject(nightColorSchemeObj));
+ assertTrue(TestValues.TRUE, Validator.validateTemplateColorScheme(nightColorScheme, cmd.getDayColorScheme()));
+
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
index abf889104..849ed07dc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
@@ -32,155 +32,155 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetGlobalProperties}
*/
public class SetGlobalPropertiesTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SetGlobalProperties msg = new SetGlobalProperties();
-
- msg.setVrHelpTitle(TestValues.GENERAL_STRING);
- msg.setMenuTitle(TestValues.GENERAL_STRING);
- msg.setMenuIcon(TestValues.GENERAL_IMAGE);
- msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
- msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
- msg.setKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES);
- msg.setMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SET_GLOBAL_PROPERTIES.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SetGlobalProperties.KEY_MENU_ICON, TestValues.JSON_IMAGE);
- result.put(SetGlobalProperties.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
- result.put(SetGlobalProperties.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
- result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
- result.put(SetGlobalProperties.KEY_MENU_TITLE, TestValues.GENERAL_STRING);
- result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, TestValues.GENERAL_STRING);
- result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, TestValues.JSON_KEYBOARDPROPERTIES);
- result.put(SetGlobalProperties.KEY_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Image testImage = ( (SetGlobalProperties) msg ).getMenuIcon();
- String testVrHelpTitle = ( (SetGlobalProperties) msg ).getVrHelpTitle();
- String testMenuTitle = ( (SetGlobalProperties) msg ).getMenuTitle();
- List<TTSChunk> testHelpPrompt = ( (SetGlobalProperties) msg ).getHelpPrompt();
- List<TTSChunk> testTimeout = ( (SetGlobalProperties) msg ).getTimeoutPrompt();
- List<VrHelpItem> testVrHelpItems = ( (SetGlobalProperties) msg ).getVrHelp();
- KeyboardProperties testKeyboardProperties = ( (SetGlobalProperties) msg ).getKeyboardProperties();
- MenuLayout testMenuLayout = ( (SetGlobalProperties) msg ).getMenuLayout();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testMenuTitle);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testVrHelpTitle);
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeout));
- assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT, testMenuLayout);
-
- // Invalid/Null Tests
- SetGlobalProperties msg = new SetGlobalProperties();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getMenuIcon());
- assertNull(TestValues.NULL, msg.getMenuTitle());
- assertNull(TestValues.NULL, msg.getVrHelp());
- assertNull(TestValues.NULL, msg.getHelpPrompt());
- assertNull(TestValues.NULL, msg.getTimeoutPrompt());
- assertNull(TestValues.NULL, msg.getKeyboardProperties());
- assertNull(TestValues.NULL, msg.getVrHelpTitle());
- assertNull(TestValues.NULL, msg.getMenuLayout());
- }
-
- /**
+
+ @Override
+ protected RPCMessage createMessage() {
+ SetGlobalProperties msg = new SetGlobalProperties();
+
+ msg.setVrHelpTitle(TestValues.GENERAL_STRING);
+ msg.setMenuTitle(TestValues.GENERAL_STRING);
+ msg.setMenuIcon(TestValues.GENERAL_IMAGE);
+ msg.setVrHelp(TestValues.GENERAL_VRHELPITEM_LIST);
+ msg.setHelpPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setTimeoutPrompt(TestValues.GENERAL_TTSCHUNK_LIST);
+ msg.setKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES);
+ msg.setMenuLayout(TestValues.GENERAL_MENU_LAYOUT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SET_GLOBAL_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SetGlobalProperties.KEY_MENU_ICON, TestValues.JSON_IMAGE);
+ result.put(SetGlobalProperties.KEY_VR_HELP, TestValues.JSON_VRHELPITEMS);
+ result.put(SetGlobalProperties.KEY_HELP_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, TestValues.JSON_TTSCHUNKS);
+ result.put(SetGlobalProperties.KEY_MENU_TITLE, TestValues.GENERAL_STRING);
+ result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, TestValues.GENERAL_STRING);
+ result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, TestValues.JSON_KEYBOARDPROPERTIES);
+ result.put(SetGlobalProperties.KEY_MENU_LAYOUT, TestValues.GENERAL_MENU_LAYOUT);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Image testImage = ((SetGlobalProperties) msg).getMenuIcon();
+ String testVrHelpTitle = ((SetGlobalProperties) msg).getVrHelpTitle();
+ String testMenuTitle = ((SetGlobalProperties) msg).getMenuTitle();
+ List<TTSChunk> testHelpPrompt = ((SetGlobalProperties) msg).getHelpPrompt();
+ List<TTSChunk> testTimeout = ((SetGlobalProperties) msg).getTimeoutPrompt();
+ List<VrHelpItem> testVrHelpItems = ((SetGlobalProperties) msg).getVrHelp();
+ KeyboardProperties testKeyboardProperties = ((SetGlobalProperties) msg).getKeyboardProperties();
+ MenuLayout testMenuLayout = ((SetGlobalProperties) msg).getMenuLayout();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testMenuTitle);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testVrHelpTitle);
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testImage));
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(TestValues.GENERAL_VRHELPITEM_LIST, testVrHelpItems));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, testTimeout));
+ assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(TestValues.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_MENU_LAYOUT, testMenuLayout);
+
+ // Invalid/Null Tests
+ SetGlobalProperties msg = new SetGlobalProperties();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getMenuIcon());
+ assertNull(TestValues.NULL, msg.getMenuTitle());
+ assertNull(TestValues.NULL, msg.getVrHelp());
+ assertNull(TestValues.NULL, msg.getHelpPrompt());
+ assertNull(TestValues.NULL, msg.getTimeoutPrompt());
+ assertNull(TestValues.NULL, msg.getKeyboardProperties());
+ assertNull(TestValues.NULL, msg.getVrHelpTitle());
+ assertNull(TestValues.NULL, msg.getMenuLayout());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetGlobalProperties cmd = new SetGlobalProperties(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle());
-
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout());
-
- JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_ICON);
- Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
-
- JSONObject keyboardProperties = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_KEYBOARD_PROPERTIES);
- KeyboardProperties referenceKeyboardProperties = new KeyboardProperties(JsonRPCMarshaller.deserializeJSONObject(keyboardProperties));
- assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(referenceKeyboardProperties, cmd.getKeyboardProperties()));
-
- JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_HELP_PROMPT);
- List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
- for (int index = 0; index < helpPromptArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)helpPromptArray.get(index)) );
- helpPromptList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
-
- JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_TIMEOUT_PROMPT);
- List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
- for (int index = 0; index < timeoutPromptArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)timeoutPromptArray.get(index)) );
- timeoutPromptList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
-
- JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP);
- List<VrHelpItem> vrHelpList = new ArrayList<VrHelpItem>();
- for (int index = 0; index < vrHelpArray.length(); index++) {
- VrHelpItem chunk = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)vrHelpArray.get(index)) );
- vrHelpList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetGlobalProperties cmd = new SetGlobalProperties(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle());
+
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout());
+
+ JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_ICON);
+ Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
+
+ JSONObject keyboardProperties = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_KEYBOARD_PROPERTIES);
+ KeyboardProperties referenceKeyboardProperties = new KeyboardProperties(JsonRPCMarshaller.deserializeJSONObject(keyboardProperties));
+ assertTrue(TestValues.TRUE, Validator.validateKeyboardProperties(referenceKeyboardProperties, cmd.getKeyboardProperties()));
+
+ JSONArray helpPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_HELP_PROMPT);
+ List<TTSChunk> helpPromptList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < helpPromptArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) helpPromptArray.get(index)));
+ helpPromptList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(helpPromptList, cmd.getHelpPrompt()));
+
+ JSONArray timeoutPromptArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_TIMEOUT_PROMPT);
+ List<TTSChunk> timeoutPromptList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < timeoutPromptArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) timeoutPromptArray.get(index)));
+ timeoutPromptList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(timeoutPromptList, cmd.getTimeoutPrompt()));
+
+ JSONArray vrHelpArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP);
+ List<VrHelpItem> vrHelpList = new ArrayList<VrHelpItem>();
+ for (int index = 0; index < vrHelpArray.length(); index++) {
+ VrHelpItem chunk = new VrHelpItem(JsonRPCMarshaller.deserializeJSONObject((JSONObject) vrHelpArray.get(index)));
+ vrHelpList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(vrHelpList, cmd.getVrHelp()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
index 727b9e209..73a3f82e9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
@@ -31,7 +31,7 @@ import static junit.framework.TestCase.fail;
public class SetInteriorVehicleDataTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
SetInteriorVehicleData msg = new SetInteriorVehicleData();
msg.setModuleData(TestValues.GENERAL_MODULEDATA);
@@ -40,22 +40,22 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(SetInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -66,9 +66,9 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- ModuleData testModuleData = ( (SetInteriorVehicleData) msg ).getModuleData();
+ ModuleData testModuleData = ((SetInteriorVehicleData) msg).getModuleData();
// Valid Tests
assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, testModuleData));
@@ -85,7 +85,7 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -105,7 +105,7 @@ public class SetInteriorVehicleDataTests extends BaseRpcTests {
ModuleData referenceModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleData.KEY_MODULE_DATA)));
assertTrue(TestValues.TRUE, Validator.validateModuleData(referenceModuleData, cmd.getModuleData()));
- }catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
index c4937aa95..7f22c0701 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetMediaClockTimerTests.java
@@ -27,174 +27,174 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetMediaClockTimer}
*/
public class SetMediaClockTimerTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- SetMediaClockTimer msg = new SetMediaClockTimer();
-
- msg.setStartTime(TestValues.GENERAL_STARTTIME);
- msg.setEndTime(TestValues.GENERAL_STARTTIME);
- msg.setUpdateMode(TestValues.GENERAL_UPDATEMODE);
- msg.setAudioStreamingIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SET_MEDIA_CLOCK_TIMER.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SetMediaClockTimer.KEY_START_TIME, TestValues.JSON_STARTTIME);
- result.put(SetMediaClockTimer.KEY_END_TIME, TestValues.JSON_STARTTIME);
- result.put(SetMediaClockTimer.KEY_UPDATE_MODE, TestValues.GENERAL_UPDATEMODE);
- result.put(SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- StartTime testStartTime = ( (SetMediaClockTimer) msg ).getStartTime();
- StartTime testEndTime = ( (SetMediaClockTimer) msg ).getEndTime();
- UpdateMode testUpdateMode = ( (SetMediaClockTimer) msg ).getUpdateMode();
- AudioStreamingIndicator testAudioStreamingIndicator = ( (SetMediaClockTimer) msg ).getAudioStreamingIndicator();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_UPDATEMODE, testUpdateMode);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, testAudioStreamingIndicator);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testStartTime));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testEndTime));
-
- // Invalid/Null Tests
- SetMediaClockTimer msg = new SetMediaClockTimer();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getStartTime());
- assertNull(TestValues.NULL, msg.getEndTime());
- assertNull(TestValues.NULL, msg.getUpdateMode());
- assertNull(TestValues.NULL, msg.getAudioStreamingIndicator());
- }
-
- /**
- * Test static initializers
- */
- @Test
- public void testInitializers(){
- Integer timeInterval1 = 5000;
- StartTime startTime1 = new StartTime(timeInterval1);
- Integer timeInterval2 = 7000;
- StartTime startTime2 = new StartTime(timeInterval2);
- SetMediaClockTimer msg;
-
- msg = SetMediaClockTimer.countUpFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countUpFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countDownFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.countDownFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.pauseWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertNull(TestValues.NULL, msg.getStartTime());
- assertNull(TestValues.NULL, msg.getEndTime());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.updatePauseWithNewStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.updatePauseWithNewStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.resumeWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.RESUME);
- assertNull(TestValues.NULL, msg.getStartTime());
- assertNull(TestValues.NULL, msg.getEndTime());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
-
- msg = SetMediaClockTimer.clearWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
- assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.CLEAR);
- assertNull(TestValues.NULL, msg.getStartTime());
- assertNull(TestValues.NULL, msg.getEndTime());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
- }
-
- /**
+ @Override
+ protected RPCMessage createMessage() {
+ SetMediaClockTimer msg = new SetMediaClockTimer();
+
+ msg.setStartTime(TestValues.GENERAL_STARTTIME);
+ msg.setEndTime(TestValues.GENERAL_STARTTIME);
+ msg.setUpdateMode(TestValues.GENERAL_UPDATEMODE);
+ msg.setAudioStreamingIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SET_MEDIA_CLOCK_TIMER.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SetMediaClockTimer.KEY_START_TIME, TestValues.JSON_STARTTIME);
+ result.put(SetMediaClockTimer.KEY_END_TIME, TestValues.JSON_STARTTIME);
+ result.put(SetMediaClockTimer.KEY_UPDATE_MODE, TestValues.GENERAL_UPDATEMODE);
+ result.put(SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ StartTime testStartTime = ((SetMediaClockTimer) msg).getStartTime();
+ StartTime testEndTime = ((SetMediaClockTimer) msg).getEndTime();
+ UpdateMode testUpdateMode = ((SetMediaClockTimer) msg).getUpdateMode();
+ AudioStreamingIndicator testAudioStreamingIndicator = ((SetMediaClockTimer) msg).getAudioStreamingIndicator();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_UPDATEMODE, testUpdateMode);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, testAudioStreamingIndicator);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testStartTime));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(TestValues.GENERAL_STARTTIME, testEndTime));
+
+ // Invalid/Null Tests
+ SetMediaClockTimer msg = new SetMediaClockTimer();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertNull(TestValues.NULL, msg.getUpdateMode());
+ assertNull(TestValues.NULL, msg.getAudioStreamingIndicator());
+ }
+
+ /**
+ * Test static initializers
+ */
+ @Test
+ public void testInitializers() {
+ Integer timeInterval1 = 5000;
+ StartTime startTime1 = new StartTime(timeInterval1);
+ Integer timeInterval2 = 7000;
+ StartTime startTime2 = new StartTime(timeInterval2);
+ SetMediaClockTimer msg;
+
+ msg = SetMediaClockTimer.countUpFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countUpFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTUP);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countDownFromStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.countDownFromStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.COUNTDOWN);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.pauseWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.updatePauseWithNewStartTimeInterval(timeInterval1, timeInterval2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.updatePauseWithNewStartTime(startTime1, startTime2, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.PAUSE);
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime1, msg.getStartTime()));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(startTime2, msg.getEndTime()));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.resumeWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.RESUME);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+
+ msg = SetMediaClockTimer.clearWithPlayPauseIndicator(TestValues.GENERAL_AUDIO_STREAMING_INDICATOR);
+ assertEquals(TestValues.MATCH, msg.getUpdateMode(), UpdateMode.CLEAR);
+ assertNull(TestValues.NULL, msg.getStartTime());
+ assertNull(TestValues.NULL, msg.getEndTime());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_AUDIO_STREAMING_INDICATOR, msg.getAudioStreamingIndicator());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetMediaClockTimer cmd = new SetMediaClockTimer(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- JSONObject startTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_START_TIME);
- StartTime referenceStartTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(startTime));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceStartTime, cmd.getStartTime()));
-
- JSONObject endTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_END_TIME);
- StartTime referenceEndTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(endTime));
- assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceEndTime, cmd.getEndTime()));
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_UPDATE_MODE), cmd.getUpdateMode().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR), cmd.getAudioStreamingIndicator().toString());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetMediaClockTimer cmd = new SetMediaClockTimer(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ JSONObject startTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_START_TIME);
+ StartTime referenceStartTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(startTime));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceStartTime, cmd.getStartTime()));
+
+ JSONObject endTime = JsonUtils.readJsonObjectFromJsonObject(parameters, SetMediaClockTimer.KEY_END_TIME);
+ StartTime referenceEndTime = new StartTime(JsonRPCMarshaller.deserializeJSONObject(endTime));
+ assertTrue(TestValues.TRUE, Validator.validateStartTime(referenceEndTime, cmd.getEndTime()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_UPDATE_MODE), cmd.getUpdateMode().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetMediaClockTimer.KEY_AUDIO_STREAMING_INDICATOR), cmd.getAudioStreamingIndicator().toString());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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
index 27d876f14..db0c88440 100644
--- 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
@@ -62,81 +62,81 @@ import static junit.framework.TestCase.fail;
*/
public class ShowAppMenuTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ShowAppMenu msg = new ShowAppMenu();
- msg.setMenuID(TestValues.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, TestValues.GENERAL_INTEGER);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer copy = ( (ShowAppMenu) msg ).getMenuID();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, copy);
-
- // Invalid/Null Tests
- ShowAppMenu msg = new ShowAppMenu();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.MATCH, msg.getMenuID());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ShowAppMenu cmd = new ShowAppMenu(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.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(TestValues.MATCH, TestValues.GENERAL_INTEGER, serviceID);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ ShowAppMenu msg = new ShowAppMenu();
+ msg.setMenuID(TestValues.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, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer copy = ((ShowAppMenu) msg).getMenuID();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, copy);
+
+ // Invalid/Null Tests
+ ShowAppMenu msg = new ShowAppMenu();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.MATCH, msg.getMenuID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenu cmd = new ShowAppMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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(TestValues.MATCH, TestValues.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/ShowConstantTbtTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
index 848d40a1f..e454fcf7a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowConstantTbtTests.java
@@ -29,99 +29,99 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowConstantTbt}
*/
public class ShowConstantTbtTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ShowConstantTbt msg = new ShowConstantTbt();
-
- msg.setDistanceToManeuver(TestValues.GENERAL_DOUBLE);
- msg.setDistanceToManeuverScale(TestValues.GENERAL_DOUBLE);
- msg.setEta(TestValues.GENERAL_STRING);
- msg.setManeuverComplete(true);
- msg.setNavigationText1(TestValues.GENERAL_STRING);
- msg.setNavigationText2(TestValues.GENERAL_STRING);
- msg.setNextTurnIcon(TestValues.GENERAL_IMAGE);
- msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
- msg.setTimeToDestination(TestValues.GENERAL_STRING);
- msg.setTotalDistance(TestValues.GENERAL_STRING);
- msg.setTurnIcon(TestValues.GENERAL_IMAGE);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SHOW_CONSTANT_TBT.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
- result.put(ShowConstantTbt.KEY_ETA, TestValues.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_MANEUVER_COMPLETE, true);
- result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, TestValues.GENERAL_DOUBLE);
- result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, TestValues.GENERAL_DOUBLE);
- result.put(ShowConstantTbt.KEY_TEXT1, TestValues.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TEXT2, TestValues.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, TestValues.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_TOTAL_DISTANCE, TestValues.GENERAL_STRING);
- result.put(ShowConstantTbt.KEY_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
- result.put(ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ @Override
+ protected RPCMessage createMessage() {
+ ShowConstantTbt msg = new ShowConstantTbt();
+
+ msg.setDistanceToManeuver(TestValues.GENERAL_DOUBLE);
+ msg.setDistanceToManeuverScale(TestValues.GENERAL_DOUBLE);
+ msg.setEta(TestValues.GENERAL_STRING);
+ msg.setManeuverComplete(true);
+ msg.setNavigationText1(TestValues.GENERAL_STRING);
+ msg.setNavigationText2(TestValues.GENERAL_STRING);
+ msg.setNextTurnIcon(TestValues.GENERAL_IMAGE);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setTimeToDestination(TestValues.GENERAL_STRING);
+ msg.setTotalDistance(TestValues.GENERAL_STRING);
+ msg.setTurnIcon(TestValues.GENERAL_IMAGE);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW_CONSTANT_TBT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ShowConstantTbt.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(ShowConstantTbt.KEY_ETA, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_MANEUVER_COMPLETE, true);
+ result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE, TestValues.GENERAL_DOUBLE);
+ result.put(ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE, TestValues.GENERAL_DOUBLE);
+ result.put(ShowConstantTbt.KEY_TEXT1, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TEXT2, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TIME_TO_DESTINATION, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_TOTAL_DISTANCE, TestValues.GENERAL_STRING);
+ result.put(ShowConstantTbt.KEY_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
+ result.put(ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE, TestValues.GENERAL_IMAGE.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Double testScale = ((ShowConstantTbt) msg).getDistanceToManeuverScale();
- Double testDistance = ((ShowConstantTbt) msg).getDistanceToManeuver();
- String testEta = ((ShowConstantTbt) msg).getEta();
- String testTimeToDestination = ((ShowConstantTbt) msg).getTimeToDestination();
- String testTotalDistance = ((ShowConstantTbt) msg).getTotalDistance();
- String testNavText2 = ((ShowConstantTbt) msg).getNavigationText2();
- String testNavText1 = ((ShowConstantTbt) msg).getNavigationText1();
- Boolean testManeuverComplete = ((ShowConstantTbt) msg).getManeuverComplete();
- Image testTurnIcon = ((ShowConstantTbt) msg).getTurnIcon();
- Image testNextTurnIcon = ((ShowConstantTbt) msg).getNextTurnIcon();
- List<SoftButton> testSoftButtons = ((ShowConstantTbt) msg).getSoftButtons();
-
- // Valid Test
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTimeToDestination);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testScale);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText1);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText2);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testEta);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTotalDistance);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testDistance);
- assertTrue(TestValues.TRUE, testManeuverComplete);
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testTurnIcon));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testNextTurnIcon));
-
- // Invalid/Null Tests
- ShowConstantTbt msg = new ShowConstantTbt();
- assertNotNull(TestValues.NOT_NULL, msg);
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Double testScale = ((ShowConstantTbt) msg).getDistanceToManeuverScale();
+ Double testDistance = ((ShowConstantTbt) msg).getDistanceToManeuver();
+ String testEta = ((ShowConstantTbt) msg).getEta();
+ String testTimeToDestination = ((ShowConstantTbt) msg).getTimeToDestination();
+ String testTotalDistance = ((ShowConstantTbt) msg).getTotalDistance();
+ String testNavText2 = ((ShowConstantTbt) msg).getNavigationText2();
+ String testNavText1 = ((ShowConstantTbt) msg).getNavigationText1();
+ Boolean testManeuverComplete = ((ShowConstantTbt) msg).getManeuverComplete();
+ Image testTurnIcon = ((ShowConstantTbt) msg).getTurnIcon();
+ Image testNextTurnIcon = ((ShowConstantTbt) msg).getNextTurnIcon();
+ List<SoftButton> testSoftButtons = ((ShowConstantTbt) msg).getSoftButtons();
+
+ // Valid Test
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTimeToDestination);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testScale);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testNavText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testEta);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTotalDistance);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOUBLE, testDistance);
+ assertTrue(TestValues.TRUE, testManeuverComplete);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testTurnIcon));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testNextTurnIcon));
+
+ // Invalid/Null Tests
+ ShowConstantTbt msg = new ShowConstantTbt();
+ assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
-
+
assertNull(TestValues.NULL, msg.getSoftButtons());
assertNull(TestValues.NULL, msg.getNavigationText1());
assertNull(TestValues.NULL, msg.getNavigationText2());
@@ -133,53 +133,53 @@ public class ShowConstantTbtTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getTimeToDestination());
assertNull(TestValues.NULL, msg.getTotalDistance());
assertNull(TestValues.NULL, msg.getTurnIcon());
- }
-
- /**
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ShowConstantTbt cmd = new ShowConstantTbt(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TOTAL_DISTANCE), cmd.getTotalDistance());
-
- JSONObject icon1 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_IMAGE);
- Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon1));
- assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, cmd.getTurnIcon()));
-
- JSONObject icon2 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE);
- Image refIcon2 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon2));
- assertTrue(TestValues.TRUE, Validator.validateImage(refIcon2, cmd.getNextTurnIcon()));
-
- JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ShowConstantTbt.KEY_SOFT_BUTTONS);
- List<SoftButton> softButtonList = new ArrayList<SoftButton>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowConstantTbt cmd = new ShowConstantTbt(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_ETA), cmd.getEta());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_COMPLETE), cmd.getManeuverComplete());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE), cmd.getDistanceToManeuver());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_DISTANCE_SCALE), cmd.getDistanceToManeuverScale());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT1), cmd.getNavigationText1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TEXT2), cmd.getNavigationText2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TIME_TO_DESTINATION), cmd.getTimeToDestination());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, ShowConstantTbt.KEY_TOTAL_DISTANCE), cmd.getTotalDistance());
+
+ JSONObject icon1 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_MANEUVER_IMAGE);
+ Image refIcon1 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon1));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon1, cmd.getTurnIcon()));
+
+ JSONObject icon2 = JsonUtils.readJsonObjectFromJsonObject(parameters, ShowConstantTbt.KEY_NEXT_MANEUVER_IMAGE);
+ Image refIcon2 = new Image(JsonRPCMarshaller.deserializeJSONObject(icon2));
+ assertTrue(TestValues.TRUE, Validator.validateImage(refIcon2, cmd.getNextTurnIcon()));
+
+ JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ShowConstantTbt.KEY_SOFT_BUTTONS);
+ List<SoftButton> softButtonList = new ArrayList<SoftButton>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ 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 14585c439..03396cd3f 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
@@ -32,184 +32,184 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Show}
*/
public class ShowTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage() {
- Show msg = new Show();
-
- msg.setMainField1(TestValues.GENERAL_STRING);
- msg.setMainField2(TestValues.GENERAL_STRING);
- msg.setMainField3(TestValues.GENERAL_STRING);
- msg.setMainField4(TestValues.GENERAL_STRING);
- msg.setStatusBar(TestValues.GENERAL_STRING);
- msg.setMediaTrack(TestValues.GENERAL_STRING);
- msg.setTemplateTitle(TestValues.GENERAL_STRING);
- msg.setAlignment(TestValues.GENERAL_TEXTALIGNMENT);
- msg.setGraphic(TestValues.GENERAL_IMAGE);
- msg.setSecondaryGraphic(TestValues.GENERAL_IMAGE);
- msg.setCustomPresets(TestValues.GENERAL_STRING_LIST);
- msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
- msg.setMetadataTags(TestValues.GENERAL_METADATASTRUCT);
- msg.setWindowID(TestValues.GENERAL_INT);
- msg.setTemplateConfiguration(TestValues.GENERAL_TEMPLATE_CONFIGURATION);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SHOW.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(Show.KEY_MAIN_FIELD_1, TestValues.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_2, TestValues.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_3, TestValues.GENERAL_STRING);
- result.put(Show.KEY_MAIN_FIELD_4, TestValues.GENERAL_STRING);
- result.put(Show.KEY_STATUS_BAR, TestValues.GENERAL_STRING);
- result.put(Show.KEY_MEDIA_TRACK, TestValues.GENERAL_STRING);
- result.put(Show.KEY_TEMPLATE_TITLE, TestValues.GENERAL_STRING);
- result.put(Show.KEY_GRAPHIC, TestValues.JSON_IMAGE);
- result.put(Show.KEY_SECONDARY_GRAPHIC, TestValues.JSON_IMAGE);
- result.put(Show.KEY_ALIGNMENT, TestValues.GENERAL_TEXTALIGNMENT);
- result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- result.put(Show.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
- result.put(Show.KEY_METADATA_TAGS, TestValues.GENERAL_METADATASTRUCT.serializeJSON());
- result.put(Show.KEY_WINDOW_ID, TestValues.GENERAL_INT);
- result.put(Show.KEY_TEMPLATE_CONFIGURATION, TestValues.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- @Test
- public void testSoftButtons () {
- // TestValues
- String testTrack = ( (Show) msg ).getMediaTrack();
- String templateTitle = ( (Show) msg ).getTemplateTitle();
- Image testGraphic2 = ( (Show) msg ).getSecondaryGraphic();
- Image testGraphic1 = ( (Show) msg ).getGraphic();
- String testStatusBar = ( (Show) msg ).getStatusBar();
- String testText1 = ( (Show) msg ).getMainField1();
- String testText2 = ( (Show) msg ).getMainField2();
- String testText3 = ( (Show) msg ).getMainField3();
- String testText4 = ( (Show) msg ).getMainField4();
- TextAlignment testAlignment = ( (Show) msg ).getAlignment();
- List<SoftButton> testSoftButtons = ( (Show) msg ).getSoftButtons();
- List<String> testCustomPresets = ( (Show) msg ).getCustomPresets();
- MetadataTags testMetadata = ( (Show) msg ).getMetadataTags();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTrack);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, templateTitle);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTALIGNMENT, testAlignment);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testStatusBar);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText3);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText4);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testCustomPresets.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_METADATASTRUCT, testMetadata);
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic2));
- assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic1));
-
- // Invalid/Null Tests
- Show msg = new Show();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getMainField1());
- assertNull(TestValues.NULL, msg.getMainField2());
- assertNull(TestValues.NULL, msg.getMainField3());
- assertNull(TestValues.NULL, msg.getMainField4());
- assertNull(TestValues.NULL, msg.getStatusBar());
- assertNull(TestValues.NULL, msg.getAlignment());
- assertNull(TestValues.NULL, msg.getGraphic());
- assertNull(TestValues.NULL, msg.getSecondaryGraphic());
- assertNull(TestValues.NULL, msg.getCustomPresets());
- assertNull(TestValues.NULL, msg.getMediaTrack());
- assertNull(TestValues.NULL, msg.getTemplateTitle());
- assertNull(TestValues.NULL, msg.getSoftButtons());
- assertNull(TestValues.NULL, msg.getMetadataTags());
- assertNull(TestValues.NULL, msg.getWindowID());
- assertNull(TestValues.NULL, msg.getTemplateConfiguration());
- }
-
- /**
+ protected RPCMessage createMessage() {
+ Show msg = new Show();
+
+ msg.setMainField1(TestValues.GENERAL_STRING);
+ msg.setMainField2(TestValues.GENERAL_STRING);
+ msg.setMainField3(TestValues.GENERAL_STRING);
+ msg.setMainField4(TestValues.GENERAL_STRING);
+ msg.setStatusBar(TestValues.GENERAL_STRING);
+ msg.setMediaTrack(TestValues.GENERAL_STRING);
+ msg.setTemplateTitle(TestValues.GENERAL_STRING);
+ msg.setAlignment(TestValues.GENERAL_TEXTALIGNMENT);
+ msg.setGraphic(TestValues.GENERAL_IMAGE);
+ msg.setSecondaryGraphic(TestValues.GENERAL_IMAGE);
+ msg.setCustomPresets(TestValues.GENERAL_STRING_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+ msg.setMetadataTags(TestValues.GENERAL_METADATASTRUCT);
+ msg.setWindowID(TestValues.GENERAL_INT);
+ msg.setTemplateConfiguration(TestValues.GENERAL_TEMPLATE_CONFIGURATION);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(Show.KEY_MAIN_FIELD_1, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_2, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_3, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MAIN_FIELD_4, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_STATUS_BAR, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_MEDIA_TRACK, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_TEMPLATE_TITLE, TestValues.GENERAL_STRING);
+ result.put(Show.KEY_GRAPHIC, TestValues.JSON_IMAGE);
+ result.put(Show.KEY_SECONDARY_GRAPHIC, TestValues.JSON_IMAGE);
+ result.put(Show.KEY_ALIGNMENT, TestValues.GENERAL_TEXTALIGNMENT);
+ result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(Show.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(Show.KEY_METADATA_TAGS, TestValues.GENERAL_METADATASTRUCT.serializeJSON());
+ result.put(Show.KEY_WINDOW_ID, TestValues.GENERAL_INT);
+ result.put(Show.KEY_TEMPLATE_CONFIGURATION, TestValues.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ @Test
+ public void testSoftButtons() {
+ // TestValues
+ String testTrack = ((Show) msg).getMediaTrack();
+ String templateTitle = ((Show) msg).getTemplateTitle();
+ Image testGraphic2 = ((Show) msg).getSecondaryGraphic();
+ Image testGraphic1 = ((Show) msg).getGraphic();
+ String testStatusBar = ((Show) msg).getStatusBar();
+ String testText1 = ((Show) msg).getMainField1();
+ String testText2 = ((Show) msg).getMainField2();
+ String testText3 = ((Show) msg).getMainField3();
+ String testText4 = ((Show) msg).getMainField4();
+ TextAlignment testAlignment = ((Show) msg).getAlignment();
+ List<SoftButton> testSoftButtons = ((Show) msg).getSoftButtons();
+ List<String> testCustomPresets = ((Show) msg).getCustomPresets();
+ MetadataTags testMetadata = ((Show) msg).getMetadataTags();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testTrack);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, templateTitle);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TEXTALIGNMENT, testAlignment);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testStatusBar);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText1);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText2);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText3);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText4);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), testCustomPresets.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_METADATASTRUCT, testMetadata);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic2));
+ assertTrue(TestValues.TRUE, Validator.validateImage(TestValues.GENERAL_IMAGE, testGraphic1));
+
+ // Invalid/Null Tests
+ Show msg = new Show();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getMainField1());
+ assertNull(TestValues.NULL, msg.getMainField2());
+ assertNull(TestValues.NULL, msg.getMainField3());
+ assertNull(TestValues.NULL, msg.getMainField4());
+ assertNull(TestValues.NULL, msg.getStatusBar());
+ assertNull(TestValues.NULL, msg.getAlignment());
+ assertNull(TestValues.NULL, msg.getGraphic());
+ assertNull(TestValues.NULL, msg.getSecondaryGraphic());
+ assertNull(TestValues.NULL, msg.getCustomPresets());
+ assertNull(TestValues.NULL, msg.getMediaTrack());
+ assertNull(TestValues.NULL, msg.getTemplateTitle());
+ assertNull(TestValues.NULL, msg.getSoftButtons());
+ assertNull(TestValues.NULL, msg.getMetadataTags());
+ assertNull(TestValues.NULL, msg.getWindowID());
+ assertNull(TestValues.NULL, msg.getTemplateConfiguration());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(),getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- Show cmd = new Show(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject graphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_GRAPHIC);
- Image referenceGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(graphic));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
-
- List<String> customPresetsList = JsonUtils.readStringListFromJsonObject(parameters, Show.KEY_CUSTOM_PRESETS);
- List<String> testPresetsList = cmd.getCustomPresets();
- assertEquals(TestValues.MATCH, customPresetsList.size(), testPresetsList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(customPresetsList, testPresetsList));
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_1), cmd.getMainField1());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_2), cmd.getMainField2());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_3), cmd.getMainField3());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_4), cmd.getMainField4());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
- assertEquals(TestValues.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(TestValues.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
-
- JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
- Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
- assertTrue(TestValues.TRUE, Validator.validateImage(referenceSecondaryGraphic, cmd.getSecondaryGraphic()));
-
- JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Show.KEY_SOFT_BUTTONS);
- List<SoftButton> softButtonList = new ArrayList<SoftButton>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ Show cmd = new Show(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject graphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_GRAPHIC);
+ Image referenceGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(graphic));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
+
+ List<String> customPresetsList = JsonUtils.readStringListFromJsonObject(parameters, Show.KEY_CUSTOM_PRESETS);
+ List<String> testPresetsList = cmd.getCustomPresets();
+ assertEquals(TestValues.MATCH, customPresetsList.size(), testPresetsList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(customPresetsList, testPresetsList));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_1), cmd.getMainField1());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_2), cmd.getMainField2());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_3), cmd.getMainField3());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MAIN_FIELD_4), cmd.getMainField4());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
+ assertEquals(TestValues.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(TestValues.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
+
+ JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
+ Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
+ assertTrue(TestValues.TRUE, Validator.validateImage(referenceSecondaryGraphic, cmd.getSecondaryGraphic()));
+
+ JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Show.KEY_SOFT_BUTTONS);
+ List<SoftButton> softButtonList = new ArrayList<SoftButton>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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 def35eae2..c4abeb086 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
@@ -25,121 +25,120 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.Slider}
*/
public class SliderTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- Slider msg = new Slider();
-
- msg.setNumTicks(TestValues.GENERAL_INT);
- msg.setPosition(TestValues.GENERAL_INT);
- msg.setTimeout(TestValues.GENERAL_INT);
- msg.setSliderHeader(TestValues.GENERAL_STRING);
- msg.setSliderFooter(TestValues.GENERAL_STRING_LIST);
- msg.setCancelID(TestValues.GENERAL_INTEGER);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SLIDER.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(Slider.KEY_SLIDER_HEADER, TestValues.GENERAL_STRING);
- result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- result.put(Slider.KEY_POSITION, TestValues.GENERAL_INT);
- result.put(Slider.KEY_TIMEOUT, TestValues.GENERAL_INT);
- result.put(Slider.KEY_NUM_TICKS, TestValues.GENERAL_INT);
- result.put(Slider.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer testNumTicks = ( (Slider) msg ).getNumTicks();
- Integer testTimeout = ( (Slider) msg ).getTimeout();
- Integer testPosition = ( (Slider) msg ).getPosition();
- String testSlider = ( (Slider) msg ).getSliderHeader();
- List<String> testFooter = ( (Slider) msg ).getSliderFooter();
- Integer testCancelID = ( (Slider) msg ).getCancelID();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testNumTicks);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testPosition);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testSlider);
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testFooter));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
-
- // Invalid/Null Tests
- Slider msg = new Slider();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSliderHeader());
- assertNull(TestValues.NULL, msg.getSliderFooter());
- assertNull(TestValues.NULL, msg.getPosition());
- assertNull(TestValues.NULL, msg.getTimeout());
- assertNull(TestValues.NULL, msg.getNumTicks());
- assertNull(TestValues.NULL, msg.getCancelID());
- }
-
- /**
+ @Override
+ protected RPCMessage createMessage() {
+ Slider msg = new Slider();
+
+ msg.setNumTicks(TestValues.GENERAL_INT);
+ msg.setPosition(TestValues.GENERAL_INT);
+ msg.setTimeout(TestValues.GENERAL_INT);
+ msg.setSliderHeader(TestValues.GENERAL_STRING);
+ msg.setSliderFooter(TestValues.GENERAL_STRING_LIST);
+ msg.setCancelID(TestValues.GENERAL_INTEGER);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SLIDER.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(Slider.KEY_SLIDER_HEADER, TestValues.GENERAL_STRING);
+ result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(Slider.KEY_POSITION, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_TIMEOUT, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_NUM_TICKS, TestValues.GENERAL_INT);
+ result.put(Slider.KEY_CANCEL_ID, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer testNumTicks = ((Slider) msg).getNumTicks();
+ Integer testTimeout = ((Slider) msg).getTimeout();
+ Integer testPosition = ((Slider) msg).getPosition();
+ String testSlider = ((Slider) msg).getSliderHeader();
+ List<String> testFooter = ((Slider) msg).getSliderFooter();
+ Integer testCancelID = ((Slider) msg).getCancelID();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testNumTicks);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testTimeout);
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testPosition);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testSlider);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testFooter));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, testCancelID);
+
+ // Invalid/Null Tests
+ Slider msg = new Slider();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSliderHeader());
+ assertNull(TestValues.NULL, msg.getSliderFooter());
+ assertNull(TestValues.NULL, msg.getPosition());
+ assertNull(TestValues.NULL, msg.getTimeout());
+ assertNull(TestValues.NULL, msg.getNumTicks());
+ assertNull(TestValues.NULL, msg.getCancelID());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- Slider cmd = new Slider(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_NUM_TICKS), cmd.getNumTicks());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Slider.KEY_SLIDER_HEADER), cmd.getSliderHeader());
-
- List<String> sliderFooterList = JsonUtils.readStringListFromJsonObject(parameters, Slider.KEY_SLIDER_FOOTER);
- List<String> testFooterList = cmd.getSliderFooter();
- assertEquals(TestValues.MATCH, sliderFooterList.size(), testFooterList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(sliderFooterList, testFooterList));
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
- }
- catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ Slider cmd = new Slider(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_NUM_TICKS), cmd.getNumTicks());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, Slider.KEY_SLIDER_HEADER), cmd.getSliderHeader());
+
+ List<String> sliderFooterList = JsonUtils.readStringListFromJsonObject(parameters, Slider.KEY_SLIDER_FOOTER);
+ List<String> testFooterList = cmd.getSliderFooter();
+ assertEquals(TestValues.MATCH, sliderFooterList.size(), testFooterList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(sliderFooterList, testFooterList));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
index b9c89493f..f66e91312 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SpeakTests.java
@@ -28,88 +28,88 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
public class SpeakTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- Speak msg = new Speak();
-
- msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SPEAK.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(Speak.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- List<TTSChunk> copy = ( (Speak) msg ).getTtsChunks();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, copy));
-
- // Invalid/Null Tests
- Speak msg = new Speak();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.MATCH, msg.getTtsChunks());
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ Speak msg = new Speak();
+
+ msg.setTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SPEAK.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(Speak.KEY_TTS_CHUNKS, TestValues.JSON_TTSCHUNKS);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<TTSChunk> copy = ((Speak) msg).getTtsChunks();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TestValues.GENERAL_TTSCHUNK_LIST, copy));
+
+ // Invalid/Null Tests
+ Speak msg = new Speak();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.MATCH, msg.getTtsChunks());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- Speak cmd = new Speak(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Speak.KEY_TTS_CHUNKS);
- List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
- for (int index = 0; index < ttsChunkArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
- ttsChunkList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ Speak cmd = new Speak(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Speak.KEY_TTS_CHUNKS);
+ List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
+ for (int index = 0; index < ttsChunkArray.length(); index++) {
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsChunkArray.get(index)));
+ ttsChunkList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+ } 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/SubscribeButtonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
index cb838dc5f..ebd1fbc8c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeButtonTests.java
@@ -23,85 +23,85 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeButton}
*/
public class SubscribeButtonTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SubscribeButton msg = new SubscribeButton();
-
- msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SUBSCRIBE_BUTTON.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- ButtonName testButtonName = ( (SubscribeButton) msg ).getButtonName();
-
- // Valid Tests
- assertEquals("Data didn't match input data.", TestValues.GENERAL_BUTTONNAME, testButtonName);
-
- // Invalid/Null Tests
- SubscribeButton msg = new SubscribeButton();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getButtonName());
- }
-
- /**
+
+ @Override
+ protected RPCMessage createMessage() {
+ SubscribeButton msg = new SubscribeButton();
+
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SUBSCRIBE_BUTTON.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ ButtonName testButtonName = ((SubscribeButton) msg).getButtonName();
+
+ // Valid Tests
+ assertEquals("Data didn't match input data.", TestValues.GENERAL_BUTTONNAME, testButtonName);
+
+ // Invalid/Null Tests
+ SubscribeButton msg = new SubscribeButton();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getButtonName());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SubscribeButton cmd = new SubscribeButton(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeButton cmd = new SubscribeButton(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
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 341eb73d4..528eeb128 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
@@ -23,67 +23,67 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeVehicleData}
*/
public class SubscribeVehicleDataTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SubscribeVehicleData msg = new SubscribeVehicleData();
- msg.setSpeed(TestValues.GENERAL_BOOLEAN);
- msg.setRpm(TestValues.GENERAL_BOOLEAN);
- msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
- msg.setPrndl(TestValues.GENERAL_BOOLEAN);
- msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
- msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
- msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
- msg.setOdometer(TestValues.GENERAL_BOOLEAN);
- msg.setGps(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
- msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
- msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
- msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
- msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
- msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
- msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
- msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setMyKey(TestValues.GENERAL_BOOLEAN);
- msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
- msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
- msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
- msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
- msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
-
- return msg;
- }
+ @Override
+ protected RPCMessage createMessage() {
+ SubscribeVehicleData msg = new SubscribeVehicleData();
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
+ msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
- @Override
- protected String getCommandType() {
- return FunctionID.SUBSCRIBE_VEHICLE_DATA.toString();
- }
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SUBSCRIBE_VEHICLE_DATA.toString();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
- try {
+ try {
result.put(SubscribeVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
@@ -117,58 +117,58 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
result.put(SubscribeVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
- return result;
- }
+ // Valid Tests
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getSpeed());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getRpm());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getExternalTemperature());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getFuelLevel());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getPrndl());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getTirePressure());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getEngineTorque());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getEngineOilLife());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getOdometer());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getGps());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getFuelLevelState());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getInstantFuelConsumption());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getBeltStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getBodyInformation());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getDeviceStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getDriverBraking());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getWiperStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getHeadLampStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getAccPedalPosition());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getSteeringWheelAngle());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getECallInfo());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getAirbagStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getEmergencyEvent());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getClusterModeStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getMyKey());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getFuelRange());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getTurnSignal());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getHandsOffSteering());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getWindowStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getGearStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getStabilityControlsStatus());
+ assertTrue(TestValues.MATCH, ((SubscribeVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
-
- // Valid Tests
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getSpeed());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getRpm());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getExternalTemperature());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelLevel());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getPrndl());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getTirePressure());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEngineTorque());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEngineOilLife());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getOdometer());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getGps());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelLevelState());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getBeltStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getBodyInformation());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getDeviceStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getDriverBraking());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getWiperStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getHeadLampStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getAccPedalPosition());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getECallInfo());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getAirbagStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getEmergencyEvent());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getClusterModeStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getMyKey());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getFuelRange());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getTurnSignal());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getHandsOffSteering());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getWindowStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getGearStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getStabilityControlsStatus());
- assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
-
- // Invalid/Null Tests
- SubscribeVehicleData msg = new SubscribeVehicleData();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
+ // Invalid/Null Tests
+ SubscribeVehicleData msg = new SubscribeVehicleData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
@@ -203,62 +203,62 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getGearStatus());
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- }
-
+ }
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SubscribeVehicleData cmd = new SubscribeVehicleData(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeVehicleData cmd = new SubscribeVehicleData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
index a28d31bbf..d79b3905b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeWayPointsTests.java
@@ -49,7 +49,7 @@ public class SubscribeWayPointsTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
SubscribeWayPoints msg = new SubscribeWayPoints();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -60,7 +60,7 @@ public class SubscribeWayPointsTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubtleAlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubtleAlertTests.java
index 7c5a49534..d817c817d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubtleAlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubtleAlertTests.java
@@ -83,12 +83,12 @@ public class SubtleAlertTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SUBTLE_ALERT.toString();
}
@@ -115,7 +115,7 @@ public class SubtleAlertTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
String testAlertText1 = ((SubtleAlert) msg).getAlertText1();
String testAlertText2 = ((SubtleAlert) msg).getAlertText2();
@@ -152,7 +152,7 @@ public class SubtleAlertTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -177,25 +177,24 @@ public class SubtleAlertTests extends BaseRpcTests {
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SubtleAlert.KEY_TTS_CHUNKS);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
for (int index = 0; index < ttsChunkArray.length(); index++) {
- TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)ttsChunkArray.get(index)) );
+ TTSChunk chunk = new TTSChunk(JsonRPCMarshaller.deserializeJSONObject((JSONObject) ttsChunkArray.get(index)));
ttsChunkList.add(chunk);
}
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
+ assertTrue(TestValues.TRUE, Validator.validateTtsChunks(ttsChunkList, cmd.getTtsChunks()));
assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SubtleAlert.KEY_DURATION), cmd.getDuration());
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SubtleAlert.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
softButtonList.add(chunk);
}
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SubtleAlert.KEY_CANCEL_ID), cmd.getCancelID());
- }
- catch (JSONException e) {
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
index 973d63713..3f2a1a997 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SystemRequestTests.java
@@ -27,108 +27,108 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SystemRequest}
*/
public class SystemRequestTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SystemRequest msg = new SystemRequest();
-
- msg.setLegacyData(TestValues.GENERAL_STRING_LIST);
- msg.setFileName(TestValues.GENERAL_STRING);
- msg.setRequestType(TestValues.GENERAL_REQUESTTYPE);
- msg.setRequestSubType(TestValues.GENERAL_STRING);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SYSTEM_REQUEST.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SystemRequest.KEY_DATA, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- result.put(SystemRequest.KEY_FILE_NAME, TestValues.GENERAL_STRING);
- result.put(SystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
- result.put(SystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- RequestType testRequestType = ( (SystemRequest) msg ).getRequestType();
- String testRequestSubType = ( (SystemRequest) msg ).getRequestSubType();
- String testFileName = ( (SystemRequest) msg ).getFileName();
- List<String> testLegacyData = ( (SystemRequest) msg ).getLegacyData();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, testRequestType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testRequestSubType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFileName);
- assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testLegacyData));
-
- // Invalid/Null Tests
- SystemRequest msg = new SystemRequest();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getLegacyData());
- assertNull(TestValues.NULL, msg.getFileName());
- assertNull(TestValues.NULL, msg.getRequestType());
- assertNull(TestValues.NULL, msg.getRequestSubType());
- assertNull(TestValues.NULL, msg.getBulkData());
- }
-
- /**
+
+ @Override
+ protected RPCMessage createMessage() {
+ SystemRequest msg = new SystemRequest();
+
+ msg.setLegacyData(TestValues.GENERAL_STRING_LIST);
+ msg.setFileName(TestValues.GENERAL_STRING);
+ msg.setRequestType(TestValues.GENERAL_REQUESTTYPE);
+ msg.setRequestSubType(TestValues.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SYSTEM_REQUEST.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SystemRequest.KEY_DATA, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
+ result.put(SystemRequest.KEY_FILE_NAME, TestValues.GENERAL_STRING);
+ result.put(SystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
+ result.put(SystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ RequestType testRequestType = ((SystemRequest) msg).getRequestType();
+ String testRequestSubType = ((SystemRequest) msg).getRequestSubType();
+ String testFileName = ((SystemRequest) msg).getFileName();
+ List<String> testLegacyData = ((SystemRequest) msg).getLegacyData();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, testRequestType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testRequestSubType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testFileName);
+ assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, testLegacyData));
+
+ // Invalid/Null Tests
+ SystemRequest msg = new SystemRequest();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getLegacyData());
+ assertNull(TestValues.NULL, msg.getFileName());
+ assertNull(TestValues.NULL, msg.getRequestType());
+ assertNull(TestValues.NULL, msg.getRequestSubType());
+ assertNull(TestValues.NULL, msg.getBulkData());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SystemRequest cmd = new SystemRequest(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_FILE_NAME), cmd.getFileName());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_TYPE), cmd.getRequestType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_SUB_TYPE), cmd.getRequestSubType());
-
- List<String> dataList = JsonUtils.readStringListFromJsonObject(parameters, SystemRequest.KEY_DATA);
- List<String> testDataList = cmd.getLegacyData();
- assertEquals(TestValues.MATCH, dataList.size(), testDataList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(dataList, testDataList));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SystemRequest cmd = new SystemRequest(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_FILE_NAME), cmd.getFileName());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_TYPE), cmd.getRequestType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, SystemRequest.KEY_REQUEST_SUB_TYPE), cmd.getRequestSubType());
+
+ List<String> dataList = JsonUtils.readStringListFromJsonObject(parameters, SystemRequest.KEY_DATA);
+ List<String> testDataList = cmd.getLegacyData();
+ assertEquals(TestValues.MATCH, dataList.size(), testDataList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(dataList, testDataList));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
index 7b57be8ac..aef04ae7e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
@@ -62,93 +62,93 @@ import static junit.framework.TestCase.fail;
*/
public class UnpublishAppServiceTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- UnpublishAppService msg = new UnpublishAppService();
- msg.setServiceID(TestValues.GENERAL_STRING);
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.UNPUBLISH_APP_SERVICE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(UnpublishAppService.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String copy = ( (UnpublishAppService) msg ).getServiceID();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
-
- // Invalid/Null Tests
- UnpublishAppService msg = new UnpublishAppService();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.MATCH, msg.getServiceID());
- }
-
- /**
- * Tests constructor with required params
- */
- @Test
- public void testRequiredParamsConstructor () {
-
- UnpublishAppService msg = new UnpublishAppService(TestValues.GENERAL_STRING);
- assertNotNull(TestValues.NOT_NULL, msg);
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceID());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnpublishAppService cmd = new UnpublishAppService(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- String serviceID = JsonUtils.readStringFromJsonObject(parameters, UnpublishAppService.KEY_SERVICE_ID);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceID);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ UnpublishAppService msg = new UnpublishAppService();
+ msg.setServiceID(TestValues.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNPUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(UnpublishAppService.KEY_SERVICE_ID, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String copy = ((UnpublishAppService) msg).getServiceID();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, copy);
+
+ // Invalid/Null Tests
+ UnpublishAppService msg = new UnpublishAppService();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.MATCH, msg.getServiceID());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ @Test
+ public void testRequiredParamsConstructor() {
+
+ UnpublishAppService msg = new UnpublishAppService(TestValues.GENERAL_STRING);
+ assertNotNull(TestValues.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, msg.getServiceID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnpublishAppService cmd = new UnpublishAppService(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ String serviceID = JsonUtils.readStringFromJsonObject(parameters, UnpublishAppService.KEY_SERVICE_ID);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, 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/UnregisterAppInterfaceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
index 768a7c27b..08cd129e6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnregisterAppInterfaceTests.java
@@ -21,63 +21,62 @@ import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnregisterAppInterface}
*/
public class UnregisterAppInterfaceTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new UnregisterAppInterface();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.UNREGISTER_APP_INTERFACE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- UnregisterAppInterface msg = new UnregisterAppInterface();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ UnregisterAppInterface msg = new UnregisterAppInterface();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnregisterAppInterface cmd = new UnregisterAppInterface(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- }
- catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnregisterAppInterface cmd = new UnregisterAppInterface(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
index 5716f8b84..667d02a77 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeButtonTests.java
@@ -23,87 +23,86 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeButton}
*/
public class UnsubscribeButtonTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- UnsubscribeButton msg = new UnsubscribeButton();
-
- msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.UNSUBSCRIBE_BUTTON.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(UnsubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- ButtonName testButtonName = ( (UnsubscribeButton) msg ).getButtonName();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, testButtonName);
-
- // Invalid/Null Tests
- UnsubscribeButton msg = new UnsubscribeButton();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getButtonName());
+
+ @Override
+ protected RPCMessage createMessage() {
+ UnsubscribeButton msg = new UnsubscribeButton();
+
+ msg.setButtonName(TestValues.GENERAL_BUTTONNAME);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNSUBSCRIBE_BUTTON.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(UnsubscribeButton.KEY_BUTTON_NAME, TestValues.GENERAL_BUTTONNAME);
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
}
-
- /**
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ ButtonName testButtonName = ((UnsubscribeButton) msg).getButtonName();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONNAME, testButtonName);
+
+ // Invalid/Null Tests
+ UnsubscribeButton msg = new UnsubscribeButton();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getButtonName());
+ }
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnsubscribeButton cmd = new UnsubscribeButton(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, UnsubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
- }
- catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeButton cmd = new UnsubscribeButton(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, UnsubscribeButton.KEY_BUTTON_NAME), cmd.getButtonName().toString());
+ } 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/UnsubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
index 2ea0dae9b..cfe2548f3 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
@@ -25,68 +25,68 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeVehicleData}
*/
public class UnsubscribeVehicleDataTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
+ @Override
+ protected RPCMessage createMessage() {
+ UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- msg.setSpeed(TestValues.GENERAL_BOOLEAN);
- msg.setRpm(TestValues.GENERAL_BOOLEAN);
- msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
- msg.setPrndl(TestValues.GENERAL_BOOLEAN);
- msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
- msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
- msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
- msg.setOdometer(TestValues.GENERAL_BOOLEAN);
- msg.setGps(TestValues.GENERAL_BOOLEAN);
- msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
- msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
- msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
- msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
- msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
- msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
- msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
- msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
- msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
- msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
- msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
- msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
- msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setMyKey(TestValues.GENERAL_BOOLEAN);
- msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
- msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
- msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
- msg.setCloudAppVehicleID(TestValues.GENERAL_BOOLEAN);
- msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
- msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
- msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
- msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
- msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
+ msg.setSpeed(TestValues.GENERAL_BOOLEAN);
+ msg.setRpm(TestValues.GENERAL_BOOLEAN);
+ msg.setExternalTemperature(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevel(TestValues.GENERAL_BOOLEAN);
+ msg.setPrndl(TestValues.GENERAL_BOOLEAN);
+ msg.setTirePressure(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineTorque(TestValues.GENERAL_BOOLEAN);
+ msg.setEngineOilLife(TestValues.GENERAL_BOOLEAN);
+ msg.setOdometer(TestValues.GENERAL_BOOLEAN);
+ msg.setGps(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelLevelState(TestValues.GENERAL_BOOLEAN);
+ msg.setInstantFuelConsumption(TestValues.GENERAL_BOOLEAN);
+ msg.setBeltStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setBodyInformation(TestValues.GENERAL_BOOLEAN);
+ msg.setDeviceStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setDriverBraking(TestValues.GENERAL_BOOLEAN);
+ msg.setWiperStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHeadLampStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setAccPedalPosition(TestValues.GENERAL_BOOLEAN);
+ msg.setSteeringWheelAngle(TestValues.GENERAL_BOOLEAN);
+ msg.setECallInfo(TestValues.GENERAL_BOOLEAN);
+ msg.setAirbagStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setEmergencyEvent(TestValues.GENERAL_BOOLEAN);
+ msg.setClusterModeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setMyKey(TestValues.GENERAL_BOOLEAN);
+ msg.setFuelRange(TestValues.GENERAL_BOOLEAN);
+ msg.setTurnSignal(TestValues.GENERAL_BOOLEAN);
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setCloudAppVehicleID(TestValues.GENERAL_BOOLEAN);
+ msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
+ msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
- return msg;
- }
+ return msg;
+ }
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_REQUEST;
- }
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString();
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
- try {
+ try {
result.put(UnsubscribeVehicleData.KEY_SPEED, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_RPM, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_BOOLEAN);
@@ -114,66 +114,66 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
result.put(UnsubscribeVehicleData.KEY_MY_KEY, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_FUEL_RANGE, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_TURN_SIGNAL, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
- result.put(UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
- return result;
- }
+ return result;
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues(){
- // Valid Tests
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getSpeed());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getRpm());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getExternalTemperature());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevel());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getPrndl());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getTirePressure());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEngineTorque());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEngineOilLife());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getOdometer());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getGps());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelLevelState());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getInstantFuelConsumption());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getBeltStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getBodyInformation());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getDeviceStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getDriverBraking());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getWiperStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getHeadLampStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getAccPedalPosition());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getSteeringWheelAngle());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getECallInfo());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getAirbagStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getEmergencyEvent());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getClusterModeStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getMyKey());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getFuelRange());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getTurnSignal());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getCloudAppVehicleID());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getHandsOffSteering());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getWindowStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getGearStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getStabilityControlsStatus());
- assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- // Invalid/Null Tests
- UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Valid Tests
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getSpeed());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getRpm());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getExternalTemperature());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getFuelLevel());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getPrndl());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getTirePressure());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getEngineTorque());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getEngineOilLife());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getOdometer());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getGps());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getFuelLevelState());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getInstantFuelConsumption());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getBeltStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getBodyInformation());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getDeviceStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getDriverBraking());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getWiperStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getHeadLampStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getAccPedalPosition());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getSteeringWheelAngle());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getECallInfo());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getAirbagStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getEmergencyEvent());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getClusterModeStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getMyKey());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getFuelRange());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getTurnSignal());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getElectronicParkBrakeStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getCloudAppVehicleID());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getHandsOffSteering());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getWindowStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getGearStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getStabilityControlsStatus());
+ assertTrue(TestValues.TRUE, ((UnsubscribeVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ // Invalid/Null Tests
+ UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
assertNull(TestValues.NULL, msg.getDriverBraking());
@@ -200,73 +200,72 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getMyKey());
assertNull(TestValues.NULL, msg.getFuelRange());
assertNull(TestValues.NULL, msg.getTurnSignal());
- assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(TestValues.NULL, msg.getCloudAppVehicleID());
- assertNull(TestValues.NULL, msg.getHandsOffSteering());
- assertNull(TestValues.NULL, msg.getWindowStatus());
- assertNull(TestValues.NULL, msg.getGearStatus());
- assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
- assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- }
+ assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(TestValues.NULL, msg.getCloudAppVehicleID());
+ assertNull(TestValues.NULL, msg.getHandsOffSteering());
+ assertNull(TestValues.NULL, msg.getWindowStatus());
+ assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
+ assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ }
- /**
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnsubscribeVehicleData cmd = new UnsubscribeVehicleData(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeVehicleData cmd = new UnsubscribeVehicleData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_RPM), cmd.getRpm());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GPS), cmd.getGps());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_PRNDL), cmd.getPrndl());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TIRE_PRESSURE), cmd.getTirePressure());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ODOMETER), cmd.getOdometer());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GPS), cmd.getGps());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BELT_STATUS), cmd.getBeltStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_BODY_INFORMATION), cmd.getBodyInformation());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DEVICE_STATUS), cmd.getDeviceStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_DRIVER_BRAKING), cmd.getDriverBraking());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WIPER_STATUS), cmd.getWiperStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HEAD_LAMP_STATUS), cmd.getHeadLampStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_E_CALL_INFO), cmd.getECallInfo());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_AIRBAG_STATUS), cmd.getAirbagStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_EMERGENCY_EVENT), cmd.getEmergencyEvent());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLUSTER_MODE_STATUS), cmd.getClusterModeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_MY_KEY), cmd.getMyKey());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- }
- catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
index fe3aa9ffc..a0320aa08 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeWayPointsTests.java
@@ -49,7 +49,7 @@ public class UnsubscribeWayPointsTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
UnsubscribeWayPoints msg = new UnsubscribeWayPoints();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -60,7 +60,7 @@ public class UnsubscribeWayPointsTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
index 195530934..4f5cd4285 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UpdateTurnListTests.java
@@ -29,107 +29,107 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UpdateTurnList}
*/
public class UpdateTurnListTests extends BaseRpcTests {
@Override
protected RPCMessage createMessage() {
- UpdateTurnList msg = new UpdateTurnList();
-
- msg.setTurnList(TestValues.GENERAL_TURN_LIST);
- msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
-
- return msg;
+ UpdateTurnList msg = new UpdateTurnList();
+
+ msg.setTurnList(TestValues.GENERAL_TURN_LIST);
+ msg.setSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST);
+
+ return msg;
}
-
+
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_REQUEST;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.UPDATE_TURN_LIST.toString();
}
-
+
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
-
- try{
- result.put(UpdateTurnList.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
- result.put(UpdateTurnList.KEY_TURN_LIST, TestValues.JSON_TURNS);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+
+ try {
+ result.put(UpdateTurnList.KEY_SOFT_BUTTONS, TestValues.JSON_SOFTBUTTONS);
+ result.put(UpdateTurnList.KEY_TURN_LIST, TestValues.JSON_TURNS);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<SoftButton> testSoftButtonList = ( (UpdateTurnList) msg ).getSoftButtons();
- List<Turn> testTurnList = ( (UpdateTurnList) msg ).getTurnList();
-
- // Valid Tests
- assertNotNull(TestValues.NOT_NULL, testSoftButtonList);
- assertNotNull(TestValues.NOT_NULL, testTurnList);
-
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtonList));
- assertTrue(TestValues.TRUE, Validator.validateTurnList(TestValues.GENERAL_TURN_LIST, testTurnList));
-
- // Invalid/Null Tests
- UpdateTurnList msg = new UpdateTurnList();
+ public void testRpcValues() {
+ // Test Values
+ List<SoftButton> testSoftButtonList = ((UpdateTurnList) msg).getSoftButtons();
+ List<Turn> testTurnList = ((UpdateTurnList) msg).getTurnList();
+
+ // Valid Tests
+ assertNotNull(TestValues.NOT_NULL, testSoftButtonList);
+ assertNotNull(TestValues.NOT_NULL, testTurnList);
+
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(TestValues.GENERAL_SOFTBUTTON_LIST, testSoftButtonList));
+ assertTrue(TestValues.TRUE, Validator.validateTurnList(TestValues.GENERAL_TURN_LIST, testTurnList));
+
+ // Invalid/Null Tests
+ UpdateTurnList msg = new UpdateTurnList();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
assertNull(TestValues.NULL, msg.getTurnList());
assertNull(TestValues.NULL, msg.getSoftButtons());
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UpdateTurnList cmd = new UpdateTurnList(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_SOFT_BUTTONS);
- List<SoftButton> softButtonList = new ArrayList<SoftButton>();
- for (int index = 0; index < softButtonArray.length(); index++) {
- SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonArray.get(index)) );
- softButtonList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
-
- JSONArray turnArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_TURN_LIST);
- List<Turn> turnList = new ArrayList<Turn>();
- for (int index = 0; index < turnArray.length(); index++) {
- Turn chunk = new Turn(JsonRPCMarshaller.deserializeJSONObject((JSONObject) turnArray.get(index)));
- if (chunk != null)
- turnList.add(chunk);
- }
- assertTrue(TestValues.TRUE, Validator.validateTurnList(turnList, cmd.getTurnList()));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UpdateTurnList cmd = new UpdateTurnList(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_SOFT_BUTTONS);
+ List<SoftButton> softButtonList = new ArrayList<SoftButton>();
+ for (int index = 0; index < softButtonArray.length(); index++) {
+ SoftButton chunk = new SoftButton(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonArray.get(index)));
+ softButtonList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
+
+ JSONArray turnArray = JsonUtils.readJsonArrayFromJsonObject(parameters, UpdateTurnList.KEY_TURN_LIST);
+ List<Turn> turnList = new ArrayList<Turn>();
+ for (int index = 0; index < turnArray.length(); index++) {
+ Turn chunk = new Turn(JsonRPCMarshaller.deserializeJSONObject((JSONObject) turnArray.get(index)));
+ if (chunk != null)
+ turnList.add(chunk);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateTurnList(turnList, cmd.getTurnList()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
index 459fce382..52e113be4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddCommandResponseTests.java
@@ -21,62 +21,62 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AddCommandResponse}
*/
-public class AddCommandResponseTests extends BaseRpcTests{
+public class AddCommandResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new AddCommandResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ADD_COMMAND.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
AddCommandResponse msg = new AddCommandResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AddCommand cmd = new AddCommand(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AddCommand cmd = new AddCommand(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/AddSubmenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
index c4cf43309..826d8f481 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AddSubmenuResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AddSubMenuResponse}
*/
-public class AddSubmenuResponseTests extends BaseRpcTests{
+public class AddSubmenuResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new AddSubMenuResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ADD_SUB_MENU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
AddSubMenuResponse msg = new AddSubMenuResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class AddSubmenuResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AddSubMenuResponse cmd = new AddSubMenuResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AddSubMenuResponse cmd = new AddSubMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/AlertManeuverResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
index 44149d663..b7caed595 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertManeuverResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AlertManeuverResponse}
*/
public class AlertManeuverResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- return new AlertManeuverResponse();
- }
+ @Override
+ protected RPCMessage createMessage() {
+ return new AlertManeuverResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.ALERT_MANEUVER.toString();
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.ALERT_MANEUVER.toString();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
AlertManeuverResponse msg = new AlertManeuverResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class AlertManeuverResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AlertManeuverResponse cmd = new AlertManeuverResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AlertManeuverResponse cmd = new AlertManeuverResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/AlertResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
index 7d439aacc..517e7fd3c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/AlertResponseTests.java
@@ -22,54 +22,54 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.AlertResponse}
*/
-public class AlertResponseTests extends BaseRpcTests{
+public class AlertResponseTests extends BaseRpcTests {
private static final int TRY_AGAIN_TIME = 400;
@Override
- protected RPCMessage createMessage(){
- AlertResponse alert = new AlertResponse();
- alert.setTryAgainTime(TRY_AGAIN_TIME);
+ protected RPCMessage createMessage() {
+ AlertResponse alert = new AlertResponse();
+ alert.setTryAgainTime(TRY_AGAIN_TIME);
return alert;
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.ALERT.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(AlertResponse.KEY_TRY_AGAIN_TIME, TRY_AGAIN_TIME);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int tryAgainTime = ( (AlertResponse) msg ).getTryAgainTime();
-
+ public void testRpcValues() {
+ // Test Values
+ int tryAgainTime = ((AlertResponse) msg).getTryAgainTime();
+
// Valid Tests
assertEquals(TestValues.MATCH, TRY_AGAIN_TIME, tryAgainTime);
-
+
// Invalid/Null Tests
AlertResponse msg = new AlertResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -82,25 +82,25 @@ public class AlertResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- AlertResponse cmd = new AlertResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AlertResponse.KEY_TRY_AGAIN_TIME), cmd.getTryAgainTime());
-
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ AlertResponse cmd = new AlertResponse(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AlertResponse.KEY_TRY_AGAIN_TIME), cmd.getTryAgainTime());
+
+ } 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/ButtonPressResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
index 6350b6e80..e614bc636 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ButtonPressResponse}
*/
public class ButtonPressResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage(){
+
+ @Override
+ protected RPCMessage createMessage() {
return new ButtonPressResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.BUTTON_PRESS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
ButtonPressResponse msg = new ButtonPressResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class ButtonPressResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
ButtonPressResponse cmd = new ButtonPressResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/CancelInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
index fb9374247..66f143449 100644
--- 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
@@ -60,22 +60,22 @@ import static junit.framework.TestCase.assertNotNull;
public class CancelInteractionResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new CancelInteractionResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CANCEL_INTERACTION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -83,7 +83,7 @@ public class CancelInteractionResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
CancelInteractionResponse msg = new CancelInteractionResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -94,7 +94,7 @@ public class CancelInteractionResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
index e3000a9ed..b81a73a45 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ChangeRegistrationResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse}
*/
-public class ChangeRegistrationResponseTests extends BaseRpcTests{
+public class ChangeRegistrationResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new ChangeRegistrationResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CHANGE_REGISTRATION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
ChangeRegistrationResponse msg = new ChangeRegistrationResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,23 +60,23 @@ public class ChangeRegistrationResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ChangeRegistrationResponse cmd = new ChangeRegistrationResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ChangeRegistrationResponse cmd = new ChangeRegistrationResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ } 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/CloseApplicationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
index 135155e6e..21a41fad9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
@@ -60,22 +60,22 @@ import static junit.framework.TestCase.assertNotNull;
public class CloseApplicationResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new CloseApplicationResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CLOSE_APPLICATION.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -83,7 +83,7 @@ public class CloseApplicationResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
CloseApplicationResponse msg = new CloseApplicationResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -94,7 +94,7 @@ public class CloseApplicationResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
index 3c0b783b3..34f290114 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateInteractionChoiceSetResponseTests.java
@@ -12,37 +12,37 @@ import org.junit.Test;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse}
*/
-public class CreateInteractionChoiceSetResponseTests extends BaseRpcTests{
+public class CreateInteractionChoiceSetResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new CreateInteractionChoiceSetResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.CREATE_INTERACTION_CHOICE_SET.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
CreateInteractionChoiceSetResponse msg = new CreateInteractionChoiceSetResponse();
assertNotNull(TestValues.NOT_NULL, msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
index 92a179855..cda4f25ba 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteCommandResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteCommandResponse}
*/
-public class DeleteCommandResponseTests extends BaseRpcTests{
+public class DeleteCommandResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new DeleteCommandResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_COMMAND.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
DeleteCommandResponse msg = new DeleteCommandResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class DeleteCommandResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteCommandResponse cmd = new DeleteCommandResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteCommandResponse cmd = new DeleteCommandResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/DeleteFileResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
index 42b26d1bd..68dcf1bd6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteFileResponseTests.java
@@ -22,13 +22,13 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteFileResponse}
*/
-public class DeleteFileResponseTests extends BaseRpcTests{
+public class DeleteFileResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DeleteFileResponse msg = new DeleteFileResponse();
msg.setSpaceAvailable(TestValues.GENERAL_INT);
@@ -37,39 +37,39 @@ public class DeleteFileResponseTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_FILE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DeleteFileResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- int spaceAvailable = ( (DeleteFileResponse) msg ).getSpaceAvailable();
-
+ public void testRpcValues() {
+ // Test Values
+ int spaceAvailable = ((DeleteFileResponse) msg).getSpaceAvailable();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, spaceAvailable);
-
+
// Invalid/Null Tests
DeleteFileResponse msg = new DeleteFileResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -82,25 +82,25 @@ public class DeleteFileResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteFileResponse cmd = new DeleteFileResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteFileResponse cmd = new DeleteFileResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ } 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/DeleteInteractionChoiceSetResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
index 53d5f58e9..647b2817c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteInteractionChoiceSetResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse}
*/
-public class DeleteInteractionChoiceSetResponseTests extends BaseRpcTests{
+public class DeleteInteractionChoiceSetResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new DeleteInteractionChoiceSetResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_INTERACTION_CHOICE_SET.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
DeleteInteractionChoiceSetResponse msg = new DeleteInteractionChoiceSetResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class DeleteInteractionChoiceSetResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteInteractionChoiceSetResponse cmd = new DeleteInteractionChoiceSetResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteInteractionChoiceSetResponse cmd = new DeleteInteractionChoiceSetResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/DeleteSubMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
index 8809b51c3..f9357510e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteSubMenuResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse}
*/
-public class DeleteSubMenuResponseTests extends BaseRpcTests{
+public class DeleteSubMenuResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new DeleteSubMenuResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DELETE_SUB_MENU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
DeleteSubMenuResponse msg = new DeleteSubMenuResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class DeleteSubMenuResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DeleteSubMenuResponse cmd = new DeleteSubMenuResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteSubMenuResponse cmd = new DeleteSubMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/DiagnosticMessageResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
index 289269ffd..5b22b5e83 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DiagnosticMessageResponseTests.java
@@ -25,13 +25,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse}
*/
-public class DiagnosticMessageResponseTests extends BaseRpcTests{
+public class DiagnosticMessageResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
DiagnosticMessageResponse msg = new DiagnosticMessageResponse();
msg.setMessageDataResult(TestValues.GENERAL_INTEGER_LIST);
@@ -40,24 +40,24 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.DIAGNOSTIC_MESSAGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(DiagnosticMessageResponse.KEY_MESSAGE_DATA_RESULT,
JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -65,20 +65,20 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<Integer> cmdId = ( (DiagnosticMessageResponse) msg ).getMessageDataResult();
+ public void testRpcValues() {
+ // Test Values
+ List<Integer> cmdId = ((DiagnosticMessageResponse) msg).getMessageDataResult();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.size(), cmdId.size());
- for(int i = 0; i < TestValues.GENERAL_INTEGER_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_INTEGER_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST.get(i), cmdId.get(i));
}
-
+
// Invalid/Null Tests
DiagnosticMessageResponse msg = new DiagnosticMessageResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -91,30 +91,30 @@ public class DiagnosticMessageResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- DiagnosticMessageResponse cmd = new DiagnosticMessageResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- List<Integer> dataResultList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessageResponse.KEY_MESSAGE_DATA_RESULT);
- List<Integer> testResultList = cmd.getMessageDataResult();
-
- assertEquals(TestValues.MATCH, dataResultList.size(), testResultList.size());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(dataResultList, testResultList));
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DiagnosticMessageResponse cmd = new DiagnosticMessageResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ List<Integer> dataResultList = JsonUtils.readIntegerListFromJsonObject(parameters, DiagnosticMessageResponse.KEY_MESSAGE_DATA_RESULT);
+ List<Integer> testResultList = cmd.getMessageDataResult();
+
+ assertEquals(TestValues.MATCH, dataResultList.size(), testResultList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(dataResultList, testResultList));
+ } 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/DialNumberResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
index 006e6d050..ec3e6c32e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DialNumberResponseTests.java
@@ -49,7 +49,7 @@ public class DialNumberResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
DialNumberResponse msg = new DialNumberResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -60,7 +60,7 @@ public class DialNumberResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
index a3a79b6bd..35ea755b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/EndAudioPassThruResponseTests.java
@@ -20,37 +20,37 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse}
*/
-public class EndAudioPassThruResponseTests extends BaseRpcTests{
+public class EndAudioPassThruResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new EndAudioPassThruResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.END_AUDIO_PASS_THRU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
EndAudioPassThruResponse msg = new EndAudioPassThruResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -60,22 +60,22 @@ public class EndAudioPassThruResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- EndAudioPassThruResponse cmd = new EndAudioPassThruResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ EndAudioPassThruResponse cmd = new EndAudioPassThruResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/GenericResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
index ecb6fad7c..f22e9ecca 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GenericResponseTests.java
@@ -12,37 +12,37 @@ import org.junit.Test;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GenericResponse}
*/
-public class GenericResponseTests extends BaseRpcTests{
+public class GenericResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new GenericResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GENERIC_RESPONSE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ public void testRpcValues() {
+ // Invalid/Null Tests
GenericResponse msg = new GenericResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
index 49de496e4..8bc12e5d7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetAppServiceDataResponseTests.java
@@ -26,61 +26,61 @@ import static junit.framework.TestCase.assertNotNull;
*/
public class GetAppServiceDataResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- return new GetAppServiceDataResponse();
- }
+ @Override
+ protected RPCMessage createMessage() {
+ return new GetAppServiceDataResponse();
+ }
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
- @Override
- protected String getCommandType(){
- return FunctionID.GET_APP_SERVICE_DATA.toString();
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_APP_SERVICE_DATA.toString();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- return new JSONObject();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
- GetAppServiceDataResponse msg = new GetAppServiceDataResponse();
- msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ GetAppServiceDataResponse msg = new GetAppServiceDataResponse();
+ msg.setServiceData(TestValues.GENERAL_APPSERVICEDATA);
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
- // test getter
- AppServiceData serviceData = msg.getServiceData();
- assertEquals(TestValues.GENERAL_APPSERVICEDATA, serviceData);
- }
+ // test getter
+ AppServiceData serviceData = msg.getServiceData();
+ assertEquals(TestValues.GENERAL_APPSERVICEDATA, serviceData);
+ }
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetAppServiceDataResponse cmd = new GetAppServiceDataResponse(hash);
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetAppServiceDataResponse cmd = new GetAppServiceDataResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ } 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/GetCloudAppPropertiesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
index b9d40f907..bc3873421 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
@@ -12,35 +12,35 @@ import org.junit.Test;
import static junit.framework.TestCase.assertNotNull;
public class GetCloudAppPropertiesResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- return new GetCloudAppPropertiesResponse();
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
- GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
- }
+ @Override
+ protected RPCMessage createMessage() {
+ return new GetCloudAppPropertiesResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
index bbbd2559a..e54b1b71b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetDTCsResponseTests.java
@@ -25,13 +25,13 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetDTCsResponse}
*/
-public class GetDTCsResponseTests extends BaseRpcTests{
-
+public class GetDTCsResponseTests extends BaseRpcTests {
+
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetDTCsResponse msg = new GetDTCsResponse();
msg.setDtc(TestValues.GENERAL_STRING_LIST);
@@ -40,43 +40,43 @@ public class GetDTCsResponseTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_DTCS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetDTCsResponse.KEY_DTC, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<String> cmdId = ( (GetDTCsResponse) msg ).getDtc();
+ public void testRpcValues() {
+ // Test Values
+ List<String> cmdId = ((GetDTCsResponse) msg).getDtc();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), cmdId.size());
- for(int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++){
+ for (int i = 0; i < TestValues.GENERAL_STRING_LIST.size(); i++) {
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.get(i), cmdId.get(i));
}
-
+
// Invalid/Null Tests
GetDTCsResponse msg = new GetDTCsResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -89,30 +89,30 @@ public class GetDTCsResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetDTCsResponse cmd = new GetDTCsResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- List<String> dtcList = JsonUtils.readStringListFromJsonObject(parameters, GetDTCsResponse.KEY_DTC);
- List<String> testDtcList = cmd.getDtc();
- assertEquals(TestValues.MATCH, dtcList.size(), testDtcList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(dtcList, testDtcList));
-
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetDTCsResponse cmd = new GetDTCsResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ List<String> dtcList = JsonUtils.readStringListFromJsonObject(parameters, GetDTCsResponse.KEY_DTC);
+ List<String> testDtcList = cmd.getDtc();
+ assertEquals(TestValues.MATCH, dtcList.size(), testDtcList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(dtcList, testDtcList));
+
+ } 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/GetFileResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
index 867e91cb2..87f7ebd8b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetFileResponseTests.java
@@ -29,100 +29,100 @@ import static junit.framework.TestCase.fail;
*/
public class GetFileResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
-
- GetFileResponse msg = new GetFileResponse();
-
- msg.setCRC(TestValues.GENERAL_INT);
- msg.setFileType(TestValues.GENERAL_FILETYPE);
- msg.setOffset(TestValues.GENERAL_INT);
- msg.setLength(TestValues.GENERAL_INT);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.GET_FILE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- try{
- result.put(GetFileResponse.KEY_CRC, TestValues.GENERAL_INTEGER);
- result.put(GetFileResponse.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
- result.put(GetFileResponse.KEY_OFFSET, TestValues.GENERAL_INTEGER);
- result.put(GetFileResponse.KEY_LENGTH, TestValues.GENERAL_INTEGER);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer crc = ( (GetFileResponse) msg ).getCRC();
- FileType fileType = ( (GetFileResponse) msg ).getFileType();
- Integer offset = ( (GetFileResponse) msg ).getOffset();
- Integer length = ( (GetFileResponse) msg ).getLength();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, crc);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
-
- // Invalid/Null Tests
- GetFileResponse msg = new GetFileResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getCRC());
- assertNull(TestValues.NULL, msg.getFileType());
- assertNull(TestValues.NULL, msg.getOffset());
- assertNull(TestValues.NULL, msg.getLength());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetFileResponse cmd = new GetFileResponse (hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_CRC), cmd.getCRC());
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFileResponse.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_LENGTH), cmd.getLength());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_OFFSET), cmd.getOffset());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+
+ GetFileResponse msg = new GetFileResponse();
+
+ msg.setCRC(TestValues.GENERAL_INT);
+ msg.setFileType(TestValues.GENERAL_FILETYPE);
+ msg.setOffset(TestValues.GENERAL_INT);
+ msg.setLength(TestValues.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(GetFileResponse.KEY_CRC, TestValues.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
+ result.put(GetFileResponse.KEY_OFFSET, TestValues.GENERAL_INTEGER);
+ result.put(GetFileResponse.KEY_LENGTH, TestValues.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer crc = ((GetFileResponse) msg).getCRC();
+ FileType fileType = ((GetFileResponse) msg).getFileType();
+ Integer offset = ((GetFileResponse) msg).getOffset();
+ Integer length = ((GetFileResponse) msg).getLength();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, crc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, offset);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER, length);
+
+ // Invalid/Null Tests
+ GetFileResponse msg = new GetFileResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getCRC());
+ assertNull(TestValues.NULL, msg.getFileType());
+ assertNull(TestValues.NULL, msg.getOffset());
+ assertNull(TestValues.NULL, msg.getLength());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetFileResponse cmd = new GetFileResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_CRC), cmd.getCRC());
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetFileResponse.KEY_FILE_TYPE).toString(), cmd.getFileType().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_LENGTH), cmd.getLength());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetFileResponse.KEY_OFFSET), cmd.getOffset());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
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
index 512d324e3..715e49f6c 100644
--- 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
@@ -25,68 +25,68 @@ import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
- msg.setAllowances(TestValues.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(TestValues.GENERAL_BOOLEAN_LIST));
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- return result;
- }
-
- @Test
- public void testRpcValues() {
- List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
- assertEquals(TestValues.MATCH, list, TestValues.GENERAL_BOOLEAN_LIST);
- }
-
- @Test
- public void testRequiredParams(){
- GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(true, Result.SUCCESS);
- assertTrue(msg.getSuccess());
- assertEquals(TestValues.MATCH, msg.getResultCode(), Result.SUCCESS);
- }
-
- @Test
- public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
- GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
+ msg.setAllowances(TestValues.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(TestValues.GENERAL_BOOLEAN_LIST));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Test
+ public void testRpcValues() {
+ List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
+ assertEquals(TestValues.MATCH, list, TestValues.GENERAL_BOOLEAN_LIST);
+ }
+
+ @Test
+ public void testRequiredParams() {
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(true, Result.SUCCESS);
+ assertTrue(msg.getSuccess());
+ assertEquals(TestValues.MATCH, msg.getResultCode(), Result.SUCCESS);
+ }
+
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
+ GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
index e4006d4a4..bef276ffb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
@@ -31,7 +31,7 @@ import static junit.framework.TestCase.fail;
public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse();
@@ -42,23 +42,23 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED, TestValues.GENERAL_BOOLEAN);
result.put(GetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -69,10 +69,10 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- boolean testIsSubscribed = ( (GetInteriorVehicleDataResponse) msg ).getIsSubscribed();
- ModuleData testModuleData = ( (GetInteriorVehicleDataResponse) msg ).getModuleData();
+ boolean testIsSubscribed = ((GetInteriorVehicleDataResponse) msg).getIsSubscribed();
+ ModuleData testModuleData = ((GetInteriorVehicleDataResponse) msg).getModuleData();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, testIsSubscribed);
@@ -91,13 +91,13 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetInteriorVehicleDataResponse cmd = new GetInteriorVehicleDataResponse (hash);
+ GetInteriorVehicleDataResponse cmd = new GetInteriorVehicleDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
assertNotNull(TestValues.NOT_NULL, body);
@@ -111,7 +111,7 @@ public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
ModuleData cmdModuleData = cmd.getModuleData();
- assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData));
assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED), cmd.getIsSubscribed());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
index 827b340e7..802201d2c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
@@ -25,7 +25,7 @@ import static junit.framework.TestCase.fail;
public class GetSystemCapabilityResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse();
msg.setSystemCapability(TestValues.GENERAL_SYSTEMCAPABILITY);
@@ -34,22 +34,22 @@ public class GetSystemCapabilityResponseTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_SYSTEM_CAPABILITY.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_SYSTEMCAPABILITY.getStore()));
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -60,9 +60,9 @@ public class GetSystemCapabilityResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- SystemCapability testCapability = ( (GetSystemCapabilityResponse) msg ).getSystemCapability();
+ SystemCapability testCapability = ((GetSystemCapabilityResponse) msg).getSystemCapability();
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_SYSTEMCAPABILITY.getSystemCapabilityType(), testCapability.getSystemCapabilityType());
@@ -79,7 +79,7 @@ public class GetSystemCapabilityResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
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 91e13586a..606283cc7 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
@@ -47,31 +47,31 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.GetVehicleDataResponse}
*/
-public class GetVehicleDataResponseTests extends BaseRpcTests{
+public class GetVehicleDataResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
- return VehicleDataHelper.VEHICLE_DATA_RESPONSE;
+ protected RPCMessage createMessage() {
+ return VehicleDataHelper.VEHICLE_DATA_RESPONSE;
}
-
+
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.GET_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(GetVehicleDataResponse.KEY_SPEED, VehicleDataHelper.SPEED);
result.put(GetVehicleDataResponse.KEY_RPM, VehicleDataHelper.RPM);
result.put(GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
@@ -101,13 +101,13 @@ 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(GetVehicleDataResponse.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
+ result.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
result.put(GetVehicleDataResponse.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
result.put(GetVehicleDataResponse.KEY_GEAR_STATUS, VehicleDataHelper.GEAR_STATUS);
- result.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
- } catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ result.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
@@ -115,440 +115,424 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
@Test
public void testJson() {
- JSONObject reference = new JSONObject();
-
- //objects needed on the first level
- JSONObject tireStatusObj = new JSONObject();
- JSONObject GPSDataObj = new JSONObject();
- JSONObject beltStatusObj = new JSONObject();
- JSONObject bodyInformationObj = new JSONObject();
- JSONObject deviceStatusObj = new JSONObject();
- JSONObject headLampStatusObj = new JSONObject();
- JSONObject ECallInfoObj = new JSONObject();
- JSONObject airbagStatusObj = new JSONObject();
- JSONObject emergencyEventObj = new JSONObject();
- JSONObject clusterModeStatusObj = new JSONObject();
- JSONObject myKeyObj = new JSONObject();
- JSONObject stabilityControlsStatusObj = new JSONObject();
- JSONObject fuelRangeObj = new JSONObject();
- JSONObject windowStatusObj = new JSONObject();
- JSONObject gearStatusObj = new JSONObject();
- JSONArray fuelRangeArrayObj = new JSONArray();
- JSONArray windowStatusArrayObj = new JSONArray();
-
- try {
- //set up the JSONObject to represent GetVehicleDataResponse
- //TIRE_PRESSURE
- tireStatusObj.put(TireStatus.KEY_PRESSURE_TELL_TALE, VehicleDataHelper.TIRE_PRESSURE_TELL_TALE);
- JSONObject tireLeftFront = new JSONObject();
- tireLeftFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_FRONT);
- tireStatusObj.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
- JSONObject tireRightFront = new JSONObject();
- tireRightFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_FRONT);
- tireStatusObj.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
- JSONObject tireLeftRear = new JSONObject();
- tireLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_REAR);
- tireStatusObj.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
- JSONObject tireRightRear = new JSONObject();
- tireRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_REAR);
- tireStatusObj.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
- JSONObject tireInnerLeftRear = new JSONObject();
- tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_LEFT_REAR);
- tireStatusObj.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
- JSONObject tireInnerRightRear = new JSONObject();
- tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_RIGHT_REAR);
- tireStatusObj.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
-
- //GPS
- GPSDataObj.put(GPSData.KEY_LONGITUDE_DEGREES, VehicleDataHelper.GPS_LONGITUDE);
- GPSDataObj.put(GPSData.KEY_LATITUDE_DEGREES, VehicleDataHelper.GPS_LATITUDE);
- GPSDataObj.put(GPSData.KEY_UTC_YEAR, VehicleDataHelper.GPS_YEAR);
- GPSDataObj.put(GPSData.KEY_UTC_MONTH, VehicleDataHelper.GPS_MONTH);
- GPSDataObj.put(GPSData.KEY_UTC_DAY, VehicleDataHelper.GPS_DAY);
- GPSDataObj.put(GPSData.KEY_UTC_HOURS, VehicleDataHelper.GPS_HOURS);
- GPSDataObj.put(GPSData.KEY_UTC_MINUTES, VehicleDataHelper.GPS_MINUTES);
- GPSDataObj.put(GPSData.KEY_UTC_SECONDS, VehicleDataHelper.GPS_SECONDS);
- GPSDataObj.put(GPSData.KEY_COMPASS_DIRECTION, VehicleDataHelper.GPS_DIRECTION);
- GPSDataObj.put(GPSData.KEY_PDOP, VehicleDataHelper.GPS_PDOP);
- GPSDataObj.put(GPSData.KEY_VDOP, VehicleDataHelper.GPS_VDOP);
- GPSDataObj.put(GPSData.KEY_HDOP, VehicleDataHelper.GPS_HDOP);
- GPSDataObj.put(GPSData.KEY_ACTUAL, VehicleDataHelper.GPS_ACTUAL);
- GPSDataObj.put(GPSData.KEY_SATELLITES, VehicleDataHelper.GPS_SATELLITES);
- GPSDataObj.put(GPSData.KEY_DIMENSION, VehicleDataHelper.GPS_DIMENSION);
- GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
- GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
- GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
- GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
-
- //BELT_STATUS
- beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_PASSENGER_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_PASSENGER_BELTED);
- beltStatusObj.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_DRIVER_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, VehicleDataHelper.BELT_STATUS_PASSENGER_CHILD);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_2_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_3_BELTED);
- beltStatusObj.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
- beltStatusObj.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
- beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_BELTED);
-
- //BODY_INFORMATION
- bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE);
- bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS);
- bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS);
- bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR);
- bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR);
-
- //DEVICE_STATUS
- deviceStatusObj.put(DeviceStatus.KEY_VOICE_REC_ON, VehicleDataHelper.DEVICE_STATUS_VOICE_REC);
- deviceStatusObj.put(DeviceStatus.KEY_BT_ICON_ON, VehicleDataHelper.DEVICE_STATUS_BT_ICON);
- deviceStatusObj.put(DeviceStatus.KEY_CALL_ACTIVE, VehicleDataHelper.DEVICE_STATUS_CALL_ACTIVE);
- deviceStatusObj.put(DeviceStatus.KEY_PHONE_ROAMING, VehicleDataHelper.DEVICE_STATUS_PHONE_ROAMING);
- deviceStatusObj.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, VehicleDataHelper.DEVICE_STATUS_TEXT_MSG_AVAILABLE);
- deviceStatusObj.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_BATT_LEVEL_STATUS);
- deviceStatusObj.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_STEREO_MUTED);
- deviceStatusObj.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_MONO_MUTED);
- deviceStatusObj.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
- deviceStatusObj.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, VehicleDataHelper.DEVICE_STATUS_PRIMARY_AUDIO);
- deviceStatusObj.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, VehicleDataHelper.DEVICE_STATUS_E_CALL_ACTIVE);
-
- //HEAD_LAMP_STATUS
- headLampStatusObj.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, VehicleDataHelper.HEAD_LAMP_STATUS_AMBIENT_STATUS);
- headLampStatusObj.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_HIGH_BEAMS);
- headLampStatusObj.put(HeadLampStatus.KEY_LOW_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_LOW_BEAMS);
-
- //E_CALL_INFO
- ECallInfoObj.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
- ECallInfoObj.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
- ECallInfoObj.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, VehicleDataHelper.E_CALL_INFO_CONFIRMATION_STATUS);
-
- //AIRBAG_STATUS
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
- airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
-
- //EMERGENCY_EVENT
- emergencyEventObj.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, VehicleDataHelper.EMERGENCY_EVENT_TYPE);
- emergencyEventObj.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, VehicleDataHelper.EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
- emergencyEventObj.put(EmergencyEvent.KEY_ROLLOVER_EVENT, VehicleDataHelper.EMERGENCY_EVENT_ROLLOVER_EVENT);
- emergencyEventObj.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, VehicleDataHelper.EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
- emergencyEventObj.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, VehicleDataHelper.EMERGENCY_EVENT_MULTIPLE_EVENTS);
-
- //CLUSTER_MODE_STATUS
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
- clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
-
- // STABILITY_CONTROL_STATUS
- stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
- stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
-
- //MY_KEY
- myKeyObj.put(MyKey.KEY_E_911_OVERRIDE, VehicleDataHelper.MY_KEY_E_911_OVERRIDE);
-
- // FUEL_RANGE
- fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
- fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
- fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
- fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
- fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
- fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
- fuelRangeArrayObj.put(fuelRangeObj);
-
- //GEAR_STATUS
- gearStatusObj.put(GearStatus.KEY_USER_SELECTED_GEAR, VehicleDataHelper.USER_SELECTED_GEAR);
- gearStatusObj.put(GearStatus.KEY_TRANSMISSION_TYPE, VehicleDataHelper.TRANSMISSION_TYPE);
- gearStatusObj.put(GearStatus.KEY_ACTUAL_GEAR, VehicleDataHelper.ACTUAL_GEAR);
-
- // WINDOW_STATUS
- windowStatusObj.put(WindowStatus.KEY_LOCATION, VehicleDataHelper.LOCATION_GRID);
- windowStatusObj.put(WindowStatus.KEY_STATE, VehicleDataHelper.WINDOW_STATE);
- windowStatusArrayObj.put(windowStatusObj);
-
- reference.put(GetVehicleDataResponse.KEY_SPEED, VehicleDataHelper.SPEED);
- reference.put(GetVehicleDataResponse.KEY_RPM, VehicleDataHelper.RPM);
- reference.put(GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
- reference.put(GetVehicleDataResponse.KEY_FUEL_LEVEL, VehicleDataHelper.FUEL_LEVEL);
- reference.put(GetVehicleDataResponse.KEY_VIN, VehicleDataHelper.VIN);
- reference.put(GetVehicleDataResponse.KEY_PRNDL, VehicleDataHelper.PRNDL_FINAL);
- reference.put(GetVehicleDataResponse.KEY_TIRE_PRESSURE, tireStatusObj);
- reference.put(GetVehicleDataResponse.KEY_ENGINE_TORQUE, VehicleDataHelper.ENGINE_TORQUE);
- reference.put(GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE, VehicleDataHelper.ENGINE_OIL_LIFE);
- reference.put(GetVehicleDataResponse.KEY_ODOMETER, VehicleDataHelper.ODOMETER);
- reference.put(GetVehicleDataResponse.KEY_GPS, GPSDataObj);
- reference.put(GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE, VehicleDataHelper.FUEL_LEVEL_STATE);
- reference.put(GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION);
- reference.put(GetVehicleDataResponse.KEY_BELT_STATUS, beltStatusObj);
- reference.put(GetVehicleDataResponse.KEY_BODY_INFORMATION, bodyInformationObj);
- reference.put(GetVehicleDataResponse.KEY_DEVICE_STATUS, deviceStatusObj);
- reference.put(GetVehicleDataResponse.KEY_DRIVER_BRAKING, VehicleDataHelper.DRIVER_BRAKING);
- reference.put(GetVehicleDataResponse.KEY_WIPER_STATUS, VehicleDataHelper.WIPER_STATUS);
- reference.put(GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS, headLampStatusObj);
- reference.put(GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION, VehicleDataHelper.ACC_PEDAL_POSITION);
- reference.put(GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, VehicleDataHelper.STEERING_WHEEL_ANGLE);
- reference.put(GetVehicleDataResponse.KEY_E_CALL_INFO, ECallInfoObj);
- reference.put(GetVehicleDataResponse.KEY_AIRBAG_STATUS, airbagStatusObj);
- reference.put(GetVehicleDataResponse.KEY_EMERGENCY_EVENT, emergencyEventObj);
- reference.put(GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, clusterModeStatusObj);
- reference.put(GetVehicleDataResponse.KEY_MY_KEY, myKeyObj);
- reference.put(GetVehicleDataResponse.KEY_FUEL_RANGE, fuelRangeArrayObj);
- reference.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, TurnSignal.OFF);
- reference.put(GetVehicleDataResponse.KEY_GEAR_STATUS, gearStatusObj);
- reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- reference.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, windowStatusArrayObj);
- reference.put(GetVehicleDataResponse.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
- reference.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatusObj);
- reference.put(TestValues.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 response key
- underTest = underTest.getJSONObject("response").getJSONObject("parameters");
-
- assertEquals("JSON size didn't match expected size.", reference.length(), underTest.length());
-
- Iterator<?> iterator = reference.keys();
-
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
-
- if (key.equals(GetVehicleDataResponse.KEY_TIRE_PRESSURE)) {
- JSONObject tirePressureReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject tirePressureTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateTireStatus(
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureReference)),
- new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureTest))));
-
- }
- else if (key.equals(GetVehicleDataResponse.KEY_GPS)) {
- JSONObject GPSObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject GPSObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateGpsData(
- new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjReference)),
- new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_BELT_STATUS)) {
- JSONObject beltObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject beltObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateBeltStatus(
- new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjReference)),
- new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_BODY_INFORMATION)) {
- JSONObject bodyInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject bodyInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateBodyInformation(
- new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjReference)),
- new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_DEVICE_STATUS)) {
- JSONObject deviceObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject deviceObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateDeviceStatus(
- new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjReference)),
- new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS)) {
- JSONObject headLampObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject headLampObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateHeadLampStatus(
- new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjReference)),
- new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_E_CALL_INFO)) {
- JSONObject callInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject callInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateECallInfo(
- new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjReference)),
- new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_AIRBAG_STATUS)) {
- JSONObject airbagObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject airbagObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateAirbagStatus(
- new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjReference)),
- new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_EMERGENCY_EVENT)) {
- JSONObject emergencyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject emergencyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateEmergencyEvent(
- new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjReference)),
- new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS)) {
- JSONObject clusterModeObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject clusterModeObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateClusterModeStatus(
- new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjReference)),
- new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_MY_KEY)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateMyKey(
- new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
- new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE)) {
- assertEquals("JSON value didn't match expected value for key \"" + key + "\".",
- JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_GEAR_STATUS)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- assertTrue(TestValues.TRUE, Validator.validateGearStatuses(
- new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
- new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
- JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
- JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
-
- StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
- StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateStabilityControlStatus(
- status1,
- status2
- )
- );
- }
- else if (key.equals(GetVehicleDataResponse.KEY_FUEL_RANGE)) {
- JSONArray fuelRangeArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- List<FuelRange> fuelRangeRefereceList = new ArrayList<FuelRange>();
- for (int index = 0; index < fuelRangeArrayObjReference.length(); index++) {
- FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)fuelRangeArrayObjReference.get(index) ));
- fuelRangeRefereceList.add(fuelRange);
- }
-
- JSONArray fuelRangeArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<FuelRange> fuelRangeUnderTestList = new ArrayList<FuelRange>();
- for (int index = 0; index < fuelRangeArrayObjTest.length(); index++) {
- FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)fuelRangeArrayObjTest.get(index) ));
- fuelRangeUnderTestList.add(fuelRange);
- }
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateFuelRange(
- fuelRangeRefereceList,
- fuelRangeUnderTestList));
- }
- else if (key.equals(GetVehicleDataResponse.KEY_WINDOW_STATUS)) {
- JSONArray windowStatusArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
- List<WindowStatus> windowStatusReferenceList = new ArrayList<>();
- for (int index = 0; index < windowStatusArrayObjReference.length(); index++) {
- WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)windowStatusArrayObjReference.get(index) ));
- windowStatusReferenceList.add(windowStatus);
- }
-
- JSONArray windowStatusArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
- List<WindowStatus> windowStatusUnderTestList = new ArrayList<>();
- for (int index = 0; index < windowStatusArrayObjTest.length(); index++) {
- WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)windowStatusArrayObjTest.get(index) ));
- windowStatusUnderTestList.add(windowStatus);
- }
-
- assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
- Validator.validateWindowStatuses(
- windowStatusReferenceList,
- windowStatusUnderTestList));
- }
- else {
- assertEquals("JSON value didn't match expected value for key \"" + key + "\".",
- JsonUtils.readObjectFromJsonObject(reference, key),
- JsonUtils.readObjectFromJsonObject(underTest, key));
- }
-
- }
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ JSONObject reference = new JSONObject();
+
+ //objects needed on the first level
+ JSONObject tireStatusObj = new JSONObject();
+ JSONObject GPSDataObj = new JSONObject();
+ JSONObject beltStatusObj = new JSONObject();
+ JSONObject bodyInformationObj = new JSONObject();
+ JSONObject deviceStatusObj = new JSONObject();
+ JSONObject headLampStatusObj = new JSONObject();
+ JSONObject ECallInfoObj = new JSONObject();
+ JSONObject airbagStatusObj = new JSONObject();
+ JSONObject emergencyEventObj = new JSONObject();
+ JSONObject clusterModeStatusObj = new JSONObject();
+ JSONObject myKeyObj = new JSONObject();
+ JSONObject stabilityControlsStatusObj = new JSONObject();
+ JSONObject fuelRangeObj = new JSONObject();
+ JSONObject windowStatusObj = new JSONObject();
+ JSONObject gearStatusObj = new JSONObject();
+ JSONArray fuelRangeArrayObj = new JSONArray();
+ JSONArray windowStatusArrayObj = new JSONArray();
+
+ try {
+ //set up the JSONObject to represent GetVehicleDataResponse
+ //TIRE_PRESSURE
+ tireStatusObj.put(TireStatus.KEY_PRESSURE_TELL_TALE, VehicleDataHelper.TIRE_PRESSURE_TELL_TALE);
+ JSONObject tireLeftFront = new JSONObject();
+ tireLeftFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_FRONT);
+ tireStatusObj.put(TireStatus.KEY_LEFT_FRONT, tireLeftFront);
+ JSONObject tireRightFront = new JSONObject();
+ tireRightFront.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_FRONT);
+ tireStatusObj.put(TireStatus.KEY_RIGHT_FRONT, tireRightFront);
+ JSONObject tireLeftRear = new JSONObject();
+ tireLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_LEFT_REAR);
+ tireStatusObj.put(TireStatus.KEY_LEFT_REAR, tireLeftRear);
+ JSONObject tireRightRear = new JSONObject();
+ tireRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_RIGHT_REAR);
+ tireStatusObj.put(TireStatus.KEY_RIGHT_REAR, tireRightRear);
+ JSONObject tireInnerLeftRear = new JSONObject();
+ tireInnerLeftRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_LEFT_REAR);
+ tireStatusObj.put(TireStatus.KEY_INNER_LEFT_REAR, tireInnerLeftRear);
+ JSONObject tireInnerRightRear = new JSONObject();
+ tireInnerRightRear.put(SingleTireStatus.KEY_STATUS, VehicleDataHelper.TIRE_PRESSURE_INNER_RIGHT_REAR);
+ tireStatusObj.put(TireStatus.KEY_INNER_RIGHT_REAR, tireInnerRightRear);
+
+ //GPS
+ GPSDataObj.put(GPSData.KEY_LONGITUDE_DEGREES, VehicleDataHelper.GPS_LONGITUDE);
+ GPSDataObj.put(GPSData.KEY_LATITUDE_DEGREES, VehicleDataHelper.GPS_LATITUDE);
+ GPSDataObj.put(GPSData.KEY_UTC_YEAR, VehicleDataHelper.GPS_YEAR);
+ GPSDataObj.put(GPSData.KEY_UTC_MONTH, VehicleDataHelper.GPS_MONTH);
+ GPSDataObj.put(GPSData.KEY_UTC_DAY, VehicleDataHelper.GPS_DAY);
+ GPSDataObj.put(GPSData.KEY_UTC_HOURS, VehicleDataHelper.GPS_HOURS);
+ GPSDataObj.put(GPSData.KEY_UTC_MINUTES, VehicleDataHelper.GPS_MINUTES);
+ GPSDataObj.put(GPSData.KEY_UTC_SECONDS, VehicleDataHelper.GPS_SECONDS);
+ GPSDataObj.put(GPSData.KEY_COMPASS_DIRECTION, VehicleDataHelper.GPS_DIRECTION);
+ GPSDataObj.put(GPSData.KEY_PDOP, VehicleDataHelper.GPS_PDOP);
+ GPSDataObj.put(GPSData.KEY_VDOP, VehicleDataHelper.GPS_VDOP);
+ GPSDataObj.put(GPSData.KEY_HDOP, VehicleDataHelper.GPS_HDOP);
+ GPSDataObj.put(GPSData.KEY_ACTUAL, VehicleDataHelper.GPS_ACTUAL);
+ GPSDataObj.put(GPSData.KEY_SATELLITES, VehicleDataHelper.GPS_SATELLITES);
+ GPSDataObj.put(GPSData.KEY_DIMENSION, VehicleDataHelper.GPS_DIMENSION);
+ GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
+ GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
+ GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
+
+ //BELT_STATUS
+ beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_PASSENGER_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_PASSENGER_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_DRIVER_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_DRIVER_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_PASSENGER_CHILD_DETECTED, VehicleDataHelper.BELT_STATUS_PASSENGER_CHILD);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_2_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_2_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_ROW_3_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_ROW_3_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_LEFT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_LEFT_REAR_INFLATABLE_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_RIGHT_REAR_INFLATABLE_BELTED, VehicleDataHelper.BELT_STATUS_RIGHT_REAR_INFLATABLE_BELTED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_DEPLOYED);
+ beltStatusObj.put(BeltStatus.KEY_MIDDLE_ROW_1_BUCKLE_BELTED, VehicleDataHelper.BELT_STATUS_MIDDLE_ROW_1_BELTED);
+
+ //BODY_INFORMATION
+ bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE);
+ bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS);
+ bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS);
+ bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR);
+ bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR);
+
+ //DEVICE_STATUS
+ deviceStatusObj.put(DeviceStatus.KEY_VOICE_REC_ON, VehicleDataHelper.DEVICE_STATUS_VOICE_REC);
+ deviceStatusObj.put(DeviceStatus.KEY_BT_ICON_ON, VehicleDataHelper.DEVICE_STATUS_BT_ICON);
+ deviceStatusObj.put(DeviceStatus.KEY_CALL_ACTIVE, VehicleDataHelper.DEVICE_STATUS_CALL_ACTIVE);
+ deviceStatusObj.put(DeviceStatus.KEY_PHONE_ROAMING, VehicleDataHelper.DEVICE_STATUS_PHONE_ROAMING);
+ deviceStatusObj.put(DeviceStatus.KEY_TEXT_MSG_AVAILABLE, VehicleDataHelper.DEVICE_STATUS_TEXT_MSG_AVAILABLE);
+ deviceStatusObj.put(DeviceStatus.KEY_BATT_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_BATT_LEVEL_STATUS);
+ deviceStatusObj.put(DeviceStatus.KEY_STEREO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_STEREO_MUTED);
+ deviceStatusObj.put(DeviceStatus.KEY_MONO_AUDIO_OUTPUT_MUTED, VehicleDataHelper.DEVICE_STATUS_MONO_MUTED);
+ deviceStatusObj.put(DeviceStatus.KEY_SIGNAL_LEVEL_STATUS, VehicleDataHelper.DEVICE_STATUS_SIGNAL_LEVEL_STATUS);
+ deviceStatusObj.put(DeviceStatus.KEY_PRIMARY_AUDIO_SOURCE, VehicleDataHelper.DEVICE_STATUS_PRIMARY_AUDIO);
+ deviceStatusObj.put(DeviceStatus.KEY_E_CALL_EVENT_ACTIVE, VehicleDataHelper.DEVICE_STATUS_E_CALL_ACTIVE);
+
+ //HEAD_LAMP_STATUS
+ headLampStatusObj.put(HeadLampStatus.KEY_AMBIENT_LIGHT_SENSOR_STATUS, VehicleDataHelper.HEAD_LAMP_STATUS_AMBIENT_STATUS);
+ headLampStatusObj.put(HeadLampStatus.KEY_HIGH_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_HIGH_BEAMS);
+ headLampStatusObj.put(HeadLampStatus.KEY_LOW_BEAMS_ON, VehicleDataHelper.HEAD_LAMP_LOW_BEAMS);
+
+ //E_CALL_INFO
+ ECallInfoObj.put(ECallInfo.KEY_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_E_CALL_NOTIFICATION_STATUS);
+ ECallInfoObj.put(ECallInfo.KEY_AUX_E_CALL_NOTIFICATION_STATUS, VehicleDataHelper.E_CALL_INFO_AUX_E_CALL_NOTIFICATION_STATUS);
+ ECallInfoObj.put(ECallInfo.KEY_E_CALL_CONFIRMATION_STATUS, VehicleDataHelper.E_CALL_INFO_CONFIRMATION_STATUS);
+
+ //AIRBAG_STATUS
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_SIDE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_CURTAIN_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_DRIVER_KNEE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_SIDE_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_CURTAIN_DEPLOYED);
+ airbagStatusObj.put(AirbagStatus.KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, VehicleDataHelper.AIRBAG_STATUS_PASSENGER_KNEE_DEPLOYED);
+
+ //EMERGENCY_EVENT
+ emergencyEventObj.put(EmergencyEvent.KEY_EMERGENCY_EVENT_TYPE, VehicleDataHelper.EMERGENCY_EVENT_TYPE);
+ emergencyEventObj.put(EmergencyEvent.KEY_FUEL_CUTOFF_STATUS, VehicleDataHelper.EMERGENCY_EVENT_FUEL_CUTOFF_STATUS);
+ emergencyEventObj.put(EmergencyEvent.KEY_ROLLOVER_EVENT, VehicleDataHelper.EMERGENCY_EVENT_ROLLOVER_EVENT);
+ emergencyEventObj.put(EmergencyEvent.KEY_MAXIMUM_CHANGE_VELOCITY, VehicleDataHelper.EMERGENCY_EVENT_MAX_CHANGE_VELOCITY);
+ emergencyEventObj.put(EmergencyEvent.KEY_MULTIPLE_EVENTS, VehicleDataHelper.EMERGENCY_EVENT_MULTIPLE_EVENTS);
+
+ //CLUSTER_MODE_STATUS
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_ACTIVE, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_ACTIVE);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
+ clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
+
+ // STABILITY_CONTROL_STATUS
+ stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
+ stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
+
+ //MY_KEY
+ myKeyObj.put(MyKey.KEY_E_911_OVERRIDE, VehicleDataHelper.MY_KEY_E_911_OVERRIDE);
+
+ // FUEL_RANGE
+ fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
+ fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
+ fuelRangeArrayObj.put(fuelRangeObj);
+
+ //GEAR_STATUS
+ gearStatusObj.put(GearStatus.KEY_USER_SELECTED_GEAR, VehicleDataHelper.USER_SELECTED_GEAR);
+ gearStatusObj.put(GearStatus.KEY_TRANSMISSION_TYPE, VehicleDataHelper.TRANSMISSION_TYPE);
+ gearStatusObj.put(GearStatus.KEY_ACTUAL_GEAR, VehicleDataHelper.ACTUAL_GEAR);
+
+ // WINDOW_STATUS
+ windowStatusObj.put(WindowStatus.KEY_LOCATION, VehicleDataHelper.LOCATION_GRID);
+ windowStatusObj.put(WindowStatus.KEY_STATE, VehicleDataHelper.WINDOW_STATE);
+ windowStatusArrayObj.put(windowStatusObj);
+
+ reference.put(GetVehicleDataResponse.KEY_SPEED, VehicleDataHelper.SPEED);
+ reference.put(GetVehicleDataResponse.KEY_RPM, VehicleDataHelper.RPM);
+ reference.put(GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, VehicleDataHelper.EXTERNAL_TEMPERATURE);
+ reference.put(GetVehicleDataResponse.KEY_FUEL_LEVEL, VehicleDataHelper.FUEL_LEVEL);
+ reference.put(GetVehicleDataResponse.KEY_VIN, VehicleDataHelper.VIN);
+ reference.put(GetVehicleDataResponse.KEY_PRNDL, VehicleDataHelper.PRNDL_FINAL);
+ reference.put(GetVehicleDataResponse.KEY_TIRE_PRESSURE, tireStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_ENGINE_TORQUE, VehicleDataHelper.ENGINE_TORQUE);
+ reference.put(GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE, VehicleDataHelper.ENGINE_OIL_LIFE);
+ reference.put(GetVehicleDataResponse.KEY_ODOMETER, VehicleDataHelper.ODOMETER);
+ reference.put(GetVehicleDataResponse.KEY_GPS, GPSDataObj);
+ reference.put(GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE, VehicleDataHelper.FUEL_LEVEL_STATE);
+ reference.put(GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION);
+ reference.put(GetVehicleDataResponse.KEY_BELT_STATUS, beltStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_BODY_INFORMATION, bodyInformationObj);
+ reference.put(GetVehicleDataResponse.KEY_DEVICE_STATUS, deviceStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_DRIVER_BRAKING, VehicleDataHelper.DRIVER_BRAKING);
+ reference.put(GetVehicleDataResponse.KEY_WIPER_STATUS, VehicleDataHelper.WIPER_STATUS);
+ reference.put(GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS, headLampStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION, VehicleDataHelper.ACC_PEDAL_POSITION);
+ reference.put(GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, VehicleDataHelper.STEERING_WHEEL_ANGLE);
+ reference.put(GetVehicleDataResponse.KEY_E_CALL_INFO, ECallInfoObj);
+ reference.put(GetVehicleDataResponse.KEY_AIRBAG_STATUS, airbagStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_EMERGENCY_EVENT, emergencyEventObj);
+ reference.put(GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS, clusterModeStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_MY_KEY, myKeyObj);
+ reference.put(GetVehicleDataResponse.KEY_FUEL_RANGE, fuelRangeArrayObj);
+ reference.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, TurnSignal.OFF);
+ reference.put(GetVehicleDataResponse.KEY_GEAR_STATUS, gearStatusObj);
+ reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ reference.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, windowStatusArrayObj);
+ reference.put(GetVehicleDataResponse.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
+ reference.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatusObj);
+ reference.put(TestValues.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 response key
+ underTest = underTest.getJSONObject("response").getJSONObject("parameters");
+
+ assertEquals("JSON size didn't match expected size.", reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(GetVehicleDataResponse.KEY_TIRE_PRESSURE)) {
+ JSONObject tirePressureReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject tirePressureTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateTireStatus(
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureReference)),
+ new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tirePressureTest))));
+
+ } else if (key.equals(GetVehicleDataResponse.KEY_GPS)) {
+ JSONObject GPSObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject GPSObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateGpsData(
+ new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjReference)),
+ new GPSData(JsonRPCMarshaller.deserializeJSONObject(GPSObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_BELT_STATUS)) {
+ JSONObject beltObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject beltObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateBeltStatus(
+ new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjReference)),
+ new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_BODY_INFORMATION)) {
+ JSONObject bodyInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject bodyInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateBodyInformation(
+ new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjReference)),
+ new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInfoObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_DEVICE_STATUS)) {
+ JSONObject deviceObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject deviceObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateDeviceStatus(
+ new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjReference)),
+ new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS)) {
+ JSONObject headLampObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject headLampObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateHeadLampStatus(
+ new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjReference)),
+ new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_E_CALL_INFO)) {
+ JSONObject callInfoObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject callInfoObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateECallInfo(
+ new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjReference)),
+ new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(callInfoObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_AIRBAG_STATUS)) {
+ JSONObject airbagObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject airbagObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateAirbagStatus(
+ new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjReference)),
+ new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_EMERGENCY_EVENT)) {
+ JSONObject emergencyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject emergencyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateEmergencyEvent(
+ new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjReference)),
+ new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS)) {
+ JSONObject clusterModeObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject clusterModeObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateClusterModeStatus(
+ new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjReference)),
+ new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_MY_KEY)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateMyKey(
+ new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
+ new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE)) {
+ assertEquals("JSON value didn't match expected value for key \"" + key + "\".",
+ JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key));
+ } else if (key.equals(GetVehicleDataResponse.KEY_GEAR_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ assertTrue(TestValues.TRUE, Validator.validateGearStatuses(
+ new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
+ new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
+ } else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
+ StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateStabilityControlStatus(
+ status1,
+ status2
+ )
+ );
+ } else if (key.equals(GetVehicleDataResponse.KEY_FUEL_RANGE)) {
+ JSONArray fuelRangeArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ List<FuelRange> fuelRangeRefereceList = new ArrayList<FuelRange>();
+ for (int index = 0; index < fuelRangeArrayObjReference.length(); index++) {
+ FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject((JSONObject) fuelRangeArrayObjReference.get(index)));
+ fuelRangeRefereceList.add(fuelRange);
+ }
+
+ JSONArray fuelRangeArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<FuelRange> fuelRangeUnderTestList = new ArrayList<FuelRange>();
+ for (int index = 0; index < fuelRangeArrayObjTest.length(); index++) {
+ FuelRange fuelRange = new FuelRange(JsonRPCMarshaller.deserializeJSONObject((JSONObject) fuelRangeArrayObjTest.get(index)));
+ fuelRangeUnderTestList.add(fuelRange);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateFuelRange(
+ fuelRangeRefereceList,
+ fuelRangeUnderTestList));
+ } else if (key.equals(GetVehicleDataResponse.KEY_WINDOW_STATUS)) {
+ JSONArray windowStatusArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ List<WindowStatus> windowStatusReferenceList = new ArrayList<>();
+ for (int index = 0; index < windowStatusArrayObjReference.length(); index++) {
+ WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject((JSONObject) windowStatusArrayObjReference.get(index)));
+ windowStatusReferenceList.add(windowStatus);
+ }
+
+ JSONArray windowStatusArrayObjTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<WindowStatus> windowStatusUnderTestList = new ArrayList<>();
+ for (int index = 0; index < windowStatusArrayObjTest.length(); index++) {
+ WindowStatus windowStatus = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject((JSONObject) windowStatusArrayObjTest.get(index)));
+ windowStatusUnderTestList.add(windowStatus);
+ }
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateWindowStatuses(
+ windowStatusReferenceList,
+ windowStatusUnderTestList));
+ } else {
+ assertEquals("JSON value didn't match expected value for key \"" + key + "\".",
+ JsonUtils.readObjectFromJsonObject(reference, key),
+ JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+
+ }
+
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues(){
- // Valid Tests
- assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, ( (GetVehicleDataResponse) msg ).getSpeed());
- assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.RPM, ( (GetVehicleDataResponse) msg ).getRpm());
- assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, ( (GetVehicleDataResponse) msg ).getExternalTemperature());
- assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, ( (GetVehicleDataResponse) msg ).getFuelLevel());
- assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, ( (GetVehicleDataResponse) msg ).getPrndl());
- assertEquals(TestValues.MATCH, VehicleDataHelper.TIRE_PRESSURE, ( (GetVehicleDataResponse) msg ).getTirePressure());
- assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, ( (GetVehicleDataResponse) msg ).getEngineTorque());
- assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, ( (GetVehicleDataResponse) msg ).getEngineOilLife());
- assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.ODOMETER, ( (GetVehicleDataResponse) msg ).getOdometer());
- assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, ( (GetVehicleDataResponse) msg ).getGps());
- assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, ( (GetVehicleDataResponse) msg ).getFuelLevelState());
- assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, ( (GetVehicleDataResponse) msg ).getInstantFuelConsumption());
- assertEquals(TestValues.MATCH, VehicleDataHelper.BELT_STATUS, ( (GetVehicleDataResponse) msg ).getBeltStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.BODY_INFORMATION, ( (GetVehicleDataResponse) msg ).getBodyInformation());
- assertEquals(TestValues.MATCH, VehicleDataHelper.DEVICE_STATUS, ( (GetVehicleDataResponse) msg ).getDeviceStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, ( (GetVehicleDataResponse) msg ).getDriverBraking());
- assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, ( (GetVehicleDataResponse) msg ).getWiperStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.HEAD_LAMP_STATUS, ( (GetVehicleDataResponse) msg ).getHeadLampStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, ( (GetVehicleDataResponse) msg ).getAccPedalPosition());
- assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, ( (GetVehicleDataResponse) msg ).getSteeringWheelAngle());
- assertEquals(TestValues.MATCH, VehicleDataHelper.E_CALL_INFO, ( (GetVehicleDataResponse) msg ).getECallInfo());
- assertEquals(TestValues.MATCH, VehicleDataHelper.AIRBAG_STATUS, ( (GetVehicleDataResponse) msg ).getAirbagStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.EMERGENCY_EVENT, ( (GetVehicleDataResponse) msg ).getEmergencyEvent());
- assertEquals(TestValues.MATCH, VehicleDataHelper.CLUSTER_MODE_STATUS, ( (GetVehicleDataResponse) msg ).getClusterModeStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.MY_KEY, ( (GetVehicleDataResponse) msg ).getMyKey());
- assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, ( (GetVehicleDataResponse) msg ).getTurnSignal());
- assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ( (GetVehicleDataResponse) msg ).getElectronicParkBrakeStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.WINDOW_STATUS_LIST, ( (GetVehicleDataResponse) msg ).getWindowStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, ( (GetVehicleDataResponse) msg ).getGearStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, ( (GetVehicleDataResponse) msg ).getHandsOffSteering());
- assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, ( (GetVehicleDataResponse) msg ).getStabilityControlsStatus());
- assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
-
- // Invalid/Null Tests
- GetVehicleDataResponse msg = new GetVehicleDataResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ public void testRpcValues() {
+ // Valid Tests
+ assertEquals(TestValues.MATCH, VehicleDataHelper.SPEED, ((GetVehicleDataResponse) msg).getSpeed());
+ assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.RPM, ((GetVehicleDataResponse) msg).getRpm());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EXTERNAL_TEMPERATURE, ((GetVehicleDataResponse) msg).getExternalTemperature());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL, ((GetVehicleDataResponse) msg).getFuelLevel());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.PRNDL_FINAL, ((GetVehicleDataResponse) msg).getPrndl());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TIRE_PRESSURE, ((GetVehicleDataResponse) msg).getTirePressure());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_TORQUE, ((GetVehicleDataResponse) msg).getEngineTorque());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ENGINE_OIL_LIFE, ((GetVehicleDataResponse) msg).getEngineOilLife());
+ assertEquals(TestValues.MATCH, (Integer) VehicleDataHelper.ODOMETER, ((GetVehicleDataResponse) msg).getOdometer());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GPS, ((GetVehicleDataResponse) msg).getGps());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.FUEL_LEVEL_STATE, ((GetVehicleDataResponse) msg).getFuelLevelState());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.INSTANT_FUEL_CONSUMPTION, ((GetVehicleDataResponse) msg).getInstantFuelConsumption());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.BELT_STATUS, ((GetVehicleDataResponse) msg).getBeltStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.BODY_INFORMATION, ((GetVehicleDataResponse) msg).getBodyInformation());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DEVICE_STATUS, ((GetVehicleDataResponse) msg).getDeviceStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.DRIVER_BRAKING, ((GetVehicleDataResponse) msg).getDriverBraking());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.WIPER_STATUS, ((GetVehicleDataResponse) msg).getWiperStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.HEAD_LAMP_STATUS, ((GetVehicleDataResponse) msg).getHeadLampStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ACC_PEDAL_POSITION, ((GetVehicleDataResponse) msg).getAccPedalPosition());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STEERING_WHEEL_ANGLE, ((GetVehicleDataResponse) msg).getSteeringWheelAngle());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.E_CALL_INFO, ((GetVehicleDataResponse) msg).getECallInfo());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.AIRBAG_STATUS, ((GetVehicleDataResponse) msg).getAirbagStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.EMERGENCY_EVENT, ((GetVehicleDataResponse) msg).getEmergencyEvent());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.CLUSTER_MODE_STATUS, ((GetVehicleDataResponse) msg).getClusterModeStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.MY_KEY, ((GetVehicleDataResponse) msg).getMyKey());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, ((GetVehicleDataResponse) msg).getTurnSignal());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ((GetVehicleDataResponse) msg).getElectronicParkBrakeStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.WINDOW_STATUS_LIST, ((GetVehicleDataResponse) msg).getWindowStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, ((GetVehicleDataResponse) msg).getGearStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, ((GetVehicleDataResponse) msg).getHandsOffSteering());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, ((GetVehicleDataResponse) msg).getStabilityControlsStatus());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ((GetVehicleDataResponse) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+
+ // Invalid/Null Tests
+ GetVehicleDataResponse msg = new GetVehicleDataResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
assertNull(TestValues.NULL, msg.getDriverBraking());
@@ -576,120 +560,120 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getTurnSignal());
assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
- assertNull(TestValues.NULL, msg.getHandsOffSteering());
+ assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
-
- /**
+
+ /**
* Tests a valid JSON construction of this RPC message.
*/
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- GetVehicleDataResponse cmd = new GetVehicleDataResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_SPEED), cmd.getSpeed());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_RPM), cmd.getRpm());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL), cmd.getFuelLevel());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_VIN), cmd.getVin());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_PRNDL), cmd.getPrndl().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleDataResponse.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
- JSONObject tireStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_TIRE_PRESSURE);
- TireStatus tireStatus = new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tireStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateTireStatus(tireStatus, cmd.getTirePressure()) );
-
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife(), 0.0002);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_ODOMETER), cmd.getOdometer());
-
- JSONObject gpsDataObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_GPS);
- GPSData gpsData = new GPSData(JsonRPCMarshaller.deserializeJSONObject(gpsDataObj));
- assertTrue(TestValues.TRUE, Validator.validateGpsData(gpsData, cmd.getGps()) );
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
-
- JSONObject beltStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BELT_STATUS);
- BeltStatus beltStatus = new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateBeltStatus(beltStatus, cmd.getBeltStatus()) );
-
- JSONObject bodyInformationObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BODY_INFORMATION);
- BodyInformation bodyInformation = new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInformationObj));
- assertTrue(TestValues.TRUE, Validator.validateBodyInformation(bodyInformation, cmd.getBodyInformation()) );
-
- JSONObject deviceStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_DEVICE_STATUS);
- DeviceStatus deviceStatus = new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(deviceStatus, cmd.getDeviceStatus()) );
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_DRIVER_BRAKING), cmd.getDriverBraking().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_WIPER_STATUS), cmd.getWiperStatus().toString());
-
- JSONObject headLampStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
- HeadLampStatus headLampStatus = new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(headLampStatus, cmd.getHeadLampStatus()) );
-
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
- assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
-
- JSONObject eCallInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_E_CALL_INFO);
- ECallInfo eCallInfo = new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(eCallInfoObj));
- assertTrue(TestValues.TRUE, Validator.validateECallInfo(eCallInfo, cmd.getECallInfo()) );
-
- JSONObject airbagStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_AIRBAG_STATUS);
- AirbagStatus airbagStatus = new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(airbagStatus, cmd.getAirbagStatus()) );
-
- JSONObject emergencyEventObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_EMERGENCY_EVENT);
- EmergencyEvent emergencyEvent = new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyEventObj));
- assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(emergencyEvent, cmd.getEmergencyEvent()) );
-
- JSONObject clusterModeStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS);
- ClusterModeStatus clusterModeStatus = new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(clusterModeStatus, cmd.getClusterModeStatus()) );
-
- JSONObject gearStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_GEAR_STATUS);
- GearStatus gearStatus = new GearStatus(JsonRPCMarshaller.deserializeJSONObject(gearStatusObj));
- GearStatus cmdStatus = cmd.getGearStatus();
- assertTrue(TestValues.TRUE, Validator.validateGearStatuses(gearStatus, cmdStatus));
-
- JSONObject myKeyObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_MY_KEY);
- MyKey myKey = new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObj));
- assertTrue(TestValues.TRUE, Validator.validateMyKey(myKey, cmd.getMyKey()) );
-
- JSONArray windowStatusArray = JsonUtils.readJsonArrayFromJsonObject(parameters, GetVehicleDataResponse.KEY_WINDOW_STATUS);
-
- List<WindowStatus> windowStatus = new ArrayList<>();
- for (int index = 0; index < windowStatusArray.length(); index++) {
- WindowStatus status = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)windowStatusArray.get(index)) );
- windowStatus.add(status);
- }
- assertTrue(TestValues.TRUE, Validator.validateWindowStatuses(windowStatus, cmd.getWindowStatus()) );
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
-
- JSONObject stabilityControlStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
- StabilityControlsStatus stabilityControlsStatus = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatusObj));
- assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(stabilityControlsStatus, cmd.getStabilityControlsStatus()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetVehicleDataResponse cmd = new GetVehicleDataResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_SPEED), cmd.getSpeed());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_RPM), cmd.getRpm());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE), cmd.getExternalTemperature());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL), cmd.getFuelLevel());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_VIN), cmd.getVin());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_PRNDL), cmd.getPrndl().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleDataResponse.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
+ JSONObject tireStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_TIRE_PRESSURE);
+ TireStatus tireStatus = new TireStatus(JsonRPCMarshaller.deserializeJSONObject(tireStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateTireStatus(tireStatus, cmd.getTirePressure()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_TORQUE), cmd.getEngineTorque());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ENGINE_OIL_LIFE), cmd.getEngineOilLife(), 0.0002);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, GetVehicleDataResponse.KEY_ODOMETER), cmd.getOdometer());
+
+ JSONObject gpsDataObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_GPS);
+ GPSData gpsData = new GPSData(JsonRPCMarshaller.deserializeJSONObject(gpsDataObj));
+ assertTrue(TestValues.TRUE, Validator.validateGpsData(gpsData, cmd.getGps()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_FUEL_LEVEL_STATE), cmd.getFuelLevelState().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION), cmd.getInstantFuelConsumption());
+
+ JSONObject beltStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BELT_STATUS);
+ BeltStatus beltStatus = new BeltStatus(JsonRPCMarshaller.deserializeJSONObject(beltStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateBeltStatus(beltStatus, cmd.getBeltStatus()));
+
+ JSONObject bodyInformationObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_BODY_INFORMATION);
+ BodyInformation bodyInformation = new BodyInformation(JsonRPCMarshaller.deserializeJSONObject(bodyInformationObj));
+ assertTrue(TestValues.TRUE, Validator.validateBodyInformation(bodyInformation, cmd.getBodyInformation()));
+
+ JSONObject deviceStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_DEVICE_STATUS);
+ DeviceStatus deviceStatus = new DeviceStatus(JsonRPCMarshaller.deserializeJSONObject(deviceStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateDeviceStatus(deviceStatus, cmd.getDeviceStatus()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_DRIVER_BRAKING), cmd.getDriverBraking().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_WIPER_STATUS), cmd.getWiperStatus().toString());
+
+ JSONObject headLampStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
+ HeadLampStatus headLampStatus = new HeadLampStatus(JsonRPCMarshaller.deserializeJSONObject(headLampStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateHeadLampStatus(headLampStatus, cmd.getHeadLampStatus()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_ACC_PEDAL_POSITION), cmd.getAccPedalPosition());
+ assertEquals(TestValues.MATCH, JsonUtils.readDoubleFromJsonObject(parameters, GetVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE), cmd.getSteeringWheelAngle());
+
+ JSONObject eCallInfoObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_E_CALL_INFO);
+ ECallInfo eCallInfo = new ECallInfo(JsonRPCMarshaller.deserializeJSONObject(eCallInfoObj));
+ assertTrue(TestValues.TRUE, Validator.validateECallInfo(eCallInfo, cmd.getECallInfo()));
+
+ JSONObject airbagStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_AIRBAG_STATUS);
+ AirbagStatus airbagStatus = new AirbagStatus(JsonRPCMarshaller.deserializeJSONObject(airbagStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateAirbagStatus(airbagStatus, cmd.getAirbagStatus()));
+
+ JSONObject emergencyEventObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_EMERGENCY_EVENT);
+ EmergencyEvent emergencyEvent = new EmergencyEvent(JsonRPCMarshaller.deserializeJSONObject(emergencyEventObj));
+ assertTrue(TestValues.TRUE, Validator.validateEmergencyEvent(emergencyEvent, cmd.getEmergencyEvent()));
+
+ JSONObject clusterModeStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_CLUSTER_MODE_STATUS);
+ ClusterModeStatus clusterModeStatus = new ClusterModeStatus(JsonRPCMarshaller.deserializeJSONObject(clusterModeStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateClusterModeStatus(clusterModeStatus, cmd.getClusterModeStatus()));
+
+ JSONObject gearStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_GEAR_STATUS);
+ GearStatus gearStatus = new GearStatus(JsonRPCMarshaller.deserializeJSONObject(gearStatusObj));
+ GearStatus cmdStatus = cmd.getGearStatus();
+ assertTrue(TestValues.TRUE, Validator.validateGearStatuses(gearStatus, cmdStatus));
+
+ JSONObject myKeyObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_MY_KEY);
+ MyKey myKey = new MyKey(JsonRPCMarshaller.deserializeJSONObject(myKeyObj));
+ assertTrue(TestValues.TRUE, Validator.validateMyKey(myKey, cmd.getMyKey()));
+
+ JSONArray windowStatusArray = JsonUtils.readJsonArrayFromJsonObject(parameters, GetVehicleDataResponse.KEY_WINDOW_STATUS);
+
+ List<WindowStatus> windowStatus = new ArrayList<>();
+ for (int index = 0; index < windowStatusArray.length(); index++) {
+ WindowStatus status = new WindowStatus(JsonRPCMarshaller.deserializeJSONObject((JSONObject) windowStatusArray.get(index)));
+ windowStatus.add(status);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateWindowStatuses(windowStatus, cmd.getWindowStatus()));
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+
+ JSONObject stabilityControlStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ StabilityControlsStatus stabilityControlsStatus = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(stabilityControlsStatus, cmd.getStabilityControlsStatus()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
index 131aba5fa..8586f650f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetWayPointsResponseTests.java
@@ -78,10 +78,10 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- List<LocationDetails> testWPs = ( (GetWayPointsResponse) msg ).getWayPoints();
+ List<LocationDetails> testWPs = ((GetWayPointsResponse) msg).getWayPoints();
// Valid Tests
assertEquals(TestValues.MATCH, waypoints, testWPs);
@@ -98,7 +98,7 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
@@ -118,11 +118,11 @@ public class GetWayPointsResponseTests extends BaseRpcTests {
JSONArray locArray = JsonUtils.readJsonArrayFromJsonObject(parameters, GetWayPointsResponse.KEY_WAY_POINTS);
List<LocationDetails> locationList = new ArrayList<LocationDetails>();
for (int index = 0; index < locArray.length(); index++) {
- LocationDetails det = new LocationDetails(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) locArray.get(index)));
+ LocationDetails det = new LocationDetails(JsonRPCMarshaller.deserializeJSONObject((JSONObject) locArray.get(index)));
locationList.add(det);
}
List<LocationDetails> dets = cmd.getWayPoints();
- assertEquals(TestValues.MATCH, locationList.size(), dets.size());
+ assertEquals(TestValues.MATCH, locationList.size(), dets.size());
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
index 67b23ef2b..c90384567 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ListFilesResponseTests.java
@@ -26,13 +26,13 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ListFilesResponse}
*/
-public class ListFilesResponseTests extends BaseRpcTests{
+public class ListFilesResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
ListFilesResponse msg = new ListFilesResponse();
msg.setFilenames(TestValues.GENERAL_STRING_LIST);
@@ -42,43 +42,43 @@ public class ListFilesResponseTests extends BaseRpcTests{
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.LIST_FILES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(ListFilesResponse.KEY_FILENAMES, JsonUtils.createJsonArray(TestValues.GENERAL_STRING_LIST));
result.put(ListFilesResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
}
return result;
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<String> filenames = ( (ListFilesResponse) msg ).getFilenames();
- int spaceAvailable = ( (ListFilesResponse) msg ).getSpaceAvailable();
-
+ public void testRpcValues() {
+ // Test Values
+ List<String> filenames = ((ListFilesResponse) msg).getFilenames();
+ int spaceAvailable = ((ListFilesResponse) msg).getSpaceAvailable();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING_LIST.size(), filenames.size());
assertTrue(TestValues.TRUE, Validator.validateStringList(TestValues.GENERAL_STRING_LIST, filenames));
assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, spaceAvailable);
-
+
// Invalid/Null Tests
ListFilesResponse msg = new ListFilesResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -92,30 +92,30 @@ public class ListFilesResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ListFilesResponse cmd = new ListFilesResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- List<String> fileNamesList = JsonUtils.readStringListFromJsonObject(parameters, ListFilesResponse.KEY_FILENAMES);
- List<String> testNamesList = cmd.getFilenames();
- assertEquals(TestValues.MATCH, fileNamesList.size(), testNamesList.size());
- assertTrue(TestValues.TRUE, Validator.validateStringList(fileNamesList, testNamesList));
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ListFilesResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ListFilesResponse cmd = new ListFilesResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ List<String> fileNamesList = JsonUtils.readStringListFromJsonObject(parameters, ListFilesResponse.KEY_FILENAMES);
+ List<String> testNamesList = cmd.getFilenames();
+ assertEquals(TestValues.MATCH, fileNamesList.size(), testNamesList.size());
+ assertTrue(TestValues.TRUE, Validator.validateStringList(fileNamesList, testNamesList));
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ListFilesResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ } 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/PerformAppServiceInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
index 2278a61a1..d464efbea 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAppServiceInteractionResponseTests.java
@@ -28,82 +28,82 @@ import static junit.framework.TestCase.fail;
*/
public class PerformAppServiceInteractionResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
-
- PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
-
- msg.setServiceSpecificResult(TestValues.GENERAL_STRING);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- try{
- result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, TestValues.GENERAL_STRING);
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- String serviceSpecificResult = ( (PerformAppServiceInteractionResponse) msg ).getServiceSpecificResult();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceSpecificResult);
-
- // Invalid/Null Tests
- PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getServiceSpecificResult());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformAppServiceInteractionResponse cmd = new PerformAppServiceInteractionResponse (hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+
+ msg.setServiceSpecificResult(TestValues.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ String serviceSpecificResult = ((PerformAppServiceInteractionResponse) msg).getServiceSpecificResult();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, serviceSpecificResult);
+
+ // Invalid/Null Tests
+ PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getServiceSpecificResult());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAppServiceInteractionResponse cmd = new PerformAppServiceInteractionResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformAppServiceInteractionResponse.KEY_SERVICE_SPECIFIC_RESULT), cmd.getServiceSpecificResult());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
index f3a0bd310..f37ed358b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformAudioPassThruResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse}
*/
public class PerformAudioPassThruResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new PerformAudioPassThruResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.PERFORM_AUDIO_PASS_THRU.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
-
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class PerformAudioPassThruResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformAudioPassThruResponse cmd = new PerformAudioPassThruResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformAudioPassThruResponse cmd = new PerformAudioPassThruResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/PerformInteractionResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
index cc78069e3..3565dd901 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PerformInteractionResponseTest.java
@@ -23,97 +23,97 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PerformInteractionResponse}
*/
public class PerformInteractionResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- PerformInteractionResponse msg = new PerformInteractionResponse();
-
- msg.setChoiceID(TestValues.GENERAL_INT);
- msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE);
- msg.setManualTextEntry(TestValues.GENERAL_STRING);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PERFORM_INTERACTION.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PerformInteractionResponse.KEY_CHOICE_ID, TestValues.GENERAL_INT);
- result.put(PerformInteractionResponse.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
- result.put(PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY, TestValues.GENERAL_STRING);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer testId = ( (PerformInteractionResponse) msg).getChoiceID();
- TriggerSource testSource = ( (PerformInteractionResponse) msg).getTriggerSource();
- String testText = ( (PerformInteractionResponse) msg).getManualTextEntry();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testId);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, testSource);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText);
-
- // Invalid/Null Tests
- PerformInteractionResponse msg = new PerformInteractionResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getChoiceID());
- assertNull(TestValues.NULL, msg.getTriggerSource());
- assertNull(TestValues.NULL, msg.getManualTextEntry());
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ PerformInteractionResponse msg = new PerformInteractionResponse();
+
+ msg.setChoiceID(TestValues.GENERAL_INT);
+ msg.setTriggerSource(TestValues.GENERAL_TRIGGERSOURCE);
+ msg.setManualTextEntry(TestValues.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PERFORM_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PerformInteractionResponse.KEY_CHOICE_ID, TestValues.GENERAL_INT);
+ result.put(PerformInteractionResponse.KEY_TRIGGER_SOURCE, TestValues.GENERAL_TRIGGERSOURCE);
+ result.put(PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY, TestValues.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer testId = ((PerformInteractionResponse) msg).getChoiceID();
+ TriggerSource testSource = ((PerformInteractionResponse) msg).getTriggerSource();
+ String testText = ((PerformInteractionResponse) msg).getManualTextEntry();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testId);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_TRIGGERSOURCE, testSource);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, testText);
+
+ // Invalid/Null Tests
+ PerformInteractionResponse msg = new PerformInteractionResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getChoiceID());
+ assertNull(TestValues.NULL, msg.getTriggerSource());
+ assertNull(TestValues.NULL, msg.getManualTextEntry());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PerformInteractionResponse cmd = new PerformInteractionResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY), cmd.getManualTextEntry());
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_TRIGGER_SOURCE), cmd.getTriggerSource().toString());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteractionResponse.KEY_CHOICE_ID), cmd.getChoiceID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PerformInteractionResponse cmd = new PerformInteractionResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_MANUAL_TEXT_ENTRY), cmd.getManualTextEntry());
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteractionResponse.KEY_TRIGGER_SOURCE), cmd.getTriggerSource().toString());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteractionResponse.KEY_CHOICE_ID), cmd.getChoiceID());
+ } 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/PublishAppServiceResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
index 197aa13d4..aff5932f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PublishAppServiceResponseTests.java
@@ -30,84 +30,84 @@ import static junit.framework.TestCase.fail;
*/
public class PublishAppServiceResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
-
- PublishAppServiceResponse msg = new PublishAppServiceResponse();
-
- msg.setServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
-
- return msg;
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.PUBLISH_APP_SERVICE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- JSONObject result = new JSONObject();
-
- try{
- result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICERECORD.getStore()));
- }catch(JSONException e){
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- AppServiceRecord testRecord = ( (PublishAppServiceResponse) msg ).getServiceRecord();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, testRecord));
-
- // Invalid/Null Tests
- PublishAppServiceResponse msg = new PublishAppServiceResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getServiceRecord());
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PublishAppServiceResponse cmd = new PublishAppServiceResponse (hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject appServiceRecordObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppServiceResponse.KEY_APP_SERVICE_RECORD);
- AppServiceRecord recordTest = new AppServiceRecord(JsonRPCMarshaller.deserializeJSONObject(appServiceRecordObject));
- assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(recordTest, cmd.getServiceRecord()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+
+ msg.setServiceRecord(TestValues.GENERAL_APPSERVICERECORD);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PublishAppServiceResponse.KEY_APP_SERVICE_RECORD, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_APPSERVICERECORD.getStore()));
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ AppServiceRecord testRecord = ((PublishAppServiceResponse) msg).getServiceRecord();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(TestValues.GENERAL_APPSERVICERECORD, testRecord));
+
+ // Invalid/Null Tests
+ PublishAppServiceResponse msg = new PublishAppServiceResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getServiceRecord());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PublishAppServiceResponse cmd = new PublishAppServiceResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject appServiceRecordObject = JsonUtils.readJsonObjectFromJsonObject(parameters, PublishAppServiceResponse.KEY_APP_SERVICE_RECORD);
+ AppServiceRecord recordTest = new AppServiceRecord(JsonRPCMarshaller.deserializeJSONObject(appServiceRecordObject));
+ assertTrue(TestValues.TRUE, Validator.validateAppServiceRecord(recordTest, cmd.getServiceRecord()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
index 6c34c9df4..8fd6c2046 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/PutFileResponseTest.java
@@ -22,85 +22,85 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.PutFileResponse}
*/
public class PutFileResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- PutFileResponse msg = new PutFileResponse();
-
- msg.setSpaceAvailable(TestValues.GENERAL_INT);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.PUT_FILE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(PutFileResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Integer testSpace = ( (PutFileResponse) msg ).getSpaceAvailable();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testSpace);
-
- // Invalid/Null Tests
- PutFileResponse msg = new PutFileResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSpaceAvailable());
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ PutFileResponse msg = new PutFileResponse();
+
+ msg.setSpaceAvailable(TestValues.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.PUT_FILE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(PutFileResponse.KEY_SPACE_AVAILABLE, TestValues.GENERAL_INT);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Integer testSpace = ((PutFileResponse) msg).getSpaceAvailable();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, testSpace);
+
+ // Invalid/Null Tests
+ PutFileResponse msg = new PutFileResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSpaceAvailable());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- PutFileResponse cmd = new PutFileResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PutFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ PutFileResponse cmd = new PutFileResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PutFileResponse.KEY_SPACE_AVAILABLE), cmd.getSpaceAvailable());
+ } 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/ReadDIDResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
index 3a62e344d..6e2ec0ffc 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReadDIDResponseTest.java
@@ -29,92 +29,92 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ReadDIDResponse}
*/
public class ReadDIDResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- ReadDIDResponse msg = new ReadDIDResponse();
-
- msg.setDidResult(TestValues.GENERAL_DIDRESULT_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.READ_DID.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(ReadDIDResponse.KEY_DID_RESULT, TestValues.JSON_DIDRESULTS);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
+
+ @Override
+ protected RPCMessage createMessage() {
+ ReadDIDResponse msg = new ReadDIDResponse();
+
+ msg.setDidResult(TestValues.GENERAL_DIDRESULT_LIST);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.READ_DID.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ReadDIDResponse.KEY_DID_RESULT, TestValues.JSON_DIDRESULTS);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Test Values
- List<DIDResult> testResults = ( (ReadDIDResponse) msg ).getDidResult();
-
- // Valid Tests
- assertTrue("Did results didn't match input data.", Validator.validateDIDResults(TestValues.GENERAL_DIDRESULT_LIST, testResults));
-
- // Invalid/Null Tests
- ReadDIDResponse msg = new ReadDIDResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getDidResult());
- }
+ public void testRpcValues() {
+ // Test Values
+ List<DIDResult> testResults = ((ReadDIDResponse) msg).getDidResult();
+
+ // Valid Tests
+ assertTrue("Did results didn't match input data.", Validator.validateDIDResults(TestValues.GENERAL_DIDRESULT_LIST, testResults));
+
+ // Invalid/Null Tests
+ ReadDIDResponse msg = new ReadDIDResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getDidResult());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ReadDIDResponse cmd = new ReadDIDResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONArray didResultArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ReadDIDResponse.KEY_DID_RESULT);
- List<DIDResult> didResultList = new ArrayList<DIDResult>();
- for (int index = 0; index < didResultArray.length(); index++) {
- DIDResult chunk = new DIDResult(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)didResultArray.get(index)) );
- didResultList.add(chunk);
- }
- assertTrue(TestValues.MATCH, Validator.validateDIDResults(didResultList, cmd.getDidResult()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReadDIDResponse cmd = new ReadDIDResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONArray didResultArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ReadDIDResponse.KEY_DID_RESULT);
+ List<DIDResult> didResultList = new ArrayList<DIDResult>();
+ for (int index = 0; index < didResultArray.length(); index++) {
+ DIDResult chunk = new DIDResult(JsonRPCMarshaller.deserializeJSONObject((JSONObject) didResultArray.get(index)));
+ didResultList.add(chunk);
+ }
+ assertTrue(TestValues.MATCH, Validator.validateDIDResults(didResultList, cmd.getDidResult()));
+ } 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/RegisterAppInterfaceResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
index 4e790a758..d95eb0594 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
@@ -39,240 +39,240 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse}
*/
public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
-
- msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
- msg.setLanguage(TestValues.GENERAL_LANGUAGE);
- msg.setHmiDisplayLanguage(TestValues.GENERAL_LANGUAGE);
- msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
- msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
- msg.setVehicleType(TestValues.GENERAL_VEHICLETYPE);
- msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
- msg.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
- msg.setPcmStreamingCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES);
- msg.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
- msg.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
- msg.setVrCapabilities(TestValues.GENERAL_VRCAPABILITIES_LIST);
- msg.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
- msg.setSupportedDiagModes(TestValues.GENERAL_INTEGER_LIST);
- msg.setIconResumed(TestValues.GENERAL_BOOLEAN);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.REGISTER_APP_INTERFACE.toString();
- }
-
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(RegisterAppInterfaceResponse.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
- result.put(RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
- result.put(RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
- result.put(RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE, TestValues.GENERAL_VEHICLETYPE.serializeJSON());
- result.put(RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES, TestValues.JSON_DISPLAYCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES, TestValues.JSON_AUDIOPASSTHRUCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES, TestValues.JSON_PCMSTREAMCAPABILITIES);
- result.put(RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_SPEECHCAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_VRCAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_HMIZONECAPABILITIES_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH, JsonUtils.createJsonArray(TestValues.GENERAL_PRERECORDEDSPEECH_LIST));
- result.put(RegisterAppInterfaceResponse.KEY_ICON_RESUMED, TestValues.GENERAL_BOOLEAN);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- List<Integer> testSupportedDiagModes = ( (RegisterAppInterfaceResponse) msg ).getSupportedDiagModes();
- List<PrerecordedSpeech> testPrerecordedSpeech = ( (RegisterAppInterfaceResponse) msg ).getPrerecordedSpeech();
- List<VrCapabilities> testVrCapabilities = ( (RegisterAppInterfaceResponse) msg ).getVrCapabilities();
- List<SpeechCapabilities> testSpeechCapabilities = ( (RegisterAppInterfaceResponse) msg ).getSpeechCapabilities();
- List<HmiZoneCapabilities> testHmiZoneCapabilities = ( (RegisterAppInterfaceResponse) msg ).getHmiZoneCapabilities();
- List<SoftButtonCapabilities> testSoftButtonCapabilities = ( (RegisterAppInterfaceResponse) msg ).getSoftButtonCapabilities();
- List<ButtonCapabilities> testButtonCapabilities = ( (RegisterAppInterfaceResponse) msg ).getButtonCapabilities();
- VehicleType testVehicleType = ( (RegisterAppInterfaceResponse) msg ).getVehicleType();
- PresetBankCapabilities testPbc = ( (RegisterAppInterfaceResponse) msg ).getPresetBankCapabilities();
- DisplayCapabilities testDc = ( (RegisterAppInterfaceResponse) msg ).getDisplayCapabilities();
- Language testHmiLang = ( (RegisterAppInterfaceResponse) msg ).getHmiDisplayLanguage();
- Language testLang = ( (RegisterAppInterfaceResponse) msg ).getLanguage();
- SdlMsgVersion testMsgVersion = ( (RegisterAppInterfaceResponse) msg ).getSdlMsgVersion();
- List<AudioPassThruCapabilities> testAptc = ( (RegisterAppInterfaceResponse) msg ).getAudioPassThruCapabilities();
- AudioPassThruCapabilities testPcmStream = ( (RegisterAppInterfaceResponse) msg ).getPcmStreamingCapabilities();
- Boolean testIconResumed = ( (RegisterAppInterfaceResponse) msg ).getIconResumed();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testSupportedDiagModes);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_PRERECORDEDSPEECH_LIST, testPrerecordedSpeech);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_VRCAPABILITIES_LIST, testVrCapabilities);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES_LIST, testSpeechCapabilities);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_HMIZONECAPABILITIES_LIST, testHmiZoneCapabilities);
- assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, testSoftButtonCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, testButtonCapabilities));
- assertTrue(TestValues.TRUE, Validator.validateVehicleType(TestValues.GENERAL_VEHICLETYPE, testVehicleType));
- assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
- assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDc));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
- assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
- assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testMsgVersion));
- assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, testAptc));
- assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES, testPcmStream));
- assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testIconResumed);
-
- // Invalid/Null Tests
- RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getSdlMsgVersion());
- assertNull(TestValues.NULL, msg.getLanguage());
- assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
- assertNull(TestValues.NULL, msg.getDisplayCapabilities());
- assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
- assertNull(TestValues.NULL, msg.getVehicleType());
- assertNull(TestValues.NULL, msg.getButtonCapabilities());
- assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
- assertNull(TestValues.NULL, msg.getAudioPassThruCapabilities());
- assertNull(TestValues.NULL, msg.getPcmStreamingCapabilities());
- assertNull(TestValues.NULL, msg.getHmiZoneCapabilities());
- assertNull(TestValues.NULL, msg.getSpeechCapabilities());
- assertNull(TestValues.NULL, msg.getVrCapabilities());
- assertNull(TestValues.NULL, msg.getPrerecordedSpeech());
- assertNull(TestValues.NULL, msg.getSupportedDiagModes());
- assertNull(TestValues.NULL, msg.getIconResumed());
- }
-
+ @Override
+ protected RPCMessage createMessage() {
+ RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
+
+ msg.setSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION);
+ msg.setLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setHmiDisplayLanguage(TestValues.GENERAL_LANGUAGE);
+ msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ msg.setVehicleType(TestValues.GENERAL_VEHICLETYPE);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ msg.setAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ msg.setPcmStreamingCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES);
+ msg.setHmiZoneCapabilities(TestValues.GENERAL_HMIZONECAPABILITIES_LIST);
+ msg.setSpeechCapabilities(TestValues.GENERAL_SPEECHCAPABILITIES_LIST);
+ msg.setVrCapabilities(TestValues.GENERAL_VRCAPABILITIES_LIST);
+ msg.setPrerecordedSpeech(TestValues.GENERAL_PRERECORDEDSPEECH_LIST);
+ msg.setSupportedDiagModes(TestValues.GENERAL_INTEGER_LIST);
+ msg.setIconResumed(TestValues.GENERAL_BOOLEAN);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.REGISTER_APP_INTERFACE.toString();
+ }
+
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(RegisterAppInterfaceResponse.KEY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE, TestValues.GENERAL_LANGUAGE);
+ result.put(RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES, JsonUtils.createJsonArray(TestValues.GENERAL_INTEGER_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION, TestValues.JSON_SDLMSGVERSION);
+ result.put(RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE, TestValues.GENERAL_VEHICLETYPE.serializeJSON());
+ result.put(RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES, TestValues.JSON_DISPLAYCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES, TestValues.JSON_AUDIOPASSTHRUCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES, TestValues.JSON_PCMSTREAMCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_SPEECHCAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_VRCAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES, JsonUtils.createJsonArray(TestValues.GENERAL_HMIZONECAPABILITIES_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH, JsonUtils.createJsonArray(TestValues.GENERAL_PRERECORDEDSPEECH_LIST));
+ result.put(RegisterAppInterfaceResponse.KEY_ICON_RESUMED, TestValues.GENERAL_BOOLEAN);
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ List<Integer> testSupportedDiagModes = ((RegisterAppInterfaceResponse) msg).getSupportedDiagModes();
+ List<PrerecordedSpeech> testPrerecordedSpeech = ((RegisterAppInterfaceResponse) msg).getPrerecordedSpeech();
+ List<VrCapabilities> testVrCapabilities = ((RegisterAppInterfaceResponse) msg).getVrCapabilities();
+ List<SpeechCapabilities> testSpeechCapabilities = ((RegisterAppInterfaceResponse) msg).getSpeechCapabilities();
+ List<HmiZoneCapabilities> testHmiZoneCapabilities = ((RegisterAppInterfaceResponse) msg).getHmiZoneCapabilities();
+ List<SoftButtonCapabilities> testSoftButtonCapabilities = ((RegisterAppInterfaceResponse) msg).getSoftButtonCapabilities();
+ List<ButtonCapabilities> testButtonCapabilities = ((RegisterAppInterfaceResponse) msg).getButtonCapabilities();
+ VehicleType testVehicleType = ((RegisterAppInterfaceResponse) msg).getVehicleType();
+ PresetBankCapabilities testPbc = ((RegisterAppInterfaceResponse) msg).getPresetBankCapabilities();
+ DisplayCapabilities testDc = ((RegisterAppInterfaceResponse) msg).getDisplayCapabilities();
+ Language testHmiLang = ((RegisterAppInterfaceResponse) msg).getHmiDisplayLanguage();
+ Language testLang = ((RegisterAppInterfaceResponse) msg).getLanguage();
+ SdlMsgVersion testMsgVersion = ((RegisterAppInterfaceResponse) msg).getSdlMsgVersion();
+ List<AudioPassThruCapabilities> testAptc = ((RegisterAppInterfaceResponse) msg).getAudioPassThruCapabilities();
+ AudioPassThruCapabilities testPcmStream = ((RegisterAppInterfaceResponse) msg).getPcmStreamingCapabilities();
+ Boolean testIconResumed = ((RegisterAppInterfaceResponse) msg).getIconResumed();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_INTEGER_LIST, testSupportedDiagModes);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_PRERECORDEDSPEECH_LIST, testPrerecordedSpeech);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_VRCAPABILITIES_LIST, testVrCapabilities);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SPEECHCAPABILITIES_LIST, testSpeechCapabilities);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_HMIZONECAPABILITIES_LIST, testHmiZoneCapabilities);
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST, testSoftButtonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST, testButtonCapabilities));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleType(TestValues.GENERAL_VEHICLETYPE, testVehicleType));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDc));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testHmiLang);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_LANGUAGE, testLang);
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(TestValues.GENERAL_SDLMSGVERSION, testMsgVersion));
+ assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, testAptc));
+ assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(TestValues.GENERAL_AUDIOPASSTHRUCAPABILITIES, testPcmStream));
+ assertEquals(TestValues.MATCH, (Boolean) TestValues.GENERAL_BOOLEAN, testIconResumed);
+
+ // Invalid/Null Tests
+ RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getSdlMsgVersion());
+ assertNull(TestValues.NULL, msg.getLanguage());
+ assertNull(TestValues.NULL, msg.getHmiDisplayLanguage());
+ assertNull(TestValues.NULL, msg.getDisplayCapabilities());
+ assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
+ assertNull(TestValues.NULL, msg.getVehicleType());
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getAudioPassThruCapabilities());
+ assertNull(TestValues.NULL, msg.getPcmStreamingCapabilities());
+ assertNull(TestValues.NULL, msg.getHmiZoneCapabilities());
+ assertNull(TestValues.NULL, msg.getSpeechCapabilities());
+ assertNull(TestValues.NULL, msg.getVrCapabilities());
+ assertNull(TestValues.NULL, msg.getPrerecordedSpeech());
+ assertNull(TestValues.NULL, msg.getSupportedDiagModes());
+ assertNull(TestValues.NULL, msg.getIconResumed());
+ }
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- RegisterAppInterfaceResponse cmd = new RegisterAppInterfaceResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject vehicleTypeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE);
- VehicleType vehicleType = new VehicleType(JsonRPCMarshaller.deserializeJSONObject(vehicleTypeObj));
- assertTrue(TestValues.TRUE, Validator.validateVehicleType(vehicleType, cmd.getVehicleType()));
-
- JSONObject pcmStreamObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES);
- AudioPassThruCapabilities pcmStreamCap = new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject(pcmStreamObj));
- assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(pcmStreamCap, cmd.getPcmStreamingCapabilities()));
-
- JSONArray speechCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES);
- for (int index = 0; index < speechCapabilitiesArray.length(); index++) {
- SpeechCapabilities speechCapability = SpeechCapabilities.valueForString( speechCapabilitiesArray.get(index).toString() );
- assertEquals(TestValues.MATCH, speechCapability, cmd.getSpeechCapabilities().get(index));
- }
-
- JSONArray vrCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES);
- for (int index = 0; index < vrCapabilitiesArray.length(); index++) {
- VrCapabilities vrCapability = VrCapabilities.valueForString( vrCapabilitiesArray.get(index).toString() );
- assertEquals(TestValues.MATCH, vrCapability, cmd.getVrCapabilities().get(index));
- }
-
- JSONArray audioPassThruCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES);
- List<AudioPassThruCapabilities> audioPassThruCapabilitiesList = new ArrayList<AudioPassThruCapabilities>();
- for (int index = 0; index < audioPassThruCapabilitiesArray.length(); index++) {
- AudioPassThruCapabilities audioPassThruCapability =
- new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)audioPassThruCapabilitiesArray.get(index) ));
- audioPassThruCapabilitiesList.add(audioPassThruCapability);
- }
- assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(audioPassThruCapabilitiesList, cmd.getAudioPassThruCapabilities() ));
-
- JSONArray hmiZoneCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES);
- for (int index = 0; index < hmiZoneCapabilitiesArray.length(); index++) {
- HmiZoneCapabilities hmiZoneCapability = HmiZoneCapabilities.valueForString( hmiZoneCapabilitiesArray.get(index).toString() );
- assertEquals(TestValues.MATCH, hmiZoneCapability, cmd.getHmiZoneCapabilities().get(index));
- }
-
- JSONArray prerecordedSpeechArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH);
- for (int index = 0; index < prerecordedSpeechArray.length(); index++) {
- PrerecordedSpeech prerecordedSpeech = PrerecordedSpeech.valueForString( prerecordedSpeechArray.get(index).toString() );
- assertEquals(TestValues.MATCH, prerecordedSpeech, cmd.getPrerecordedSpeech().get(index));
- }
-
- List<Integer> supportedDiagnosticModesList = JsonUtils.readIntegerListFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES);
- List<Integer> testDiagnosticModesList = cmd.getSupportedDiagModes();
- assertEquals(TestValues.MATCH, supportedDiagnosticModesList.size(), testDiagnosticModesList.size());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(supportedDiagnosticModesList, testDiagnosticModesList));
-
- JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION);
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
- assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()) );
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_LANGUAGE), cmd.getLanguage().toString());
-
- JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES);
- List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
- for (int index = 0; index < buttonCapabilitiesArray.length(); index++) {
- ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)buttonCapabilitiesArray.get(index) ));
- buttonCapabilitiesList.add(buttonCapability);
- }
- assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
-
- JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES);
- DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
- assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
-
- JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES);
- List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
- for (int index = 0; index < softButtonCapabilitiesArray.length(); index++) {
- SoftButtonCapabilities softButtonCapability =
- new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonCapabilitiesArray.get(index) ));
- softButtonCapabilitiesList.add(softButtonCapability);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
-
- JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES);
- PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
- assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
-
- Boolean iconResumed = JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_ICON_RESUMED);
- assertEquals(TestValues.MATCH, iconResumed, cmd.getIconResumed());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ RegisterAppInterfaceResponse cmd = new RegisterAppInterfaceResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject vehicleTypeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE);
+ VehicleType vehicleType = new VehicleType(JsonRPCMarshaller.deserializeJSONObject(vehicleTypeObj));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleType(vehicleType, cmd.getVehicleType()));
+
+ JSONObject pcmStreamObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES);
+ AudioPassThruCapabilities pcmStreamCap = new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject(pcmStreamObj));
+ assertTrue(TestValues.TRUE, Validator.validatePcmStreamCapabilities(pcmStreamCap, cmd.getPcmStreamingCapabilities()));
+
+ JSONArray speechCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES);
+ for (int index = 0; index < speechCapabilitiesArray.length(); index++) {
+ SpeechCapabilities speechCapability = SpeechCapabilities.valueForString(speechCapabilitiesArray.get(index).toString());
+ assertEquals(TestValues.MATCH, speechCapability, cmd.getSpeechCapabilities().get(index));
+ }
+
+ JSONArray vrCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES);
+ for (int index = 0; index < vrCapabilitiesArray.length(); index++) {
+ VrCapabilities vrCapability = VrCapabilities.valueForString(vrCapabilitiesArray.get(index).toString());
+ assertEquals(TestValues.MATCH, vrCapability, cmd.getVrCapabilities().get(index));
+ }
+
+ JSONArray audioPassThruCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES);
+ List<AudioPassThruCapabilities> audioPassThruCapabilitiesList = new ArrayList<AudioPassThruCapabilities>();
+ for (int index = 0; index < audioPassThruCapabilitiesArray.length(); index++) {
+ AudioPassThruCapabilities audioPassThruCapability =
+ new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject((JSONObject) audioPassThruCapabilitiesArray.get(index)));
+ audioPassThruCapabilitiesList.add(audioPassThruCapability);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateAudioPassThruCapabilities(audioPassThruCapabilitiesList, cmd.getAudioPassThruCapabilities()));
+
+ JSONArray hmiZoneCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES);
+ for (int index = 0; index < hmiZoneCapabilitiesArray.length(); index++) {
+ HmiZoneCapabilities hmiZoneCapability = HmiZoneCapabilities.valueForString(hmiZoneCapabilitiesArray.get(index).toString());
+ assertEquals(TestValues.MATCH, hmiZoneCapability, cmd.getHmiZoneCapabilities().get(index));
+ }
+
+ JSONArray prerecordedSpeechArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRERECORDED_SPEECH);
+ for (int index = 0; index < prerecordedSpeechArray.length(); index++) {
+ PrerecordedSpeech prerecordedSpeech = PrerecordedSpeech.valueForString(prerecordedSpeechArray.get(index).toString());
+ assertEquals(TestValues.MATCH, prerecordedSpeech, cmd.getPrerecordedSpeech().get(index));
+ }
+
+ List<Integer> supportedDiagnosticModesList = JsonUtils.readIntegerListFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SUPPORTED_DIAG_MODES);
+ List<Integer> testDiagnosticModesList = cmd.getSupportedDiagModes();
+ assertEquals(TestValues.MATCH, supportedDiagnosticModesList.size(), testDiagnosticModesList.size());
+ assertTrue(TestValues.TRUE, Validator.validateIntegerList(supportedDiagnosticModesList, testDiagnosticModesList));
+
+ JSONObject sdlMsgVersionObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SDL_MSG_VERSION);
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion(JsonRPCMarshaller.deserializeJSONObject(sdlMsgVersionObj));
+ assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(sdlMsgVersion, cmd.getSdlMsgVersion()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_LANGUAGE), cmd.getLanguage().toString());
+
+ JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES);
+ List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
+ for (int index = 0; index < buttonCapabilitiesArray.length(); index++) {
+ ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject((JSONObject) buttonCapabilitiesArray.get(index)));
+ buttonCapabilitiesList.add(buttonCapability);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities()));
+
+ JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_DISPLAY_CAPABILITIES);
+ DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()));
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_HMI_DISPLAY_LANGUAGE), cmd.getHmiDisplayLanguage().toString());
+
+ JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES);
+ List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
+ for (int index = 0; index < softButtonCapabilitiesArray.length(); index++) {
+ SoftButtonCapabilities softButtonCapability =
+ new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonCapabilitiesArray.get(index)));
+ softButtonCapabilitiesList.add(softButtonCapability);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities()));
+
+ JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PRESET_BANK_CAPABILITIES);
+ PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()));
+
+ Boolean iconResumed = JsonUtils.readBooleanFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_ICON_RESUMED);
+ assertEquals(TestValues.MATCH, iconResumed, cmd.getIconResumed());
+ } 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/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
index b2ba952b8..887d3822d 100644
--- 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
@@ -22,43 +22,43 @@ import static junit.framework.TestCase.fail;
public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse();
- return msg;
- }
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse();
+ return msg;
+ }
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- return new JSONObject();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
- @Test
- public void testJsonConstructor() {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
- }
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
index 980d2d1ba..2c5c441e5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ResetGlobalPropertiesResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse}
*/
public class ResetGlobalPropertiesResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new ResetGlobalPropertiesResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.RESET_GLOBAL_PROPERTIES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse();
assertNotNull(TestValues.NULL, msg);
testNullBase(msg);
}
@@ -60,23 +60,23 @@ public class ResetGlobalPropertiesResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ResetGlobalPropertiesResponse cmd = new ResetGlobalPropertiesResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ResetGlobalPropertiesResponse cmd = new ResetGlobalPropertiesResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/ScrollableMessageResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
index 6ee9b0779..6e2129083 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ScrollableMessageResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ScrollableMessageResponse}
*/
public class ScrollableMessageResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new ScrollableMessageResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SCROLLABLE_MESSAGE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- ScrollableMessageResponse msg = new ScrollableMessageResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ ScrollableMessageResponse msg = new ScrollableMessageResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class ScrollableMessageResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ScrollableMessageResponse cmd = new ScrollableMessageResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ScrollableMessageResponse cmd = new ScrollableMessageResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SendLocationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
index 0ba8ea411..a51fd9309 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SendLocationResponseTests.java
@@ -20,62 +20,62 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SendLocationResponse}
*/
public class SendLocationResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- SendLocationResponse msg = new SendLocationResponse();
- return msg;
- }
+ @Override
+ protected RPCMessage createMessage() {
+ SendLocationResponse msg = new SendLocationResponse();
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SEND_LOCATION.toString();
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.SEND_LOCATION.toString();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
SendLocationResponse msg = new SendLocationResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
- }
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SendLocationResponse cmd = new SendLocationResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SendLocationResponse cmd = new SendLocationResponse(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SetAppIconResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
index b3a174c02..dc4255259 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetAppIconResponseTest.java
@@ -20,62 +20,62 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetAppIconResponse}
*/
public class SetAppIconResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new SetAppIconResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_APP_ICON.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SetAppIconResponse msg = new SetAppIconResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SetAppIconResponse msg = new SetAppIconResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetAppIconResponse cmd = new SetAppIconResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetAppIconResponse cmd = new SetAppIconResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SetCloudAppPropertiesResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
index f6558ab5a..2dea383ff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
@@ -13,22 +13,22 @@ import static junit.framework.TestCase.assertNotNull;
public class SetCloudAppPropertiesResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new SetCloudAppPropertiesResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_CLOUD_APP_PROPERTIES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -36,7 +36,7 @@ public class SetCloudAppPropertiesResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
SetCloudAppPropertiesResponse msg = new SetCloudAppPropertiesResponse();
assertNotNull(TestValues.NOT_NULL, msg);
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 6985ad238..f7c08cd90 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
@@ -31,130 +31,130 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse}
*/
public class SetDisplayLayoutResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
-
- msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
- msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
- msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
- msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SET_DISPLAY_LAYOUT.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
- try {
- result.put(SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES, TestValues.GENERAL_DISPLAYCAPABILITIES.serializeJSON());
- result.put(SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
- result.put(SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
+ @Override
+ protected RPCMessage createMessage() {
+ SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
+
+ msg.setDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES);
+ msg.setPresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES);
+ msg.setButtonCapabilities(TestValues.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SET_DISPLAY_LAYOUT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES, TestValues.GENERAL_DISPLAYCAPABILITIES.serializeJSON());
+ result.put(SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES, TestValues.JSON_PRESETBANKCAPABILITIES);
+ result.put(SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES, TestValues.JSON_BUTTONCAPABILITIES);
result.put(SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES, TestValues.JSON_SOFTBUTTONCAPABILITIES);
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- DisplayCapabilities testDisplay = ( (SetDisplayLayoutResponse) msg ).getDisplayCapabilities();
- PresetBankCapabilities testPbc = ( (SetDisplayLayoutResponse) msg ).getPresetBankCapabilities();
- List<ButtonCapabilities> testBc = ( (SetDisplayLayoutResponse) msg ).getButtonCapabilities();
- List<SoftButtonCapabilities> testSbc = ( (SetDisplayLayoutResponse) msg ).getSoftButtonCapabilities();
-
- // Valid Tests
- assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDisplay));
- assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), testBc.size());
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), testSbc.size());
- for (int i = 0; i < TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(); i++) {
- assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.get(i), testBc.get(i));
- }
- for (int i = 0; i < TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(); i++) {
- assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.get(i), testSbc.get(i));
- }
-
- // Invalid/Null Tests
- SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
-
- assertNull(TestValues.NULL, msg.getDisplayCapabilities());
- assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
- assertNull(TestValues.NULL, msg.getButtonCapabilities());
- assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
- }
-
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ DisplayCapabilities testDisplay = ((SetDisplayLayoutResponse) msg).getDisplayCapabilities();
+ PresetBankCapabilities testPbc = ((SetDisplayLayoutResponse) msg).getPresetBankCapabilities();
+ List<ButtonCapabilities> testBc = ((SetDisplayLayoutResponse) msg).getButtonCapabilities();
+ List<SoftButtonCapabilities> testSbc = ((SetDisplayLayoutResponse) msg).getSoftButtonCapabilities();
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(TestValues.GENERAL_DISPLAYCAPABILITIES, testDisplay));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(TestValues.GENERAL_PRESETBANKCAPABILITIES, testPbc));
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(), testBc.size());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), testSbc.size());
+ for (int i = 0; i < TestValues.GENERAL_BUTTONCAPABILITIES_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_BUTTONCAPABILITIES_LIST.get(i), testBc.get(i));
+ }
+ for (int i = 0; i < TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(); i++) {
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_SOFTBUTTONCAPABILITIES_LIST.get(i), testSbc.get(i));
+ }
+
+ // Invalid/Null Tests
+ SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(TestValues.NULL, msg.getDisplayCapabilities());
+ assertNull(TestValues.NULL, msg.getPresetBankCapabilities());
+ assertNull(TestValues.NULL, msg.getButtonCapabilities());
+ assertNull(TestValues.NULL, msg.getSoftButtonCapabilities());
+ }
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetDisplayLayoutResponse cmd = new SetDisplayLayoutResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES);
- List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
- for (int index = 0; index < buttonCapabilitiesArray.length(); index++) {
- ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)buttonCapabilitiesArray.get(index) ));
- buttonCapabilitiesList.add(buttonCapability);
- }
- assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
-
- JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES);
- DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
- assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
-
- JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES);
- List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
- for (int index = 0; index < softButtonCapabilitiesArray.length(); index++) {
- SoftButtonCapabilities softButtonCapability =
- new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonCapabilitiesArray.get(index) ));
- softButtonCapabilitiesList.add(softButtonCapability);
- }
- assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
-
- JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES);
- PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
- assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetDisplayLayoutResponse cmd = new SetDisplayLayoutResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES);
+ List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
+ for (int index = 0; index < buttonCapabilitiesArray.length(); index++) {
+ ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject((JSONObject) buttonCapabilitiesArray.get(index)));
+ buttonCapabilitiesList.add(buttonCapability);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities()));
+
+ JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES);
+ DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
+ assertTrue(TestValues.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()));
+
+ JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES);
+ List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
+ for (int index = 0; index < softButtonCapabilitiesArray.length(); index++) {
+ SoftButtonCapabilities softButtonCapability =
+ new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject((JSONObject) softButtonCapabilitiesArray.get(index)));
+ softButtonCapabilitiesList.add(softButtonCapability);
+ }
+ assertTrue(TestValues.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities()));
+
+ JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES);
+ PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
+ assertTrue(TestValues.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()));
+ } 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/SetGlobalPropertiesResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
index 04445f520..f4f336381 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetGlobalPropertiesResponseTest.java
@@ -21,38 +21,38 @@ import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse}
*/
public class SetGlobalPropertiesResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new SetGlobalPropertiesResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_GLOBAL_PROPERTIES.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -61,22 +61,22 @@ public class SetGlobalPropertiesResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetGlobalPropertiesResponse cmd = new SetGlobalPropertiesResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetGlobalPropertiesResponse cmd = new SetGlobalPropertiesResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SetInteriorVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
index 17187b64b..d191ea4d7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
@@ -31,7 +31,7 @@ import static junit.framework.TestCase.fail;
public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse();
@@ -41,22 +41,22 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try{
+ try {
result.put(SetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(TestValues.GENERAL_MODULEDATA.getStore()));
- }catch(JSONException e){
+ } catch (JSONException e) {
fail(TestValues.JSON_FAIL);
}
@@ -67,9 +67,9 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Test Values
- ModuleData testModuleData = ( (SetInteriorVehicleDataResponse) msg ).getModuleData();
+ ModuleData testModuleData = ((SetInteriorVehicleDataResponse) msg).getModuleData();
// Valid Tests
assertTrue(TestValues.TRUE, Validator.validateModuleData(TestValues.GENERAL_MODULEDATA, testModuleData));
@@ -86,13 +86,13 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetInteriorVehicleDataResponse cmd = new SetInteriorVehicleDataResponse (hash);
+ SetInteriorVehicleDataResponse cmd = new SetInteriorVehicleDataResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
assertNotNull(TestValues.NOT_NULL, body);
@@ -106,7 +106,7 @@ public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
ModuleData cmdModuleData = cmd.getModuleData();
- assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ assertTrue(TestValues.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
index 4d0b7b081..cfe157579 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetMediaClockTimerResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse}
*/
public class SetMediaClockTimerResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new SetMediaClockTimerResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SET_MEDIA_CLOCK_TIMER.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class SetMediaClockTimerResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SetMediaClockTimerResponse cmd = new SetMediaClockTimerResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetMediaClockTimerResponse cmd = new SetMediaClockTimerResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/ShowAppMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
index 28cf0b436..b0e19efe4 100644
--- 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
@@ -56,58 +56,58 @@ import static junit.framework.TestCase.assertNotNull;
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.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
- ShowAppMenuResponse msg = new ShowAppMenuResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @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.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ ShowAppMenuResponse msg = new ShowAppMenuResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/ShowConstantTbtResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
index 6beaa9e62..220c05828 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowConstantTbtResponseTests.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse}
*/
public class ShowConstantTbtResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- ShowConstantTbtResponse msg = new ShowConstantTbtResponse();
- return msg;
- }
+ @Override
+ protected RPCMessage createMessage() {
+ ShowConstantTbtResponse msg = new ShowConstantTbtResponse();
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW_CONSTANT_TBT.toString();
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.SHOW_CONSTANT_TBT.toString();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
ShowConstantTbtResponse msg = new ShowConstantTbtResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
@@ -61,21 +61,21 @@ public class ShowConstantTbtResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ShowConstantTbtResponse cmd = new ShowConstantTbtResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowConstantTbtResponse cmd = new ShowConstantTbtResponse(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/ShowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
index 2062c5fe1..f29b5cf15 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
@@ -21,38 +21,38 @@ import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.ShowResponse}
*/
public class ShowResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new ShowResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SHOW.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- ShowResponse msg = new ShowResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ ShowResponse msg = new ShowResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -61,22 +61,22 @@ public class ShowResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- ShowResponse cmd = new ShowResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowResponse cmd = new ShowResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SliderResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
index 4a200d106..78e9244f0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SliderResponseTest.java
@@ -23,83 +23,83 @@ import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SliderResponse}
*/
public class SliderResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage() {
- SliderResponse msg = new SliderResponse();
- msg.setSliderPosition(TestValues.GENERAL_INT);
+ @Override
+ protected RPCMessage createMessage() {
+ SliderResponse msg = new SliderResponse();
- return msg;
- }
+ msg.setSliderPosition(TestValues.GENERAL_INT);
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SLIDER.toString();
+ }
- @Override
- protected String getCommandType() {
- return FunctionID.SLIDER.toString();
- }
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
+ try {
+ result.put(SliderResponse.KEY_SLIDER_POSITION, TestValues.GENERAL_INT);
- try {
- result.put(SliderResponse.KEY_SLIDER_POSITION, TestValues.GENERAL_INT);
-
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
- return result;
- }
+ return result;
+ }
- @Test
- public void testPosition() {
- Integer copy = ( (SliderResponse) msg ).getSliderPosition();
- assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, copy);
- }
+ @Test
+ public void testPosition() {
+ Integer copy = ((SliderResponse) msg).getSliderPosition();
+ assertEquals(TestValues.MATCH, (Integer) TestValues.GENERAL_INT, copy);
+ }
- @Test
- public void testNull() {
- SliderResponse msg = new SliderResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
+ @Test
+ public void testNull() {
+ SliderResponse msg = new SliderResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
+ testNullBase(msg);
- assertNull(TestValues.NULL, msg.getSliderPosition());
- }
+ assertNull(TestValues.NULL, msg.getSliderPosition());
+ }
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SliderResponse cmd = new SliderResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SliderResponse.KEY_SLIDER_POSITION), cmd.getSliderPosition());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SliderResponse cmd = new SliderResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, SliderResponse.KEY_SLIDER_POSITION), cmd.getSliderPosition());
+ } 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/SpeakResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
index 859cd8e30..a6f6effa8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SpeakResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SpeakResponse}
*/
public class SpeakResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new SpeakResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SPEAK.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SpeakResponse msg = new SpeakResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SpeakResponse msg = new SpeakResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class SpeakResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SpeakResponse cmd = new SpeakResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SpeakResponse cmd = new SpeakResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/SubscribeButtonResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
index 4560784ca..c0eb4f664 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeButtonResponseTest.java
@@ -21,38 +21,38 @@ import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeButtonResponse}
*/
public class SubscribeButtonResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new SubscribeButtonResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SUBSCRIBE_BUTTON.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SubscribeButtonResponse msg = new SubscribeButtonResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SubscribeButtonResponse msg = new SubscribeButtonResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -61,22 +61,22 @@ public class SubscribeButtonResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SubscribeButtonResponse cmd = new SubscribeButtonResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals("Correlation ID doesn't match input ID", JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeButtonResponse cmd = new SubscribeButtonResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals("Correlation ID doesn't match input ID", 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/SubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
index 1e486f7eb..6f9c9a45c 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
@@ -27,197 +27,197 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse}
*/
public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
-
- msg.setResultCode(TestValues.GENERAL_RESULT);
- msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
- msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
- msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
- msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
- msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
- msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
- msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
- msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
- msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
- msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
- msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
- msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
- msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
- msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
- msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
- msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
- msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
- msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
- msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
- msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
- msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
- msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
- msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
- msg.setClusterModes(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
- msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
- msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
- msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
- msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
- msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
- msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
- msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
- msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
- msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.SUBSCRIBE_VEHICLE_DATA.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
+ @Override
+ protected RPCMessage createMessage() {
+ SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
+
+ msg.setResultCode(TestValues.GENERAL_RESULT);
+ msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
+ msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
+ msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
+ msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
+ msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
+ msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
+ msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
+ msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
+ msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
+ msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
+ msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
+ msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
+ msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
+ msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
+ msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
+ msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
+ msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
+ msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
+ msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
+ msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
+ msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
+ msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
+ msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
+ msg.setClusterModes(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
+ msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
+ msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
+ msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
+ msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
+ msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
+ msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SUBSCRIBE_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
try {
-
- // Note: If the key values stored in SubscribeVehicleDataResponse
- // were to be in a list then this could be easily looped through
- // instead of individually set.
-
- result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
- result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODES, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Result testResult = ( (SubscribeVehicleDataResponse) msg ).getResultCode();
- VehicleDataResult testGps = ( (SubscribeVehicleDataResponse) msg ).getGps();
- VehicleDataResult testOdometer = ( (SubscribeVehicleDataResponse) msg ).getOdometer();
- VehicleDataResult testTirePressure = ( (SubscribeVehicleDataResponse) msg ).getTirePressure();
- VehicleDataResult testBeltStatus = ( (SubscribeVehicleDataResponse) msg ).getBeltStatus();
- VehicleDataResult testBodyInfo = ( (SubscribeVehicleDataResponse) msg ).getBodyInformation();
- VehicleDataResult testDeviceStatus = ( (SubscribeVehicleDataResponse) msg ).getDeviceStatus();
- VehicleDataResult testHeadLampStatus = ( (SubscribeVehicleDataResponse) msg ).getHeadLampStatus();
- VehicleDataResult testECallInfo = ( (SubscribeVehicleDataResponse) msg ).getECallInfo();
- VehicleDataResult testAirbagStatus = ( (SubscribeVehicleDataResponse) msg ).getAirbagStatus();
- VehicleDataResult testEmergencyEvent = ( (SubscribeVehicleDataResponse) msg ).getEmergencyEvent();
- VehicleDataResult testClusterMode = ( (SubscribeVehicleDataResponse) msg ).getClusterModes();
- VehicleDataResult testMyKey = ( (SubscribeVehicleDataResponse) msg ).getMyKey();
- VehicleDataResult testSpeed = ( (SubscribeVehicleDataResponse) msg ).getSpeed();
- VehicleDataResult testRpm = ( (SubscribeVehicleDataResponse) msg ).getRpm();
- VehicleDataResult testFuelLevel = ( (SubscribeVehicleDataResponse) msg ).getFuelLevel();
- VehicleDataResult testConsumption = ( (SubscribeVehicleDataResponse) msg ).getInstantFuelConsumption();
- VehicleDataResult testExternalTemp = ( (SubscribeVehicleDataResponse) msg ).getExternalTemperature();
- VehicleDataResult testEngineTorque = ( (SubscribeVehicleDataResponse) msg ).getEngineTorque();
- VehicleDataResult testEngineOilLife = ( (SubscribeVehicleDataResponse) msg ).getEngineOilLife();
- VehicleDataResult testAccPedal = ( (SubscribeVehicleDataResponse) msg ).getAccPedalPosition();
- VehicleDataResult testSteeringWheel = ( (SubscribeVehicleDataResponse) msg ).getSteeringWheelAngle();
- VehicleDataResult testFuelLevelState = ( (SubscribeVehicleDataResponse) msg ).getFuelLevelState();
- VehicleDataResult testPrndl = ( (SubscribeVehicleDataResponse) msg ).getPrndl();
- VehicleDataResult testBraking = ( (SubscribeVehicleDataResponse) msg ).getDriverBraking();
- VehicleDataResult testWiperStatus = ( (SubscribeVehicleDataResponse) msg ).getWiperStatus();
- VehicleDataResult testFuelRange = ( (SubscribeVehicleDataResponse) msg ).getFuelRange();
- VehicleDataResult testTurnSignal = ( (SubscribeVehicleDataResponse) msg ).getTurnSignal();
- VehicleDataResult testEBrakeStatus = ( (SubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
- VehicleDataResult testHOffSteering = ( (SubscribeVehicleDataResponse) msg ).getHandsOffSteering();
- VehicleDataResult testWindowStatus = ( (SubscribeVehicleDataResponse) msg ).getWindowStatus();
- VehicleDataResult testGearStatus = ( (SubscribeVehicleDataResponse) msg ).getGearStatus();
- VehicleDataResult testStabilityControlStatus = ( (SubscribeVehicleDataResponse) msg ).getStabilityControlsStatus();
- VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
-
- // Valid Tests
- assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
- assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
- assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
- assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
- assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
- assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
- assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
- assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
- assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
- assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
- assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
- assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
- assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
- assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
- assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
- assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
- assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
- assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
- assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
- assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
- assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
- assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
- assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
- assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
- assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
- assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
- assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
- assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
- assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
- assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
- assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
- assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
- assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
- assertTrue(TestValues.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
-
+
+ // Note: If the key values stored in SubscribeVehicleDataResponse
+ // were to be in a list then this could be easily looped through
+ // instead of individually set.
+
+ result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
+ result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODES, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Result testResult = ((SubscribeVehicleDataResponse) msg).getResultCode();
+ VehicleDataResult testGps = ((SubscribeVehicleDataResponse) msg).getGps();
+ VehicleDataResult testOdometer = ((SubscribeVehicleDataResponse) msg).getOdometer();
+ VehicleDataResult testTirePressure = ((SubscribeVehicleDataResponse) msg).getTirePressure();
+ VehicleDataResult testBeltStatus = ((SubscribeVehicleDataResponse) msg).getBeltStatus();
+ VehicleDataResult testBodyInfo = ((SubscribeVehicleDataResponse) msg).getBodyInformation();
+ VehicleDataResult testDeviceStatus = ((SubscribeVehicleDataResponse) msg).getDeviceStatus();
+ VehicleDataResult testHeadLampStatus = ((SubscribeVehicleDataResponse) msg).getHeadLampStatus();
+ VehicleDataResult testECallInfo = ((SubscribeVehicleDataResponse) msg).getECallInfo();
+ VehicleDataResult testAirbagStatus = ((SubscribeVehicleDataResponse) msg).getAirbagStatus();
+ VehicleDataResult testEmergencyEvent = ((SubscribeVehicleDataResponse) msg).getEmergencyEvent();
+ VehicleDataResult testClusterMode = ((SubscribeVehicleDataResponse) msg).getClusterModes();
+ VehicleDataResult testMyKey = ((SubscribeVehicleDataResponse) msg).getMyKey();
+ VehicleDataResult testSpeed = ((SubscribeVehicleDataResponse) msg).getSpeed();
+ VehicleDataResult testRpm = ((SubscribeVehicleDataResponse) msg).getRpm();
+ VehicleDataResult testFuelLevel = ((SubscribeVehicleDataResponse) msg).getFuelLevel();
+ VehicleDataResult testConsumption = ((SubscribeVehicleDataResponse) msg).getInstantFuelConsumption();
+ VehicleDataResult testExternalTemp = ((SubscribeVehicleDataResponse) msg).getExternalTemperature();
+ VehicleDataResult testEngineTorque = ((SubscribeVehicleDataResponse) msg).getEngineTorque();
+ VehicleDataResult testEngineOilLife = ((SubscribeVehicleDataResponse) msg).getEngineOilLife();
+ VehicleDataResult testAccPedal = ((SubscribeVehicleDataResponse) msg).getAccPedalPosition();
+ VehicleDataResult testSteeringWheel = ((SubscribeVehicleDataResponse) msg).getSteeringWheelAngle();
+ VehicleDataResult testFuelLevelState = ((SubscribeVehicleDataResponse) msg).getFuelLevelState();
+ VehicleDataResult testPrndl = ((SubscribeVehicleDataResponse) msg).getPrndl();
+ VehicleDataResult testBraking = ((SubscribeVehicleDataResponse) msg).getDriverBraking();
+ VehicleDataResult testWiperStatus = ((SubscribeVehicleDataResponse) msg).getWiperStatus();
+ VehicleDataResult testFuelRange = ((SubscribeVehicleDataResponse) msg).getFuelRange();
+ VehicleDataResult testTurnSignal = ((SubscribeVehicleDataResponse) msg).getTurnSignal();
+ VehicleDataResult testEBrakeStatus = ((SubscribeVehicleDataResponse) msg).getElectronicParkBrakeStatus();
+ VehicleDataResult testHOffSteering = ((SubscribeVehicleDataResponse) msg).getHandsOffSteering();
+ VehicleDataResult testWindowStatus = ((SubscribeVehicleDataResponse) msg).getWindowStatus();
+ VehicleDataResult testGearStatus = ((SubscribeVehicleDataResponse) msg).getGearStatus();
+ VehicleDataResult testStabilityControlStatus = ((SubscribeVehicleDataResponse) msg).getStabilityControlsStatus();
+ VehicleDataResult testOEMCustomVehicleData = ((SubscribeVehicleDataResponse) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
+ assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
+ assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
+ assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
+ assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
+ assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
+ assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
+ assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
+ assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
+ assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
+ assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
+ assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
+ assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
+ assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
+ assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
+ assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
+ assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
+ assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
+ assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
+ assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
+ assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
+ assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
+ assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
+ assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
+ assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
+ assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
+ assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
+ assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
+ assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
+ assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
+ assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
+ assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
+ assertTrue(TestValues.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+
// Invalid/Null Tests
- SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
- assertNotNull("Null object creation failed.", msg);
+ SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
+ assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(TestValues.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getResultCode());
assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
@@ -252,161 +252,161 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
-
+
/**
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SubscribeVehicleDataResponse cmd = new SubscribeVehicleDataResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_SPEED);
- VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
-
- JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_RPM);
- VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
-
- JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
- VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
-
- JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
- VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
-
- JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_PRNDL);
- VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
-
- JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
- VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
-
- JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
- VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
-
- JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
- VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
-
- JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ODOMETER);
- VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
-
- JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_GPS);
- VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
-
- JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
- VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
-
- JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
- VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
-
- JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BELT_STATUS);
- VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
-
- JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
- VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
-
- JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
- VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
-
- JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
- VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
-
- JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_WIPER_STATUS);
- VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
-
- JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
- VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
-
- JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
- VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
-
- JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
- VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
-
- JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_E_CALL_INFO);
- VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
-
- JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
- VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
-
- JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
- VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
-
- JSONObject clusterModes = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_CLUSTER_MODES);
- VehicleDataResult referenceClusterModes = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModes));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModes, cmd.getClusterModes()));
-
- JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_MY_KEY);
- VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
-
- JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_RANGE);
- VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
-
- JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
- VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
-
- JSONObject electronicParkBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
- VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(electronicParkBrakeStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
-
- JSONObject handsOffSteering = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING);
- VehicleDataResult referenceHandsOffSteering = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(handsOffSteering));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHandsOffSteering, cmd.getHandsOffSteering()));
-
- JSONObject windowStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_WINDOW_STATUS);
- VehicleDataResult referenceWindowStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(windowStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWindowStatus, cmd.getWindowStatus()));
-
- JSONObject gearStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_GEAR_STATUS);
- VehicleDataResult referenceGearStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gearStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGearStatus, cmd.getGearStatus()));
-
- JSONObject stabilityControlStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
- VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatus));
- assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
-
- JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
- VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SubscribeVehicleDataResponse cmd = new SubscribeVehicleDataResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_SPEED);
+ VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
+
+ JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_RPM);
+ VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
+
+ JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
+ VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
+
+ JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
+ VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
+
+ JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_PRNDL);
+ VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
+
+ JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
+ VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
+
+ JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
+ VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
+
+ JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
+ VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
+
+ JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ODOMETER);
+ VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
+
+ JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_GPS);
+ VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
+
+ JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
+ VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
+
+ JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
+ VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
+
+ JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BELT_STATUS);
+ VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
+
+ JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
+ VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
+
+ JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
+ VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
+
+ JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
+ VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
+
+ JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_WIPER_STATUS);
+ VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
+
+ JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
+ VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
+
+ JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
+ VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
+
+ JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
+ VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
+
+ JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_E_CALL_INFO);
+ VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
+
+ JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
+ VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
+
+ JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
+ VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
+
+ JSONObject clusterModes = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_CLUSTER_MODES);
+ VehicleDataResult referenceClusterModes = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModes));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModes, cmd.getClusterModes()));
+
+ JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_MY_KEY);
+ VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
+
+ JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_FUEL_RANGE);
+ VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
+
+ JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
+ VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
+
+ JSONObject electronicParkBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
+ VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(electronicParkBrakeStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject handsOffSteering = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING);
+ VehicleDataResult referenceHandsOffSteering = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(handsOffSteering));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHandsOffSteering, cmd.getHandsOffSteering()));
+
+ JSONObject windowStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_WINDOW_STATUS);
+ VehicleDataResult referenceWindowStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(windowStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWindowStatus, cmd.getWindowStatus()));
+
+ JSONObject gearStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_GEAR_STATUS);
+ VehicleDataResult referenceGearStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gearStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGearStatus, cmd.getGearStatus()));
+
+ JSONObject stabilityControlStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatus));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
+
+ JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
+ } 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/SubscribeWaypointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
index 8a156d12f..3434b12b8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeWaypointsResponseTests.java
@@ -25,22 +25,22 @@ import static junit.framework.TestCase.assertNotNull;
public class SubscribeWaypointsResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new SubscribeWayPointsResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SUBSCRIBE_WAY_POINTS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -48,7 +48,7 @@ public class SubscribeWaypointsResponseTests extends BaseRpcTests {
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
SubscribeWayPointsResponse msg = new SubscribeWayPointsResponse();
assertNotNull(TestValues.NOT_NULL, msg);
@@ -59,7 +59,7 @@ public class SubscribeWaypointsResponseTests extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
index 4fb706980..7e2827d40 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SystemRequestResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.SystemRequestResponse}
*/
public class SystemRequestResponseTest extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage(){
+
+ @Override
+ protected RPCMessage createMessage() {
return new SystemRequestResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.SYSTEM_REQUEST.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- SystemRequestResponse msg = new SystemRequestResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ SystemRequestResponse msg = new SystemRequestResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class SystemRequestResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- SystemRequestResponse cmd = new SystemRequestResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SystemRequestResponse cmd = new SystemRequestResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/UnpublishAppServiceResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
index 474c05cd6..ccbe562f9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
@@ -60,58 +60,58 @@ import static junit.framework.TestCase.assertNotNull;
*/
public class UnpublishAppServiceResponseTests extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
- return new UnpublishAppServiceResponse();
- }
-
- @Override
- protected String getMessageType(){
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType(){
- return FunctionID.UNPUBLISH_APP_SERVICE.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
- return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
- UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
- }
-
- /**
- * Tests a valid JSON construction of this RPC message.
- */
- @Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnpublishAppServiceResponse cmd = new UnpublishAppServiceResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ @Override
+ protected RPCMessage createMessage() {
+ return new UnpublishAppServiceResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNPUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnpublishAppServiceResponse cmd = new UnpublishAppServiceResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/UnregisterAppInterfaceResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
index 02d0623c5..a6fc526f3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnregisterAppInterfaceResponseTest.java
@@ -20,38 +20,38 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnregisterAppInterfaceResponse}
*/
public class UnregisterAppInterfaceResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new UnregisterAppInterfaceResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.UNREGISTER_APP_INTERFACE.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -60,22 +60,22 @@ public class UnregisterAppInterfaceResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnregisterAppInterfaceResponse cmd = new UnregisterAppInterfaceResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnregisterAppInterfaceResponse cmd = new UnregisterAppInterfaceResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/UnsubscribeButtonResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
index 348ffd95d..55d7b1e51 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeButtonResponseTest.java
@@ -21,38 +21,38 @@ import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse}
*/
public class UnsubscribeButtonResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage(){
+ @Override
+ protected RPCMessage createMessage() {
return new UnsubscribeButtonResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.UNSUBSCRIBE_BUTTON.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testRpcValues () {
- // Invalid/Null Tests
- UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse();
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse();
assertNotNull(TestValues.NOT_NULL, msg);
testNullBase(msg);
}
@@ -61,22 +61,22 @@ public class UnsubscribeButtonResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnsubscribeButtonResponse cmd = new UnsubscribeButtonResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeButtonResponse cmd = new UnsubscribeButtonResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/UnsubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
index f4f61fde3..1d5504b08 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
@@ -29,199 +29,199 @@ import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse}
*/
public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
- @Override
- protected RPCMessage createMessage() {
- UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
-
- msg.setResultCode(TestValues.GENERAL_RESULT);
- msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
- msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
- msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
- msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
- msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
- msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
- msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
- msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
- msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
- msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
- msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
- msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
- msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
- msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
- msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
- msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
- msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
- msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
- msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
- msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
- msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
- msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
- msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
- msg.setClusterModes(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
- msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
- msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
- msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
- msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
- msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
- msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
- msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
- msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
- msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
-
- return msg;
- }
-
- @Override
- protected String getMessageType() {
- return RPCMessage.KEY_RESPONSE;
- }
-
- @Override
- protected String getCommandType() {
- return FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString();
- }
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion) {
- JSONObject result = new JSONObject();
-
+ @Override
+ protected RPCMessage createMessage() {
+ UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
+
+ msg.setResultCode(TestValues.GENERAL_RESULT);
+ msg.setSpeed(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()));
+ msg.setRpm(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()));
+ msg.setExternalTemperature(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()));
+ msg.setFuelLevel(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()));
+ msg.setPrndl(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()));
+ msg.setTirePressure(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()));
+ msg.setEngineTorque(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()));
+ msg.setEngineOilLife(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()));
+ msg.setOdometer(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()));
+ msg.setGps(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()));
+ msg.setFuelLevelState(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()));
+ msg.setInstantFuelConsumption(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()));
+ msg.setBeltStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()));
+ msg.setBodyInformation(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()));
+ msg.setDeviceStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()));
+ msg.setDriverBraking(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()));
+ msg.setWiperStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()));
+ msg.setHeadLampStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()));
+ msg.setAccPedalPosition(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()));
+ msg.setSteeringWheelAngle(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()));
+ msg.setECallInfo(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()));
+ msg.setAirbagStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()));
+ msg.setEmergencyEvent(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()));
+ msg.setClusterModes(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()));
+ msg.setMyKey(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()));
+ msg.setFuelRange(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
+ msg.setTurnSignal(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
+ msg.setElectronicParkBrakeStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
+ msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
+ msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
+ msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
try {
- // Note: If the key values stored in SubscribeVehicleDataResponse
- // were to be in a list then this could be easily looped through
- // instead of individually set.
-
- result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
- result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODES, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
- result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
- } catch (JSONException e) {
- fail(TestValues.JSON_FAIL);
- }
-
- return result;
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Test Values
- Result testResult = ( (UnsubscribeVehicleDataResponse) msg ).getResultCode();
- VehicleDataResult testGps = ( (UnsubscribeVehicleDataResponse) msg ).getGps();
- VehicleDataResult testOdometer = ( (UnsubscribeVehicleDataResponse) msg ).getOdometer();
- VehicleDataResult testTirePressure = ( (UnsubscribeVehicleDataResponse) msg ).getTirePressure();
- VehicleDataResult testBeltStatus = ( (UnsubscribeVehicleDataResponse) msg ).getBeltStatus();
- VehicleDataResult testBodyInfo = ( (UnsubscribeVehicleDataResponse) msg ).getBodyInformation();
- VehicleDataResult testDeviceStatus = ( (UnsubscribeVehicleDataResponse) msg ).getDeviceStatus();
- VehicleDataResult testHeadLampStatus = ( (UnsubscribeVehicleDataResponse) msg ).getHeadLampStatus();
- VehicleDataResult testECallInfo = ( (UnsubscribeVehicleDataResponse) msg ).getECallInfo();
- VehicleDataResult testAirbagStatus = ( (UnsubscribeVehicleDataResponse) msg ).getAirbagStatus();
- VehicleDataResult testEmergencyEvent = ( (UnsubscribeVehicleDataResponse) msg ).getEmergencyEvent();
- VehicleDataResult testClusterMode = ( (UnsubscribeVehicleDataResponse) msg ).getClusterModes();
- VehicleDataResult testMyKey = ( (UnsubscribeVehicleDataResponse) msg ).getMyKey();
- VehicleDataResult testSpeed = ( (UnsubscribeVehicleDataResponse) msg ).getSpeed();
- VehicleDataResult testRpm = ( (UnsubscribeVehicleDataResponse) msg ).getRpm();
- VehicleDataResult testFuelLevel = ( (UnsubscribeVehicleDataResponse) msg ).getFuelLevel();
- VehicleDataResult testConsumption = ( (UnsubscribeVehicleDataResponse) msg ).getInstantFuelConsumption();
- VehicleDataResult testExternalTemp = ( (UnsubscribeVehicleDataResponse) msg ).getExternalTemperature();
- VehicleDataResult testEngineTorque = ( (UnsubscribeVehicleDataResponse) msg ).getEngineTorque();
- VehicleDataResult testEngineOilLife = ( (UnsubscribeVehicleDataResponse) msg ).getEngineOilLife();
- VehicleDataResult testAccPedal = ( (UnsubscribeVehicleDataResponse) msg ).getAccPedalPosition();
- VehicleDataResult testSteeringWheel = ( (UnsubscribeVehicleDataResponse) msg ).getSteeringWheelAngle();
- VehicleDataResult testFuelLevelState = ( (UnsubscribeVehicleDataResponse) msg ).getFuelLevelState();
- VehicleDataResult testPrndl = ( (UnsubscribeVehicleDataResponse) msg ).getPrndl();
- VehicleDataResult testBraking = ( (UnsubscribeVehicleDataResponse) msg ).getDriverBraking();
- VehicleDataResult testWiperStatus = ( (UnsubscribeVehicleDataResponse) msg ).getWiperStatus();
- VehicleDataResult testFuelRange = ( (UnsubscribeVehicleDataResponse) msg ).getFuelRange();
- VehicleDataResult testTurnSignal = ( (UnsubscribeVehicleDataResponse) msg ).getTurnSignal();
- VehicleDataResult testEBrakeStatus = ( (UnsubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
- VehicleDataResult testHOffSteering = ( (UnsubscribeVehicleDataResponse) msg ).getHandsOffSteering();
- VehicleDataResult testGearStatus = ( (UnsubscribeVehicleDataResponse) msg ).getGearStatus();
- VehicleDataResult testWindowStatus = ( (UnsubscribeVehicleDataResponse) msg ).getWindowStatus();
- VehicleDataResult testStabilityControlStatus = ( (UnsubscribeVehicleDataResponse) msg ).getStabilityControlsStatus();
- VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
-
- // Valid Tests
- assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
- assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
- assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
- assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
- assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
- assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
- assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
- assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
- assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
- assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
- assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
- assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
- assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
- assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
- assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
- assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
- assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
- assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
- assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
- assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
- assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
- assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
- assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
- assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
- assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
- assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
- assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
- assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
- assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
- assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
- assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
- assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
- assertTrue(TestValues.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
- assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
+ // Note: If the key values stored in SubscribeVehicleDataResponse
+ // were to be in a list then this could be easily looped through
+ // instead of individually set.
+
+ result.put(SubscribeVehicleDataResponse.KEY_RESULT_CODE, TestValues.GENERAL_RESULT);
+ result.put(SubscribeVehicleDataResponse.KEY_SPEED, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_SPEED.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_RPM, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_RPM.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EXTERNTEMP.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_PRNDL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_PRNDL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TIRE_PRESSURE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TIREPRESSURE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_TORQUE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINETORQUE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ODOMETER, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ODOMETER.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GPS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GPS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BELT_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BELTSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_BODY_INFORMATION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BODYINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DEVICE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_DEVICESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_DRIVER_BRAKING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_BRAKING.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WIPER_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WIPERSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ACCPEDAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STEERINGWHEEL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_E_CALL_INFO, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ECALLINFO.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_AIRBAG_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_CLUSTER_MODES, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_MY_KEY, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_MYKEY.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testRpcValues() {
+ // Test Values
+ Result testResult = ((UnsubscribeVehicleDataResponse) msg).getResultCode();
+ VehicleDataResult testGps = ((UnsubscribeVehicleDataResponse) msg).getGps();
+ VehicleDataResult testOdometer = ((UnsubscribeVehicleDataResponse) msg).getOdometer();
+ VehicleDataResult testTirePressure = ((UnsubscribeVehicleDataResponse) msg).getTirePressure();
+ VehicleDataResult testBeltStatus = ((UnsubscribeVehicleDataResponse) msg).getBeltStatus();
+ VehicleDataResult testBodyInfo = ((UnsubscribeVehicleDataResponse) msg).getBodyInformation();
+ VehicleDataResult testDeviceStatus = ((UnsubscribeVehicleDataResponse) msg).getDeviceStatus();
+ VehicleDataResult testHeadLampStatus = ((UnsubscribeVehicleDataResponse) msg).getHeadLampStatus();
+ VehicleDataResult testECallInfo = ((UnsubscribeVehicleDataResponse) msg).getECallInfo();
+ VehicleDataResult testAirbagStatus = ((UnsubscribeVehicleDataResponse) msg).getAirbagStatus();
+ VehicleDataResult testEmergencyEvent = ((UnsubscribeVehicleDataResponse) msg).getEmergencyEvent();
+ VehicleDataResult testClusterMode = ((UnsubscribeVehicleDataResponse) msg).getClusterModes();
+ VehicleDataResult testMyKey = ((UnsubscribeVehicleDataResponse) msg).getMyKey();
+ VehicleDataResult testSpeed = ((UnsubscribeVehicleDataResponse) msg).getSpeed();
+ VehicleDataResult testRpm = ((UnsubscribeVehicleDataResponse) msg).getRpm();
+ VehicleDataResult testFuelLevel = ((UnsubscribeVehicleDataResponse) msg).getFuelLevel();
+ VehicleDataResult testConsumption = ((UnsubscribeVehicleDataResponse) msg).getInstantFuelConsumption();
+ VehicleDataResult testExternalTemp = ((UnsubscribeVehicleDataResponse) msg).getExternalTemperature();
+ VehicleDataResult testEngineTorque = ((UnsubscribeVehicleDataResponse) msg).getEngineTorque();
+ VehicleDataResult testEngineOilLife = ((UnsubscribeVehicleDataResponse) msg).getEngineOilLife();
+ VehicleDataResult testAccPedal = ((UnsubscribeVehicleDataResponse) msg).getAccPedalPosition();
+ VehicleDataResult testSteeringWheel = ((UnsubscribeVehicleDataResponse) msg).getSteeringWheelAngle();
+ VehicleDataResult testFuelLevelState = ((UnsubscribeVehicleDataResponse) msg).getFuelLevelState();
+ VehicleDataResult testPrndl = ((UnsubscribeVehicleDataResponse) msg).getPrndl();
+ VehicleDataResult testBraking = ((UnsubscribeVehicleDataResponse) msg).getDriverBraking();
+ VehicleDataResult testWiperStatus = ((UnsubscribeVehicleDataResponse) msg).getWiperStatus();
+ VehicleDataResult testFuelRange = ((UnsubscribeVehicleDataResponse) msg).getFuelRange();
+ VehicleDataResult testTurnSignal = ((UnsubscribeVehicleDataResponse) msg).getTurnSignal();
+ VehicleDataResult testEBrakeStatus = ((UnsubscribeVehicleDataResponse) msg).getElectronicParkBrakeStatus();
+ VehicleDataResult testHOffSteering = ((UnsubscribeVehicleDataResponse) msg).getHandsOffSteering();
+ VehicleDataResult testGearStatus = ((UnsubscribeVehicleDataResponse) msg).getGearStatus();
+ VehicleDataResult testWindowStatus = ((UnsubscribeVehicleDataResponse) msg).getWindowStatus();
+ VehicleDataResult testStabilityControlStatus = ((UnsubscribeVehicleDataResponse) msg).getStabilityControlsStatus();
+ VehicleDataResult testOemCustomData = ((UnsubscribeVehicleDataResponse) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+
+ // Valid Tests
+ assertTrue(TestValues.TRUE, testResult.equals(TestValues.GENERAL_RESULT));
+ assertTrue(TestValues.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
+ assertTrue(TestValues.TRUE, testOdometer.getDataType().equals(VehicleDataType.VEHICLEDATA_ODOMETER));
+ assertTrue(TestValues.TRUE, testTirePressure.getDataType().equals(VehicleDataType.VEHICLEDATA_TIREPRESSURE));
+ assertTrue(TestValues.TRUE, testBeltStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_BELTSTATUS));
+ assertTrue(TestValues.TRUE, testBodyInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_BODYINFO));
+ assertTrue(TestValues.TRUE, testDeviceStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_DEVICESTATUS));
+ assertTrue(TestValues.TRUE, testHeadLampStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS));
+ assertTrue(TestValues.TRUE, testECallInfo.getDataType().equals(VehicleDataType.VEHICLEDATA_ECALLINFO));
+ assertTrue(TestValues.TRUE, testAirbagStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_AIRBAGSTATUS));
+ assertTrue(TestValues.TRUE, testEmergencyEvent.getDataType().equals(VehicleDataType.VEHICLEDATA_EMERGENCYEVENT));
+ assertTrue(TestValues.TRUE, testClusterMode.getDataType().equals(VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS));
+ assertTrue(TestValues.TRUE, testMyKey.getDataType().equals(VehicleDataType.VEHICLEDATA_MYKEY));
+ assertTrue(TestValues.TRUE, testSpeed.getDataType().equals(VehicleDataType.VEHICLEDATA_SPEED));
+ assertTrue(TestValues.TRUE, testRpm.getDataType().equals(VehicleDataType.VEHICLEDATA_RPM));
+ assertTrue(TestValues.TRUE, testFuelLevel.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL));
+ assertTrue(TestValues.TRUE, testConsumption.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELCONSUMPTION));
+ assertTrue(TestValues.TRUE, testExternalTemp.getDataType().equals(VehicleDataType.VEHICLEDATA_EXTERNTEMP));
+ assertTrue(TestValues.TRUE, testEngineTorque.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINETORQUE));
+ assertTrue(TestValues.TRUE, testEngineOilLife.getDataType().equals(VehicleDataType.VEHICLEDATA_ENGINEOILLIFE));
+ assertTrue(TestValues.TRUE, testAccPedal.getDataType().equals(VehicleDataType.VEHICLEDATA_ACCPEDAL));
+ assertTrue(TestValues.TRUE, testSteeringWheel.getDataType().equals(VehicleDataType.VEHICLEDATA_STEERINGWHEEL));
+ assertTrue(TestValues.TRUE, testFuelLevelState.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE));
+ assertTrue(TestValues.TRUE, testPrndl.getDataType().equals(VehicleDataType.VEHICLEDATA_PRNDL));
+ assertTrue(TestValues.TRUE, testBraking.getDataType().equals(VehicleDataType.VEHICLEDATA_BRAKING));
+ assertTrue(TestValues.TRUE, testWiperStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WIPERSTATUS));
+ assertTrue(TestValues.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
+ assertTrue(TestValues.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
+ assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
+ assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
+ assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
+ assertTrue(TestValues.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+ assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
// Invalid/Null Tests
- UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
- assertNotNull("Null object creation failed.", msg);
+ UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
+ assertNotNull("Null object creation failed.", msg);
testNullBase(msg);
- assertNull(TestValues.NULL, msg.getResultCode());
- assertNull(TestValues.NULL, msg.getAccPedalPosition());
+ assertNull(TestValues.NULL, msg.getResultCode());
+ assertNull(TestValues.NULL, msg.getAccPedalPosition());
assertNull(TestValues.NULL, msg.getAirbagStatus());
assertNull(TestValues.NULL, msg.getBeltStatus());
assertNull(TestValues.NULL, msg.getDriverBraking());
@@ -249,9 +249,9 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getFuelRange());
assertNull(TestValues.NULL, msg.getTurnSignal());
assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
- assertNull(TestValues.NULL, msg.getGearStatus());
- assertNull(TestValues.NULL, msg.getHandsOffSteering());
- assertNull(TestValues.NULL, msg.getWindowStatus());
+ assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getHandsOffSteering());
+ assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
@@ -261,156 +261,156 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UnsubscribeVehicleDataResponse cmd = new UnsubscribeVehicleDataResponse(hash);
-
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
-
- JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
- JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_SPEED);
- VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
-
- JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_RPM);
- VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
-
- JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
- VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
-
- JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
- VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
-
- JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_PRNDL);
- VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
-
- JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
- VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
-
- JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
- VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
-
- JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
- VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
-
- JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ODOMETER);
- VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
-
- JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_GPS);
- VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
-
- JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
- VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
-
- JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
- VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
-
- JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BELT_STATUS);
- VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
-
- JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
- VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
-
- JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
- VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
-
- JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
- VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
-
- JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_WIPER_STATUS);
- VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
-
- JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
- VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
-
- JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
- VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
-
- JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
- VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
-
- JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_E_CALL_INFO);
- VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
-
- JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
- VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
-
- JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
- VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
-
- JSONObject clusterModes = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_CLUSTER_MODES);
- VehicleDataResult referenceClusterModes = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModes));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModes, cmd.getClusterModes()));
-
- JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_MY_KEY);
- VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
-
- JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_RANGE);
- VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
-
- JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
- VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
-
- JSONObject eBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
- VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eBrakeStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
-
- JSONObject handsOffSteering = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING);
- VehicleDataResult referenceHandsOffSteering = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(handsOffSteering));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHandsOffSteering, cmd.getHandsOffSteering()));
-
- JSONObject gearStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_GEAR_STATUS);
- VehicleDataResult referenceGearStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gearStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGearStatus, cmd.getGearStatus()));
-
- JSONObject windowStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_WINDOW_STATUS);
- VehicleDataResult referenceWindowStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(windowStatus));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWindowStatus, cmd.getWindowStatus()));
-
- JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
- VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
- assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
-
- JSONObject stabilityControlsStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
- VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlsStatus));
- assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
- } catch (JSONException e) {
- e.printStackTrace();
- }
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnsubscribeVehicleDataResponse cmd = new UnsubscribeVehicleDataResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ JSONObject speed = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_SPEED);
+ VehicleDataResult referenceSpeed = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(speed));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSpeed, cmd.getSpeed()));
+
+ JSONObject rpm = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_RPM);
+ VehicleDataResult referenceRpm = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(rpm));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceRpm, cmd.getRpm()));
+
+ JSONObject fuelLevel = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL);
+ VehicleDataResult referenceFuelLevel = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevel));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevel, cmd.getFuelLevel()));
+
+ JSONObject externalTemperature = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EXTERNAL_TEMPERATURE);
+ VehicleDataResult referenceExternalTemperature = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(externalTemperature));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceExternalTemperature, cmd.getExternalTemperature()));
+
+ JSONObject prndl = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_PRNDL);
+ VehicleDataResult referencePrndl = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(prndl));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referencePrndl, cmd.getPrndl()));
+
+ JSONObject tirePressure = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TIRE_PRESSURE);
+ VehicleDataResult referenceTirePressure = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(tirePressure));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTirePressure, cmd.getTirePressure()));
+
+ JSONObject engineTorque = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_TORQUE);
+ VehicleDataResult referenceEngineTorque = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineTorque));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineTorque, cmd.getEngineTorque()));
+
+ JSONObject engineOilLife = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ENGINE_OIL_LIFE);
+ VehicleDataResult referenceEngineOilLife = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(engineOilLife));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEngineOilLife, cmd.getEngineOilLife()));
+
+ JSONObject odometer = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ODOMETER);
+ VehicleDataResult referenceOdometer = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(odometer));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOdometer, cmd.getOdometer()));
+
+ JSONObject gps = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_GPS);
+ VehicleDataResult referenceGps = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gps));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGps, cmd.getGps()));
+
+ JSONObject fuelLevelState = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_LEVEL_STATE);
+ VehicleDataResult referenceFuelLevelState = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelLevelState));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelLevelState, cmd.getFuelLevelState()));
+
+ JSONObject fuelConsumption = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_INSTANT_FUEL_CONSUMPTION);
+ VehicleDataResult referenceFuelConsumption = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelConsumption));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelConsumption, cmd.getInstantFuelConsumption()));
+
+ JSONObject beltStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BELT_STATUS);
+ VehicleDataResult referenceBeltStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(beltStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBeltStatus, cmd.getBeltStatus()));
+
+ JSONObject bodyInformation = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_BODY_INFORMATION);
+ VehicleDataResult referenceBodyInformation = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(bodyInformation));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceBodyInformation, cmd.getBodyInformation()));
+
+ JSONObject deviceStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DEVICE_STATUS);
+ VehicleDataResult referenceDeviceStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(deviceStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDeviceStatus, cmd.getDeviceStatus()));
+
+ JSONObject driverBraking = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_DRIVER_BRAKING);
+ VehicleDataResult referenceDriverBraking = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(driverBraking));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceDriverBraking, cmd.getDriverBraking()));
+
+ JSONObject wiperStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_WIPER_STATUS);
+ VehicleDataResult referenceWiperStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(wiperStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWiperStatus, cmd.getWiperStatus()));
+
+ JSONObject headLampStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_HEAD_LAMP_STATUS);
+ VehicleDataResult referenceHeadLampStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(headLampStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHeadLampStatus, cmd.getHeadLampStatus()));
+
+ JSONObject accPedalPosition = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ACC_PEDAL_POSITION);
+ VehicleDataResult referenceAccPedalPosition = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(accPedalPosition));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAccPedalPosition, cmd.getAccPedalPosition()));
+
+ JSONObject steeringWheelAngle = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STEERING_WHEEL_ANGLE);
+ VehicleDataResult referenceSteeringWheelAngle = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(steeringWheelAngle));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceSteeringWheelAngle, cmd.getSteeringWheelAngle()));
+
+ JSONObject eCallInfo = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_E_CALL_INFO);
+ VehicleDataResult referenceECallInfo = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eCallInfo));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceECallInfo, cmd.getECallInfo()));
+
+ JSONObject airbagStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_AIRBAG_STATUS);
+ VehicleDataResult referenceAirbagStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(airbagStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceAirbagStatus, cmd.getAirbagStatus()));
+
+ JSONObject emergencyEvent = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_EMERGENCY_EVENT);
+ VehicleDataResult referenceEmergencyEvent = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(emergencyEvent));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEmergencyEvent, cmd.getEmergencyEvent()));
+
+ JSONObject clusterModes = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_CLUSTER_MODES);
+ VehicleDataResult referenceClusterModes = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(clusterModes));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceClusterModes, cmd.getClusterModes()));
+
+ JSONObject myKey = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_MY_KEY);
+ VehicleDataResult referenceMyKey = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(myKey));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceMyKey, cmd.getMyKey()));
+
+ JSONObject fuelRange = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_FUEL_RANGE);
+ VehicleDataResult referenceFuelRange = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(fuelRange));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceFuelRange, cmd.getFuelRange()));
+
+ JSONObject turnSignal = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_TURN_SIGNAL);
+ VehicleDataResult referenceTurnSignal = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(turnSignal));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceTurnSignal, cmd.getTurnSignal()));
+
+ JSONObject eBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
+ VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eBrakeStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject handsOffSteering = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING);
+ VehicleDataResult referenceHandsOffSteering = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(handsOffSteering));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceHandsOffSteering, cmd.getHandsOffSteering()));
+
+ JSONObject gearStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_GEAR_STATUS);
+ VehicleDataResult referenceGearStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gearStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGearStatus, cmd.getGearStatus()));
+
+ JSONObject windowStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_WINDOW_STATUS);
+ VehicleDataResult referenceWindowStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(windowStatus));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceWindowStatus, cmd.getWindowStatus()));
+
+ JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
+ assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
+
+ JSONObject stabilityControlsStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlsStatus));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
+ } 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/UnsubscribeWayPointsResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
index 5cf058392..070a6e631 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeWayPointsResponseTests.java
@@ -25,24 +25,24 @@ import static junit.framework.TestCase.assertNotNull;
* Created by austinkirk on 6/7/17.
*/
-public class UnsubscribeWayPointsResponseTests extends BaseRpcTests{
+public class UnsubscribeWayPointsResponseTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage(){
+ protected RPCMessage createMessage() {
return new UnsubscribeWayPointsResponse();
}
@Override
- protected String getMessageType(){
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
@Override
- protected String getCommandType(){
+ protected String getCommandType() {
return FunctionID.UNSUBSCRIBE_WAY_POINTS.toString();
}
@Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
}
@@ -50,7 +50,7 @@ public class UnsubscribeWayPointsResponseTests extends BaseRpcTests{
* Tests the expected values of the RPC message.
*/
@Test
- public void testRpcValues () {
+ public void testRpcValues() {
// Invalid/Null Tests
UnsubscribeWayPointsResponse msg = new UnsubscribeWayPointsResponse();
msg.setWayPoints(TestValues.GENERAL_LOCATIONDETAILS_LIST);
@@ -66,7 +66,7 @@ public class UnsubscribeWayPointsResponseTests extends BaseRpcTests{
* Tests a valid JSON construction of this RPC message.
*/
@Test
- public void testJsonConstructor () {
+ public void testJsonConstructor() {
JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
assertNotNull(TestValues.NOT_NULL, commandJson);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
index 8280e56aa..e44a86419 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UpdateTurnListResponseTests.java
@@ -20,61 +20,61 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.UpdateTurnListResponse}
*/
public class UpdateTurnListResponseTests extends BaseRpcTests {
-
- @Override
- protected RPCMessage createMessage(){
- return new UpdateTurnListResponse();
- }
-
- @Override
- protected String getMessageType(){
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new UpdateTurnListResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
return RPCMessage.KEY_RESPONSE;
}
-
- @Override
- protected String getCommandType(){
+
+ @Override
+ protected String getCommandType() {
return FunctionID.UPDATE_TURN_LIST.toString();
}
-
- @Override
- protected JSONObject getExpectedParameters(int sdlVersion){
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
return new JSONObject();
- }
-
- /**
- * Tests the expected values of the RPC message.
- */
- @Test
- public void testRpcValues () {
- // Invalid/Null Tests
- UpdateTurnListResponse msg = new UpdateTurnListResponse();
- assertNotNull(TestValues.NOT_NULL, msg);
- testNullBase(msg);
- }
-
+ }
+
/**
- * Tests the expected values of the RPC message.
- */
+ * Tests the expected values of the RPC message.
+ */
@Test
- public void testJsonConstructor () {
- JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
- assertNotNull(TestValues.NOT_NULL, commandJson);
-
- try {
- Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
- UpdateTurnListResponse cmd = new UpdateTurnListResponse(hash);
- JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
- assertNotNull(TestValues.NOT_NULL, body);
-
- // Test everything in the json body.
- assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
- assertEquals(TestValues.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ UpdateTurnListResponse msg = new UpdateTurnListResponse();
+ assertNotNull(TestValues.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ @Test
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(getInstrumentation().getTargetContext(), getCommandType(), getMessageType());
+ assertNotNull(TestValues.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UpdateTurnListResponse cmd = new UpdateTurnListResponse(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(TestValues.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(TestValues.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/security/SdlSecurityBaseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
index f2648c7e2..4406ad800 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
@@ -2,9 +2,9 @@ package com.smartdevicelink.test.security;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.streaming.MockInterfaceBroker;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -22,98 +22,98 @@ import static junit.framework.TestCase.assertNotNull;
@RunWith(AndroidJUnit4.class)
public class SdlSecurityBaseTest {
- private class MockSdlSecurityBase extends SdlSecurityBase {
-
- @Override
- public void initialize() {
-
- }
-
- @Override
- public Integer runHandshake(byte[] inputData, byte[] outputData) {
- return null;
- }
-
- @Override
- public Integer encryptData(byte[] inputData, byte[] outputData) {
- return null;
- }
-
- @Override
- public Integer decryptData(byte[] inputData, byte[] outputData) {
- return null;
- }
-
- @Override
- public void shutDown() {
-
- }
-
- public SdlSession getSdlSession() {
- return session;
- }
-
- public void setStartServiceList(List<SessionType> list) {
- startServiceList = list;
- }
- }
-
- @Test
- public void testMakeListSetAndGet(){
- List<String> makeList = new ArrayList<String>();
- MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
-
- String MAKE_1 = "SDL1";
- String MAKE_2 = "SDL2";
- makeList.add(MAKE_1);
- makeList.add(MAKE_2);
-
- mockSdlSecurityBase.setMakeList(makeList);
-
- assertNotNull(TestValues.NOT_NULL, makeList);
- assertEquals(TestValues.MATCH, makeList, mockSdlSecurityBase.getMakeList());
- }
-
- @Test
- public void testHandleInitResult() {
- byte testWiproVersion = (byte) 0x0B;
- boolean testInitResult = true;
- MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
- MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(),"19216801");
- MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
-
- SdlSession testSdlSession = new SdlSession(interfaceBroker, transportConfig);
-
- assertNotNull(TestValues.NOT_NULL, mockSdlSecurityBase);
- assertNotNull(TestValues.NOT_NULL, testSdlSession);
-
- testSdlSession.setSdlSecurity(mockSdlSecurityBase);
-
- mockSdlSecurityBase.handleSdlSession(testSdlSession);
-
- assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession(), testSdlSession);
- assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession().getSessionId(), testSdlSession.getSessionId());
-
- mockSdlSecurityBase.handleInitResult(testInitResult);
-
- assertEquals(TestValues.MATCH, testInitResult, mockSdlSecurityBase.getInitSuccess());
- }
-
- @Test
- public void testStartServiceListSetAndGet() {
- List<SessionType> startServiceList = new ArrayList<SessionType>();
- MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
-
- startServiceList.add(SessionType.RPC);
- startServiceList.add(SessionType.NAV);
- startServiceList.add(SessionType.PCM);
- startServiceList.add(SessionType.CONTROL);
-
- assertNotNull(TestValues.NOT_NULL, startServiceList);
-
- mockSdlSecurityBase.setStartServiceList(startServiceList);
-
- assertEquals(TestValues.MATCH, startServiceList, mockSdlSecurityBase.getServiceList());
- }
+ private class MockSdlSecurityBase extends SdlSecurityBase {
+
+ @Override
+ public void initialize() {
+
+ }
+
+ @Override
+ public Integer runHandshake(byte[] inputData, byte[] outputData) {
+ return null;
+ }
+
+ @Override
+ public Integer encryptData(byte[] inputData, byte[] outputData) {
+ return null;
+ }
+
+ @Override
+ public Integer decryptData(byte[] inputData, byte[] outputData) {
+ return null;
+ }
+
+ @Override
+ public void shutDown() {
+
+ }
+
+ public SdlSession getSdlSession() {
+ return session;
+ }
+
+ public void setStartServiceList(List<SessionType> list) {
+ startServiceList = list;
+ }
+ }
+
+ @Test
+ public void testMakeListSetAndGet() {
+ List<String> makeList = new ArrayList<String>();
+ MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
+
+ String MAKE_1 = "SDL1";
+ String MAKE_2 = "SDL2";
+ makeList.add(MAKE_1);
+ makeList.add(MAKE_2);
+
+ mockSdlSecurityBase.setMakeList(makeList);
+
+ assertNotNull(TestValues.NOT_NULL, makeList);
+ assertEquals(TestValues.MATCH, makeList, mockSdlSecurityBase.getMakeList());
+ }
+
+ @Test
+ public void testHandleInitResult() {
+ byte testWiproVersion = (byte) 0x0B;
+ boolean testInitResult = true;
+ MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
+ MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "19216801");
+ MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
+
+ SdlSession testSdlSession = new SdlSession(interfaceBroker, transportConfig);
+
+ assertNotNull(TestValues.NOT_NULL, mockSdlSecurityBase);
+ assertNotNull(TestValues.NOT_NULL, testSdlSession);
+
+ testSdlSession.setSdlSecurity(mockSdlSecurityBase);
+
+ mockSdlSecurityBase.handleSdlSession(testSdlSession);
+
+ assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession(), testSdlSession);
+ assertEquals(TestValues.MATCH, mockSdlSecurityBase.getSdlSession().getSessionId(), testSdlSession.getSessionId());
+
+ mockSdlSecurityBase.handleInitResult(testInitResult);
+
+ assertEquals(TestValues.MATCH, testInitResult, mockSdlSecurityBase.getInitSuccess());
+ }
+
+ @Test
+ public void testStartServiceListSetAndGet() {
+ List<SessionType> startServiceList = new ArrayList<SessionType>();
+ MockSdlSecurityBase mockSdlSecurityBase = new MockSdlSecurityBase();
+
+ startServiceList.add(SessionType.RPC);
+ startServiceList.add(SessionType.NAV);
+ startServiceList.add(SessionType.PCM);
+ startServiceList.add(SessionType.CONTROL);
+
+ assertNotNull(TestValues.NOT_NULL, startServiceList);
+
+ mockSdlSecurityBase.setStartServiceList(startServiceList);
+
+ assertEquals(TestValues.MATCH, startServiceList, mockSdlSecurityBase.getServiceList());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
index dbec1301e..7fde73e3b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
@@ -1,8 +1,8 @@
package com.smartdevicelink.test.streaming;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -18,52 +18,52 @@ import java.io.InputStream;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.streaming.AbstractPacketizer}
*/
public class AbstractPacketizerTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.streaming.AbstractPacketizer#AbstractPacketizer(IStreamListener, InputStream, RPCRequest, SessionType, byte, Version, SdlSession)}
- * {@link com.smartdevicelink.streaming.AbstractPacketizer#AbstractPacketizer(IStreamListener, InputStream, RPCRequest, SessionType, byte, Version, SdlSession)}
- */
- public void testConstructors () {
-
- // Test Values
- byte testSessionId = (byte) 0x0A;
- SessionType testSessionType = SessionType.RPC;
- SdlSession testSdlSession = null;
- InputStream testInputStream = null;
- MockPacketizer testPacketizer1 = null;
- MockPacketizer testPacketizer2 = null;
- IStreamListener testListener = new MockStreamListener();
- try {
- testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
- MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
- MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(),"19216801");
- testSdlSession = new SdlSession(interfaceBroker, transportConfig);
- testPacketizer1 = new MockPacketizer(testListener, testInputStream, testSessionType, testSessionId, testSdlSession);
- testPacketizer2 = new MockPacketizer(null, null, null, testSessionId, testSdlSession);
- // Valid Tests
- assertNotNull(TestValues.NOT_NULL, testPacketizer1);
- assertNotNull(TestValues.NOT_NULL, testPacketizer2);
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.streaming.AbstractPacketizer#AbstractPacketizer(IStreamListener, InputStream, RPCRequest, SessionType, byte, Version, SdlSession)}
+ * {@link com.smartdevicelink.streaming.AbstractPacketizer#AbstractPacketizer(IStreamListener, InputStream, RPCRequest, SessionType, byte, Version, SdlSession)}
+ */
+ public void testConstructors() {
+
+ // Test Values
+ byte testSessionId = (byte) 0x0A;
+ SessionType testSessionType = SessionType.RPC;
+ SdlSession testSdlSession = null;
+ InputStream testInputStream = null;
+ MockPacketizer testPacketizer1 = null;
+ MockPacketizer testPacketizer2 = null;
+ IStreamListener testListener = new MockStreamListener();
+ try {
+ testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
+ MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
+ MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "19216801");
+ testSdlSession = new SdlSession(interfaceBroker, transportConfig);
+ testPacketizer1 = new MockPacketizer(testListener, testInputStream, testSessionType, testSessionId, testSdlSession);
+ testPacketizer2 = new MockPacketizer(null, null, null, testSessionId, testSdlSession);
+
+ // Valid Tests
+ assertNotNull(TestValues.NOT_NULL, testPacketizer1);
+ assertNotNull(TestValues.NOT_NULL, testPacketizer2);
+
+ assertEquals(TestValues.MATCH, testListener, testPacketizer1.getListener());
+ assertEquals(TestValues.MATCH, testInputStream, testPacketizer1.getInputStream());
+ assertEquals(TestValues.MATCH, testSessionType, testPacketizer1.getSessionType());
+ assertEquals(TestValues.MATCH, testSessionId, testPacketizer1.getSessionId());
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, testPacketizer2.getListener());
+ assertNull(TestValues.NULL, testPacketizer2.getInputStream());
+ assertNull(TestValues.NULL, testPacketizer2.getSessionType());
- assertEquals(TestValues.MATCH, testListener, testPacketizer1.getListener());
- assertEquals(TestValues.MATCH, testInputStream, testPacketizer1.getInputStream());
- assertEquals(TestValues.MATCH, testSessionType, testPacketizer1.getSessionType());
- assertEquals(TestValues.MATCH, testSessionId, testPacketizer1.getSessionId());
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, testPacketizer2.getListener());
- assertNull(TestValues.NULL, testPacketizer2.getInputStream());
- assertNull(TestValues.NULL, testPacketizer2.getSessionType());
-
- } catch (IOException e) {
- e.printStackTrace();
- fail("IOException was thrown.");
- }
- }
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("IOException was thrown.");
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
index 14905fa7d..364e6c976 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.streaming;
-import com.smartdevicelink.session.ISdlSessionListener;
import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.session.ISdlSessionListener;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.util.Version;
@@ -10,30 +10,31 @@ import com.smartdevicelink.util.Version;
* {@link com.smartdevicelink.streaming.AbstractPacketizer}
*/
public class MockInterfaceBroker implements ISdlSessionListener {
- public MockInterfaceBroker () { }
+ public MockInterfaceBroker() {
+ }
- @Override
- public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
+ @Override
+ public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
- }
+ }
- @Override
- public void onRPCMessageReceived(RPCMessage rpcMessage) {
+ @Override
+ public void onRPCMessageReceived(RPCMessage rpcMessage) {
- }
+ }
- @Override
- public void onSessionStarted(int sessionID, Version version) {
+ @Override
+ public void onSessionStarted(int sessionID, Version version) {
- }
+ }
- @Override
- public void onSessionEnded(int sessionID) {
+ @Override
+ public void onSessionEnded(int sessionID) {
- }
+ }
- @Override
- public void onAuthTokenReceived(String authToken, int sessionID) {
+ @Override
+ public void onAuthTokenReceived(String authToken, int sessionID) {
- }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
index 77eae6cba..bad0f688c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.test.streaming;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
@@ -13,16 +13,39 @@ import java.io.InputStream;
* {@link com.smartdevicelink.streaming.AbstractPacketizer}
*/
public class MockPacketizer extends AbstractPacketizer {
- public MockPacketizer (IStreamListener l, InputStream i, SessionType s, byte sid, SdlSession sdlsession) throws IOException { super (l, i, s, sid, sdlsession); }
+ public MockPacketizer(IStreamListener l, InputStream i, SessionType s, byte sid, SdlSession sdlsession) throws IOException {
+ super(l, i, s, sid, sdlsession);
+ }
+
+ @Override
+ public void start() throws IOException {
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ public IStreamListener getListener() {
+ return _streamListener;
+ }
+
+ public InputStream getInputStream() {
+ return is;
+ }
+
+ public SessionType getSessionType() {
+ return _serviceType;
+ }
- @Override public void start() throws IOException { }
- @Override public void stop() { }
+ public byte getSessionId() {
+ return _rpcSessionID;
+ }
- public IStreamListener getListener () { return _streamListener; }
- public InputStream getInputStream () { return is; }
- public SessionType getSessionType () { return _serviceType; }
- public byte getSessionId () { return _rpcSessionID; }
+ @Override
+ public void pause() {
+ }
- @Override public void pause() { }
- @Override public void resume() { }
+ @Override
+ public void resume() {
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java
index 0081c65ea..8bd0d70d5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java
@@ -8,6 +8,10 @@ import com.smartdevicelink.streaming.IStreamListener;
* {@link com.smartdevicelink.streaming.AbstractPacketizer}
*/
public class MockStreamListener implements IStreamListener {
- public MockStreamListener () { }
- @Override public void sendStreamPacket(ProtocolMessage pm) { }
+ public MockStreamListener() {
+ }
+
+ @Override
+ public void sendStreamPacket(ProtocolMessage pm) {
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
index d6d2083af..ededb3e03 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
@@ -1,11 +1,11 @@
package com.smartdevicelink.test.streaming;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.streaming.video.IVideoStreamListener;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
+import com.smartdevicelink.streaming.video.IVideoStreamListener;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -22,482 +22,490 @@ import java.util.Arrays;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.streaming.StreamPacketizer}
*/
public class StreamPacketizerTests extends TestCase {
- private static final byte WIPRO_VERSION = 0x0B;
- private static final byte SESSION_ID = 0x0A;
-
- private final byte[][] SAMPLE_H264_VIDEO_STREAM = {
- // one byte array represents a frame
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60,
- 0x00, 0x00, 0x00, 0x01,
- 0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20,
- 0x00, 0x00, 0x01,
- 0x65, (byte)0x88, (byte)0x82, 0x07, 0x67, 0x39, 0x31, 0x40,
- 0x00, 0x5E, 0x0A, (byte)0xFB, (byte)0xEF, (byte)0xAE, (byte)0xBA, (byte)0xEB,
- (byte)0xAE, (byte)0xBA, (byte)0xEB, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x1C, 0x0E, (byte)0xCE, 0x71, (byte)0xB0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x2A, 0x03, (byte)0xB3, (byte)0x9C, 0x6C},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x3B, 0x03, (byte)0xB3, (byte)0x9C, 0x6C},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x49, 0x00, (byte)0xEC, (byte)0xE7, 0x1B},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x59, 0x40, (byte)0xEC, (byte)0xE7, 0x1B},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x69, (byte)0x80, (byte)0xEC, (byte)0xE7, 0x1B},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x79, (byte)0xC0, (byte)0xEC, (byte)0xE7, 0x1B},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0x88, (byte)0x80, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0x98, (byte)0x90, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xA8, (byte)0xA0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xB8, (byte)0xB0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xC8, (byte)0xC0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xD8, (byte)0xD0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xE8, (byte)0xE0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, (byte)0xF8, (byte)0xF0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x00, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x10, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x20, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x30, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x40, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x50, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x60, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, 0x70, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0x80, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0x90, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0xA0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0xB0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0xC0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9B, (byte)0xD0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60,
- 0x00, 0x00, 0x00, 0x01,
- 0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20,
- 0x00, 0x00, 0x01,
- 0x65, (byte)0x88, (byte)0x81, 0x00, (byte)0x8E, 0x73, (byte)0x93, 0x14,
- 0x00, 0x06, (byte)0xA4, 0x2F, (byte)0xBE, (byte)0xFA, (byte)0xEB, (byte)0xAE,
- (byte)0xBA, (byte)0xEB, (byte)0xAE, (byte)0xBC},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x1C, 0x0D, (byte)0xCE, 0x71, (byte)0xB0},
- new byte[]{0x00, 0x00, 0x00, 0x01,
- 0x41, (byte)0x9A, 0x2A, 0x03, 0x33, (byte)0x9C, 0x6C},
- };
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.streaming.StreamPacketizer#StreamPacketizer(IStreamListener, InputStream, SessionType, byte, SdlSession)}
- */
- public void testConstructor () {
-
- // Test Values
- byte testSessionId = (byte) 0x0A;
- SessionType testSessionType = SessionType.RPC;
- InputStream testInputStream = null;
- byte testWiproVersion = (byte) 0x0B;
- IStreamListener testListener = new MockStreamListener();
- MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
- MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(),"19216801");
- SdlSession testSdlSession = new SdlSession(interfaceBroker, transportConfig);
- try {
- testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
- StreamPacketizer testStreamPacketizer = new StreamPacketizer(testListener, testInputStream, testSessionType, testSessionId, testSdlSession);
- assertNotNull(TestValues.NOT_NULL, testStreamPacketizer);
-
- // NOTE: Cannot test thread handling methods currently.
-
- } catch (IOException e) {
- fail("IOException was thrown.");
- }
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(byte[], int, int, long)}
- */
- public void testSendFrameInterfaceWithArray() {
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithArray(SAMPLE_H264_VIDEO_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(byte[], int, int, long)}
- * with offset parameter
- */
- public void testSendFrameInterfaceWithArrayOffset() {
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithArrayOffset(SAMPLE_H264_VIDEO_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(ByteBuffer, long)}
- */
- public void testSendFrameInterfaceWithByteBuffer() {
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithByteBuffer(SAMPLE_H264_VIDEO_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(ByteBuffer, long)}
- * with direct ByteBuffer
- */
- public void testSendFrameInterfaceWithDirectByteBuffer() {
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithDirectByteBuffer(SAMPLE_H264_VIDEO_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(byte[], int, int, long)}
- */
- public void testSendAudioInterfaceWithArray() {
- // assume 100 data of 16kHz / 16bits audio for 10 msecs
- int dataCount = 100;
- byte[][] sampleAudio = new byte[dataCount][];
- for (int i = 0; i < dataCount; i++) {
- sampleAudio[i] = new byte[4 * 160];
- Arrays.fill(sampleAudio[i], (byte)0);
- }
-
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithArray(sampleAudio);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(sampleAudio));
- }
-
- /**
- * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(byte[], int, int, long)}
- */
- public void testSendAudioInterfaceWithArrayOffset() {
- // assume 100 data of 16kHz / 16bits audio for 10 msecs
- int dataCount = 100;
- byte[][] sampleAudio = new byte[dataCount][];
- for (int i = 0; i < dataCount; i++) {
- sampleAudio[i] = new byte[4 * 160];
- Arrays.fill(sampleAudio[i], (byte)0);
- }
-
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithArrayOffset(sampleAudio);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(sampleAudio));
- }
-
- public void testSendAudioInterfaceWithByteBuffer() {
- // assume 100 data of 16kHz / 16bits audio for 10 msecs
- int dataCount = 100;
- byte[][] sampleAudio = new byte[dataCount][];
- for (int i = 0; i < dataCount; i++) {
- sampleAudio[i] = new byte[4 * 160];
- Arrays.fill(sampleAudio[i], (byte)0);
- }
-
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithByteBuffer(sampleAudio);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(sampleAudio));
- }
-
- public void testSendAudioInterfaceWithDirectByteBuffer() {
- // assume 100 data of 16kHz / 16bits audio for 10 msecs
- int dataCount = 100;
- byte[][] sampleAudio = new byte[dataCount][];
- for (int i = 0; i < dataCount; i++) {
- sampleAudio[i] = new byte[4 * 160];
- Arrays.fill(sampleAudio[i], (byte)0);
- }
-
- StreamReceiver mockReceiver = new StreamReceiver();
- SdlSession session = createTestSession();
- StreamPacketizer packetizer = null;
- try {
- packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithDirectByteBuffer(sampleAudio);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertTrue(mockReceiver.verify(sampleAudio));
- }
-
-
- private SdlSession createTestSession() {
- return new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(),"19216801"));
- }
-
- private class StreamReceiver implements IStreamListener {
- private ByteArrayOutputStream mReceiveBuffer;
-
- StreamReceiver() {
- mReceiveBuffer = new ByteArrayOutputStream();
- }
-
- @Override
- public void sendStreamPacket(ProtocolMessage pm) {
- try {
- mReceiveBuffer.write(pm.getData());
- } catch (IOException e) {
- fail();
- }
- }
-
- boolean verify(byte[][] expectedStream) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- for (byte[] frame : expectedStream) {
- try {
- buffer.write(frame);
- } catch (IOException e) {
- fail();
- }
- }
- boolean result = Arrays.equals(buffer.toByteArray(), mReceiveBuffer.toByteArray());
- try {
- buffer.close();
- } catch (IOException e) {
- fail();
- }
- return result;
- }
- }
-
- private class MockVideoApp {
- private IVideoStreamListener mListener;
-
- MockVideoApp(IVideoStreamListener listener) {
- mListener = listener;
- }
-
- void inputByteStreamWithArray(byte[][] stream) {
- for (byte[] data : stream) {
- mListener.sendFrame(data, 0, data.length, -1);
- }
- }
-
- void inputByteStreamWithArrayOffset(byte[][] stream) {
- int dummyOffset = 0;
- for (byte[] data : stream) {
- // to test 'offset' param, create a buffer with a dummy offset
- byte[] buffer = new byte[dummyOffset + data.length];
- System.arraycopy(data, 0, buffer, dummyOffset, data.length);
-
- mListener.sendFrame(buffer, dummyOffset, data.length, -1);
- dummyOffset++;
- }
- }
-
- void inputByteStreamWithByteBuffer(byte[][] stream) {
- int dummyOffset = 0;
- for (byte[] data : stream) {
- // add a dummy offset inside byteBuffer for testing
- ByteBuffer byteBuffer = ByteBuffer.allocate(dummyOffset + data.length);
- byteBuffer.position(dummyOffset);
-
- byteBuffer.put(data);
- byteBuffer.flip();
- byteBuffer.position(dummyOffset);
-
- mListener.sendFrame(byteBuffer, -1);
- dummyOffset++;
- }
- }
-
- void inputByteStreamWithDirectByteBuffer(byte[][] stream) {
- int dummyOffset = 0;
- for (byte[] data : stream) {
- // add a dummy offset inside byteBuffer for testing
- ByteBuffer byteBuffer = ByteBuffer.allocateDirect(dummyOffset + data.length);
- byteBuffer.position(dummyOffset);
-
- byteBuffer.put(data);
- byteBuffer.flip();
- byteBuffer.position(dummyOffset);
-
- mListener.sendFrame(byteBuffer, -1);
- dummyOffset++;
- }
- }
- }
+ private static final byte WIPRO_VERSION = 0x0B;
+ private static final byte SESSION_ID = 0x0A;
+
+ private final byte[][] SAMPLE_H264_VIDEO_STREAM = {
+ // one byte array represents a frame
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x68, (byte) 0xC8, 0x42, 0x0F, 0x13, 0x20,
+ 0x00, 0x00, 0x01,
+ 0x65, (byte) 0x88, (byte) 0x82, 0x07, 0x67, 0x39, 0x31, 0x40,
+ 0x00, 0x5E, 0x0A, (byte) 0xFB, (byte) 0xEF, (byte) 0xAE, (byte) 0xBA, (byte) 0xEB,
+ (byte) 0xAE, (byte) 0xBA, (byte) 0xEB, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x1C, 0x0E, (byte) 0xCE, 0x71, (byte) 0xB0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x2A, 0x03, (byte) 0xB3, (byte) 0x9C, 0x6C},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x3B, 0x03, (byte) 0xB3, (byte) 0x9C, 0x6C},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x49, 0x00, (byte) 0xEC, (byte) 0xE7, 0x1B},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x59, 0x40, (byte) 0xEC, (byte) 0xE7, 0x1B},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x69, (byte) 0x80, (byte) 0xEC, (byte) 0xE7, 0x1B},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x79, (byte) 0xC0, (byte) 0xEC, (byte) 0xE7, 0x1B},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0x88, (byte) 0x80, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0x98, (byte) 0x90, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xA8, (byte) 0xA0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xB8, (byte) 0xB0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xC8, (byte) 0xC0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xD8, (byte) 0xD0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xE8, (byte) 0xE0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, (byte) 0xF8, (byte) 0xF0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x00, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x10, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x20, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x30, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x40, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x50, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x60, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, 0x70, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0x80, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0x90, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0xA0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0xB0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0xC0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9B, (byte) 0xD0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x68, (byte) 0xC8, 0x42, 0x0F, 0x13, 0x20,
+ 0x00, 0x00, 0x01,
+ 0x65, (byte) 0x88, (byte) 0x81, 0x00, (byte) 0x8E, 0x73, (byte) 0x93, 0x14,
+ 0x00, 0x06, (byte) 0xA4, 0x2F, (byte) 0xBE, (byte) 0xFA, (byte) 0xEB, (byte) 0xAE,
+ (byte) 0xBA, (byte) 0xEB, (byte) 0xAE, (byte) 0xBC},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x1C, 0x0D, (byte) 0xCE, 0x71, (byte) 0xB0},
+ new byte[]{0x00, 0x00, 0x00, 0x01,
+ 0x41, (byte) 0x9A, 0x2A, 0x03, 0x33, (byte) 0x9C, 0x6C},
+ };
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.streaming.StreamPacketizer#StreamPacketizer(IStreamListener, InputStream, SessionType, byte, SdlSession)}
+ */
+ public void testConstructor() {
+
+ // Test Values
+ byte testSessionId = (byte) 0x0A;
+ SessionType testSessionType = SessionType.RPC;
+ InputStream testInputStream = null;
+ byte testWiproVersion = (byte) 0x0B;
+ IStreamListener testListener = new MockStreamListener();
+ MockInterfaceBroker interfaceBroker = new MockInterfaceBroker();
+ MultiplexTransportConfig transportConfig = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "19216801");
+ SdlSession testSdlSession = new SdlSession(interfaceBroker, transportConfig);
+ try {
+ testInputStream = new BufferedInputStream(new ByteArrayInputStream("sdl streaming test".getBytes()));
+ StreamPacketizer testStreamPacketizer = new StreamPacketizer(testListener, testInputStream, testSessionType, testSessionId, testSdlSession);
+ assertNotNull(TestValues.NOT_NULL, testStreamPacketizer);
+
+ // NOTE: Cannot test thread handling methods currently.
+
+ } catch (IOException e) {
+ fail("IOException was thrown.");
+ }
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(byte[], int, int, long)}
+ */
+ public void testSendFrameInterfaceWithArray() {
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithArray(SAMPLE_H264_VIDEO_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(byte[], int, int, long)}
+ * with offset parameter
+ */
+ public void testSendFrameInterfaceWithArrayOffset() {
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithArrayOffset(SAMPLE_H264_VIDEO_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(ByteBuffer, long)}
+ */
+ public void testSendFrameInterfaceWithByteBuffer() {
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithByteBuffer(SAMPLE_H264_VIDEO_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendFrame(ByteBuffer, long)}
+ * with direct ByteBuffer
+ */
+ public void testSendFrameInterfaceWithDirectByteBuffer() {
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithDirectByteBuffer(SAMPLE_H264_VIDEO_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(SAMPLE_H264_VIDEO_STREAM));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(byte[], int, int, long)}
+ */
+ public void testSendAudioInterfaceWithArray() {
+ // assume 100 data of 16kHz / 16bits audio for 10 msecs
+ int dataCount = 100;
+ byte[][] sampleAudio = new byte[dataCount][];
+ for (int i = 0; i < dataCount; i++) {
+ sampleAudio[i] = new byte[4 * 160];
+ Arrays.fill(sampleAudio[i], (byte) 0);
+ }
+
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithArray(sampleAudio);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(sampleAudio));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(byte[], int, int, long)}
+ */
+ public void testSendAudioInterfaceWithArrayOffset() {
+ // assume 100 data of 16kHz / 16bits audio for 10 msecs
+ int dataCount = 100;
+ byte[][] sampleAudio = new byte[dataCount][];
+ for (int i = 0; i < dataCount; i++) {
+ sampleAudio[i] = new byte[4 * 160];
+ Arrays.fill(sampleAudio[i], (byte) 0);
+ }
+
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithArrayOffset(sampleAudio);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(sampleAudio));
+ }
+
+ public void testSendAudioInterfaceWithByteBuffer() {
+ // assume 100 data of 16kHz / 16bits audio for 10 msecs
+ int dataCount = 100;
+ byte[][] sampleAudio = new byte[dataCount][];
+ for (int i = 0; i < dataCount; i++) {
+ sampleAudio[i] = new byte[4 * 160];
+ Arrays.fill(sampleAudio[i], (byte) 0);
+ }
+
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithByteBuffer(sampleAudio);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(sampleAudio));
+ }
+
+ public void testSendAudioInterfaceWithDirectByteBuffer() {
+ // assume 100 data of 16kHz / 16bits audio for 10 msecs
+ int dataCount = 100;
+ byte[][] sampleAudio = new byte[dataCount][];
+ for (int i = 0; i < dataCount; i++) {
+ sampleAudio[i] = new byte[4 * 160];
+ Arrays.fill(sampleAudio[i], (byte) 0);
+ }
+
+ StreamReceiver mockReceiver = new StreamReceiver();
+ SdlSession session = createTestSession();
+ StreamPacketizer packetizer = null;
+ try {
+ packetizer = new StreamPacketizer(mockReceiver, null, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithDirectByteBuffer(sampleAudio);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertTrue(mockReceiver.verify(sampleAudio));
+ }
+
+
+ private SdlSession createTestSession() {
+ return new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "19216801"));
+ }
+
+ private class StreamReceiver implements IStreamListener {
+ private ByteArrayOutputStream mReceiveBuffer;
+
+ StreamReceiver() {
+ mReceiveBuffer = new ByteArrayOutputStream();
+ }
+
+ @Override
+ public void sendStreamPacket(ProtocolMessage pm) {
+ try {
+ mReceiveBuffer.write(pm.getData());
+ } catch (IOException e) {
+ fail();
+ }
+ }
+
+ boolean verify(byte[][] expectedStream) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ for (byte[] frame : expectedStream) {
+ try {
+ buffer.write(frame);
+ } catch (IOException e) {
+ fail();
+ }
+ }
+ boolean result = Arrays.equals(buffer.toByteArray(), mReceiveBuffer.toByteArray());
+ try {
+ buffer.close();
+ } catch (IOException e) {
+ fail();
+ }
+ return result;
+ }
+ }
+
+ private class MockVideoApp {
+ private IVideoStreamListener mListener;
+
+ MockVideoApp(IVideoStreamListener listener) {
+ mListener = listener;
+ }
+
+ void inputByteStreamWithArray(byte[][] stream) {
+ for (byte[] data : stream) {
+ mListener.sendFrame(data, 0, data.length, -1);
+ }
+ }
+
+ void inputByteStreamWithArrayOffset(byte[][] stream) {
+ int dummyOffset = 0;
+ for (byte[] data : stream) {
+ // to test 'offset' param, create a buffer with a dummy offset
+ byte[] buffer = new byte[dummyOffset + data.length];
+ System.arraycopy(data, 0, buffer, dummyOffset, data.length);
+
+ mListener.sendFrame(buffer, dummyOffset, data.length, -1);
+ dummyOffset++;
+ }
+ }
+
+ void inputByteStreamWithByteBuffer(byte[][] stream) {
+ int dummyOffset = 0;
+ for (byte[] data : stream) {
+ // add a dummy offset inside byteBuffer for testing
+ ByteBuffer byteBuffer = ByteBuffer.allocate(dummyOffset + data.length);
+ byteBuffer.position(dummyOffset);
+
+ byteBuffer.put(data);
+ byteBuffer.flip();
+ byteBuffer.position(dummyOffset);
+
+ mListener.sendFrame(byteBuffer, -1);
+ dummyOffset++;
+ }
+ }
+
+ void inputByteStreamWithDirectByteBuffer(byte[][] stream) {
+ int dummyOffset = 0;
+ for (byte[] data : stream) {
+ // add a dummy offset inside byteBuffer for testing
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(dummyOffset + data.length);
+ byteBuffer.position(dummyOffset);
+
+ byteBuffer.put(data);
+ byteBuffer.flip();
+ byteBuffer.position(dummyOffset);
+
+ mListener.sendFrame(byteBuffer, -1);
+ dummyOffset++;
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java
index 5dfe36e19..70a175d46 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java
@@ -33,11 +33,11 @@ package com.smartdevicelink.test.streaming.video;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.streaming.video.IVideoStreamListener;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.IStreamListener;
+import com.smartdevicelink.streaming.video.IVideoStreamListener;
import com.smartdevicelink.streaming.video.RTPH264Packetizer;
import com.smartdevicelink.test.streaming.MockInterfaceBroker;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -62,840 +62,852 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
@RunWith(AndroidJUnit4.class)
public class RTPH264PacketizerTest extends TestCase {
- private static final int FRAME_LENGTH_LEN = 2;
- private static final int RTP_HEADER_LEN = 12;
-
- private static final byte WIPRO_VERSION = 0x0B;
- private static final byte SESSION_ID = 0x0A;
-
- private class ByteStreamNALUnit {
- byte[] startCode;
- byte[] nalUnit;
- int frameNum;
-
- ByteStreamNALUnit(byte[] startCode, byte[] nalUnit, int frameNum) {
- this.startCode = startCode;
- this.nalUnit = nalUnit;
- this.frameNum = frameNum;
- }
-
- byte[] createArray() {
- byte[] array = new byte[startCode.length + nalUnit.length];
- System.arraycopy(startCode, 0, array, 0, startCode.length);
- System.arraycopy(nalUnit, 0, array, startCode.length, nalUnit.length);
- return array;
- }
-
- public int getLength() {
- return startCode.length + nalUnit.length;
- }
- }
-
- private static final byte[] START_CODE_3 = {0x00, 0x00, 0x01};
- private static final byte[] START_CODE_4 = {0x00, 0x00, 0x00, 0x01};
-
- /* a sample H.264 stream, including 33 frames of 16px white square */
- private final ByteStreamNALUnit[] SAMPLE_STREAM = new ByteStreamNALUnit[] {
- // SPS
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60}, 0),
- // PPS
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20}, 0),
- // I
- new ByteStreamNALUnit(START_CODE_3, new byte[]{0x65, (byte)0x88, (byte)0x82, 0x07, 0x67, 0x39, 0x31, 0x40,
- 0x00, 0x5E, 0x0A, (byte)0xFB, (byte)0xEF, (byte)0xAE, (byte)0xBA, (byte)0xEB,
- (byte)0xAE, (byte)0xBA, (byte)0xEB, (byte)0xC0}, 0),
- // P
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x1C, 0x0E, (byte)0xCE, 0x71, (byte)0xB0}, 1),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x2A, 0x03, (byte)0xB3, (byte)0x9C, 0x6C}, 2),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x3B, 0x03, (byte)0xB3, (byte)0x9C, 0x6C}, 3),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x49, 0x00, (byte)0xEC, (byte)0xE7, 0x1B}, 4),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x59, 0x40, (byte)0xEC, (byte)0xE7, 0x1B}, 5),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x69, (byte)0x80, (byte)0xEC, (byte)0xE7, 0x1B}, 6),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x79, (byte)0xC0, (byte)0xEC, (byte)0xE7, 0x1B}, 7),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0x88, (byte)0x80, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 8),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0x98, (byte)0x90, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 9),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xA8, (byte)0xA0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 10),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xB8, (byte)0xB0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 11),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xC8, (byte)0xC0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 12),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xD8, (byte)0xD0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 13),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xE8, (byte)0xE0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 14),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, (byte)0xF8, (byte)0xF0, 0x3B, 0x39, (byte)0xC6, (byte)0xC0}, 15),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x00, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 16),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x10, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 17),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x20, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 18),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x30, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 19),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x40, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 20),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x50, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 21),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x60, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 22),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, 0x70, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 23),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0x80, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 24),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0x90, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 25),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0xA0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 26),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0xB0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 27),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0xC0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 28),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9B, (byte)0xD0, 0x1D, (byte)0x9C, (byte)0xE3, 0x60}, 29),
- // SPS
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x67, 0x42, (byte)0xC0, 0x0A, (byte)0xA6, 0x11, 0x11, (byte)0xE8,
- 0x40, 0x00, 0x00, (byte)0xFA, 0x40, 0x00, 0x3A, (byte)0x98,
- 0x23, (byte)0xC4, (byte)0x89, (byte)0x84, 0x60}, 30),
- // PPS
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20}, 30),
- // I
- new ByteStreamNALUnit(START_CODE_3, new byte[]{0x65, (byte)0x88, (byte)0x81, 0x00, (byte)0x8E, 0x73, (byte)0x93, 0x14,
- 0x00, 0x06, (byte)0xA4, 0x2F, (byte)0xBE, (byte)0xFA, (byte)0xEB, (byte)0xAE,
- (byte)0xBA, (byte)0xEB, (byte)0xAE, (byte)0xBC}, 30),
- // P
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x1C, 0x0D, (byte)0xCE, 0x71, (byte)0xB0}, 31),
- new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte)0x9A, 0x2A, 0x03, 0x33, (byte)0x9C, 0x6C}, 32),
- };
-
- /**
- * Test for creating Single Frame RTP packets from H.264 byte stream
- */
- @Test
- public void testSingleFrames() {
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for creating Single Frame RTP packets then splitting into multiple SDL frames
- */
- @Test
- public void testSingleFramesIntoMultipleMessages() {
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
-
- // try to modify "bufferSize" variable (in AbstractPacketizer)
- Class packetizerClass = RTPH264Packetizer.class;
- String fieldName = "bufferSize";
- java.lang.reflect.Field bufferSizeField = null;
- while (packetizerClass != null) {
- try {
- bufferSizeField = packetizerClass.getDeclaredField(fieldName);
- break;
- } catch (NoSuchFieldException e) {
- packetizerClass = packetizerClass.getSuperclass();
- }
- }
- if (bufferSizeField != null) {
- try {
- bufferSizeField.setAccessible(true);
- // use small MTU and make some RTP packets split into multiple SDL frames
- bufferSizeField.set(packetizer, FRAME_LENGTH_LEN + RTP_HEADER_LEN + 16);
- } catch (IllegalAccessException e) {
- fail("Cannot access to private field \"" + fieldName + "\".");
- }
- } else {
- fail("Cannot find private field \"" + fieldName + "\".");
- }
-
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for creating Fragmentation Units from H.264 byte stream
- */
- @Test
- public void testFragmentationUnits() {
- ByteStreamNALUnit[] stream = new ByteStreamNALUnit[] {
- SAMPLE_STREAM[0], SAMPLE_STREAM[1], null, null, null, SAMPLE_STREAM[5]
- };
- byte[] fakeNALUnit1 = new byte[65535 - RTP_HEADER_LEN]; // not fragmented
- byte[] fakeNALUnit2 = new byte[65536 - RTP_HEADER_LEN]; // will be fragmented
- byte[] fakeNALUnit3 = new byte[65537 - RTP_HEADER_LEN]; // ditto
-
- for (int i = 0; i < fakeNALUnit1.length; i++) {
- fakeNALUnit1[i] = (byte)(i % 256);
- }
- for (int i = 0; i < fakeNALUnit2.length; i++) {
- fakeNALUnit2[i] = (byte)(i % 256);
- }
- for (int i = 0; i < fakeNALUnit3.length; i++) {
- fakeNALUnit3[i] = (byte)(i % 256);
- }
-
- stream[2] = new ByteStreamNALUnit(START_CODE_3, fakeNALUnit1, 0);
- stream[3] = new ByteStreamNALUnit(START_CODE_4, fakeNALUnit2, 1);
- stream[4] = new ByteStreamNALUnit(START_CODE_4, fakeNALUnit3, 2);
-
- StreamVerifier verifier = new StreamVerifier(stream);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(stream);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(stream.length + 2, verifier.getPacketCount());
- }
-
- /**
- * Test for RTP sequence number gets wrap-around correctly
- */
- @Test
- public void testSequenceNumWrapAround() {
- ByteStreamNALUnit[] stream = new ByteStreamNALUnit[70000];
- for (int i = 0; i < stream.length; i++) {
- stream[i] = new ByteStreamNALUnit(START_CODE_4, SAMPLE_STREAM[3].nalUnit, i);
- }
-
- StreamVerifier verifier = new StreamVerifier(stream);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(stream);
- try {
- Thread.sleep(2000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(stream.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#setPayloadType(byte)}
- */
- @Test
- public void testSetPayloadType() {
- byte pt = (byte)123;
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM, pt);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- packetizer.setPayloadType(pt);
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#setSSRC(int)}
- */
- @Test
- public void testSetSSRC() {
- int ssrc = 0xFEDCBA98;
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- verifier.setExpectedSSRC(ssrc);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- packetizer.setSSRC(ssrc);
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#pause()} and
- * {@link RTPH264Packetizer#resume()}
- */
- @Test
- public void testPauseResume() {
- int index = 0;
- // split SAMPLE_STREAM into three parts
- ByteStreamNALUnit[] inputStream1 = new ByteStreamNALUnit[8];
- ByteStreamNALUnit[] inputStream2 = new ByteStreamNALUnit[19];
- ByteStreamNALUnit[] inputStream3 = new ByteStreamNALUnit[10];
- for (int i = 0; i < inputStream1.length; i++) {
- inputStream1[i] = SAMPLE_STREAM[index++];
- }
- for (int i = 0; i < inputStream2.length; i++) {
- inputStream2[i] = SAMPLE_STREAM[index++];
- }
- for (int i = 0; i < inputStream3.length; i++) {
- inputStream3[i] = SAMPLE_STREAM[index++];
- }
-
- index = 0;
- // expected output is "all NAL units in inputStream1" plus "I frame and onwards in inputStream3"
- ByteStreamNALUnit[] expectedStream = new ByteStreamNALUnit[inputStream1.length + 3];
- for (int i = 0; i < inputStream1.length; i++) {
- expectedStream[index++] = inputStream1[i];
- }
- expectedStream[index++] = SAMPLE_STREAM[34];
- expectedStream[index++] = SAMPLE_STREAM[35];
- expectedStream[index] = SAMPLE_STREAM[36];
-
- StreamVerifier verifier = new StreamVerifier(expectedStream);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp encoder = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- encoder.inputByteStreamWithArray(inputStream1);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.pause();
-
- // this input stream should be disposed
- encoder.inputByteStreamWithArray(inputStream2);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.resume();
-
- // packetizer should resume from a I frame
- encoder.inputByteStreamWithArray(inputStream3);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(expectedStream.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#sendFrame(byte[], int, int, long)}
- */
- @Test
- public void testSendFrameInterfaceWithArray() {
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithArrayOffset(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#sendFrame(ByteBuffer, long)}
- */
- @Test
- public void testSendFrameInterfaceWithByteBuffer() {
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithByteBuffer(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- /**
- * Test for {@link RTPH264Packetizer#sendFrame(ByteBuffer, long)}
- * with direct ByteBuffer
- */
- @Test
- public void testSendFrameInterfaceWithDirectByteBuffer() {
- StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
- SdlSession session = createTestSession();
- RTPH264Packetizer packetizer = null;
- try {
- packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
- } catch (IOException e) {
- fail();
- }
- MockVideoApp mockApp = new MockVideoApp(packetizer);
-
- try {
- packetizer.start();
- } catch (IOException e) {
- fail();
- }
-
- mockApp.inputByteStreamWithDirectByteBuffer(SAMPLE_STREAM);
- try {
- Thread.sleep(1000, 0);
- } catch (InterruptedException e) {}
-
- packetizer.stop();
- assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
- }
-
- private SdlSession createTestSession() {
- return new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "41146"));
- }
-
- private class StreamVerifier implements IStreamListener {
- private static final int STATE_LENGTH = 0;
- private static final int STATE_PACKET = 1;
-
- private ByteStreamNALUnit[] mStream;
- private byte[] mExpectedNALUnit;
- private ByteBuffer mReceiveBuffer;
- private int mPacketLen;
- private int mState;
- private int mNALCount;
- private int mTotalPacketCount;
- private boolean mFragmented;
- private int mOffsetInNALUnit;
- private byte mPayloadType;
- private boolean mVerifySSRC;
- private int mExpectedSSRC;
- private boolean mFirstPacketReceived;
- private short mFirstSequenceNum;
- private int mFirstTimestamp;
-
- StreamVerifier(ByteStreamNALUnit[] stream) {
- this(stream, (byte)96);
- }
-
- StreamVerifier(ByteStreamNALUnit[] stream, byte payloadType) {
- mStream = stream;
- mReceiveBuffer = ByteBuffer.allocate(256 * 1024);
- mReceiveBuffer.order(ByteOrder.BIG_ENDIAN);
- mPacketLen = 0;
- mState = STATE_LENGTH;
-
- mNALCount = 0;
- mTotalPacketCount = 0;
- mFragmented = false;
- mOffsetInNALUnit = 1; // Used when verifying FUs. The first byte is skipped.
-
- mPayloadType = payloadType;
- mVerifySSRC = false;
- mExpectedSSRC = 0;
- mFirstPacketReceived = false;
- mFirstSequenceNum = 0;
- mFirstTimestamp = 0;
- }
-
- void setExpectedSSRC(int ssrc) {
- mVerifySSRC = true;
- mExpectedSSRC = ssrc;
- }
-
- int getPacketCount() {
- return mTotalPacketCount;
- }
-
- @Override
- public void sendStreamPacket(ProtocolMessage pm) {
- mExpectedNALUnit = mStream[mNALCount].nalUnit;
- // should be same as MockVideoApp's configuration (29.97 FPS)
- int expectedPTSDelta = mStream[mNALCount].frameNum * 1001 * 3;
- boolean isLast = shouldBeLast();
-
- verifyProtocolMessage(pm, SESSION_ID);
-
- mReceiveBuffer.put(pm.getData());
- mReceiveBuffer.flip();
-
- if (mState == STATE_LENGTH) {
- if (mReceiveBuffer.remaining() >= 2) {
- mPacketLen = mReceiveBuffer.getShort() & 0xFFFF;
- mState = STATE_PACKET;
- }
- }
-
- if (mState == STATE_PACKET) {
- if (mReceiveBuffer.remaining() >= mPacketLen) {
- byte[] packet = new byte[mPacketLen];
- mReceiveBuffer.get(packet);
-
- verifyRTPPacket(packet, mPayloadType, expectedPTSDelta,
- mVerifySSRC, mExpectedSSRC, isLast);
- mFirstPacketReceived = true;
-
- mState = STATE_LENGTH;
- mPacketLen = 0;
- mTotalPacketCount++;
- }
- }
-
- mReceiveBuffer.compact();
- }
-
- private void verifyProtocolMessage(ProtocolMessage pm, byte sessionId) {
- assertEquals(true, pm != null);
- assertEquals(sessionId, pm.getSessionID());
- assertEquals(SessionType.NAV, pm.getSessionType());
- assertEquals(0, pm.getFunctionID());
- assertEquals(0, pm.getCorrID());
- assertEquals(false, pm.getPayloadProtected());
- }
-
- private void verifyRTPPacket(byte[] packet, byte payloadType, int expectedPTSDelta,
- boolean verifySSRC, int expectedSSRC, boolean isLast) {
- assertTrue(packet.length > RTP_HEADER_LEN);
- verifyRTPHeader(packet, false, isLast, payloadType, (short)(mTotalPacketCount % 65536),
- expectedPTSDelta, verifySSRC, expectedSSRC);
-
- byte type = (byte)(packet[RTP_HEADER_LEN] & 0x1F);
- if (type == 28) { // FU-A frame
- boolean fuEnd = verifyFUTypeA(packet);
- if (fuEnd) {
- mNALCount++;
- }
- } else if (type == 29) { // FU-B frame
- fail("Fragmentation Unit B is not supported by this test");
- } else if (type == 24 || type == 25 || type == 26 || type == 27) {
- fail("STAP and MTAP are not supported by this test");
- } else {
- // Single Frame
- verifySingleFrame(packet);
- mNALCount++;
- }
- }
-
- private void verifyRTPHeader(byte[] packet,
- boolean hasPadding, boolean isLast, byte payloadType,
- short seqNumDelta, int ptsDelta, boolean checkSSRC, int ssrc) {
- int byte0 = packet[0] & 0xFF;
- assertEquals((byte)2, (byte)((byte0 >> 6) & 3)); // version
- assertEquals((byte)(hasPadding ? 1 : 0), (byte)((byte0 >> 5) & 1)); // padding
- assertEquals((byte)0, (byte)((byte0 >> 4) & 1)); // extension
- assertEquals((byte)0, (byte)(byte0 & 0xF)); // CSRC count
-
- int byte1 = packet[1] & 0xFF;
- assertEquals((byte)(isLast ? 1 : 0), (byte)((byte1 >> 7) & 1)); // marker
- assertEquals(payloadType, (byte)(byte1 & 0x7F)); // Payload Type
-
- short actualSeq = (short)(((packet[2] & 0xFF) << 8) | (packet[3] & 0xFF));
- if (!mFirstPacketReceived) {
- mFirstSequenceNum = actualSeq;
- } else {
- assertEquals((short)(mFirstSequenceNum + seqNumDelta), actualSeq);
- }
-
- int actualPTS = ((packet[4] & 0xFF) << 24) | ((packet[5] & 0xFF) << 16) |
- ((packet[6] & 0xFF) << 8) | (packet[7] & 0xFF);
- if (!mFirstPacketReceived) {
- mFirstTimestamp = actualPTS;
- } else {
- // accept calculation error
- assertTrue(mFirstTimestamp + ptsDelta - 1 <= actualPTS &&
- actualPTS <= mFirstTimestamp + ptsDelta + 1);
- }
-
- if (checkSSRC) {
- int actualSSRC = ((packet[8] & 0xFF) << 24) | ((packet[9] & 0xFF) << 16) |
- ((packet[10] & 0xFF) << 8) | (packet[11] & 0xFF);
- assertEquals(ssrc, actualSSRC);
- }
- }
-
- private void verifySingleFrame(byte[] packet) {
- assertEquals(true, arrayCompare(packet, RTP_HEADER_LEN, packet.length - RTP_HEADER_LEN,
- mExpectedNALUnit, 0, mExpectedNALUnit.length));
- }
-
- private boolean verifyFUTypeA(byte[] packet) {
- int firstByte = mExpectedNALUnit[0] & 0xFF;
-
- int byte0 = packet[RTP_HEADER_LEN] & 0xFF;
- assertEquals((byte)((firstByte >> 7) & 1), (byte)((byte0 >> 7) & 1)); // F bit
- assertEquals((byte)((firstByte >> 5) & 3), (byte)((byte0 >> 5) & 3)); // NRI
- assertEquals((byte)28, (byte)(byte0 & 0x1F)); // Type
-
- int byte1 = packet[RTP_HEADER_LEN+1] & 0xFF;
- boolean isFirstFU = ((byte1 >> 7) & 1) == 1; // Start bit
- boolean isLastFU = ((byte1 >> 6) & 1) == 1; // End bit
- assertEquals((byte)0, (byte)((byte1 >> 5) & 1)); // Reserved bit
- assertEquals((byte)(firstByte & 0x1F), (byte)(byte1 & 0x1F)); // Type
-
- int len = packet.length - (RTP_HEADER_LEN + 2);
- assertEquals(true, arrayCompare(packet, RTP_HEADER_LEN + 2, len, mExpectedNALUnit, mOffsetInNALUnit, len));
- mOffsetInNALUnit += len;
-
- if (!mFragmented) {
- // this should be the first fragmentation unit
- assertEquals(true, isFirstFU);
- assertEquals(false, isLastFU);
- mFragmented = true;
- } else {
- assertEquals(false, isFirstFU);
- if (mExpectedNALUnit.length == mOffsetInNALUnit) {
- // this is the last fragmentation unit
- assertEquals(true, isLastFU);
-
- mFragmented = false;
- mOffsetInNALUnit = 1;
- return true;
- } else {
- assertEquals(false, isLastFU);
- }
- }
- return false;
- }
-
- private boolean shouldBeLast() {
- if (mNALCount + 1 >= mStream.length) {
- return true;
- }
- ByteStreamNALUnit current = mStream[mNALCount];
- ByteStreamNALUnit next = mStream[mNALCount + 1];
- if (next.frameNum != current.frameNum) {
- return true;
- } else {
- return false;
- }
- }
-
- private boolean arrayCompare(byte[] a1, int start1, int len1, byte[] a2, int start2, int len2) {
- assertTrue(start1 + len1 <= a1.length);
- assertTrue(start2 + len2 <= a2.length);
-
- if (len1 != len2) {
- return false;
- }
-
- for (int i = 0; i < len1; i++) {
- if (a1[start1 + i] != a2[start2 + i]) {
- return false;
- }
- }
- return true;
- }
- }
-
- private interface IVideoFrameSender {
- void onVideoFrame(byte[] data, long timestampUs);
- }
-
- private class MockVideoApp {
- private IVideoStreamListener mListener;
- private int mFPSNum;
- private int mFPSDen;
-
- MockVideoApp(IVideoStreamListener listener) {
- mListener = listener;
- // 29.97 fps
- mFPSNum = 30000;
- mFPSDen = 1001;
- }
-
- void inputByteStreamWithArray(ByteStreamNALUnit[] stream) {
- generateFramesFromStream(stream, new IVideoFrameSender() {
- @Override
- public void onVideoFrame(byte[] data, long timestampUs) {
- byte[] buffer = new byte[data.length];
- System.arraycopy(data, 0, buffer, 0, data.length);
- mListener.sendFrame(buffer, 0, data.length, timestampUs);
- }
- });
- }
-
- void inputByteStreamWithArrayOffset(ByteStreamNALUnit[] stream) {
- generateFramesFromStream(stream, new IVideoFrameSender() {
- private int mDummyOffset = 0;
-
- @Override
- public void onVideoFrame(byte[] data, long timestampUs) {
- // to test 'offset' param, create a buffer with a dummy offset
- byte[] buffer = new byte[mDummyOffset + data.length];
- System.arraycopy(data, 0, buffer, mDummyOffset, data.length);
-
- mListener.sendFrame(buffer, mDummyOffset, data.length, timestampUs);
- mDummyOffset++;
- }
- });
- }
-
- void inputByteStreamWithByteBuffer(ByteStreamNALUnit[] stream) {
- generateFramesFromStream(stream, new IVideoFrameSender() {
- private int mDummyOffset = 0;
-
- @Override
- public void onVideoFrame(byte[] data, long timestampUs) {
- // add a dummy offset inside byteBuffer for testing
- ByteBuffer byteBuffer = ByteBuffer.allocate(mDummyOffset + data.length);
- byteBuffer.position(mDummyOffset);
-
- byteBuffer.put(data);
- byteBuffer.flip();
- byteBuffer.position(mDummyOffset);
-
- mListener.sendFrame(byteBuffer, timestampUs);
- mDummyOffset++;
- }
- });
- }
-
- void inputByteStreamWithDirectByteBuffer(ByteStreamNALUnit[] stream) {
- generateFramesFromStream(stream, new IVideoFrameSender() {
- private int mDummyOffset = 0;
-
- @Override
- public void onVideoFrame(byte[] data, long timestampUs) {
- // add a dummy offset inside byteBuffer for testing
- ByteBuffer byteBuffer = ByteBuffer.allocateDirect(mDummyOffset + data.length);
- byteBuffer.position(mDummyOffset);
-
- byteBuffer.put(data);
- byteBuffer.flip();
- byteBuffer.position(mDummyOffset);
-
- mListener.sendFrame(byteBuffer, timestampUs);
- mDummyOffset++;
- }
- });
- }
-
- private void generateFramesFromStream(ByteStreamNALUnit[] stream, IVideoFrameSender callback) {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
-
- for (int i = 0; i < stream.length; i++) {
- ByteStreamNALUnit bs = stream[i];
- byte[] array = bs.createArray();
- os.write(array, 0, array.length);
-
- if (i < stream.length - 1) {
- ByteStreamNALUnit next = stream[i + 1];
- if (bs.frameNum == next.frameNum) {
- // enqueue it and send at once
- continue;
- }
- }
-
- long timestampUs = bs.frameNum * 1000L * 1000L * mFPSDen / mFPSNum;
- byte[] data = os.toByteArray();
- callback.onVideoFrame(data, timestampUs);
- os.reset();
- }
-
- try {
- os.close();
- } catch (IOException e) {
- }
- }
- }
+ private static final int FRAME_LENGTH_LEN = 2;
+ private static final int RTP_HEADER_LEN = 12;
+
+ private static final byte WIPRO_VERSION = 0x0B;
+ private static final byte SESSION_ID = 0x0A;
+
+ private class ByteStreamNALUnit {
+ byte[] startCode;
+ byte[] nalUnit;
+ int frameNum;
+
+ ByteStreamNALUnit(byte[] startCode, byte[] nalUnit, int frameNum) {
+ this.startCode = startCode;
+ this.nalUnit = nalUnit;
+ this.frameNum = frameNum;
+ }
+
+ byte[] createArray() {
+ byte[] array = new byte[startCode.length + nalUnit.length];
+ System.arraycopy(startCode, 0, array, 0, startCode.length);
+ System.arraycopy(nalUnit, 0, array, startCode.length, nalUnit.length);
+ return array;
+ }
+
+ public int getLength() {
+ return startCode.length + nalUnit.length;
+ }
+ }
+
+ private static final byte[] START_CODE_3 = {0x00, 0x00, 0x01};
+ private static final byte[] START_CODE_4 = {0x00, 0x00, 0x00, 0x01};
+
+ /* a sample H.264 stream, including 33 frames of 16px white square */
+ private final ByteStreamNALUnit[] SAMPLE_STREAM = new ByteStreamNALUnit[]{
+ // SPS
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60}, 0),
+ // PPS
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x68, (byte) 0xC8, 0x42, 0x0F, 0x13, 0x20}, 0),
+ // I
+ new ByteStreamNALUnit(START_CODE_3, new byte[]{0x65, (byte) 0x88, (byte) 0x82, 0x07, 0x67, 0x39, 0x31, 0x40,
+ 0x00, 0x5E, 0x0A, (byte) 0xFB, (byte) 0xEF, (byte) 0xAE, (byte) 0xBA, (byte) 0xEB,
+ (byte) 0xAE, (byte) 0xBA, (byte) 0xEB, (byte) 0xC0}, 0),
+ // P
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x1C, 0x0E, (byte) 0xCE, 0x71, (byte) 0xB0}, 1),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x2A, 0x03, (byte) 0xB3, (byte) 0x9C, 0x6C}, 2),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x3B, 0x03, (byte) 0xB3, (byte) 0x9C, 0x6C}, 3),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x49, 0x00, (byte) 0xEC, (byte) 0xE7, 0x1B}, 4),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x59, 0x40, (byte) 0xEC, (byte) 0xE7, 0x1B}, 5),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x69, (byte) 0x80, (byte) 0xEC, (byte) 0xE7, 0x1B}, 6),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x79, (byte) 0xC0, (byte) 0xEC, (byte) 0xE7, 0x1B}, 7),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0x88, (byte) 0x80, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 8),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0x98, (byte) 0x90, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 9),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xA8, (byte) 0xA0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 10),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xB8, (byte) 0xB0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 11),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xC8, (byte) 0xC0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 12),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xD8, (byte) 0xD0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 13),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xE8, (byte) 0xE0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 14),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, (byte) 0xF8, (byte) 0xF0, 0x3B, 0x39, (byte) 0xC6, (byte) 0xC0}, 15),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x00, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 16),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x10, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 17),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x20, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 18),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x30, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 19),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x40, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 20),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x50, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 21),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x60, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 22),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, 0x70, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 23),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0x80, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 24),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0x90, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 25),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0xA0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 26),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0xB0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 27),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0xC0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 28),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9B, (byte) 0xD0, 0x1D, (byte) 0x9C, (byte) 0xE3, 0x60}, 29),
+ // SPS
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x67, 0x42, (byte) 0xC0, 0x0A, (byte) 0xA6, 0x11, 0x11, (byte) 0xE8,
+ 0x40, 0x00, 0x00, (byte) 0xFA, 0x40, 0x00, 0x3A, (byte) 0x98,
+ 0x23, (byte) 0xC4, (byte) 0x89, (byte) 0x84, 0x60}, 30),
+ // PPS
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x68, (byte) 0xC8, 0x42, 0x0F, 0x13, 0x20}, 30),
+ // I
+ new ByteStreamNALUnit(START_CODE_3, new byte[]{0x65, (byte) 0x88, (byte) 0x81, 0x00, (byte) 0x8E, 0x73, (byte) 0x93, 0x14,
+ 0x00, 0x06, (byte) 0xA4, 0x2F, (byte) 0xBE, (byte) 0xFA, (byte) 0xEB, (byte) 0xAE,
+ (byte) 0xBA, (byte) 0xEB, (byte) 0xAE, (byte) 0xBC}, 30),
+ // P
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x1C, 0x0D, (byte) 0xCE, 0x71, (byte) 0xB0}, 31),
+ new ByteStreamNALUnit(START_CODE_4, new byte[]{0x41, (byte) 0x9A, 0x2A, 0x03, 0x33, (byte) 0x9C, 0x6C}, 32),
+ };
+
+ /**
+ * Test for creating Single Frame RTP packets from H.264 byte stream
+ */
+ @Test
+ public void testSingleFrames() {
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for creating Single Frame RTP packets then splitting into multiple SDL frames
+ */
+ @Test
+ public void testSingleFramesIntoMultipleMessages() {
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+
+ // try to modify "bufferSize" variable (in AbstractPacketizer)
+ Class packetizerClass = RTPH264Packetizer.class;
+ String fieldName = "bufferSize";
+ java.lang.reflect.Field bufferSizeField = null;
+ while (packetizerClass != null) {
+ try {
+ bufferSizeField = packetizerClass.getDeclaredField(fieldName);
+ break;
+ } catch (NoSuchFieldException e) {
+ packetizerClass = packetizerClass.getSuperclass();
+ }
+ }
+ if (bufferSizeField != null) {
+ try {
+ bufferSizeField.setAccessible(true);
+ // use small MTU and make some RTP packets split into multiple SDL frames
+ bufferSizeField.set(packetizer, FRAME_LENGTH_LEN + RTP_HEADER_LEN + 16);
+ } catch (IllegalAccessException e) {
+ fail("Cannot access to private field \"" + fieldName + "\".");
+ }
+ } else {
+ fail("Cannot find private field \"" + fieldName + "\".");
+ }
+
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for creating Fragmentation Units from H.264 byte stream
+ */
+ @Test
+ public void testFragmentationUnits() {
+ ByteStreamNALUnit[] stream = new ByteStreamNALUnit[]{
+ SAMPLE_STREAM[0], SAMPLE_STREAM[1], null, null, null, SAMPLE_STREAM[5]
+ };
+ byte[] fakeNALUnit1 = new byte[65535 - RTP_HEADER_LEN]; // not fragmented
+ byte[] fakeNALUnit2 = new byte[65536 - RTP_HEADER_LEN]; // will be fragmented
+ byte[] fakeNALUnit3 = new byte[65537 - RTP_HEADER_LEN]; // ditto
+
+ for (int i = 0; i < fakeNALUnit1.length; i++) {
+ fakeNALUnit1[i] = (byte) (i % 256);
+ }
+ for (int i = 0; i < fakeNALUnit2.length; i++) {
+ fakeNALUnit2[i] = (byte) (i % 256);
+ }
+ for (int i = 0; i < fakeNALUnit3.length; i++) {
+ fakeNALUnit3[i] = (byte) (i % 256);
+ }
+
+ stream[2] = new ByteStreamNALUnit(START_CODE_3, fakeNALUnit1, 0);
+ stream[3] = new ByteStreamNALUnit(START_CODE_4, fakeNALUnit2, 1);
+ stream[4] = new ByteStreamNALUnit(START_CODE_4, fakeNALUnit3, 2);
+
+ StreamVerifier verifier = new StreamVerifier(stream);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(stream);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(stream.length + 2, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for RTP sequence number gets wrap-around correctly
+ */
+ @Test
+ public void testSequenceNumWrapAround() {
+ ByteStreamNALUnit[] stream = new ByteStreamNALUnit[70000];
+ for (int i = 0; i < stream.length; i++) {
+ stream[i] = new ByteStreamNALUnit(START_CODE_4, SAMPLE_STREAM[3].nalUnit, i);
+ }
+
+ StreamVerifier verifier = new StreamVerifier(stream);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(stream);
+ try {
+ Thread.sleep(2000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(stream.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#setPayloadType(byte)}
+ */
+ @Test
+ public void testSetPayloadType() {
+ byte pt = (byte) 123;
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM, pt);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ packetizer.setPayloadType(pt);
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#setSSRC(int)}
+ */
+ @Test
+ public void testSetSSRC() {
+ int ssrc = 0xFEDCBA98;
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ verifier.setExpectedSSRC(ssrc);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ packetizer.setSSRC(ssrc);
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#pause()} and
+ * {@link RTPH264Packetizer#resume()}
+ */
+ @Test
+ public void testPauseResume() {
+ int index = 0;
+ // split SAMPLE_STREAM into three parts
+ ByteStreamNALUnit[] inputStream1 = new ByteStreamNALUnit[8];
+ ByteStreamNALUnit[] inputStream2 = new ByteStreamNALUnit[19];
+ ByteStreamNALUnit[] inputStream3 = new ByteStreamNALUnit[10];
+ for (int i = 0; i < inputStream1.length; i++) {
+ inputStream1[i] = SAMPLE_STREAM[index++];
+ }
+ for (int i = 0; i < inputStream2.length; i++) {
+ inputStream2[i] = SAMPLE_STREAM[index++];
+ }
+ for (int i = 0; i < inputStream3.length; i++) {
+ inputStream3[i] = SAMPLE_STREAM[index++];
+ }
+
+ index = 0;
+ // expected output is "all NAL units in inputStream1" plus "I frame and onwards in inputStream3"
+ ByteStreamNALUnit[] expectedStream = new ByteStreamNALUnit[inputStream1.length + 3];
+ for (int i = 0; i < inputStream1.length; i++) {
+ expectedStream[index++] = inputStream1[i];
+ }
+ expectedStream[index++] = SAMPLE_STREAM[34];
+ expectedStream[index++] = SAMPLE_STREAM[35];
+ expectedStream[index] = SAMPLE_STREAM[36];
+
+ StreamVerifier verifier = new StreamVerifier(expectedStream);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp encoder = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ encoder.inputByteStreamWithArray(inputStream1);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.pause();
+
+ // this input stream should be disposed
+ encoder.inputByteStreamWithArray(inputStream2);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.resume();
+
+ // packetizer should resume from a I frame
+ encoder.inputByteStreamWithArray(inputStream3);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(expectedStream.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#sendFrame(byte[], int, int, long)}
+ */
+ @Test
+ public void testSendFrameInterfaceWithArray() {
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithArrayOffset(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#sendFrame(ByteBuffer, long)}
+ */
+ @Test
+ public void testSendFrameInterfaceWithByteBuffer() {
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithByteBuffer(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ /**
+ * Test for {@link RTPH264Packetizer#sendFrame(ByteBuffer, long)}
+ * with direct ByteBuffer
+ */
+ @Test
+ public void testSendFrameInterfaceWithDirectByteBuffer() {
+ StreamVerifier verifier = new StreamVerifier(SAMPLE_STREAM);
+ SdlSession session = createTestSession();
+ RTPH264Packetizer packetizer = null;
+ try {
+ packetizer = new RTPH264Packetizer(verifier, SessionType.NAV, SESSION_ID, session);
+ } catch (IOException e) {
+ fail();
+ }
+ MockVideoApp mockApp = new MockVideoApp(packetizer);
+
+ try {
+ packetizer.start();
+ } catch (IOException e) {
+ fail();
+ }
+
+ mockApp.inputByteStreamWithDirectByteBuffer(SAMPLE_STREAM);
+ try {
+ Thread.sleep(1000, 0);
+ } catch (InterruptedException e) {
+ }
+
+ packetizer.stop();
+ assertEquals(SAMPLE_STREAM.length, verifier.getPacketCount());
+ }
+
+ private SdlSession createTestSession() {
+ return new SdlSession(new MockInterfaceBroker(), new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "41146"));
+ }
+
+ private class StreamVerifier implements IStreamListener {
+ private static final int STATE_LENGTH = 0;
+ private static final int STATE_PACKET = 1;
+
+ private ByteStreamNALUnit[] mStream;
+ private byte[] mExpectedNALUnit;
+ private ByteBuffer mReceiveBuffer;
+ private int mPacketLen;
+ private int mState;
+ private int mNALCount;
+ private int mTotalPacketCount;
+ private boolean mFragmented;
+ private int mOffsetInNALUnit;
+ private byte mPayloadType;
+ private boolean mVerifySSRC;
+ private int mExpectedSSRC;
+ private boolean mFirstPacketReceived;
+ private short mFirstSequenceNum;
+ private int mFirstTimestamp;
+
+ StreamVerifier(ByteStreamNALUnit[] stream) {
+ this(stream, (byte) 96);
+ }
+
+ StreamVerifier(ByteStreamNALUnit[] stream, byte payloadType) {
+ mStream = stream;
+ mReceiveBuffer = ByteBuffer.allocate(256 * 1024);
+ mReceiveBuffer.order(ByteOrder.BIG_ENDIAN);
+ mPacketLen = 0;
+ mState = STATE_LENGTH;
+
+ mNALCount = 0;
+ mTotalPacketCount = 0;
+ mFragmented = false;
+ mOffsetInNALUnit = 1; // Used when verifying FUs. The first byte is skipped.
+
+ mPayloadType = payloadType;
+ mVerifySSRC = false;
+ mExpectedSSRC = 0;
+ mFirstPacketReceived = false;
+ mFirstSequenceNum = 0;
+ mFirstTimestamp = 0;
+ }
+
+ void setExpectedSSRC(int ssrc) {
+ mVerifySSRC = true;
+ mExpectedSSRC = ssrc;
+ }
+
+ int getPacketCount() {
+ return mTotalPacketCount;
+ }
+
+ @Override
+ public void sendStreamPacket(ProtocolMessage pm) {
+ mExpectedNALUnit = mStream[mNALCount].nalUnit;
+ // should be same as MockVideoApp's configuration (29.97 FPS)
+ int expectedPTSDelta = mStream[mNALCount].frameNum * 1001 * 3;
+ boolean isLast = shouldBeLast();
+
+ verifyProtocolMessage(pm, SESSION_ID);
+
+ mReceiveBuffer.put(pm.getData());
+ mReceiveBuffer.flip();
+
+ if (mState == STATE_LENGTH) {
+ if (mReceiveBuffer.remaining() >= 2) {
+ mPacketLen = mReceiveBuffer.getShort() & 0xFFFF;
+ mState = STATE_PACKET;
+ }
+ }
+
+ if (mState == STATE_PACKET) {
+ if (mReceiveBuffer.remaining() >= mPacketLen) {
+ byte[] packet = new byte[mPacketLen];
+ mReceiveBuffer.get(packet);
+
+ verifyRTPPacket(packet, mPayloadType, expectedPTSDelta,
+ mVerifySSRC, mExpectedSSRC, isLast);
+ mFirstPacketReceived = true;
+
+ mState = STATE_LENGTH;
+ mPacketLen = 0;
+ mTotalPacketCount++;
+ }
+ }
+
+ mReceiveBuffer.compact();
+ }
+
+ private void verifyProtocolMessage(ProtocolMessage pm, byte sessionId) {
+ assertEquals(true, pm != null);
+ assertEquals(sessionId, pm.getSessionID());
+ assertEquals(SessionType.NAV, pm.getSessionType());
+ assertEquals(0, pm.getFunctionID());
+ assertEquals(0, pm.getCorrID());
+ assertEquals(false, pm.getPayloadProtected());
+ }
+
+ private void verifyRTPPacket(byte[] packet, byte payloadType, int expectedPTSDelta,
+ boolean verifySSRC, int expectedSSRC, boolean isLast) {
+ assertTrue(packet.length > RTP_HEADER_LEN);
+ verifyRTPHeader(packet, false, isLast, payloadType, (short) (mTotalPacketCount % 65536),
+ expectedPTSDelta, verifySSRC, expectedSSRC);
+
+ byte type = (byte) (packet[RTP_HEADER_LEN] & 0x1F);
+ if (type == 28) { // FU-A frame
+ boolean fuEnd = verifyFUTypeA(packet);
+ if (fuEnd) {
+ mNALCount++;
+ }
+ } else if (type == 29) { // FU-B frame
+ fail("Fragmentation Unit B is not supported by this test");
+ } else if (type == 24 || type == 25 || type == 26 || type == 27) {
+ fail("STAP and MTAP are not supported by this test");
+ } else {
+ // Single Frame
+ verifySingleFrame(packet);
+ mNALCount++;
+ }
+ }
+
+ private void verifyRTPHeader(byte[] packet,
+ boolean hasPadding, boolean isLast, byte payloadType,
+ short seqNumDelta, int ptsDelta, boolean checkSSRC, int ssrc) {
+ int byte0 = packet[0] & 0xFF;
+ assertEquals((byte) 2, (byte) ((byte0 >> 6) & 3)); // version
+ assertEquals((byte) (hasPadding ? 1 : 0), (byte) ((byte0 >> 5) & 1)); // padding
+ assertEquals((byte) 0, (byte) ((byte0 >> 4) & 1)); // extension
+ assertEquals((byte) 0, (byte) (byte0 & 0xF)); // CSRC count
+
+ int byte1 = packet[1] & 0xFF;
+ assertEquals((byte) (isLast ? 1 : 0), (byte) ((byte1 >> 7) & 1)); // marker
+ assertEquals(payloadType, (byte) (byte1 & 0x7F)); // Payload Type
+
+ short actualSeq = (short) (((packet[2] & 0xFF) << 8) | (packet[3] & 0xFF));
+ if (!mFirstPacketReceived) {
+ mFirstSequenceNum = actualSeq;
+ } else {
+ assertEquals((short) (mFirstSequenceNum + seqNumDelta), actualSeq);
+ }
+
+ int actualPTS = ((packet[4] & 0xFF) << 24) | ((packet[5] & 0xFF) << 16) |
+ ((packet[6] & 0xFF) << 8) | (packet[7] & 0xFF);
+ if (!mFirstPacketReceived) {
+ mFirstTimestamp = actualPTS;
+ } else {
+ // accept calculation error
+ assertTrue(mFirstTimestamp + ptsDelta - 1 <= actualPTS &&
+ actualPTS <= mFirstTimestamp + ptsDelta + 1);
+ }
+
+ if (checkSSRC) {
+ int actualSSRC = ((packet[8] & 0xFF) << 24) | ((packet[9] & 0xFF) << 16) |
+ ((packet[10] & 0xFF) << 8) | (packet[11] & 0xFF);
+ assertEquals(ssrc, actualSSRC);
+ }
+ }
+
+ private void verifySingleFrame(byte[] packet) {
+ assertEquals(true, arrayCompare(packet, RTP_HEADER_LEN, packet.length - RTP_HEADER_LEN,
+ mExpectedNALUnit, 0, mExpectedNALUnit.length));
+ }
+
+ private boolean verifyFUTypeA(byte[] packet) {
+ int firstByte = mExpectedNALUnit[0] & 0xFF;
+
+ int byte0 = packet[RTP_HEADER_LEN] & 0xFF;
+ assertEquals((byte) ((firstByte >> 7) & 1), (byte) ((byte0 >> 7) & 1)); // F bit
+ assertEquals((byte) ((firstByte >> 5) & 3), (byte) ((byte0 >> 5) & 3)); // NRI
+ assertEquals((byte) 28, (byte) (byte0 & 0x1F)); // Type
+
+ int byte1 = packet[RTP_HEADER_LEN + 1] & 0xFF;
+ boolean isFirstFU = ((byte1 >> 7) & 1) == 1; // Start bit
+ boolean isLastFU = ((byte1 >> 6) & 1) == 1; // End bit
+ assertEquals((byte) 0, (byte) ((byte1 >> 5) & 1)); // Reserved bit
+ assertEquals((byte) (firstByte & 0x1F), (byte) (byte1 & 0x1F)); // Type
+
+ int len = packet.length - (RTP_HEADER_LEN + 2);
+ assertEquals(true, arrayCompare(packet, RTP_HEADER_LEN + 2, len, mExpectedNALUnit, mOffsetInNALUnit, len));
+ mOffsetInNALUnit += len;
+
+ if (!mFragmented) {
+ // this should be the first fragmentation unit
+ assertEquals(true, isFirstFU);
+ assertEquals(false, isLastFU);
+ mFragmented = true;
+ } else {
+ assertEquals(false, isFirstFU);
+ if (mExpectedNALUnit.length == mOffsetInNALUnit) {
+ // this is the last fragmentation unit
+ assertEquals(true, isLastFU);
+
+ mFragmented = false;
+ mOffsetInNALUnit = 1;
+ return true;
+ } else {
+ assertEquals(false, isLastFU);
+ }
+ }
+ return false;
+ }
+
+ private boolean shouldBeLast() {
+ if (mNALCount + 1 >= mStream.length) {
+ return true;
+ }
+ ByteStreamNALUnit current = mStream[mNALCount];
+ ByteStreamNALUnit next = mStream[mNALCount + 1];
+ if (next.frameNum != current.frameNum) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean arrayCompare(byte[] a1, int start1, int len1, byte[] a2, int start2, int len2) {
+ assertTrue(start1 + len1 <= a1.length);
+ assertTrue(start2 + len2 <= a2.length);
+
+ if (len1 != len2) {
+ return false;
+ }
+
+ for (int i = 0; i < len1; i++) {
+ if (a1[start1 + i] != a2[start2 + i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ private interface IVideoFrameSender {
+ void onVideoFrame(byte[] data, long timestampUs);
+ }
+
+ private class MockVideoApp {
+ private IVideoStreamListener mListener;
+ private int mFPSNum;
+ private int mFPSDen;
+
+ MockVideoApp(IVideoStreamListener listener) {
+ mListener = listener;
+ // 29.97 fps
+ mFPSNum = 30000;
+ mFPSDen = 1001;
+ }
+
+ void inputByteStreamWithArray(ByteStreamNALUnit[] stream) {
+ generateFramesFromStream(stream, new IVideoFrameSender() {
+ @Override
+ public void onVideoFrame(byte[] data, long timestampUs) {
+ byte[] buffer = new byte[data.length];
+ System.arraycopy(data, 0, buffer, 0, data.length);
+ mListener.sendFrame(buffer, 0, data.length, timestampUs);
+ }
+ });
+ }
+
+ void inputByteStreamWithArrayOffset(ByteStreamNALUnit[] stream) {
+ generateFramesFromStream(stream, new IVideoFrameSender() {
+ private int mDummyOffset = 0;
+
+ @Override
+ public void onVideoFrame(byte[] data, long timestampUs) {
+ // to test 'offset' param, create a buffer with a dummy offset
+ byte[] buffer = new byte[mDummyOffset + data.length];
+ System.arraycopy(data, 0, buffer, mDummyOffset, data.length);
+
+ mListener.sendFrame(buffer, mDummyOffset, data.length, timestampUs);
+ mDummyOffset++;
+ }
+ });
+ }
+
+ void inputByteStreamWithByteBuffer(ByteStreamNALUnit[] stream) {
+ generateFramesFromStream(stream, new IVideoFrameSender() {
+ private int mDummyOffset = 0;
+
+ @Override
+ public void onVideoFrame(byte[] data, long timestampUs) {
+ // add a dummy offset inside byteBuffer for testing
+ ByteBuffer byteBuffer = ByteBuffer.allocate(mDummyOffset + data.length);
+ byteBuffer.position(mDummyOffset);
+
+ byteBuffer.put(data);
+ byteBuffer.flip();
+ byteBuffer.position(mDummyOffset);
+
+ mListener.sendFrame(byteBuffer, timestampUs);
+ mDummyOffset++;
+ }
+ });
+ }
+
+ void inputByteStreamWithDirectByteBuffer(ByteStreamNALUnit[] stream) {
+ generateFramesFromStream(stream, new IVideoFrameSender() {
+ private int mDummyOffset = 0;
+
+ @Override
+ public void onVideoFrame(byte[] data, long timestampUs) {
+ // add a dummy offset inside byteBuffer for testing
+ ByteBuffer byteBuffer = ByteBuffer.allocateDirect(mDummyOffset + data.length);
+ byteBuffer.position(mDummyOffset);
+
+ byteBuffer.put(data);
+ byteBuffer.flip();
+ byteBuffer.position(mDummyOffset);
+
+ mListener.sendFrame(byteBuffer, timestampUs);
+ mDummyOffset++;
+ }
+ });
+ }
+
+ private void generateFramesFromStream(ByteStreamNALUnit[] stream, IVideoFrameSender callback) {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ for (int i = 0; i < stream.length; i++) {
+ ByteStreamNALUnit bs = stream[i];
+ byte[] array = bs.createArray();
+ os.write(array, 0, array.length);
+
+ if (i < stream.length - 1) {
+ ByteStreamNALUnit next = stream[i + 1];
+ if (bs.frameNum == next.frameNum) {
+ // enqueue it and send at once
+ continue;
+ }
+ }
+
+ long timestampUs = bs.frameNum * 1000L * 1000L * mFPSDen / mFPSNum;
+ byte[] data = os.toByteArray();
+ callback.onVideoFrame(data, timestampUs);
+ os.reset();
+ }
+
+ try {
+ os.close();
+ } catch (IOException e) {
+ }
+ }
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java
index 4a0d7b87f..134de0519 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java
@@ -28,12 +28,12 @@ public class SdlRemoteDisplayTest extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- if(Looper.myLooper() == null){
+ if (Looper.myLooper() == null) {
Looper.prepare();
}
}
- public void testCreator(){
+ public void testCreator() {
VirtualDisplayEncoder encoder = createVDE();
assertNotNull(encoder);
@@ -46,7 +46,7 @@ public class SdlRemoteDisplayTest extends TestCase {
assert true;
}
- public void testConstructor(){
+ public void testConstructor() {
VirtualDisplayEncoder encoder = createVDE();
assertNotNull(encoder);
MockRemoteDisplay remoteDisplay = new MockRemoteDisplay(InstrumentationRegistry.getInstrumentation().getContext(), encoder.getVirtualDisplay());
@@ -57,7 +57,7 @@ public class SdlRemoteDisplayTest extends TestCase {
@TargetApi(19)
- public void testTouchEvents(){
+ public void testTouchEvents() {
VirtualDisplayEncoder encoder = createVDE();
assertNotNull(encoder);
MockRemoteDisplay remoteDisplay = new MockRemoteDisplay(InstrumentationRegistry.getInstrumentation().getContext(), encoder.getVirtualDisplay());
@@ -66,9 +66,9 @@ public class SdlRemoteDisplayTest extends TestCase {
assertNotNull(remoteDisplay.getMainView());
- try{
+ try {
remoteDisplay.handleMotionEvent(MotionEvent.obtain(10, System.currentTimeMillis(), MotionEvent.ACTION_DOWN, 100, 100, 0));
- }catch (Exception e){
+ } catch (Exception e) {
assert false;
}
@@ -77,13 +77,13 @@ public class SdlRemoteDisplayTest extends TestCase {
}
- public VirtualDisplayEncoder createVDE(){
- try{
+ public VirtualDisplayEncoder createVDE() {
+ try {
VirtualDisplayEncoder displayEncoder = new VirtualDisplayEncoder();
displayEncoder.init(InstrumentationRegistry.getInstrumentation().getContext(), new MockVideoStreamListener(), new VideoStreamingParameters());
displayEncoder.start();
return displayEncoder;
- }catch (Exception e ){
+ } catch (Exception e) {
e.printStackTrace();
}
return null;
@@ -92,7 +92,7 @@ public class SdlRemoteDisplayTest extends TestCase {
//Mock classes
- public static class MockRemoteDisplay extends SdlRemoteDisplay{
+ public static class MockRemoteDisplay extends SdlRemoteDisplay {
public MockRemoteDisplay(Context context, Display display) {
super(context, display);
@@ -102,14 +102,14 @@ public class SdlRemoteDisplayTest extends TestCase {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView( new RelativeLayout(getContext()));
+ setContentView(new RelativeLayout(getContext()));
}
}
- class MockVideoStreamListener implements IVideoStreamListener{
+ class MockVideoStreamListener implements IVideoStreamListener {
@Override
public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs) throws ArrayIndexOutOfBoundsException {
@@ -122,7 +122,7 @@ public class SdlRemoteDisplayTest extends TestCase {
}
}
- class MockRemoteDisplayCallback implements SdlRemoteDisplay.Callback{
+ class MockRemoteDisplayCallback implements SdlRemoteDisplay.Callback {
@Override
public void onCreated(SdlRemoteDisplay remoteDisplay) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
index a297a9626..ca7924e8f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
@@ -162,10 +162,10 @@ public class VideoStreamingParametersTest {
}
@Test
- public void testUpdateCapabilityFormat(){
+ public void testUpdateCapabilityFormat() {
VideoStreamingCapability capability = new VideoStreamingCapability();
capability.setMaxBitrate(10000);
- capability.setPreferredResolution( new ImageResolution(800,600));
+ capability.setPreferredResolution(new ImageResolution(800, 600));
capability.setIsHapticSpatialDataSupported(false);
VideoStreamingFormat format = new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.H264);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
index 34685897f..cd617eaed 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/DiagLevelTests.java
@@ -8,124 +8,124 @@ import com.smartdevicelink.trace.enums.Mod;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.DiagLevel}
*/
public class DiagLevelTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.trace.DiagLevel#setAllLevels(DetailLevel)}
- * {@link com.smartdevicelink.trace.DiagLevel#setLevel(Mod, DetailLevel)}
- * {@link com.smartdevicelink.trace.DiagLevel#getLevel(Mod)}
- * {@link com.smartdevicelink.trace.DiagLevel#isValidDetailLevel(String)}
- * {@link com.smartdevicelink.trace.DiagLevel#toDetailLevel(String)}
- */
- public void testLevels () {
-
- // Test Values
- Mod testMar = Mod.mar;
- Mod testRpc = Mod.rpc;
- Mod testApp = Mod.app;
- Mod testTran = Mod.tran;
- Mod testProxy = Mod.proxy;
- Mod testProto = Mod.proto;
-
- String testOffS = "off";
- String testTerseS = "terse";
- String testVerboseS = "verbose";
- String testInvalidS = "invalid";
-
- DetailLevel testOff = DetailLevel.OFF;
- DetailLevel testTerse = DetailLevel.TERSE;
- DetailLevel testVerbose = DetailLevel.VERBOSE;
-
- // Valid Tests
- DiagLevel.setAllLevels(testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
-
- DiagLevel.setAllLevels(testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
-
- DiagLevel.setAllLevels(testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
-
-
- DiagLevel.setLevel(testMar, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
- DiagLevel.setLevel(testMar, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
- DiagLevel.setLevel(testMar, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
-
- DiagLevel.setLevel(testRpc, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
- DiagLevel.setLevel(testRpc, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
- DiagLevel.setLevel(testRpc, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
-
- DiagLevel.setLevel(testApp, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
- DiagLevel.setLevel(testApp, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
- DiagLevel.setLevel(testApp, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
-
- DiagLevel.setLevel(testTran, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
- DiagLevel.setLevel(testTran, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
- DiagLevel.setLevel(testTran, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
-
- DiagLevel.setLevel(testProxy, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
- DiagLevel.setLevel(testProxy, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
- DiagLevel.setLevel(testProxy, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
-
- DiagLevel.setLevel(testProto, testVerbose);
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
- DiagLevel.setLevel(testProto, testTerse);
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
- DiagLevel.setLevel(testProto, testOff);
- assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
-
- assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testVerboseS));
- assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testTerseS));
- assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testOffS));
-
- assertEquals(TestValues.MATCH, testVerbose, DiagLevel.toDetailLevel(testVerboseS));
- assertEquals(TestValues.MATCH, testTerse, DiagLevel.toDetailLevel(testTerseS));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testOffS));
- assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testInvalidS));
-
- try {
- // Invalid/Null Tests
- assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(testInvalidS));
- assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(null));
- assertNull(TestValues.NULL, DiagLevel.getLevel(null));
- DiagLevel.setLevel(null, null);
- DiagLevel.setAllLevels(null);
- } catch (NullPointerException e) {
- fail("NullPointerException was thrown when attempting to set null values.");
- }
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.trace.DiagLevel#setAllLevels(DetailLevel)}
+ * {@link com.smartdevicelink.trace.DiagLevel#setLevel(Mod, DetailLevel)}
+ * {@link com.smartdevicelink.trace.DiagLevel#getLevel(Mod)}
+ * {@link com.smartdevicelink.trace.DiagLevel#isValidDetailLevel(String)}
+ * {@link com.smartdevicelink.trace.DiagLevel#toDetailLevel(String)}
+ */
+ public void testLevels() {
+
+ // Test Values
+ Mod testMar = Mod.mar;
+ Mod testRpc = Mod.rpc;
+ Mod testApp = Mod.app;
+ Mod testTran = Mod.tran;
+ Mod testProxy = Mod.proxy;
+ Mod testProto = Mod.proto;
+
+ String testOffS = "off";
+ String testTerseS = "terse";
+ String testVerboseS = "verbose";
+ String testInvalidS = "invalid";
+
+ DetailLevel testOff = DetailLevel.OFF;
+ DetailLevel testTerse = DetailLevel.TERSE;
+ DetailLevel testVerbose = DetailLevel.VERBOSE;
+
+ // Valid Tests
+ DiagLevel.setAllLevels(testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
+
+ DiagLevel.setAllLevels(testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
+
+ DiagLevel.setAllLevels(testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
+
+
+ DiagLevel.setLevel(testMar, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testMar));
+ DiagLevel.setLevel(testMar, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testMar));
+ DiagLevel.setLevel(testMar, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testMar));
+
+ DiagLevel.setLevel(testRpc, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testRpc));
+ DiagLevel.setLevel(testRpc, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testRpc));
+ DiagLevel.setLevel(testRpc, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testRpc));
+
+ DiagLevel.setLevel(testApp, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testApp));
+ DiagLevel.setLevel(testApp, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testApp));
+ DiagLevel.setLevel(testApp, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testApp));
+
+ DiagLevel.setLevel(testTran, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testTran));
+ DiagLevel.setLevel(testTran, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testTran));
+ DiagLevel.setLevel(testTran, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testTran));
+
+ DiagLevel.setLevel(testProxy, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProxy));
+ DiagLevel.setLevel(testProxy, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProxy));
+ DiagLevel.setLevel(testProxy, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProxy));
+
+ DiagLevel.setLevel(testProto, testVerbose);
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.getLevel(testProto));
+ DiagLevel.setLevel(testProto, testTerse);
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.getLevel(testProto));
+ DiagLevel.setLevel(testProto, testOff);
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.getLevel(testProto));
+
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testVerboseS));
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testTerseS));
+ assertTrue(TestValues.TRUE, DiagLevel.isValidDetailLevel(testOffS));
+
+ assertEquals(TestValues.MATCH, testVerbose, DiagLevel.toDetailLevel(testVerboseS));
+ assertEquals(TestValues.MATCH, testTerse, DiagLevel.toDetailLevel(testTerseS));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testOffS));
+ assertEquals(TestValues.MATCH, testOff, DiagLevel.toDetailLevel(testInvalidS));
+
+ try {
+ // Invalid/Null Tests
+ assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(testInvalidS));
+ assertFalse(TestValues.FALSE, DiagLevel.isValidDetailLevel(null));
+ assertNull(TestValues.NULL, DiagLevel.getLevel(null));
+ DiagLevel.setLevel(null, null);
+ DiagLevel.setAllLevels(null);
+ } catch (NullPointerException e) {
+ fail("NullPointerException was thrown when attempting to set null values.");
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
index c28d4af87..2e4f59f01 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/MimeTests.java
@@ -8,47 +8,47 @@ import junit.framework.TestCase;
import java.io.UnsupportedEncodingException;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.Mime}
*/
public class MimeTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.trace.Mime#base64Encode(byte[])}
- * {@link com.smartdevicelink.trace.Mime#base64Encode(String)}
- * {@link com.smartdevicelink.trace.Mime#base64Encode(byte[], int, int)}
- */
- public void testEncoding () {
-
- try {
- // Test Values
- String testString = "test";
- byte[] testBytes = testString.getBytes("US-ASCII");
-
- // Comparison Values
- String expectedEncodedString = "dGVzdA==";
- String actualNullResult1 = Mime.base64Encode((byte[]) null);
- String actualNullResult2 = Mime.base64Encode((String) null);
- String actualNullResult3 = Mime.base64Encode(null, 0, 0);
- String actualInvalidResult = Mime.base64Encode(testBytes, 35, 2);
- String actualEncodedString1 = Mime.base64Encode(testString);
- String actualEncodedString2 = Mime.base64Encode(testBytes);
- String actualEncodedString3 = Mime.base64Encode(testBytes, 0, testBytes.length);
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString1);
- assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString2);
- assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString3);
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualNullResult1);
- assertNull(TestValues.NULL, actualNullResult2);
- assertNull(TestValues.NULL, actualNullResult3);
- assertNull(TestValues.NULL, actualInvalidResult);
-
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.trace.Mime#base64Encode(byte[])}
+ * {@link com.smartdevicelink.trace.Mime#base64Encode(String)}
+ * {@link com.smartdevicelink.trace.Mime#base64Encode(byte[], int, int)}
+ */
+ public void testEncoding() {
+
+ try {
+ // Test Values
+ String testString = "test";
+ byte[] testBytes = testString.getBytes("US-ASCII");
+
+ // Comparison Values
+ String expectedEncodedString = "dGVzdA==";
+ String actualNullResult1 = Mime.base64Encode((byte[]) null);
+ String actualNullResult2 = Mime.base64Encode((String) null);
+ String actualNullResult3 = Mime.base64Encode(null, 0, 0);
+ String actualInvalidResult = Mime.base64Encode(testBytes, 35, 2);
+ String actualEncodedString1 = Mime.base64Encode(testString);
+ String actualEncodedString2 = Mime.base64Encode(testBytes);
+ String actualEncodedString3 = Mime.base64Encode(testBytes, 0, testBytes.length);
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString1);
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString2);
+ assertEquals(TestValues.MATCH, expectedEncodedString, actualEncodedString3);
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualNullResult1);
+ assertNull(TestValues.NULL, actualNullResult2);
+ assertNull(TestValues.NULL, actualNullResult3);
+ assertNull(TestValues.NULL, actualInvalidResult);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
index 1a770f609..566aa7dfb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/SdlTraceTests.java
@@ -9,116 +9,116 @@ import com.smartdevicelink.trace.enums.Mod;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.SdlTrace}
*/
public class SdlTraceTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.trace.SdlTrace#setAcceptAPITraceAdjustments(Boolean)}
- * {@link com.smartdevicelink.trace.SdlTrace#getAcceptAPITraceAdjustments()}
- */
- public void testAdjustmentFlags () {
-
- SdlTrace.setAcceptAPITraceAdjustments(true);
- assertTrue(TestValues.TRUE, SdlTrace.getAcceptAPITraceAdjustments());
-
- SdlTrace.setAcceptAPITraceAdjustments(false);
- assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
-
- // This should not change the value from the previous setting.
- SdlTrace.setAcceptAPITraceAdjustments(null);
- assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
- }
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.trace.SdlTrace#setAppTraceLevel(DetailLevel)}
- * {@link com.smartdevicelink.trace.SdlTrace#setProxyTraceLevel(DetailLevel)}
- * {@link com.smartdevicelink.trace.SdlTrace#setRpcTraceLevel(DetailLevel)}
- * {@link com.smartdevicelink.trace.SdlTrace#setMarshallingTraceLevel(DetailLevel)}
- * {@link com.smartdevicelink.trace.SdlTrace#setProtocolTraceLevel(DetailLevel)}
- * {@link com.smartdevicelink.trace.SdlTrace#setTransportTraceLevel(DetailLevel)}
- */
- public void testTraceLevelFlags () {
-
- SdlTrace.setAcceptAPITraceAdjustments(true);
-
- // App Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setAppTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.app));
- SdlTrace.setAppTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.app));
- SdlTrace.setAppTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
-
- // This should not change the value from the previous setting.
- SdlTrace.setAppTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
-
- // Proxy Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setProxyTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proxy));
- SdlTrace.setProxyTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proxy));
- SdlTrace.setProxyTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
-
- // This should not change the value from the previous setting.
- SdlTrace.setProxyTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
-
- // Rpc Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setRpcTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.rpc));
- SdlTrace.setRpcTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.rpc));
- SdlTrace.setRpcTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
-
- // This should not change the value from the previous setting.
- SdlTrace.setRpcTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
-
- // Marshalling Trace Level - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setMarshallingTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.mar));
- SdlTrace.setMarshallingTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.mar));
- SdlTrace.setMarshallingTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
-
- // This should not change the value from the previous setting.
- SdlTrace.setMarshallingTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
-
- // Protocol Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setProtocolTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proto));
- SdlTrace.setProtocolTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proto));
- SdlTrace.setProtocolTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
-
- // This should not change the value from the previous setting.
- SdlTrace.setProtocolTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
-
- // Transport Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
- SdlTrace.setTransportTraceLevel(DetailLevel.VERBOSE);
- assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.tran));
- SdlTrace.setTransportTraceLevel(DetailLevel.TERSE);
- assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.tran));
- SdlTrace.setTransportTraceLevel(DetailLevel.OFF);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
-
- // This should not change the value from the previous setting.
- SdlTrace.setTransportTraceLevel(null);
- assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
- }
-
- // NOTE : No testing can currently be done for the logging methods.
-
- // NOTE : Cannot test for Bluetooth connected information currently.
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.trace.SdlTrace#setAcceptAPITraceAdjustments(Boolean)}
+ * {@link com.smartdevicelink.trace.SdlTrace#getAcceptAPITraceAdjustments()}
+ */
+ public void testAdjustmentFlags() {
+
+ SdlTrace.setAcceptAPITraceAdjustments(true);
+ assertTrue(TestValues.TRUE, SdlTrace.getAcceptAPITraceAdjustments());
+
+ SdlTrace.setAcceptAPITraceAdjustments(false);
+ assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setAcceptAPITraceAdjustments(null);
+ assertFalse(TestValues.FALSE, SdlTrace.getAcceptAPITraceAdjustments());
+ }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.trace.SdlTrace#setAppTraceLevel(DetailLevel)}
+ * {@link com.smartdevicelink.trace.SdlTrace#setProxyTraceLevel(DetailLevel)}
+ * {@link com.smartdevicelink.trace.SdlTrace#setRpcTraceLevel(DetailLevel)}
+ * {@link com.smartdevicelink.trace.SdlTrace#setMarshallingTraceLevel(DetailLevel)}
+ * {@link com.smartdevicelink.trace.SdlTrace#setProtocolTraceLevel(DetailLevel)}
+ * {@link com.smartdevicelink.trace.SdlTrace#setTransportTraceLevel(DetailLevel)}
+ */
+ public void testTraceLevelFlags() {
+
+ SdlTrace.setAcceptAPITraceAdjustments(true);
+
+ // App Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setAppTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.app));
+ SdlTrace.setAppTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.app));
+ SdlTrace.setAppTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setAppTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.app));
+
+ // Proxy Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setProxyTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proxy));
+ SdlTrace.setProxyTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proxy));
+ SdlTrace.setProxyTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setProxyTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proxy));
+
+ // Rpc Trace Level - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setRpcTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.rpc));
+ SdlTrace.setRpcTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.rpc));
+ SdlTrace.setRpcTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setRpcTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.rpc));
+
+ // Marshalling Trace Level - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setMarshallingTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.mar));
+ SdlTrace.setMarshallingTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.mar));
+ SdlTrace.setMarshallingTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setMarshallingTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.mar));
+
+ // Protocol Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setProtocolTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.proto));
+ SdlTrace.setProtocolTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.proto));
+ SdlTrace.setProtocolTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setProtocolTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.proto));
+
+ // Transport Trace Level - - - - - - - - - - - - - - - - - - - - - - - -
+ SdlTrace.setTransportTraceLevel(DetailLevel.VERBOSE);
+ assertEquals(TestValues.MATCH, DetailLevel.VERBOSE, DiagLevel.getLevel(Mod.tran));
+ SdlTrace.setTransportTraceLevel(DetailLevel.TERSE);
+ assertEquals(TestValues.MATCH, DetailLevel.TERSE, DiagLevel.getLevel(Mod.tran));
+ SdlTrace.setTransportTraceLevel(DetailLevel.OFF);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
+
+ // This should not change the value from the previous setting.
+ SdlTrace.setTransportTraceLevel(null);
+ assertEquals(TestValues.MATCH, DetailLevel.OFF, DiagLevel.getLevel(Mod.tran));
+ }
+
+ // NOTE : No testing can currently be done for the logging methods.
+
+ // NOTE : Cannot test for Bluetooth connected information currently.
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
index 07cd3e56e..8cb5eee63 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/DetailLevelTests.java
@@ -10,54 +10,54 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.enums.DetailLevel}
*/
public class DetailLevelTests extends TestCase {
-
- /**
- * This is a unit test for the following enum :
- * {@link com.smartdevicelink.trace.enums.DetailLevel}
- */
- public void testDetailLevelEnum () {
-
- // Test Values
- String testOff = "OFF";
- String testTerse = "TERSE";
- String testInvalid = "INVALID";
- String testVerbose = "VERBOSE";
-
- try {
- // Comparison Values
- DetailLevel expectedOffEnum = DetailLevel.OFF;
- DetailLevel expectedTerseEnum = DetailLevel.TERSE;
- DetailLevel expectedVerboseEnum = DetailLevel.VERBOSE;
- List<DetailLevel> expectedEnumList = new ArrayList<DetailLevel>();
- expectedEnumList.add(DetailLevel.OFF);
- expectedEnumList.add(DetailLevel.TERSE);
- expectedEnumList.add(DetailLevel.VERBOSE);
-
- DetailLevel actualNullEnum = DetailLevel.valueForString(null);
- DetailLevel actualOffEnum = DetailLevel.valueForString(testOff);
- DetailLevel actualTerseEnum = DetailLevel.valueForString(testTerse);
- DetailLevel actualInvalidEnum = DetailLevel.valueForString(testInvalid);
- DetailLevel actualVerboseEnum = DetailLevel.valueForString(testVerbose);
- List<DetailLevel> actualEnumList = Arrays.asList(DetailLevel.values());
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedOffEnum, actualOffEnum);
- assertEquals(TestValues.MATCH, expectedTerseEnum, actualTerseEnum);
- assertEquals(TestValues.MATCH, expectedVerboseEnum, actualVerboseEnum);
- assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualInvalidEnum);
- assertNull(TestValues.NULL, actualNullEnum);
-
- }catch (NullPointerException e) {
- fail("Could not retrieve value for null string, should return null.");
- } catch (IllegalArgumentException e) {
- fail("Could not retrieve value for invalid string, should return null.");
- }
- }
+
+ /**
+ * This is a unit test for the following enum :
+ * {@link com.smartdevicelink.trace.enums.DetailLevel}
+ */
+ public void testDetailLevelEnum() {
+
+ // Test Values
+ String testOff = "OFF";
+ String testTerse = "TERSE";
+ String testInvalid = "INVALID";
+ String testVerbose = "VERBOSE";
+
+ try {
+ // Comparison Values
+ DetailLevel expectedOffEnum = DetailLevel.OFF;
+ DetailLevel expectedTerseEnum = DetailLevel.TERSE;
+ DetailLevel expectedVerboseEnum = DetailLevel.VERBOSE;
+ List<DetailLevel> expectedEnumList = new ArrayList<DetailLevel>();
+ expectedEnumList.add(DetailLevel.OFF);
+ expectedEnumList.add(DetailLevel.TERSE);
+ expectedEnumList.add(DetailLevel.VERBOSE);
+
+ DetailLevel actualNullEnum = DetailLevel.valueForString(null);
+ DetailLevel actualOffEnum = DetailLevel.valueForString(testOff);
+ DetailLevel actualTerseEnum = DetailLevel.valueForString(testTerse);
+ DetailLevel actualInvalidEnum = DetailLevel.valueForString(testInvalid);
+ DetailLevel actualVerboseEnum = DetailLevel.valueForString(testVerbose);
+ List<DetailLevel> actualEnumList = Arrays.asList(DetailLevel.values());
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedOffEnum, actualOffEnum);
+ assertEquals(TestValues.MATCH, expectedTerseEnum, actualTerseEnum);
+ assertEquals(TestValues.MATCH, expectedVerboseEnum, actualVerboseEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
+
+ } catch (NullPointerException e) {
+ fail("Could not retrieve value for null string, should return null.");
+ } catch (IllegalArgumentException e) {
+ fail("Could not retrieve value for invalid string, should return null.");
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
index 32aae24b1..2d687ed33 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/InterfaceActivityDirectionTests.java
@@ -10,54 +10,54 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.enums.InterfaceActivityDirection}
*/
public class InterfaceActivityDirectionTests extends TestCase {
-
- /**
- * This is a unit test for the following enum :
- * {@link com.smartdevicelink.trace.enums.InterfaceActivityDirection}
- */
- public void testInterfaceActivityDirectionEnum () {
-
- // Test Values
- String testNone = "None";
- String testInvalid = "Invalid";
- String testReceive = "Receive";
- String testTransmit = "Transmit";
-
- try {
- // Comparison Values
- InterfaceActivityDirection expectedNoneEnum = InterfaceActivityDirection.None;
- InterfaceActivityDirection expectedReceiveEnum = InterfaceActivityDirection.Receive;
- InterfaceActivityDirection expectedTransmitEnum = InterfaceActivityDirection.Transmit;
- List<InterfaceActivityDirection> expectedEnumList = new ArrayList<InterfaceActivityDirection>();
- expectedEnumList.add(InterfaceActivityDirection.None);
- expectedEnumList.add(InterfaceActivityDirection.Receive);
- expectedEnumList.add(InterfaceActivityDirection.Transmit);
-
- InterfaceActivityDirection actualNullEnum = InterfaceActivityDirection.valueForString(null);
- InterfaceActivityDirection actualNoneEnum = InterfaceActivityDirection.valueForString(testNone);
- InterfaceActivityDirection actualInvalidEnum = InterfaceActivityDirection.valueForString(testInvalid);
- InterfaceActivityDirection actualReceiveEnum = InterfaceActivityDirection.valueForString(testReceive);
- InterfaceActivityDirection actualTransmitEnum = InterfaceActivityDirection.valueForString(testTransmit);
- List<InterfaceActivityDirection> actualEnumList = Arrays.asList(InterfaceActivityDirection.values());
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedNoneEnum, actualNoneEnum);
- assertEquals(TestValues.MATCH, expectedReceiveEnum, actualReceiveEnum);
- assertEquals(TestValues.MATCH, expectedTransmitEnum, actualTransmitEnum);
- assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
-
- // Invalid/Null
- assertNull(TestValues.NULL, actualInvalidEnum);
- assertNull(TestValues.NULL, actualNullEnum);
-
- } catch (NullPointerException e) {
- fail("Could not retrieve value for null string, should return null.");
- } catch (IllegalArgumentException e) {
- fail("Could not retrieve value for invalid string, should return null.");
- }
- }
+
+ /**
+ * This is a unit test for the following enum :
+ * {@link com.smartdevicelink.trace.enums.InterfaceActivityDirection}
+ */
+ public void testInterfaceActivityDirectionEnum() {
+
+ // Test Values
+ String testNone = "None";
+ String testInvalid = "Invalid";
+ String testReceive = "Receive";
+ String testTransmit = "Transmit";
+
+ try {
+ // Comparison Values
+ InterfaceActivityDirection expectedNoneEnum = InterfaceActivityDirection.None;
+ InterfaceActivityDirection expectedReceiveEnum = InterfaceActivityDirection.Receive;
+ InterfaceActivityDirection expectedTransmitEnum = InterfaceActivityDirection.Transmit;
+ List<InterfaceActivityDirection> expectedEnumList = new ArrayList<InterfaceActivityDirection>();
+ expectedEnumList.add(InterfaceActivityDirection.None);
+ expectedEnumList.add(InterfaceActivityDirection.Receive);
+ expectedEnumList.add(InterfaceActivityDirection.Transmit);
+
+ InterfaceActivityDirection actualNullEnum = InterfaceActivityDirection.valueForString(null);
+ InterfaceActivityDirection actualNoneEnum = InterfaceActivityDirection.valueForString(testNone);
+ InterfaceActivityDirection actualInvalidEnum = InterfaceActivityDirection.valueForString(testInvalid);
+ InterfaceActivityDirection actualReceiveEnum = InterfaceActivityDirection.valueForString(testReceive);
+ InterfaceActivityDirection actualTransmitEnum = InterfaceActivityDirection.valueForString(testTransmit);
+ List<InterfaceActivityDirection> actualEnumList = Arrays.asList(InterfaceActivityDirection.values());
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedNoneEnum, actualNoneEnum);
+ assertEquals(TestValues.MATCH, expectedReceiveEnum, actualReceiveEnum);
+ assertEquals(TestValues.MATCH, expectedTransmitEnum, actualTransmitEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+
+ // Invalid/Null
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
+
+ } catch (NullPointerException e) {
+ fail("Could not retrieve value for null string, should return null.");
+ } catch (IllegalArgumentException e) {
+ fail("Could not retrieve value for invalid string, should return null.");
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
index c2621d789..7503f9dc2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/trace/enums/ModTests.java
@@ -10,70 +10,70 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.trace.enums.Mod}
*/
public class ModTests extends TestCase {
-
- /**
- * This is a unit test for the following enum :
- * {@link com.smartdevicelink.trace.enums.Mod}
- */
- public void testModEnum () {
-
- // TestValues
- String testApp = "app";
- String testRpc = "rpc";
- String testMar = "mar";
- String testTran = "tran";
- String testProto = "proto";
- String testProxy = "proxy";
- String testInvalid = "invalid";
-
- try {
- // Comparison Values
- Mod expectedAppEnum = Mod.app;
- Mod expectedRpcEnum = Mod.rpc;
- Mod expectedMarEnum = Mod.mar;
- Mod expectedTranEnum = Mod.tran;
- Mod expectedProtoEnum = Mod.proto;
- Mod expectedProxyEnum = Mod.proxy;
- List<Mod> expectedEnumList = new ArrayList<Mod>();
- expectedEnumList.add(Mod.app);
- expectedEnumList.add(Mod.rpc);
- expectedEnumList.add(Mod.mar);
- expectedEnumList.add(Mod.tran);
- expectedEnumList.add(Mod.proto);
- expectedEnumList.add(Mod.proxy);
-
- Mod actualNullEnum = Mod.valueForString(null);
- Mod actualAppEnum = Mod.valueForString(testApp);
- Mod actualRpcEnum = Mod.valueForString(testRpc);
- Mod actualMarEnum = Mod.valueForString(testMar);
- Mod actualTranEnum = Mod.valueForString(testTran);
- Mod actualProtoEnum = Mod.valueForString(testProto);
- Mod actualProxyEnum = Mod.valueForString(testProxy);
- Mod actualInvalidEnum = Mod.valueForString(testInvalid);
- List<Mod> actualEnumList = Arrays.asList(Mod.values());
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedAppEnum, actualAppEnum);
- assertEquals(TestValues.MATCH, expectedRpcEnum, actualRpcEnum);
- assertEquals(TestValues.MATCH, expectedMarEnum, actualMarEnum);
- assertEquals(TestValues.MATCH, expectedTranEnum, actualTranEnum);
- assertEquals(TestValues.MATCH, expectedProtoEnum, actualProtoEnum);
- assertEquals(TestValues.MATCH, expectedProxyEnum, actualProxyEnum);
- assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualInvalidEnum);
- assertNull(TestValues.NULL, actualNullEnum);
-
- } catch (NullPointerException e) {
- fail("Could not retrieve value for null string, should return null.");
- } catch (IllegalArgumentException e) {
- fail("Could not retrieve value for invalid string, should return null.");
- }
-
- }
+
+ /**
+ * This is a unit test for the following enum :
+ * {@link com.smartdevicelink.trace.enums.Mod}
+ */
+ public void testModEnum() {
+
+ // TestValues
+ String testApp = "app";
+ String testRpc = "rpc";
+ String testMar = "mar";
+ String testTran = "tran";
+ String testProto = "proto";
+ String testProxy = "proxy";
+ String testInvalid = "invalid";
+
+ try {
+ // Comparison Values
+ Mod expectedAppEnum = Mod.app;
+ Mod expectedRpcEnum = Mod.rpc;
+ Mod expectedMarEnum = Mod.mar;
+ Mod expectedTranEnum = Mod.tran;
+ Mod expectedProtoEnum = Mod.proto;
+ Mod expectedProxyEnum = Mod.proxy;
+ List<Mod> expectedEnumList = new ArrayList<Mod>();
+ expectedEnumList.add(Mod.app);
+ expectedEnumList.add(Mod.rpc);
+ expectedEnumList.add(Mod.mar);
+ expectedEnumList.add(Mod.tran);
+ expectedEnumList.add(Mod.proto);
+ expectedEnumList.add(Mod.proxy);
+
+ Mod actualNullEnum = Mod.valueForString(null);
+ Mod actualAppEnum = Mod.valueForString(testApp);
+ Mod actualRpcEnum = Mod.valueForString(testRpc);
+ Mod actualMarEnum = Mod.valueForString(testMar);
+ Mod actualTranEnum = Mod.valueForString(testTran);
+ Mod actualProtoEnum = Mod.valueForString(testProto);
+ Mod actualProxyEnum = Mod.valueForString(testProxy);
+ Mod actualInvalidEnum = Mod.valueForString(testInvalid);
+ List<Mod> actualEnumList = Arrays.asList(Mod.values());
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedAppEnum, actualAppEnum);
+ assertEquals(TestValues.MATCH, expectedRpcEnum, actualRpcEnum);
+ assertEquals(TestValues.MATCH, expectedMarEnum, actualMarEnum);
+ assertEquals(TestValues.MATCH, expectedTranEnum, actualTranEnum);
+ assertEquals(TestValues.MATCH, expectedProtoEnum, actualProtoEnum);
+ assertEquals(TestValues.MATCH, expectedProxyEnum, actualProxyEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
+
+ } catch (NullPointerException e) {
+ fail("Could not retrieve value for null string, should return null.");
+ } catch (IllegalArgumentException e) {
+ fail("Could not retrieve value for invalid string, should return null.");
+ }
+
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
index 8fcde0456..fcb77c3cf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BaseTransportConfigTests.java
@@ -7,41 +7,46 @@ import com.smartdevicelink.transport.enums.TransportType;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.transport.BaseTransportConfig}
*/
public class BaseTransportConfigTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.transport.BaseTransportConfig#getTransportType()}
- * {@link com.smartdevicelink.transport.BaseTransportConfig#getHeartBeatTimeout()}
- * {@link com.smartdevicelink.transport.BaseTransportConfig#setHeartBeatTimeout(int)}
- */
- public void testConfigs () {
-
- // Test Values
- int testInt = 10;
- MockBaseTransportConfig testBaseTransportConfig = new MockBaseTransportConfig();
-
- // Comparison Values
- int expectedMaxValue = Integer.MAX_VALUE;
- int actualMaxValue = testBaseTransportConfig.getHeartBeatTimeout();
-
- // Valid Tests
- assertNotNull(TestValues.NOT_NULL, testBaseTransportConfig);
- assertEquals(TestValues.MATCH, expectedMaxValue, actualMaxValue);
-
- testBaseTransportConfig.setHeartBeatTimeout(testInt);
- assertEquals(TestValues.MATCH, testInt, testBaseTransportConfig.getHeartBeatTimeout());
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#getTransportType()}
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#getHeartBeatTimeout()}
+ * {@link com.smartdevicelink.transport.BaseTransportConfig#setHeartBeatTimeout(int)}
+ */
+ public void testConfigs() {
+
+ // Test Values
+ int testInt = 10;
+ MockBaseTransportConfig testBaseTransportConfig = new MockBaseTransportConfig();
+
+ // Comparison Values
+ int expectedMaxValue = Integer.MAX_VALUE;
+ int actualMaxValue = testBaseTransportConfig.getHeartBeatTimeout();
+
+ // Valid Tests
+ assertNotNull(TestValues.NOT_NULL, testBaseTransportConfig);
+ assertEquals(TestValues.MATCH, expectedMaxValue, actualMaxValue);
+
+ testBaseTransportConfig.setHeartBeatTimeout(testInt);
+ assertEquals(TestValues.MATCH, testInt, testBaseTransportConfig.getHeartBeatTimeout());
+ }
}
/**
- * This is a mock class for testing the following :
+ * This is a mock class for testing the following :
* {@link com.smartdevicelink.transport.BaseTransportConfig}
*/
-class MockBaseTransportConfig extends BaseTransportConfig {
- public MockBaseTransportConfig () { }
- @Override public TransportType getTransportType() { return null; }
+class MockBaseTransportConfig extends BaseTransportConfig {
+ public MockBaseTransportConfig() {
+ }
+
+ @Override
+ public TransportType getTransportType() {
+ return null;
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexBluetoothTransportTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexBluetoothTransportTest.java
index 51916ea16..5d9f75268 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexBluetoothTransportTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexBluetoothTransportTest.java
@@ -12,68 +12,69 @@ import junit.framework.TestCase;
public class MultiplexBluetoothTransportTest extends TestCase {
-
- private static final Object REQUEST_LOCK = new Object();
-
- MultiplexBluetoothTransport bluetooth;
- boolean didCorrectThing = false, isWaitingForResponse = false;
-
- //Example handler
- Handler stateChangeHandler;
-
- public void testStateTransitions() {
- if(Looper.myLooper() == null){
- Looper.prepare();
- }
-
- stateChangeHandler = new Handler(){
- int stateDesired = MultiplexBluetoothTransport.STATE_LISTEN;
- @Override
- public void handleMessage(Message msg) {
- if(!isWaitingForResponse){
- return;
- }
- switch(msg.what){
- case SdlRouterService.MESSAGE_STATE_CHANGE:
- if(msg.arg1 == stateDesired){
- didCorrectThing = true;
- break;
- }
- default:
- didCorrectThing = false;
- }
- REQUEST_LOCK.notify();
- }
-
- };
-
- bluetooth = new MultiplexBluetoothTransport(stateChangeHandler);
- assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
-
- bluetooth.start();
- if(DeviceUtil.isEmulator()){
- assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
- }else{
- assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_LISTEN);
- }
-
- bluetooth.stop();
- assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
- }
-
- private void notifyResponseReceived(){
- REQUEST_LOCK.notify();
- }
-
- private void waitForResponse(){
- synchronized(REQUEST_LOCK){
- try {
- REQUEST_LOCK.wait();
- assertTrue(didCorrectThing);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
+
+ private static final Object REQUEST_LOCK = new Object();
+
+ MultiplexBluetoothTransport bluetooth;
+ boolean didCorrectThing = false, isWaitingForResponse = false;
+
+ //Example handler
+ Handler stateChangeHandler;
+
+ public void testStateTransitions() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+
+ stateChangeHandler = new Handler() {
+ int stateDesired = MultiplexBluetoothTransport.STATE_LISTEN;
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (!isWaitingForResponse) {
+ return;
+ }
+ switch (msg.what) {
+ case SdlRouterService.MESSAGE_STATE_CHANGE:
+ if (msg.arg1 == stateDesired) {
+ didCorrectThing = true;
+ break;
+ }
+ default:
+ didCorrectThing = false;
+ }
+ REQUEST_LOCK.notify();
+ }
+
+ };
+
+ bluetooth = new MultiplexBluetoothTransport(stateChangeHandler);
+ assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
+
+ bluetooth.start();
+ if (DeviceUtil.isEmulator()) {
+ assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
+ } else {
+ assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_LISTEN);
+ }
+
+ bluetooth.stop();
+ assertEquals(bluetooth.getState(), MultiplexBluetoothTransport.STATE_NONE);
+ }
+
+ private void notifyResponseReceived() {
+ REQUEST_LOCK.notify();
+ }
+
+ private void waitForResponse() {
+ synchronized (REQUEST_LOCK) {
+ try {
+ REQUEST_LOCK.wait();
+ assertTrue(didCorrectThing);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
index 53fe30114..c2f0a048d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/MultiplexTransportConfigTests.java
@@ -13,20 +13,20 @@ import static junit.framework.TestCase.assertEquals;
@RunWith(AndroidJUnit4.class)
public class MultiplexTransportConfigTests {
- @Test
- public void testDefaultSecurity(){
- MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341");
- assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
- }
-
- @Test
- public void testSettingSecurity(){
- MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341", MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
-
- config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341");
- config.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- }
-
+ @Test
+ public void testDefaultSecurity() {
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341");
+ assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
+ }
+
+ @Test
+ public void testSettingSecurity() {
+ MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341", MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+
+ config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), "2341");
+ config.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ assertEquals(config.getSecurityLevel(), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ }
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
index 48b0eebb2..64b0cb768 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/SdlPsmTests.java
@@ -13,82 +13,82 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.transport.SdlPsm}
*/
public class SdlPsmTests extends TestCase {
- private static final String TAG = "SdlPsmTests";
- private static final int MAX_DATA_LENGTH = SdlProtocol.V1_V2_MTU_SIZE - SdlProtocol.V1_HEADER_SIZE;
- SdlPsm sdlPsm;
- Field frameType, dataLength, version, controlFrameInfo;
- Method transitionOnInput;
- byte rawByte = (byte) 0x0;
-
- protected void setUp() throws Exception{
- super.setUp();
- sdlPsm = new SdlPsm();
- transitionOnInput = SdlPsm.class.getDeclaredMethod("transitionOnInput", byte.class, int.class);
- transitionOnInput.setAccessible(true);
-
- frameType = SdlPsm.class.getDeclaredField("frameType");
- dataLength = SdlPsm.class.getDeclaredField("dataLength");
- version = SdlPsm.class.getDeclaredField("version");
- controlFrameInfo = SdlPsm.class.getDeclaredField("controlFrameInfo");
- frameType.setAccessible(true);
- dataLength.setAccessible(true);
- version.setAccessible(true);
- controlFrameInfo.setAccessible(true);
- }
-
-
- public void testGarbledControlFrame() {
- try{
- rawByte = 0x0;
- version.set(sdlPsm, 1);
- controlFrameInfo.set(sdlPsm, SdlPacket.FRAME_INFO_START_SERVICE);
- frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_CONTROL);
-
- dataLength.set(sdlPsm, MAX_DATA_LENGTH + 1);
- int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
-
- assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
- }catch (Exception e){
- Log.e(TAG, e.toString());
- }
- }
-
- public void testMaximumControlFrame(){
- try{
- rawByte = 0x0;
- version.set(sdlPsm, 1);
- controlFrameInfo.set(sdlPsm, SdlPacket.FRAME_INFO_START_SERVICE);
- frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_CONTROL);
-
- dataLength.set(sdlPsm, MAX_DATA_LENGTH);
- int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
-
- assertEquals(TestValues.MATCH, SdlPsm.DATA_PUMP_STATE, STATE);
- }catch (Exception e){
- Log.e(TAG, e.toString());
- }
- }
-
- public void testOutOfMemoryDS4(){
- try{
- rawByte = 0x0;
- version.set(sdlPsm, 1);
- frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_SINGLE);
-
- dataLength.set(sdlPsm, 2147483647);
- int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
-
- assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
- }catch (Exception e){
- Log.e(TAG, e.toString());
- }
- }
-
- protected void tearDown() throws Exception{
- super.tearDown();
- }
+ private static final String TAG = "SdlPsmTests";
+ private static final int MAX_DATA_LENGTH = SdlProtocol.V1_V2_MTU_SIZE - SdlProtocol.V1_HEADER_SIZE;
+ SdlPsm sdlPsm;
+ Field frameType, dataLength, version, controlFrameInfo;
+ Method transitionOnInput;
+ byte rawByte = (byte) 0x0;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ sdlPsm = new SdlPsm();
+ transitionOnInput = SdlPsm.class.getDeclaredMethod("transitionOnInput", byte.class, int.class);
+ transitionOnInput.setAccessible(true);
+
+ frameType = SdlPsm.class.getDeclaredField("frameType");
+ dataLength = SdlPsm.class.getDeclaredField("dataLength");
+ version = SdlPsm.class.getDeclaredField("version");
+ controlFrameInfo = SdlPsm.class.getDeclaredField("controlFrameInfo");
+ frameType.setAccessible(true);
+ dataLength.setAccessible(true);
+ version.setAccessible(true);
+ controlFrameInfo.setAccessible(true);
+ }
+
+
+ public void testGarbledControlFrame() {
+ try {
+ rawByte = 0x0;
+ version.set(sdlPsm, 1);
+ controlFrameInfo.set(sdlPsm, SdlPacket.FRAME_INFO_START_SERVICE);
+ frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_CONTROL);
+
+ dataLength.set(sdlPsm, MAX_DATA_LENGTH + 1);
+ int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
+
+ assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ }
+
+ public void testMaximumControlFrame() {
+ try {
+ rawByte = 0x0;
+ version.set(sdlPsm, 1);
+ controlFrameInfo.set(sdlPsm, SdlPacket.FRAME_INFO_START_SERVICE);
+ frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_CONTROL);
+
+ dataLength.set(sdlPsm, MAX_DATA_LENGTH);
+ int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
+
+ assertEquals(TestValues.MATCH, SdlPsm.DATA_PUMP_STATE, STATE);
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ }
+
+ public void testOutOfMemoryDS4() {
+ try {
+ rawByte = 0x0;
+ version.set(sdlPsm, 1);
+ frameType.set(sdlPsm, SdlPacket.FRAME_TYPE_SINGLE);
+
+ dataLength.set(sdlPsm, 2147483647);
+ int STATE = (Integer) transitionOnInput.invoke(sdlPsm, rawByte, SdlPsm.DATA_SIZE_4_STATE);
+
+ assertEquals(TestValues.MATCH, SdlPsm.ERROR_STATE, STATE);
+ } catch (Exception e) {
+ Log.e(TAG, e.toString());
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
index 5ba848245..37d841a5c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TCPTransportConfigTests.java
@@ -7,48 +7,48 @@ import com.smartdevicelink.transport.enums.TransportType;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.transport.TCPTransportConfig}
*/
public class TCPTransportConfigTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.transport.TCPTransportConfig#getPort()}
- * {@link com.smartdevicelink.transport.TCPTransportConfig#getIPAddress()}
- * {@link com.smartdevicelink.transport.TCPTransportConfig#getAutoReconnect()}
- * {@link com.smartdevicelink.transport.TCPTransportConfig#getTransportType()}
- */
- public void testConfigs () {
-
- // Test Values
- int testInt = 123;
- String testString = "test";
- boolean testBoolean = true;
- TCPTransportConfig testConfig1 = new TCPTransportConfig(testInt, testString, testBoolean);
- TCPTransportConfig testConfig2 = new TCPTransportConfig(testInt, null, testBoolean);
-
- // Comparison Values
- TransportType expectedTransportType = TransportType.TCP;
- String expectedToString1 = "TCPTransportConfig{Port=123, IpAddress='test', AutoReconnect=true}";
- String expectedToString2 = "TCPTransportConfig{Port=123, IpAddress='null', AutoReconnect=true}";
- int actualPort = testConfig1.getPort();
- String actualIpAddress = testConfig1.getIPAddress();
- String actualToString1 = testConfig1.toString();
- String actualToString2 = testConfig2.toString();
- String actualNullString = testConfig2.getIPAddress();
- boolean actualAutoReconnect = testConfig1.getAutoReconnect();
- TransportType actualTransportType = testConfig1.getTransportType();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, testInt, actualPort);
- assertEquals(TestValues.MATCH, testString, actualIpAddress);
- assertEquals(TestValues.MATCH, testBoolean, actualAutoReconnect);
- assertEquals(TestValues.MATCH, expectedTransportType, actualTransportType);
- assertEquals(TestValues.MATCH, expectedToString1, actualToString1);
- assertEquals(TestValues.MATCH, expectedToString2, actualToString2);
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualNullString);
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.transport.TCPTransportConfig#getPort()}
+ * {@link com.smartdevicelink.transport.TCPTransportConfig#getIPAddress()}
+ * {@link com.smartdevicelink.transport.TCPTransportConfig#getAutoReconnect()}
+ * {@link com.smartdevicelink.transport.TCPTransportConfig#getTransportType()}
+ */
+ public void testConfigs() {
+
+ // Test Values
+ int testInt = 123;
+ String testString = "test";
+ boolean testBoolean = true;
+ TCPTransportConfig testConfig1 = new TCPTransportConfig(testInt, testString, testBoolean);
+ TCPTransportConfig testConfig2 = new TCPTransportConfig(testInt, null, testBoolean);
+
+ // Comparison Values
+ TransportType expectedTransportType = TransportType.TCP;
+ String expectedToString1 = "TCPTransportConfig{Port=123, IpAddress='test', AutoReconnect=true}";
+ String expectedToString2 = "TCPTransportConfig{Port=123, IpAddress='null', AutoReconnect=true}";
+ int actualPort = testConfig1.getPort();
+ String actualIpAddress = testConfig1.getIPAddress();
+ String actualToString1 = testConfig1.toString();
+ String actualToString2 = testConfig2.toString();
+ String actualNullString = testConfig2.getIPAddress();
+ boolean actualAutoReconnect = testConfig1.getAutoReconnect();
+ TransportType actualTransportType = testConfig1.getTransportType();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, testInt, actualPort);
+ assertEquals(TestValues.MATCH, testString, actualIpAddress);
+ assertEquals(TestValues.MATCH, testBoolean, actualAutoReconnect);
+ assertEquals(TestValues.MATCH, expectedTransportType, actualTransportType);
+ assertEquals(TestValues.MATCH, expectedToString1, actualToString1);
+ assertEquals(TestValues.MATCH, expectedToString2, actualToString2);
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualNullString);
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
index dc54b2197..3b6a066a4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/TransportTypeTests.java
@@ -10,71 +10,71 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.transport.enums.TransportType}
*/
public class TransportTypeTests extends TestCase {
-
- /**
- * This is a unit test for the following enum :
- * {@link com.smartdevicelink.transport.enums.TransportType}
- */
- public void testTransportTypeEnum () {
-
- // Test Values
- String testTcp = "TCP";
- String testUsb = "USB";
- String testInvalid = "INVALID";
- String testBluetooth = "BLUETOOTH";
- String testMultiplexing = "MULTIPLEX";
- String testWebSocketServer = "WEB_SOCKET_SERVER";
- String testCustom = "CUSTOM";
- try {
- // Comparison Values
- TransportType expectedTcpEnum = TransportType.TCP;
- TransportType expectedUsbEnum = TransportType.USB;
- TransportType expectedBluetoothEnum = TransportType.BLUETOOTH;
- TransportType expectedMultiplexingEnum = TransportType.MULTIPLEX;
- TransportType expectedWebSocketServerEnum = TransportType.WEB_SOCKET_SERVER;
- TransportType expectedCustomEnum = TransportType.CUSTOM;
+ /**
+ * This is a unit test for the following enum :
+ * {@link com.smartdevicelink.transport.enums.TransportType}
+ */
+ public void testTransportTypeEnum() {
- List<TransportType> expectedEnumList = new ArrayList<TransportType>();
- expectedEnumList.add(TransportType.BLUETOOTH);
- expectedEnumList.add(TransportType.TCP);
- expectedEnumList.add(TransportType.USB);
- expectedEnumList.add(TransportType.MULTIPLEX);
- expectedEnumList.add(TransportType.WEB_SOCKET_SERVER);
- expectedEnumList.add(TransportType.CUSTOM);
+ // Test Values
+ String testTcp = "TCP";
+ String testUsb = "USB";
+ String testInvalid = "INVALID";
+ String testBluetooth = "BLUETOOTH";
+ String testMultiplexing = "MULTIPLEX";
+ String testWebSocketServer = "WEB_SOCKET_SERVER";
+ String testCustom = "CUSTOM";
- TransportType actualNullEnum = TransportType.valueForString(null);
- TransportType actualTcpEnum = TransportType.valueForString(testTcp);
- TransportType actualUsbEnum = TransportType.valueForString(testUsb);
- TransportType actualInvalidEnum = TransportType.valueForString(testInvalid);
- TransportType actualBluetoothEnum = TransportType.valueForString(testBluetooth);
- TransportType actualMultiplexingEnum = TransportType.valueForString(testMultiplexing);
- TransportType actualWebSocketServerEnum = TransportType.valueForString(testWebSocketServer);
- TransportType actualCustomEnum = TransportType.valueForString(testCustom);
+ try {
+ // Comparison Values
+ TransportType expectedTcpEnum = TransportType.TCP;
+ TransportType expectedUsbEnum = TransportType.USB;
+ TransportType expectedBluetoothEnum = TransportType.BLUETOOTH;
+ TransportType expectedMultiplexingEnum = TransportType.MULTIPLEX;
+ TransportType expectedWebSocketServerEnum = TransportType.WEB_SOCKET_SERVER;
+ TransportType expectedCustomEnum = TransportType.CUSTOM;
- List<TransportType> actualEnumList = Arrays.asList(TransportType.values());
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedTcpEnum, actualTcpEnum);
- assertEquals(TestValues.MATCH, expectedUsbEnum, actualUsbEnum);
- assertEquals(TestValues.MATCH, expectedBluetoothEnum, actualBluetoothEnum);
- assertEquals(TestValues.MATCH, expectedMultiplexingEnum, actualMultiplexingEnum);
- assertEquals(TestValues.MATCH, expectedWebSocketServerEnum, actualWebSocketServerEnum);
- assertEquals(TestValues.MATCH, expectedCustomEnum, actualCustomEnum);
- assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualInvalidEnum);
- assertNull(TestValues.NULL, actualNullEnum);
-
- } catch (NullPointerException e) {
- fail("Could not retrieve value for null string, should return null.");
- } catch (IllegalArgumentException e) {
- fail("Could not retrieve value for invalid string, should return null.");
- }
- }
+ List<TransportType> expectedEnumList = new ArrayList<TransportType>();
+ expectedEnumList.add(TransportType.BLUETOOTH);
+ expectedEnumList.add(TransportType.TCP);
+ expectedEnumList.add(TransportType.USB);
+ expectedEnumList.add(TransportType.MULTIPLEX);
+ expectedEnumList.add(TransportType.WEB_SOCKET_SERVER);
+ expectedEnumList.add(TransportType.CUSTOM);
+
+ TransportType actualNullEnum = TransportType.valueForString(null);
+ TransportType actualTcpEnum = TransportType.valueForString(testTcp);
+ TransportType actualUsbEnum = TransportType.valueForString(testUsb);
+ TransportType actualInvalidEnum = TransportType.valueForString(testInvalid);
+ TransportType actualBluetoothEnum = TransportType.valueForString(testBluetooth);
+ TransportType actualMultiplexingEnum = TransportType.valueForString(testMultiplexing);
+ TransportType actualWebSocketServerEnum = TransportType.valueForString(testWebSocketServer);
+ TransportType actualCustomEnum = TransportType.valueForString(testCustom);
+
+ List<TransportType> actualEnumList = Arrays.asList(TransportType.values());
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedTcpEnum, actualTcpEnum);
+ assertEquals(TestValues.MATCH, expectedUsbEnum, actualUsbEnum);
+ assertEquals(TestValues.MATCH, expectedBluetoothEnum, actualBluetoothEnum);
+ assertEquals(TestValues.MATCH, expectedMultiplexingEnum, actualMultiplexingEnum);
+ assertEquals(TestValues.MATCH, expectedWebSocketServerEnum, actualWebSocketServerEnum);
+ assertEquals(TestValues.MATCH, expectedCustomEnum, actualCustomEnum);
+ assertTrue(TestValues.ARRAY, expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
+
+ } catch (NullPointerException e) {
+ fail("Could not retrieve value for null string, should return null.");
+ } catch (IllegalArgumentException e) {
+ fail("Could not retrieve value for invalid string, should return null.");
+ }
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/WiFiSocketFactoryTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/WiFiSocketFactoryTest.java
index ab2b7b52d..8cbaa3c72 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/WiFiSocketFactoryTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/WiFiSocketFactoryTest.java
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.when;
/**
* This is a unit test class for the WiFiSocketFactory class:
* {@link com.smartdevicelink.transport.utl.WiFiSocketFactory}
- *
+ * <p>
* Requires LOLLIPOP or later since the tests use android.net.NetworkCapabilities class
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@@ -168,7 +168,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the happy path
public void testWithWiFiNetwork() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_CELLULAR, FactoryRet.RETURNS_ANOTHER_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
@@ -204,8 +204,8 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where we do not have ACCESS_NETWORK_STATE permission
public void testWithoutPermission() {
- setupMockNetworks(new MockNetworkConfig[] {
- new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
+ setupMockNetworks(new MockNetworkConfig[]{
+ new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
// simulate the case where required permission isn't available
@@ -220,7 +220,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where context.getPackageManager() returns null
public void testPackageManagerNull() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
@@ -236,7 +236,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where getSystemService() returns null
public void testConnectivityManagerNull() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
@@ -263,7 +263,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where the network list contains a null for Network instance
public void testNetworkListHasNull() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
// multiple Network instances in the list, the first one being NULL
new MockNetworkConfig(true, 0, FactoryRet.RETURNS_ANOTHER_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
@@ -277,7 +277,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where the phone isn't connected to Wi-Fi network
public void testNoWiFiNetwork() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
// none of the instances has TRANSPORT_WIFI in their capabilities
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_CELLULAR, FactoryRet.RETURNS_ANOTHER_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_BLUETOOTH, FactoryRet.RETURNS_ANOTHER_FACTORY),
@@ -293,7 +293,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where we get null for SocketFactory
public void testSocketFactoryNull() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_CELLULAR, FactoryRet.RETURNS_ANOTHER_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_NULL),
});
@@ -307,7 +307,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where we get a null for SocketFactory, then a valid one for another
public void testSocketFactoryNull2() {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_CELLULAR, FactoryRet.RETURNS_ANOTHER_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_NULL),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
@@ -321,7 +321,7 @@ public class WiFiSocketFactoryTest extends TestCase {
// test the case where we get an exception with SocketFactory.createSocket()
public void testFactoryReturnsException() throws IOException {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
@@ -338,13 +338,13 @@ public class WiFiSocketFactoryTest extends TestCase {
// the first one throws Exception and the other one succeeds.
// This is to simulate Samsung Galaxy S9.
public void testFactoryReturnsException2() throws IOException {
- setupMockNetworks(new MockNetworkConfig[] {
+ setupMockNetworks(new MockNetworkConfig[]{
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
new MockNetworkConfig(false, NetworkCapabilities.TRANSPORT_WIFI, FactoryRet.RETURNS_CORRECT_FACTORY),
});
when(mMockSocketFactory.createSocket()).thenThrow(new IOException("Dummy IOException for testing!"))
- .thenReturn(mWiFiBoundSocket);
+ .thenReturn(mWiFiBoundSocket);
Socket ret = WiFiSocketFactory.createSocket(mMockContext);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
index 4fd0ca2cb..69d82c0bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/BitConverterTests.java
@@ -8,81 +8,81 @@ import junit.framework.TestCase;
import java.util.Arrays;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.util.BitConverter}
*/
public class BitConverterTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.BitConverter#bytesToHex(byte[])}
- * {@link com.smartdevicelink.util.BitConverter#bytesToHex(byte[], int, int)}
- * {@link com.smartdevicelink.util.BitConverter#hexToBytes(String)}
- */
- public void testHexToByteConversions () {
-
- // Test Values
- byte[] testBytes = { (byte) 0x01, (byte) 0x02 };
-
- // Comparison Values
- String expectedHex = "0102";
- String actualHex1 = BitConverter.bytesToHex(testBytes);
- String actualHex2 = BitConverter.bytesToHex(testBytes, 0, testBytes.length);
- byte[] actualBytes = BitConverter.hexToBytes(expectedHex);
-
- // Valid Tests
- assertEquals("Values should match.", expectedHex, actualHex1);
- assertEquals("Values should match.", expectedHex, actualHex2);
- assertTrue("Arrays should match.", Arrays.equals(testBytes, actualBytes));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, BitConverter.bytesToHex(null));
- assertNull(TestValues.NULL, BitConverter.bytesToHex(null, 0, 0));
- assertNull(TestValues.NULL, BitConverter.hexToBytes(null));
- }
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.BitConverter#intToByteArray(int)}
- * {@link com.smartdevicelink.util.BitConverter#intFromByteArray(byte[], int)}
- */
- public void testIntToByteConversions () {
-
- // Comparison Values
- Integer expectedInt = 1234;
- byte[] expectedBytes = { (byte)(1234 >>> 24), (byte)(1234 >>> 16),
- (byte)(1234 >>> 8), (byte)(1234) };
- int actualInt = BitConverter.intFromByteArray(expectedBytes, 0);
- byte[] actualBytes = BitConverter.intToByteArray(expectedInt);
- int actualNullBytes = BitConverter.intFromByteArray(null, 0);
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedInt.intValue(), actualInt);
- assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
-
- // Invalid/Null Tests
- assertEquals(TestValues.MATCH, (int) -1, actualNullBytes);
- }
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.BitConverter#shortToByteArray(short)}
- * {@link com.smartdevicelink.util.BitConverter#shortFromByteArray(byte[], int)}
- */
- public void testShortToByteConverstions () {
-
- // Comparison Values
- short expectedShort = 1;
- byte[] expectedBytes = { ((byte) ((1 >> 8) & 0xff)), ((byte) (1 & 0xff)) };
- short actualShort = BitConverter.shortFromByteArray(expectedBytes, 0);
- byte[] actualBytes = BitConverter.shortToByteArray(expectedShort);
- short actualNullBytes = BitConverter.shortFromByteArray(null, 0);
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedShort, actualShort);
- assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
-
- // Invalid/Null Tests
- assertEquals(TestValues.MATCH, (short) -1, actualNullBytes);
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.BitConverter#bytesToHex(byte[])}
+ * {@link com.smartdevicelink.util.BitConverter#bytesToHex(byte[], int, int)}
+ * {@link com.smartdevicelink.util.BitConverter#hexToBytes(String)}
+ */
+ public void testHexToByteConversions() {
+
+ // Test Values
+ byte[] testBytes = {(byte) 0x01, (byte) 0x02};
+
+ // Comparison Values
+ String expectedHex = "0102";
+ String actualHex1 = BitConverter.bytesToHex(testBytes);
+ String actualHex2 = BitConverter.bytesToHex(testBytes, 0, testBytes.length);
+ byte[] actualBytes = BitConverter.hexToBytes(expectedHex);
+
+ // Valid Tests
+ assertEquals("Values should match.", expectedHex, actualHex1);
+ assertEquals("Values should match.", expectedHex, actualHex2);
+ assertTrue("Arrays should match.", Arrays.equals(testBytes, actualBytes));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, BitConverter.bytesToHex(null));
+ assertNull(TestValues.NULL, BitConverter.bytesToHex(null, 0, 0));
+ assertNull(TestValues.NULL, BitConverter.hexToBytes(null));
+ }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.BitConverter#intToByteArray(int)}
+ * {@link com.smartdevicelink.util.BitConverter#intFromByteArray(byte[], int)}
+ */
+ public void testIntToByteConversions() {
+
+ // Comparison Values
+ Integer expectedInt = 1234;
+ byte[] expectedBytes = {(byte) (1234 >>> 24), (byte) (1234 >>> 16),
+ (byte) (1234 >>> 8), (byte) (1234)};
+ int actualInt = BitConverter.intFromByteArray(expectedBytes, 0);
+ byte[] actualBytes = BitConverter.intToByteArray(expectedInt);
+ int actualNullBytes = BitConverter.intFromByteArray(null, 0);
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedInt.intValue(), actualInt);
+ assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
+
+ // Invalid/Null Tests
+ assertEquals(TestValues.MATCH, (int) -1, actualNullBytes);
+ }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.BitConverter#shortToByteArray(short)}
+ * {@link com.smartdevicelink.util.BitConverter#shortFromByteArray(byte[], int)}
+ */
+ public void testShortToByteConverstions() {
+
+ // Comparison Values
+ short expectedShort = 1;
+ byte[] expectedBytes = {((byte) ((1 >> 8) & 0xff)), ((byte) (1 & 0xff))};
+ short actualShort = BitConverter.shortFromByteArray(expectedBytes, 0);
+ byte[] actualBytes = BitConverter.shortToByteArray(expectedShort);
+ short actualNullBytes = BitConverter.shortFromByteArray(null, 0);
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedShort, actualShort);
+ assertTrue(TestValues.ARRAY, Arrays.equals(expectedBytes, actualBytes));
+
+ // Invalid/Null Tests
+ assertEquals(TestValues.MATCH, (short) -1, actualNullBytes);
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
index 0cf0efc47..02f1d1c90 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/ByteEnumerTests.java
@@ -8,89 +8,89 @@ import junit.framework.TestCase;
import java.util.Vector;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.util.ByteEnumer}
*/
public class ByteEnumerTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.ByteEnumer#value()}
- * {@link com.smartdevicelink.util.ByteEnumer#getValue()}
- * {@link com.smartdevicelink.util.ByteEnumer#getName()}
- * {@link com.smartdevicelink.util.ByteEnumer#equals(ByteEnumer)}
- * {@link com.smartdevicelink.util.ByteEnumer#eq(ByteEnumer)}
- */
- public void testStoredValues () {
-
- // Test Values
- byte testByte = (byte) 0x01;
- String testString = "test";
- MockByteEnumer testObject = new MockByteEnumer(testByte, null);
-
- // Comparison Values
- MockByteEnumer expectedObject = new MockByteEnumer(testByte, testString);
- MockByteEnumer actualObject = new MockByteEnumer(testByte, testString);
- byte actualByte1 = expectedObject.getValue();
- byte actualByte2 = expectedObject.value();
- String actualString = expectedObject.getName();
- String actualNullString = testObject.getName();
-
- // Valid Tests
- assertNotNull(TestValues.NOT_NULL, expectedObject);
- assertEquals(TestValues.MATCH, testByte, actualByte1);
- assertEquals(TestValues.MATCH, testByte, actualByte2);
- assertEquals(TestValues.MATCH, testString, actualString);
- assertTrue(TestValues.TRUE, actualObject.equals(expectedObject));
- assertTrue(TestValues.TRUE, actualObject.eq(expectedObject));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualNullString);
- }
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.ByteEnumer#get(Vector, byte)}
- * {@link com.smartdevicelink.util.ByteEnumer#get(Vector, String)}
- */
- public void testSearchMethods () {
-
- // Test Values
- byte testByte1 = (byte) 0x01;
- byte testByte2 = (byte) 0x02;
- String testString1 = "test_1";
- String testString2 = "test_2";
- Vector<ByteEnumer> testList = new Vector<ByteEnumer>();
- Vector<String> testInvalidList = new Vector<String>();
-
- // Comparison Values
- MockByteEnumer expectedObject1 = new MockByteEnumer(testByte1, testString1);
- MockByteEnumer expectedObject2 = new MockByteEnumer(testByte2, testString2);
-
- testList.add(expectedObject1);
- testList.add(expectedObject2);
- testInvalidList.add(testString1);
- testInvalidList.add(testString2);
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testByte1));
- assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testString1));
- assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testByte2));
- assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testString2));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, ByteEnumer.get(testList, null));
- assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testByte1));
- assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testString1));
- }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.ByteEnumer#value()}
+ * {@link com.smartdevicelink.util.ByteEnumer#getValue()}
+ * {@link com.smartdevicelink.util.ByteEnumer#getName()}
+ * {@link com.smartdevicelink.util.ByteEnumer#equals(ByteEnumer)}
+ * {@link com.smartdevicelink.util.ByteEnumer#eq(ByteEnumer)}
+ */
+ public void testStoredValues() {
+
+ // Test Values
+ byte testByte = (byte) 0x01;
+ String testString = "test";
+ MockByteEnumer testObject = new MockByteEnumer(testByte, null);
+
+ // Comparison Values
+ MockByteEnumer expectedObject = new MockByteEnumer(testByte, testString);
+ MockByteEnumer actualObject = new MockByteEnumer(testByte, testString);
+ byte actualByte1 = expectedObject.getValue();
+ byte actualByte2 = expectedObject.value();
+ String actualString = expectedObject.getName();
+ String actualNullString = testObject.getName();
+
+ // Valid Tests
+ assertNotNull(TestValues.NOT_NULL, expectedObject);
+ assertEquals(TestValues.MATCH, testByte, actualByte1);
+ assertEquals(TestValues.MATCH, testByte, actualByte2);
+ assertEquals(TestValues.MATCH, testString, actualString);
+ assertTrue(TestValues.TRUE, actualObject.equals(expectedObject));
+ assertTrue(TestValues.TRUE, actualObject.eq(expectedObject));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualNullString);
+ }
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.ByteEnumer#get(Vector, byte)}
+ * {@link com.smartdevicelink.util.ByteEnumer#get(Vector, String)}
+ */
+ public void testSearchMethods() {
+
+ // Test Values
+ byte testByte1 = (byte) 0x01;
+ byte testByte2 = (byte) 0x02;
+ String testString1 = "test_1";
+ String testString2 = "test_2";
+ Vector<ByteEnumer> testList = new Vector<ByteEnumer>();
+ Vector<String> testInvalidList = new Vector<String>();
+
+ // Comparison Values
+ MockByteEnumer expectedObject1 = new MockByteEnumer(testByte1, testString1);
+ MockByteEnumer expectedObject2 = new MockByteEnumer(testByte2, testString2);
+
+ testList.add(expectedObject1);
+ testList.add(expectedObject2);
+ testInvalidList.add(testString1);
+ testInvalidList.add(testString2);
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testByte1));
+ assertEquals(TestValues.MATCH, expectedObject1, ByteEnumer.get(testList, testString1));
+ assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testByte2));
+ assertEquals(TestValues.MATCH, expectedObject2, ByteEnumer.get(testList, testString2));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, ByteEnumer.get(testList, null));
+ assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testByte1));
+ assertNull(TestValues.NULL, ByteEnumer.get(testInvalidList, testString1));
+ }
}
/**
- * This is a mock class for testing the following :
+ * This is a mock class for testing the following :
* {@link com.smartdevicelink.util.ByteEnumer}
*/
class MockByteEnumer extends ByteEnumer {
- protected MockByteEnumer(byte value, String name) {
- super(value, name);
- }
+ protected MockByteEnumer(byte value, String name) {
+ super(value, name);
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
index 044d22f2d..26b4819bd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
@@ -15,7 +15,7 @@ import static junit.framework.TestCase.assertTrue;
public class CompareUtilsTest {
@Test
- public void testAreStringsEqual(){
+ public void testAreStringsEqual() {
assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, true, true));
assertTrue(CompareUtils.areStringsEqual(TestValues.GENERAL_STRING, TestValues.GENERAL_STRING, false, true));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
index 62d159f26..dd2a4fdcd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DebugToolTests.java
@@ -6,23 +6,23 @@ import com.smartdevicelink.util.DebugTool;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.util.DebugTool}
*/
public class DebugToolTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.util.DebugTool#enableDebugTool()}
- * {@link com.smartdevicelink.util.DebugTool#disableDebugTool()}
- * {@link com.smartdevicelink.util.DebugTool#isDebugEnabled()}
- */
- public void testDebugEnableMethods () {
- DebugTool.enableDebugTool();
- assertTrue(TestValues.TRUE, DebugTool.isDebugEnabled());
- DebugTool.disableDebugTool();
- assertFalse(TestValues.FALSE, DebugTool.isDebugEnabled());
- }
-
- // NOTE : No testing can currently be done for the logging methods.
+
+ /**
+ * This is a unit test for the following methods :
+ * {@link com.smartdevicelink.util.DebugTool#enableDebugTool()}
+ * {@link com.smartdevicelink.util.DebugTool#disableDebugTool()}
+ * {@link com.smartdevicelink.util.DebugTool#isDebugEnabled()}
+ */
+ public void testDebugEnableMethods() {
+ DebugTool.enableDebugTool();
+ assertTrue(TestValues.TRUE, DebugTool.isDebugEnabled());
+ DebugTool.disableDebugTool();
+ assertFalse(TestValues.FALSE, DebugTool.isDebugEnabled());
+ }
+
+ // NOTE : No testing can currently be done for the logging methods.
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
index 8aa8c81f4..7397b24a7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/NativeLogToolTests.java
@@ -10,63 +10,63 @@ import java.util.Arrays;
import java.util.List;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.util.NativeLogTool}
*/
public class NativeLogToolTests extends TestCase {
-
- /**
- * This is a unit test for the following enum :
- * {@link com.smartdevicelink.util.NativeLogTool.LogTarget}
- */
- public void testLogTargetEnum () {
-
- // Test Values
- String testInfo = "Info";
- String testError = "Error";
- String testInvalid = "Invalid";
- String testWarning = "Warning";
-
- try {
- // Comparison Values
- NativeLogTool.LogTarget expectedInfoEnum = NativeLogTool.LogTarget.Info;
- NativeLogTool.LogTarget expectedErrorEnum = NativeLogTool.LogTarget.Error;
- NativeLogTool.LogTarget expectedWarningEnum = NativeLogTool.LogTarget.Warning;
- List<NativeLogTool.LogTarget> expectedEnumList = new ArrayList<NativeLogTool.LogTarget>();
- expectedEnumList.add(NativeLogTool.LogTarget.Info);
- expectedEnumList.add(NativeLogTool.LogTarget.Error);
- expectedEnumList.add(NativeLogTool.LogTarget.Warning);
-
- NativeLogTool.LogTarget actualNullEnum = NativeLogTool.LogTarget.valueForString(null);
- NativeLogTool.LogTarget actualInfoEnum = NativeLogTool.LogTarget.valueForString(testInfo);
- NativeLogTool.LogTarget actualErrorEnum = NativeLogTool.LogTarget.valueForString(testError);
- NativeLogTool.LogTarget actualInvalidEnum = NativeLogTool.LogTarget.valueForString(testInvalid);
- NativeLogTool.LogTarget actualWarningEnum = NativeLogTool.LogTarget.valueForString(testWarning);
- List<NativeLogTool.LogTarget> actualEnumList = Arrays.asList(NativeLogTool.LogTarget.values());
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedInfoEnum, actualInfoEnum);
- assertEquals(TestValues.MATCH, expectedErrorEnum, actualErrorEnum);
- assertEquals(TestValues.MATCH, expectedWarningEnum, actualWarningEnum);
- assertTrue("Contents should match.", expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
-
- // Invalid/Null Tests
- assertNull(TestValues.NULL, actualInvalidEnum);
- assertNull(TestValues.NULL, actualNullEnum);
-
- } catch (NullPointerException e) {
- fail("Could not retrieve value for null string, should return null.");
- } catch (IllegalArgumentException e) {
- fail("Could not retrieve value for invalid string, should return null.");
- }
- }
- public void testEnabled () {
- NativeLogTool.setEnableState(false);
- assertFalse("Value should be false.", NativeLogTool.isEnabled());
- NativeLogTool.setEnableState(true);
- assertTrue("Valueshould be true.", NativeLogTool.isEnabled());
- }
-
- // NOTE : No testing can currently be done for the logging methods.
+ /**
+ * This is a unit test for the following enum :
+ * {@link com.smartdevicelink.util.NativeLogTool.LogTarget}
+ */
+ public void testLogTargetEnum() {
+
+ // Test Values
+ String testInfo = "Info";
+ String testError = "Error";
+ String testInvalid = "Invalid";
+ String testWarning = "Warning";
+
+ try {
+ // Comparison Values
+ NativeLogTool.LogTarget expectedInfoEnum = NativeLogTool.LogTarget.Info;
+ NativeLogTool.LogTarget expectedErrorEnum = NativeLogTool.LogTarget.Error;
+ NativeLogTool.LogTarget expectedWarningEnum = NativeLogTool.LogTarget.Warning;
+ List<NativeLogTool.LogTarget> expectedEnumList = new ArrayList<NativeLogTool.LogTarget>();
+ expectedEnumList.add(NativeLogTool.LogTarget.Info);
+ expectedEnumList.add(NativeLogTool.LogTarget.Error);
+ expectedEnumList.add(NativeLogTool.LogTarget.Warning);
+
+ NativeLogTool.LogTarget actualNullEnum = NativeLogTool.LogTarget.valueForString(null);
+ NativeLogTool.LogTarget actualInfoEnum = NativeLogTool.LogTarget.valueForString(testInfo);
+ NativeLogTool.LogTarget actualErrorEnum = NativeLogTool.LogTarget.valueForString(testError);
+ NativeLogTool.LogTarget actualInvalidEnum = NativeLogTool.LogTarget.valueForString(testInvalid);
+ NativeLogTool.LogTarget actualWarningEnum = NativeLogTool.LogTarget.valueForString(testWarning);
+ List<NativeLogTool.LogTarget> actualEnumList = Arrays.asList(NativeLogTool.LogTarget.values());
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedInfoEnum, actualInfoEnum);
+ assertEquals(TestValues.MATCH, expectedErrorEnum, actualErrorEnum);
+ assertEquals(TestValues.MATCH, expectedWarningEnum, actualWarningEnum);
+ assertTrue("Contents should match.", expectedEnumList.containsAll(actualEnumList) && actualEnumList.containsAll(expectedEnumList));
+
+ // Invalid/Null Tests
+ assertNull(TestValues.NULL, actualInvalidEnum);
+ assertNull(TestValues.NULL, actualNullEnum);
+
+ } catch (NullPointerException e) {
+ fail("Could not retrieve value for null string, should return null.");
+ } catch (IllegalArgumentException e) {
+ fail("Could not retrieve value for invalid string, should return null.");
+ }
+ }
+
+ public void testEnabled() {
+ NativeLogTool.setEnableState(false);
+ assertFalse("Value should be false.", NativeLogTool.isEnabled());
+ NativeLogTool.setEnableState(true);
+ assertTrue("Valueshould be true.", NativeLogTool.isEnabled());
+ }
+
+ // NOTE : No testing can currently be done for the logging methods.
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
index 64c2d7b7b..7909d4997 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
@@ -73,7 +73,7 @@ public class SdlAppInfoTests {
@Before
public void setUp() throws Exception {
context = getInstrumentation().getContext();
- defaultResolveInfo = createResolveInfo(context.getResources().getInteger(R.integer.sdl_router_service_version_value), "com.smartdevicelink.test", "com.smartdevicelink.test.SdlRouterService",false);
+ defaultResolveInfo = createResolveInfo(context.getResources().getInteger(R.integer.sdl_router_service_version_value), "com.smartdevicelink.test", "com.smartdevicelink.test.SdlRouterService", false);
defaultServiceInfo = defaultResolveInfo.serviceInfo;
defaultBundle = defaultServiceInfo.metaData;
@@ -83,19 +83,19 @@ public class SdlAppInfoTests {
}
@Test
- public void testConstructorWithDefaultData(){
+ public void testConstructorWithDefaultData() {
- SdlAppInfo info = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
+ SdlAppInfo info = new SdlAppInfo(defaultResolveInfo, defaultPackageInfo);
assertNotNull(info);
- ComponentName componentName = info.getRouterServiceComponentName();
+ ComponentName componentName = info.getRouterServiceComponentName();
assertNotNull(componentName);
- assertEquals(defaultServiceInfo.name,componentName.getClassName());
+ assertEquals(defaultServiceInfo.name, componentName.getClassName());
- assertEquals(context.getResources().getInteger(R.integer.sdl_router_service_version_value),info.getRouterServiceVersion());
+ assertEquals(context.getResources().getInteger(R.integer.sdl_router_service_version_value), info.getRouterServiceVersion());
assertFalse(info.isCustomRouterService());
}
@@ -104,16 +104,16 @@ public class SdlAppInfoTests {
* If an app is found to have a newer service the compare should put it at the top of the list
*/
@Test
- public void testCompareVersion(){
- SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
+ public void testCompareVersion() {
+ SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo, defaultPackageInfo);
int newVersion = context.getResources().getInteger(R.integer.sdl_router_service_version_value) + 1;
- SdlAppInfo testInfo = new SdlAppInfo(createResolveInfo(newVersion,"com.smartdevicelink.test2", "com.smartdevicelink.test2.SdlRouterService", false), defaultPackageInfo);
+ SdlAppInfo testInfo = new SdlAppInfo(createResolveInfo(newVersion, "com.smartdevicelink.test2", "com.smartdevicelink.test2.SdlRouterService", false), defaultPackageInfo);
List<SdlAppInfo> infos = new ArrayList<>();
infos.add(defaultInfo);
infos.add(testInfo);
- assertEquals(defaultInfo,infos.get(0));
+ assertEquals(defaultInfo, infos.get(0));
Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
@@ -125,16 +125,16 @@ public class SdlAppInfoTests {
* Regardless of version, if the router service is custom it should be towards the end of the list
*/
@Test
- public void testCompareVersionAndCustom(){
- SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
+ public void testCompareVersionAndCustom() {
+ SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo, defaultPackageInfo);
int newVersion = context.getResources().getInteger(R.integer.sdl_router_service_version_value) + 1;
- SdlAppInfo testInfo = new SdlAppInfo(createResolveInfo(newVersion,"com.smartdevicelink.test2", "com.smartdevicelink.test2.SdlRouterService",true ), defaultPackageInfo);
+ SdlAppInfo testInfo = new SdlAppInfo(createResolveInfo(newVersion, "com.smartdevicelink.test2", "com.smartdevicelink.test2.SdlRouterService", true), defaultPackageInfo);
List<SdlAppInfo> infos = new ArrayList<>();
infos.add(defaultInfo);
infos.add(testInfo);
- assertEquals(defaultInfo,infos.get(0));
+ assertEquals(defaultInfo, infos.get(0));
Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
@@ -146,18 +146,18 @@ public class SdlAppInfoTests {
* If two services have the same version and are not custom, we need to check which app has been updated the most recently
*/
@Test
- public void testCompareUpdatedTime(){
- SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
+ public void testCompareUpdatedTime() {
+ SdlAppInfo defaultInfo = new SdlAppInfo(defaultResolveInfo, defaultPackageInfo);
PackageInfo packageInfo = new PackageInfo();
packageInfo.firstInstallTime = defaultPackageInfo.firstInstallTime;
packageInfo.lastUpdateTime = defaultPackageInfo.lastUpdateTime + 500;
- SdlAppInfo testInfo = new SdlAppInfo(defaultResolveInfo, packageInfo);
+ SdlAppInfo testInfo = new SdlAppInfo(defaultResolveInfo, packageInfo);
List<SdlAppInfo> infos = new ArrayList<>();
infos.add(defaultInfo);
infos.add(testInfo);
- assertEquals(defaultInfo,infos.get(0));
+ assertEquals(defaultInfo, infos.get(0));
Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
@@ -165,11 +165,11 @@ public class SdlAppInfoTests {
}
- public ResolveInfo createResolveInfo(int routerServiceVersion,String packageName, String className, boolean isCustom){
+ public ResolveInfo createResolveInfo(int routerServiceVersion, String packageName, String className, boolean isCustom) {
ResolveInfo info = new ResolveInfo();
ServiceInfo serviceInfo = new ServiceInfo();
defaultBundle = new Bundle();
- defaultBundle.putInt(context.getString(R.string.sdl_router_service_version_name),routerServiceVersion);
+ defaultBundle.putInt(context.getString(R.string.sdl_router_service_version_name), routerServiceVersion);
defaultBundle.putBoolean(context.getString(R.string.sdl_router_service_is_custom_name), isCustom);
serviceInfo.metaData = defaultBundle;
serviceInfo.packageName = packageName;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
index 0912354d7..c5ab9e35f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlDataTypeConverterTests.java
@@ -6,41 +6,41 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
import junit.framework.TestCase;
/**
- * This is a unit test class for the SmartDeviceLink library project class :
+ * This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.util.SdlDataTypeConverter}
*/
public class SdlDataTypeConverterTests extends TestCase {
-
- /**
- * This is a unit test for the following method :
- * {@link com.smartdevicelink.util.SdlDataTypeConverter#objectToDouble(Object)}
- */
- public void testObjectToDouble () {
-
- // Test Values
- Long testLong = Long.valueOf(1);
- Short testShort = 1;
- Float testFloat = 1f;
- Double testDouble = 1.0;
- Integer testInteger = 1;
-
- // Comparison Values
- Double expectedValue = 1.0;
- Double actualNullValue = SdlDataTypeConverter.objectToDouble(null);
- Double actualLongValue = SdlDataTypeConverter.objectToDouble(testLong);
- Double actualShortValue = SdlDataTypeConverter.objectToDouble(testShort);
- Double actualFloatValue = SdlDataTypeConverter.objectToDouble(testFloat);
- Double actualDoubleValue = SdlDataTypeConverter.objectToDouble(testDouble);
- Double actualIntegerValue = SdlDataTypeConverter.objectToDouble(testInteger);
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedValue, actualDoubleValue);
- assertEquals(TestValues.MATCH, expectedValue, actualIntegerValue);
- assertEquals(TestValues.MATCH, expectedValue, actualFloatValue);
-
- // Null Tests
- assertNull(TestValues.NULL, actualNullValue);
- assertNull(TestValues.NULL, actualLongValue);
- assertNull(TestValues.NULL, actualShortValue);
- }
+
+ /**
+ * This is a unit test for the following method :
+ * {@link com.smartdevicelink.util.SdlDataTypeConverter#objectToDouble(Object)}
+ */
+ public void testObjectToDouble() {
+
+ // Test Values
+ Long testLong = Long.valueOf(1);
+ Short testShort = 1;
+ Float testFloat = 1f;
+ Double testDouble = 1.0;
+ Integer testInteger = 1;
+
+ // Comparison Values
+ Double expectedValue = 1.0;
+ Double actualNullValue = SdlDataTypeConverter.objectToDouble(null);
+ Double actualLongValue = SdlDataTypeConverter.objectToDouble(testLong);
+ Double actualShortValue = SdlDataTypeConverter.objectToDouble(testShort);
+ Double actualFloatValue = SdlDataTypeConverter.objectToDouble(testFloat);
+ Double actualDoubleValue = SdlDataTypeConverter.objectToDouble(testDouble);
+ Double actualIntegerValue = SdlDataTypeConverter.objectToDouble(testInteger);
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, expectedValue, actualDoubleValue);
+ assertEquals(TestValues.MATCH, expectedValue, actualIntegerValue);
+ assertEquals(TestValues.MATCH, expectedValue, actualFloatValue);
+
+ // Null Tests
+ assertNull(TestValues.NULL, actualNullValue);
+ assertNull(TestValues.NULL, actualLongValue);
+ assertNull(TestValues.NULL, actualShortValue);
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
index 2dab00ccd..88ff2f8d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
@@ -13,10 +13,10 @@ import static junit.framework.TestCase.assertEquals;
public class VersionTest {
private static final String TEST_VERSION_STRING = "1.2.3";
- private static final Version TEST_VERSION = new Version(1,2,3);
+ private static final Version TEST_VERSION = new Version(1, 2, 3);
@Test
- public void testConstructorCorrect(){
+ public void testConstructorCorrect() {
Version version = new Version(TEST_VERSION_STRING);
assertEquals(1, version.getMajor());
assertEquals(2, version.getMinor());
@@ -24,51 +24,51 @@ public class VersionTest {
}
@Test
- public void testConstructorIncorrect(){
- try{
+ public void testConstructorIncorrect() {
+ try {
Version version = new Version("1.2");
- }catch (Exception e){
+ } catch (Exception e) {
assert true;
}
assert false;
}
@Test
- public void testToString(){
+ public void testToString() {
Version version = new Version(TEST_VERSION_STRING);
assertEquals(version.toString(), TEST_VERSION_STRING);
}
@Test
- public void testisNewerThan(){
- Version version1 = new Version(5,0,0);
+ public void testisNewerThan() {
+ Version version1 = new Version(5, 0, 0);
//Supplied version is newer
- assertEquals(-1,version1.isNewerThan(new Version(6,0,0)));
- assertEquals(-1,version1.isNewerThan( new Version(5,1,0)));
- assertEquals(-1,version1.isNewerThan( new Version(5,0,1)));
+ assertEquals(-1, version1.isNewerThan(new Version(6, 0, 0)));
+ assertEquals(-1, version1.isNewerThan(new Version(5, 1, 0)));
+ assertEquals(-1, version1.isNewerThan(new Version(5, 0, 1)));
//Supplied version is older
- assertEquals(1,version1.isNewerThan( new Version(4,0,0)));
- assertEquals(1,version1.isNewerThan( new Version(4,1,0)));
- assertEquals(1,version1.isNewerThan( new Version(4,0,1)));
+ assertEquals(1, version1.isNewerThan(new Version(4, 0, 0)));
+ assertEquals(1, version1.isNewerThan(new Version(4, 1, 0)));
+ assertEquals(1, version1.isNewerThan(new Version(4, 0, 1)));
//Supplied version is equal
- assertEquals(0,version1.isNewerThan( new Version(5,0,0)));
+ assertEquals(0, version1.isNewerThan(new Version(5, 0, 0)));
}
@Test
- public void testIsBetween(){
+ public void testIsBetween() {
- assertEquals(TEST_VERSION.isBetween(new Version(1,0,0), new Version (2,0,0)), 1);
- assertEquals(TEST_VERSION.isBetween(new Version(2,0,0), new Version (1,0,0)), -1);
- assertEquals(TEST_VERSION.isBetween(new Version(2,0,0), new Version (3,0,0)), -1);
+ assertEquals(TEST_VERSION.isBetween(new Version(1, 0, 0), new Version(2, 0, 0)), 1);
+ assertEquals(TEST_VERSION.isBetween(new Version(2, 0, 0), new Version(1, 0, 0)), -1);
+ assertEquals(TEST_VERSION.isBetween(new Version(2, 0, 0), new Version(3, 0, 0)), -1);
- assertEquals(TEST_VERSION.isBetween(new Version(1,0,0), new Version (1,2,3)), 0);
- assertEquals(TEST_VERSION.isBetween(new Version(1,2,3), new Version (3,2,3)), 0);
+ assertEquals(TEST_VERSION.isBetween(new Version(1, 0, 0), new Version(1, 2, 3)), 0);
+ assertEquals(TEST_VERSION.isBetween(new Version(1, 2, 3), new Version(3, 2, 3)), 0);
- assertEquals(TEST_VERSION.isBetween(new Version(1,2,3), new Version (1,2,3)), 0);
+ assertEquals(TEST_VERSION.isBetween(new Version(1, 2, 3), new Version(1, 2, 3)), 0);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
index 9deff1ec8..1ad01a1c3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AndroidToolsTests.java
@@ -15,27 +15,28 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
@RunWith(AndroidJUnit4.class)
public class AndroidToolsTests {
-
- @Test
- public void testIsServiceExportedNormal(){
-
- try{
- AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), new ComponentName(getInstrumentation().getTargetContext(), "test"));
- }catch(Exception e){
- Assert.fail("Exception during normal test: " + e.getMessage());
- }
-
- }
- @Test
- public void testIsServiceExportedNull(){
-
- try{
- AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), null);
- Assert.fail("Proccessed null data");
- }catch(Exception e){
-
- }
-
- }
+
+ @Test
+ public void testIsServiceExportedNormal() {
+
+ try {
+ AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), new ComponentName(getInstrumentation().getTargetContext(), "test"));
+ } catch (Exception e) {
+ Assert.fail("Exception during normal test: " + e.getMessage());
+ }
+
+ }
+
+ @Test
+ public void testIsServiceExportedNull() {
+
+ try {
+ AndroidTools.isServiceExported(getInstrumentation().getTargetContext(), null);
+ Assert.fail("Proccessed null data");
+ } catch (Exception e) {
+
+ }
+
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
index aa37eda2d..6400d9252 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/utl/AppServiceFactory.java
@@ -18,7 +18,7 @@ import java.util.List;
public class AppServiceFactory {
- public static AppServiceManifest createAppServiceManifest(AppServiceType type, String serviceName){
+ public static AppServiceManifest createAppServiceManifest(AppServiceType type, String serviceName) {
AppServiceManifest manifest = new AppServiceManifest();
manifest.setServiceName(serviceName);
@@ -26,7 +26,7 @@ public class AppServiceFactory {
manifest.setAllowAppConsumers(true);
List<FunctionID> handledRPCs = new ArrayList<>();
- switch (type){
+ switch (type) {
case MEDIA:
handledRPCs.add(FunctionID.BUTTON_PRESS);
manifest.setMediaServiceManifest(new MediaServiceManifest());
@@ -57,18 +57,18 @@ public class AppServiceFactory {
return manifest;
}
- public static AppServiceRecord createAppServiceRecord(AppServiceType type, String serviceName, String serviceID, boolean isActive){
+ public static AppServiceRecord createAppServiceRecord(AppServiceType type, String serviceName, String serviceID, boolean isActive) {
AppServiceRecord appServiceRecord = new AppServiceRecord();
- appServiceRecord.setServiceManifest(createAppServiceManifest(type,serviceName));
+ appServiceRecord.setServiceManifest(createAppServiceManifest(type, serviceName));
appServiceRecord.setServiceID(serviceID);
appServiceRecord.setServiceActive(isActive);
appServiceRecord.setServicePublished(true);
return appServiceRecord;
}
- public static AppServiceCapability createAppServiceCapability(AppServiceType type, String serviceName, String serviceID, boolean isActive, ServiceUpdateReason updateReason){
+ public static AppServiceCapability createAppServiceCapability(AppServiceType type, String serviceName, String serviceID, boolean isActive, ServiceUpdateReason updateReason) {
AppServiceCapability appServiceCapability = new AppServiceCapability();
- appServiceCapability.setUpdatedAppServiceRecord(createAppServiceRecord(type,serviceName,serviceID,isActive));
+ appServiceCapability.setUpdatedAppServiceRecord(createAppServiceRecord(type, serviceName, serviceID, isActive));
appServiceCapability.setUpdateReason(updateReason);
return appServiceCapability;
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
index a816d6d87..c7b449fc3 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/LocalRouterServiceTests.java
@@ -17,139 +17,139 @@ import static junit.framework.TestCase.assertNull;
@RunWith(AndroidJUnit4.class)
public class LocalRouterServiceTests {
- private static final int TEST_WITH_CONSTRUCTOR = 0;
- private static final int TEST_WITH_CREATOR = 1;
-
-
- @Test
- public void testLocalRouterServiceParcel(){
- Parcel p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
- p.setDataPosition(0);
-
- SdlRouterService.LocalRouterService local = new SdlRouterService.LocalRouterService(p);
-
- assertNotNull(local);
- assertEquals(local.version,4);
- p.recycle();
-
- }
-
- @Test
- public void testLocalRouterServiceParcelCreator(){
- Parcel p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
- p.setDataPosition(0);
-
- SdlRouterService.LocalRouterService local = SdlRouterService.LocalRouterService.CREATOR.createFromParcel(p);
-
- assertNotNull(local);
- assertEquals(local.version,4);
- p.recycle();
-
- }
-
- public SdlRouterService.LocalRouterService getLocalRouterService(int testWith, Parcel p){
- if(testWith == TEST_WITH_CONSTRUCTOR){
- return new SdlRouterService.LocalRouterService(p);
- }else{
- return SdlRouterService.LocalRouterService.CREATOR.createFromParcel(p);
- }
- }
-
- public void corruptParcel(int testWith){
- Parcel p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
- p.writeParcelable(new Intent(), 0);
- p.setDataPosition(0);
-
- SdlRouterService.LocalRouterService local = getLocalRouterService(testWith, p);
-
- assertNotNull(local);
- assertNull(local.launchIntent);
- assertNull(local.name);
-
- p.recycle();
- //---------------------------------------------------------------------------
-
- p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- p.writeParcelable(null,0);
- p.writeParcelable(null,0);
- p.setDataPosition(0);
-
- local = getLocalRouterService(testWith, p);
-
- assertNotNull(local);
- assertNull(local.launchIntent);
- assertNull(local.name);
-
- p.recycle();
- //---------------------------------------------------------------------------
-
- p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- p.setDataPosition(0);
-
- local = getLocalRouterService(testWith, p);
-
- assertNotNull(local);
- assertNull(local.launchIntent);
- assertNull(local.name);
-
- p.recycle();
-
- //---------------------------------------------------------------------------
- local = null;
- p = null;
-
- p = Parcel.obtain();
- p.writeInt(4);
- p.writeLong(System.currentTimeMillis());
- int space = p.dataSize();
- p.writeParcelable(new Intent(), 0);
- p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
- p.setDataPosition(0);
-
- byte[] raw = p.marshall();
- for(;space<raw.length;space++){
- raw[space] = 0x00;
- }
- p.recycle();
- p = Parcel.obtain();
- p.unmarshall(raw, 0, raw.length);
- p.setDataPosition(0);
-
-
- local = getLocalRouterService(testWith, p);
-
- assertNotNull(local);
- assertNull(local.launchIntent);
- assertNull(local.name);
-
- p.recycle();
-
- }
-
- @Test
- public void testLocalRouterServiceCorruptParcel(){
- corruptParcel(TEST_WITH_CONSTRUCTOR);
- }
-
- @Test
- public void testLocalRouterServiceCorruptParcelCreator(){
- corruptParcel(TEST_WITH_CREATOR);
- }
-
+ private static final int TEST_WITH_CONSTRUCTOR = 0;
+ private static final int TEST_WITH_CREATOR = 1;
+
+
+ @Test
+ public void testLocalRouterServiceParcel() {
+ Parcel p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ p.writeParcelable(new Intent(), 0);
+ p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
+ p.setDataPosition(0);
+
+ SdlRouterService.LocalRouterService local = new SdlRouterService.LocalRouterService(p);
+
+ assertNotNull(local);
+ assertEquals(local.version, 4);
+ p.recycle();
+
+ }
+
+ @Test
+ public void testLocalRouterServiceParcelCreator() {
+ Parcel p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ p.writeParcelable(new Intent(), 0);
+ p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
+ p.setDataPosition(0);
+
+ SdlRouterService.LocalRouterService local = SdlRouterService.LocalRouterService.CREATOR.createFromParcel(p);
+
+ assertNotNull(local);
+ assertEquals(local.version, 4);
+ p.recycle();
+
+ }
+
+ public SdlRouterService.LocalRouterService getLocalRouterService(int testWith, Parcel p) {
+ if (testWith == TEST_WITH_CONSTRUCTOR) {
+ return new SdlRouterService.LocalRouterService(p);
+ } else {
+ return SdlRouterService.LocalRouterService.CREATOR.createFromParcel(p);
+ }
+ }
+
+ public void corruptParcel(int testWith) {
+ Parcel p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
+ p.writeParcelable(new Intent(), 0);
+ p.setDataPosition(0);
+
+ SdlRouterService.LocalRouterService local = getLocalRouterService(testWith, p);
+
+ assertNotNull(local);
+ assertNull(local.launchIntent);
+ assertNull(local.name);
+
+ p.recycle();
+ //---------------------------------------------------------------------------
+
+ p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ p.writeParcelable(null, 0);
+ p.writeParcelable(null, 0);
+ p.setDataPosition(0);
+
+ local = getLocalRouterService(testWith, p);
+
+ assertNotNull(local);
+ assertNull(local.launchIntent);
+ assertNull(local.name);
+
+ p.recycle();
+ //---------------------------------------------------------------------------
+
+ p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ p.setDataPosition(0);
+
+ local = getLocalRouterService(testWith, p);
+
+ assertNotNull(local);
+ assertNull(local.launchIntent);
+ assertNull(local.name);
+
+ p.recycle();
+
+ //---------------------------------------------------------------------------
+ local = null;
+ p = null;
+
+ p = Parcel.obtain();
+ p.writeInt(4);
+ p.writeLong(System.currentTimeMillis());
+ int space = p.dataSize();
+ p.writeParcelable(new Intent(), 0);
+ p.writeParcelable(new ComponentName(getInstrumentation().getContext(), "test"), 0);
+ p.setDataPosition(0);
+
+ byte[] raw = p.marshall();
+ for (; space < raw.length; space++) {
+ raw[space] = 0x00;
+ }
+ p.recycle();
+ p = Parcel.obtain();
+ p.unmarshall(raw, 0, raw.length);
+ p.setDataPosition(0);
+
+
+ local = getLocalRouterService(testWith, p);
+
+ assertNotNull(local);
+ assertNull(local.launchIntent);
+ assertNull(local.name);
+
+ p.recycle();
+
+ }
+
+ @Test
+ public void testLocalRouterServiceCorruptParcel() {
+ corruptParcel(TEST_WITH_CONSTRUCTOR);
+ }
+
+ @Test
+ public void testLocalRouterServiceCorruptParcelCreator() {
+ corruptParcel(TEST_WITH_CREATOR);
+ }
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
index 03c71264a..63beacb5f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
@@ -19,41 +19,42 @@ import static junit.framework.TestCase.assertNotNull;
@RunWith(AndroidJUnit4.class)
public class MultiplexTransportTest {
- RouterServiceValidator rsvp;
-
-
- @Before
- public void setUp() throws Exception {
- rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
-
- }
- });
-
-
- }
- // test for setting error state.
- @Test
- public void testSetState() {
- MultiplexBluetoothTransport btTransport = new MultiplexBluetoothTransport(new Handler(Looper.getMainLooper()) {
- @Override
- public void handleMessage(Message message) {
- assertNotNull(message);
- if (message.arg1 == MultiplexBaseTransport.STATE_ERROR) {
- assertNotNull(message.getData());
- assertEquals(MultiplexBaseTransport.REASON_SPP_ERROR, message.getData().getByte(MultiplexBaseTransport.ERROR_REASON_KEY));
- } else {
- //It will first listen before the error state
- assertEquals(MultiplexBaseTransport.STATE_LISTEN, message.arg1);
- }
- }
- });
- btTransport.start();
- final Bundle bundle = new Bundle();
- bundle.putByte(MultiplexBaseTransport.ERROR_REASON_KEY, MultiplexBaseTransport.REASON_SPP_ERROR);
- btTransport.setState(MultiplexBaseTransport.STATE_ERROR, bundle);
- }
+ RouterServiceValidator rsvp;
+
+
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+
+ }
+ });
+
+
+ }
+
+ // test for setting error state.
+ @Test
+ public void testSetState() {
+ MultiplexBluetoothTransport btTransport = new MultiplexBluetoothTransport(new Handler(Looper.getMainLooper()) {
+ @Override
+ public void handleMessage(Message message) {
+ assertNotNull(message);
+ if (message.arg1 == MultiplexBaseTransport.STATE_ERROR) {
+ assertNotNull(message.getData());
+ assertEquals(MultiplexBaseTransport.REASON_SPP_ERROR, message.getData().getByte(MultiplexBaseTransport.ERROR_REASON_KEY));
+ } else {
+ //It will first listen before the error state
+ assertEquals(MultiplexBaseTransport.STATE_LISTEN, message.arg1);
+ }
+ }
+ });
+ btTransport.start();
+ final Bundle bundle = new Bundle();
+ bundle.putByte(MultiplexBaseTransport.ERROR_REASON_KEY, MultiplexBaseTransport.REASON_SPP_ERROR);
+ btTransport.setState(MultiplexBaseTransport.STATE_ERROR, bundle);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
index 812556f2c..840bfe118 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
@@ -38,504 +38,506 @@ import static junit.framework.TestCase.fail;
@RunWith(AndroidJUnit4.class)
@FixMethodOrder(MethodSorters.JVM)
public class RSVTestCase {
- private static final String TAG = "RSVTestCase";
-
- private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
- private static final long REFRESH_TRUSTED_APP_LIST_TIME_WEEK = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 7; // A week in ms
- private static final long REFRESH_TRUSTED_APP_LIST_TIME_MONTH = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 30; // A ~month in ms
- private static final String TEST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
- RouterServiceValidator rsvp;
- private static final String APP_ID = "com.smartdevicelink.test.RSVTestCase";
- /**
- * Set this boolean if you want to test the actual validation of router service
- */
- boolean liveTest = false;
-
- @Before
- public void setUp() throws Exception {
- rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
-
- }
-
- private static final Semaphore TRUSTED_LIST_LOCK = new Semaphore(1);
-
- private void requestTListLock(){
- try {
- TRUSTED_LIST_LOCK.acquire();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- private void releaseTListLock(){
- TRUSTED_LIST_LOCK.release();
- }
-
- private RouterServiceValidator.TrustedListCallback trustedListCallback = new RouterServiceValidator.TrustedListCallback(){
- @Override
- public void onListObtained(boolean successful) {
- releaseTListLock();
- }
- };
-
-/*
- * These tests are a little strange because they don't test the logic behind the validation of each piece.
- * However, they allow us to test
- */
-
- @Test
- public void testInstalledFrom(){
- if(liveTest){
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
- }
-
- @Test
- public void testPackageCheck(){
- if(liveTest){
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PACKAGE_CHECK);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
- }
-
- @Test
- public void testVersionCheck(){
- if(liveTest){
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
- }
-
- @Test
- public void testNoFlags(){
- if(liveTest){
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
- }
-
- @Test
- public void testAllFlags(){
- if(liveTest){
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
- }
-
- @Test
- public void testSecuritySetting(){
-
- RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
-
- try{
- Field securityLevelField = RouterServiceValidator.class.getDeclaredField("securityLevel");
- securityLevelField.setAccessible(true);
- assertEquals(securityLevelField.get(rsvp),MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- }catch(NoSuchFieldException e1){
- fail(e1.getMessage());
- }catch( IllegalAccessException e2){
- fail(e2.getMessage());
- }
- assertEquals(RouterServiceValidator.getSecurityLevel(getInstrumentation().getTargetContext()), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- }
-
- @Test
- public void testHighSecurity(){
- requestTListLock();
-
- RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
-
- assertTrue(checkShouldOverrideInstalledFrom(rsvp,false));
-
- assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
-
- assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
-
- }
-
- @Test
- public void testMediumSecurity(){
- requestTListLock();
-
- RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
-
- assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
-
- assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
-
- assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
-
- }
-
- @Test
- public void testLowSecurity(){
- requestTListLock();
-
- RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW);
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
-
- assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
-
- assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_MONTH);
-
- assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
-
- }
-
- @Test
- public void testNoSecurity(){
- requestTListLock();
-
- RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext(), new ComponentName("anything", getInstrumentation().getTargetContext().getClass().getSimpleName())) {
- @Override
- protected boolean isServiceRunning(Context context, ComponentName service) {
- return true;
- }
- };
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
-
- assertTrue(checkShouldOverrideInstalledFrom(rsvp,true));
-
- assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
-
- assertFalse(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
-
- //This should always return true
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
-
- }
-
- public boolean checkShouldOverrideInstalledFrom(RouterServiceValidator rsvp, boolean shouldOverride){
- try{
- Method shouldOverrideInstalledFrom = RouterServiceValidator.class.getDeclaredMethod("shouldOverrideInstalledFrom");
- shouldOverrideInstalledFrom.setAccessible(true);
- boolean should = (Boolean)shouldOverrideInstalledFrom.invoke(rsvp);
-
- return shouldOverride == should;
-
- }catch(NoSuchMethodException e1){
- fail(e1.getMessage());
- }catch( IllegalAccessException e2){
- fail(e2.getMessage());
- }catch( InvocationTargetException e3){
- fail(e3.getMessage());
- }
- return false;
- }
-
- @Test
- public void testJsonRecovery(){
- assertNotNull(rsvp.stringToJson(null));
- assertNotNull(rsvp.stringToJson("asdf235vq32{]]"));
-
- }
-
- @Test
- public void testInvalidateList(){
- requestTListLock();
-
- assertFalse(RouterServiceValidator.invalidateList(null));
- assertTrue(RouterServiceValidator.invalidateList(getInstrumentation().getTargetContext()));
-
- releaseTListLock();
- }
-
- @Test
- public void testGetTrustedList(){
- requestTListLock();
-
- assertNull(RouterServiceValidator.getTrustedList(null));
- assertNotNull(RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext()));
-
- releaseTListLock();
- }
-
- @Test
- public void testSetTrustedList(){
- requestTListLock();
-
- assertFalse(RouterServiceValidator.setTrustedList(null,null));
- assertFalse(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),null));
- assertFalse(RouterServiceValidator.setTrustedList(null,"test"));
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),"test"));
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),TEST));
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),TEST+TEST+TEST+TEST+TEST));
- StringBuilder builder = new StringBuilder();
- for(int i = 0; i<1000; i++){
- builder.append(TEST);
- }
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),builder.toString()));
-
- releaseTListLock();
- }
-
- @Test
- public void testTrustedListSetAndGet(){
- requestTListLock();
-
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),TEST));
- String retVal = RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext());
- assertNotNull(retVal);
- assertTrue(TEST.equals(retVal));
-
- StringBuilder builder = new StringBuilder();
- for(int i = 0; i<1000; i++){
- builder.append(TEST);
- }
- assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(),builder.toString()));
- retVal = RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext());
- assertNotNull(retVal);
- assertTrue(builder.toString().equals(retVal));
-
- releaseTListLock();
- }
-
- @Test
- public void testInvalidationSequence(){
- requestTListLock();
-
- assertTrue(RouterServiceValidator.invalidateList(getInstrumentation().getTargetContext()));
- assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), false, null, trustedListCallback));
- }
-
- @Test
- public void testAppStorePackages(){
- assertTrue(TrustedAppStore.isTrustedStore(TrustedAppStore.PLAY_STORE.packageString));
- assertTrue(TrustedAppStore.isTrustedStore("com.xiaomi.market"));
- assertFalse(TrustedAppStore.isTrustedStore("test"));
- assertFalse(TrustedAppStore.isTrustedStore(null));
-
- rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
- rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
- rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
-
- PackageManager packageManager = getInstrumentation().getTargetContext().getPackageManager();
- List<PackageInfo> packages = packageManager.getInstalledPackages(0);
- String appStore;
- for(PackageInfo info: packages){
- appStore = packageManager.getInstallerPackageName(info.packageName);
- if(TrustedAppStore.isTrustedStore(appStore)){
- assertTrue(rsvp.wasInstalledByAppStore(info.packageName));
- }
- }
-
- assertFalse(rsvp.wasInstalledByAppStore(null));
- }
-
- @Test
- public void testVersionBlackList(){
- rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
- JSONArray array = new JSONArray();
- for(int i=0; i<25; i++){
- if(i%3 == 0){
- array.put(i);
- }
- }
- assertTrue(rsvp.verifyVersion(1, null));
- assertTrue(rsvp.verifyVersion(1, array));
- assertTrue(rsvp.verifyVersion(100, array));
- assertFalse(rsvp.verifyVersion(3, array));
- assertFalse(rsvp.verifyVersion(-3, array));
-
- }
-
- static boolean didFinish = false;
- @Test
- public void testGetAndCheckList(){
- requestTListLock();
-
- final Object REQUEST_LOCK = new Object();
- didFinish = false;
- HttpRequestTaskCallback cb = new HttpRequestTaskCallback(){
-
- @Override
- public void httpCallComplete(String response) {
- //Might want to check if this list is ok
- Log.d(TAG, "APPS! " + response);
- synchronized(REQUEST_LOCK){
- didFinish = true;
- REQUEST_LOCK.notify();
- }
- releaseTListLock();
- }
- @Override
- public void httpFailure(int statusCode) {
- Log.e(TAG, "Error while requesting trusted app list: " + statusCode);
- synchronized(REQUEST_LOCK){
- didFinish = true;
- REQUEST_LOCK.notify();
- }
- releaseTListLock();
- }
- };
-
- assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(),true, cb, null));
- //Now wait for call to finish
- synchronized(REQUEST_LOCK){
- try {
- REQUEST_LOCK.wait();
- assertTrue(didFinish);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
-
- }
-
- /**
- * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
- */
- @Test
- public void testRequestChange(){
- requestTListLock();
-
- RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), null);
- assertNull(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext()));
-
- JSONObject object = null;
- try {
- object = new JSONObject(TEST);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- assertNotNull(object);
- assertFalse(object.equals(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext())));
-
- assertTrue(RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), object.toString()));
-
- String oldRequest = RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext());
- assertNotNull(oldRequest);
- assertTrue(object.toString().equals(oldRequest));
-
- //Now test a new list
- String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.test.test\" : { \"versionBlacklist\":[] },\"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
- object = null;
- try {
- object = new JSONObject(test);
- } catch (JSONException e) {
- e.printStackTrace();
- }
- assertNotNull(object);
- assertFalse(object.equals(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext())));
- //Clear it for next test
- RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), null);
-
- releaseTListLock();
- }
-
- /**
- * Test app's router validation. Validation should fail when the given context and ComponentName object are from different packages and security setting is not OFF
- * and app is not on trusted list. Validation should pass when the given context and ComponentName object are from the same package.
- */
- @Test
- public void testAppSelfValidation() {
-
- class RouterServiceValidatorTest extends RouterServiceValidator{
- public RouterServiceValidatorTest(Context context){
- super(context);
- }
-
- public RouterServiceValidatorTest(Context context, ComponentName service){
- super(context, service);
- }
-
- // Override this method and simply returning true for the purpose of this test
- protected boolean isServiceRunning(Context context, ComponentName service){
- return true;
- }
- }
-
- // Fail, different package name for context and service and app security setting is not OFF and app is not on trusted list
- RouterServiceValidatorTest rsvpFail = new RouterServiceValidatorTest(getInstrumentation().getTargetContext(), new ComponentName("anything", getInstrumentation().getTargetContext().getClass().getSimpleName()));
- rsvpFail.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- rsvpFail.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertFalse(valid);
- }
- });
-
- // Success, same package name for context and service
- RouterServiceValidatorTest rsvpPass = new RouterServiceValidatorTest(getInstrumentation().getTargetContext(), new ComponentName(getInstrumentation().getTargetContext().getPackageName(), getInstrumentation().getTargetContext().getClass().getSimpleName()));
- rsvpPass.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- rsvpPass.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- assertTrue(valid);
- }
- });
- }
-
- /**
- * Unit test for validateAsync.
- */
- @Test
- public void testValidateAsync() {
- final MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
- final RouterServiceValidator validator = new RouterServiceValidator(config);
- final ConditionVariable cond = new ConditionVariable();
- validator.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- Log.d(TAG, "onFinishedValidation: valid=" + valid + "; componentName=" + name);
- assertFalse(valid); // expected valid = false for this (bogus) APP_ID..
- cond.open();
- }
- });
- cond.block();
-
- // next, test for FLAG_MULTI_SECURITY_OFF
- final MultiplexTransportConfig config2 = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
- final RouterServiceValidator validator2 = new RouterServiceValidator(config2);
- cond.close();
- validator2.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
- Log.d(TAG, "onFinishedValidation: valid=" + valid + "; componentName=" + name);
- // return value does not matter when security is off.
- cond.open();
- }
- });
- cond.block();
- }
+ private static final String TAG = "RSVTestCase";
+
+ private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
+ private static final long REFRESH_TRUSTED_APP_LIST_TIME_WEEK = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 7; // A week in ms
+ private static final long REFRESH_TRUSTED_APP_LIST_TIME_MONTH = REFRESH_TRUSTED_APP_LIST_TIME_DAY * 30; // A ~month in ms
+ private static final String TEST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
+ RouterServiceValidator rsvp;
+ private static final String APP_ID = "com.smartdevicelink.test.RSVTestCase";
+ /**
+ * Set this boolean if you want to test the actual validation of router service
+ */
+ boolean liveTest = false;
+
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
+
+ }
+
+ private static final Semaphore TRUSTED_LIST_LOCK = new Semaphore(1);
+
+ private void requestTListLock() {
+ try {
+ TRUSTED_LIST_LOCK.acquire();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void releaseTListLock() {
+ TRUSTED_LIST_LOCK.release();
+ }
+
+ private RouterServiceValidator.TrustedListCallback trustedListCallback = new RouterServiceValidator.TrustedListCallback() {
+ @Override
+ public void onListObtained(boolean successful) {
+ releaseTListLock();
+ }
+ };
+
+ /*
+ * These tests are a little strange because they don't test the logic behind the validation of each piece.
+ * However, they allow us to test
+ */
+
+ @Test
+ public void testInstalledFrom() {
+ if (liveTest) {
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testPackageCheck() {
+ if (liveTest) {
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PACKAGE_CHECK);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testVersionCheck() {
+ if (liveTest) {
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testNoFlags() {
+ if (liveTest) {
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testAllFlags() {
+ if (liveTest) {
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_PERFORM_ALL_CHECKS);
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testSecuritySetting() {
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+
+ try {
+ Field securityLevelField = RouterServiceValidator.class.getDeclaredField("securityLevel");
+ securityLevelField.setAccessible(true);
+ assertEquals(securityLevelField.get(rsvp), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ } catch (NoSuchFieldException e1) {
+ fail(e1.getMessage());
+ } catch (IllegalAccessException e2) {
+ fail(e2.getMessage());
+ }
+ assertEquals(RouterServiceValidator.getSecurityLevel(getInstrumentation().getTargetContext()), MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ }
+
+ @Test
+ public void testHighSecurity() {
+ requestTListLock();
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+
+ assertTrue(checkShouldOverrideInstalledFrom(rsvp, false));
+
+ assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
+
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
+
+ }
+
+ @Test
+ public void testMediumSecurity() {
+ requestTListLock();
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+
+ assertTrue(checkShouldOverrideInstalledFrom(rsvp, true));
+
+ assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
+
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
+
+ }
+
+ @Test
+ public void testLowSecurity() {
+ requestTListLock();
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext()); //Use a locally scoped instance
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW);
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+
+ assertTrue(checkShouldOverrideInstalledFrom(rsvp, true));
+
+ assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_MONTH);
+
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
+
+ }
+
+ @Test
+ public void testNoSecurity() {
+ requestTListLock();
+
+ RouterServiceValidator rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext(), new ComponentName("anything", getInstrumentation().getTargetContext().getClass().getSimpleName())) {
+ @Override
+ protected boolean isServiceRunning(Context context, ComponentName service) {
+ return true;
+ }
+ };
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+
+ assertTrue(checkShouldOverrideInstalledFrom(rsvp, true));
+
+ assertEquals(RouterServiceValidator.getRefreshRate(), REFRESH_TRUSTED_APP_LIST_TIME_WEEK);
+
+ assertFalse(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, null, trustedListCallback));
+
+ //This should always return true
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+
+ }
+
+ public boolean checkShouldOverrideInstalledFrom(RouterServiceValidator rsvp, boolean shouldOverride) {
+ try {
+ Method shouldOverrideInstalledFrom = RouterServiceValidator.class.getDeclaredMethod("shouldOverrideInstalledFrom");
+ shouldOverrideInstalledFrom.setAccessible(true);
+ boolean should = (Boolean) shouldOverrideInstalledFrom.invoke(rsvp);
+
+ return shouldOverride == should;
+
+ } catch (NoSuchMethodException e1) {
+ fail(e1.getMessage());
+ } catch (IllegalAccessException e2) {
+ fail(e2.getMessage());
+ } catch (InvocationTargetException e3) {
+ fail(e3.getMessage());
+ }
+ return false;
+ }
+
+ @Test
+ public void testJsonRecovery() {
+ assertNotNull(rsvp.stringToJson(null));
+ assertNotNull(rsvp.stringToJson("asdf235vq32{]]"));
+
+ }
+
+ @Test
+ public void testInvalidateList() {
+ requestTListLock();
+
+ assertFalse(RouterServiceValidator.invalidateList(null));
+ assertTrue(RouterServiceValidator.invalidateList(getInstrumentation().getTargetContext()));
+
+ releaseTListLock();
+ }
+
+ @Test
+ public void testGetTrustedList() {
+ requestTListLock();
+
+ assertNull(RouterServiceValidator.getTrustedList(null));
+ assertNotNull(RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext()));
+
+ releaseTListLock();
+ }
+
+ @Test
+ public void testSetTrustedList() {
+ requestTListLock();
+
+ assertFalse(RouterServiceValidator.setTrustedList(null, null));
+ assertFalse(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), null));
+ assertFalse(RouterServiceValidator.setTrustedList(null, "test"));
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), "test"));
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), TEST));
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), TEST + TEST + TEST + TEST + TEST));
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < 1000; i++) {
+ builder.append(TEST);
+ }
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), builder.toString()));
+
+ releaseTListLock();
+ }
+
+ @Test
+ public void testTrustedListSetAndGet() {
+ requestTListLock();
+
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), TEST));
+ String retVal = RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext());
+ assertNotNull(retVal);
+ assertTrue(TEST.equals(retVal));
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < 1000; i++) {
+ builder.append(TEST);
+ }
+ assertTrue(RouterServiceValidator.setTrustedList(getInstrumentation().getTargetContext(), builder.toString()));
+ retVal = RouterServiceValidator.getTrustedList(getInstrumentation().getTargetContext());
+ assertNotNull(retVal);
+ assertTrue(builder.toString().equals(retVal));
+
+ releaseTListLock();
+ }
+
+ @Test
+ public void testInvalidationSequence() {
+ requestTListLock();
+
+ assertTrue(RouterServiceValidator.invalidateList(getInstrumentation().getTargetContext()));
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), false, null, trustedListCallback));
+ }
+
+ @Test
+ public void testAppStorePackages() {
+ assertTrue(TrustedAppStore.isTrustedStore(TrustedAppStore.PLAY_STORE.packageString));
+ assertTrue(TrustedAppStore.isTrustedStore("com.xiaomi.market"));
+ assertFalse(TrustedAppStore.isTrustedStore("test"));
+ assertFalse(TrustedAppStore.isTrustedStore(null));
+
+ rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
+ rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_INSTALLED_FROM_CHECK);
+ rsvp.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+
+ PackageManager packageManager = getInstrumentation().getTargetContext().getPackageManager();
+ List<PackageInfo> packages = packageManager.getInstalledPackages(0);
+ String appStore;
+ for (PackageInfo info : packages) {
+ appStore = packageManager.getInstallerPackageName(info.packageName);
+ if (TrustedAppStore.isTrustedStore(appStore)) {
+ assertTrue(rsvp.wasInstalledByAppStore(info.packageName));
+ }
+ }
+
+ assertFalse(rsvp.wasInstalledByAppStore(null));
+ }
+
+ @Test
+ public void testVersionBlackList() {
+ rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
+ JSONArray array = new JSONArray();
+ for (int i = 0; i < 25; i++) {
+ if (i % 3 == 0) {
+ array.put(i);
+ }
+ }
+ assertTrue(rsvp.verifyVersion(1, null));
+ assertTrue(rsvp.verifyVersion(1, array));
+ assertTrue(rsvp.verifyVersion(100, array));
+ assertFalse(rsvp.verifyVersion(3, array));
+ assertFalse(rsvp.verifyVersion(-3, array));
+
+ }
+
+ static boolean didFinish = false;
+
+ @Test
+ public void testGetAndCheckList() {
+ requestTListLock();
+
+ final Object REQUEST_LOCK = new Object();
+ didFinish = false;
+ HttpRequestTaskCallback cb = new HttpRequestTaskCallback() {
+
+ @Override
+ public void httpCallComplete(String response) {
+ //Might want to check if this list is ok
+ Log.d(TAG, "APPS! " + response);
+ synchronized (REQUEST_LOCK) {
+ didFinish = true;
+ REQUEST_LOCK.notify();
+ }
+ releaseTListLock();
+ }
+
+ @Override
+ public void httpFailure(int statusCode) {
+ Log.e(TAG, "Error while requesting trusted app list: " + statusCode);
+ synchronized (REQUEST_LOCK) {
+ didFinish = true;
+ REQUEST_LOCK.notify();
+ }
+ releaseTListLock();
+ }
+ };
+
+ assertTrue(RouterServiceValidator.createTrustedListRequest(getInstrumentation().getTargetContext(), true, cb, null));
+ //Now wait for call to finish
+ synchronized (REQUEST_LOCK) {
+ try {
+ REQUEST_LOCK.wait();
+ assertTrue(didFinish);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ }
+
+ /**
+ * Test to check that we can save our last request which actually houses all the previous known sdl enabled apps
+ */
+ @Test
+ public void testRequestChange() {
+ requestTListLock();
+
+ RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), null);
+ assertNull(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext()));
+
+ JSONObject object = null;
+ try {
+ object = new JSONObject(TEST);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(object);
+ assertFalse(object.equals(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext())));
+
+ assertTrue(RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), object.toString()));
+
+ String oldRequest = RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext());
+ assertNotNull(oldRequest);
+ assertTrue(object.toString().equals(oldRequest));
+
+ //Now test a new list
+ String test = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.test.test\" : { \"versionBlacklist\":[] },\"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
+ object = null;
+ try {
+ object = new JSONObject(test);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(object);
+ assertFalse(object.equals(RouterServiceValidator.getLastRequest(getInstrumentation().getTargetContext())));
+ //Clear it for next test
+ RouterServiceValidator.setLastRequest(getInstrumentation().getTargetContext(), null);
+
+ releaseTListLock();
+ }
+
+ /**
+ * Test app's router validation. Validation should fail when the given context and ComponentName object are from different packages and security setting is not OFF
+ * and app is not on trusted list. Validation should pass when the given context and ComponentName object are from the same package.
+ */
+ @Test
+ public void testAppSelfValidation() {
+
+ class RouterServiceValidatorTest extends RouterServiceValidator {
+ public RouterServiceValidatorTest(Context context) {
+ super(context);
+ }
+
+ public RouterServiceValidatorTest(Context context, ComponentName service) {
+ super(context, service);
+ }
+
+ // Override this method and simply returning true for the purpose of this test
+ protected boolean isServiceRunning(Context context, ComponentName service) {
+ return true;
+ }
+ }
+
+ // Fail, different package name for context and service and app security setting is not OFF and app is not on trusted list
+ RouterServiceValidatorTest rsvpFail = new RouterServiceValidatorTest(getInstrumentation().getTargetContext(), new ComponentName("anything", getInstrumentation().getTargetContext().getClass().getSimpleName()));
+ rsvpFail.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ rsvpFail.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertFalse(valid);
+ }
+ });
+
+ // Success, same package name for context and service
+ RouterServiceValidatorTest rsvpPass = new RouterServiceValidatorTest(getInstrumentation().getTargetContext(), new ComponentName(getInstrumentation().getTargetContext().getPackageName(), getInstrumentation().getTargetContext().getClass().getSimpleName()));
+ rsvpPass.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ rsvpPass.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ assertTrue(valid);
+ }
+ });
+ }
+
+ /**
+ * Unit test for validateAsync.
+ */
+ @Test
+ public void testValidateAsync() {
+ final MultiplexTransportConfig config = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ final RouterServiceValidator validator = new RouterServiceValidator(config);
+ final ConditionVariable cond = new ConditionVariable();
+ validator.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ Log.d(TAG, "onFinishedValidation: valid=" + valid + "; componentName=" + name);
+ assertFalse(valid); // expected valid = false for this (bogus) APP_ID..
+ cond.open();
+ }
+ });
+ cond.block();
+
+ // next, test for FLAG_MULTI_SECURITY_OFF
+ final MultiplexTransportConfig config2 = new MultiplexTransportConfig(getInstrumentation().getTargetContext(), APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+ final RouterServiceValidator validator2 = new RouterServiceValidator(config2);
+ cond.close();
+ validator2.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+ Log.d(TAG, "onFinishedValidation: valid=" + valid + "; componentName=" + name);
+ // return value does not matter when security is off.
+ cond.open();
+ }
+ });
+ cond.block();
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
index d9af0faed..6a7d0b4fa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RegisteredAppTests.java
@@ -36,7 +36,7 @@ public class RegisteredAppTests {
SdlRouterService.RegisteredApp app = router.new RegisteredApp(APP_ID, 1, messenger);
// Call Handle Message
- app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START,bytes, TransportType.BLUETOOTH);
+ app.handleMessage(TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START, bytes, TransportType.BLUETOOTH);
// Insure that the buffer is not null, if it is the test will fail
assertNotNull(app.buffer);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
index 2ab12e51a..cc5252cdd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
@@ -59,15 +59,15 @@ public class SdlRouterServiceTests {
ProtocolMessage pm = null;
BinaryFrameHeader binFrameHeader = null;
- /**
- * Ensure that the router service hardcoded number is the same as the integer value in
- * the resources.
- */
- @Test
- public void testVersionCorrectness(){
- int resourceVersion = getInstrumentation().getContext().getResources().getInteger(com.smartdevicelink.test.R.integer.sdl_router_service_version_value);
- assertEquals(resourceVersion, SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER);
- }
+ /**
+ * Ensure that the router service hardcoded number is the same as the integer value in
+ * the resources.
+ */
+ @Test
+ public void testVersionCorrectness() {
+ int resourceVersion = getInstrumentation().getContext().getResources().getInteger(com.smartdevicelink.test.R.integer.sdl_router_service_version_value);
+ assertEquals(resourceVersion, SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER);
+ }
/**
* Test null bundle handling in AltTransportHandler when handling messages. Only test the case of
@@ -170,535 +170,536 @@ public class SdlRouterServiceTests {
}
}
- /**
- * Test sending UAI to an app whose session id is the same as a removed app
- * but is indeed a different app
- *
- * @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
- */
- @Test
- public void testRegisterAppExistingSessionIDDifferentApp() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- // create instance of router service
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- // We need a registered app for this to work
- Message message = Message.obtain();
- SdlRouterService.RegisteredApp app1 = sdlRouterService.new RegisteredApp("12345", 1, message.replyTo);
- SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344", 1, message.replyTo);
- HashMap<String,SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
- registeredApps.put(app1.getAppId(),app1);
- registeredApps.put(app2.getAppId(),app2);
-
- // set registered apps array
- Field raf = sdlRouterService.getClass().getDeclaredField("registeredApps");
- raf.setAccessible(true);
- raf.set(sdlRouterService, registeredApps);
-
- // need a session map too
- SparseArray<String> sessionMap = new SparseArray<String>();
- sessionMap.put(1, "12345");
- Field sessionMapField = sdlRouterService.getClass().getDeclaredField("bluetoothSessionMap");
- sessionMapField.setAccessible(true);
- sessionMapField.set(sdlRouterService, sessionMap);
-
- // set cleaned session map
- SparseIntArray testCleanedMap = new SparseIntArray();
- testCleanedMap.put(1, 12345);
- Field f = sdlRouterService.getClass().getDeclaredField("cleanedSessionMap");
- f.setAccessible(true);
- f.set(sdlRouterService, testCleanedMap);
-
- // set session hash id map
- SparseIntArray testHashIdMap = new SparseIntArray();
- testHashIdMap.put(1, 12344);
- Field f2 = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
- f2.setAccessible(true);
- f2.set(sdlRouterService, testHashIdMap);
-
- // make sure maps are set and NOT the same
- Assert.assertNotNull(raf.get(sdlRouterService));
- Assert.assertNotNull(sessionMapField.get(sdlRouterService));
- Assert.assertNotNull(f.get(sdlRouterService));
- Assert.assertNotNull(f2.get(sdlRouterService));
-
- // make da RPC
- UnregisterAppInterface request = new UnregisterAppInterface();
- request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
-
- // build protocol message
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte) version);
- pm = new ProtocolMessage();
- pm.setData(msgBytes);
- pm.setSessionID((byte) sessionId);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
- pm.setCorrID(request.getCorrelationID());
-
- if (request.getBulkData() != null) {
- pm.setBulkData(request.getBulkData());
- }
-
- // binary frame header
- byte[] data = new byte[12 + pm.getJsonSize()];
- binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
- System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
- System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
-
- // create packet and invoke sendPacketToRegisteredApp
- SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, 123, data);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
-
- // we do not want the UAI packet to be sent. make sure it is dropped
- Assert.assertFalse(success);
-
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
- /**
- * Test sending UAI to an app whose session id is the same as a removed app
- * but is indeed the SAME app
- *
- * @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
- */
- @Test
- public void testRegisterAppExistingSessionIDSameApp() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- // create instance of router service
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- // We need a registered app for this to work
- Message message = Message.obtain();
- SdlRouterService.RegisteredApp app1 = sdlRouterService.new RegisteredApp("12345", 1, message.replyTo);
- SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344", 1, message.replyTo);
- HashMap<String,SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
- registeredApps.put(app1.getAppId(),app1);
- registeredApps.put(app2.getAppId(),app2);
-
- // set registered apps array
- Field raf = sdlRouterService.getClass().getDeclaredField("registeredApps");
- raf.setAccessible(true);
- raf.set(sdlRouterService, registeredApps);
-
- // need a session map too
- SparseArray<String> sessionMap = new SparseArray<String>();
- sessionMap.put(1, "12345");
- Field sessionMapField = sdlRouterService.getClass().getDeclaredField("bluetoothSessionMap");
- sessionMapField.setAccessible(true);
- sessionMapField.set(sdlRouterService, sessionMap);
-
- // set cleaned session map
- SparseIntArray testCleanedMap = new SparseIntArray();
- testCleanedMap.put(1, 12345);
- Field f = sdlRouterService.getClass().getDeclaredField("cleanedSessionMap");
- f.setAccessible(true);
- f.set(sdlRouterService, testCleanedMap);
-
- // set session hash id map
- SparseIntArray testHashIdMap = new SparseIntArray();
- testHashIdMap.put(1, 12345);
- Field f2 = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
- f2.setAccessible(true);
- f2.set(sdlRouterService, testHashIdMap);
-
- // make sure maps are set and NOT the same
- Assert.assertNotNull(raf.get(sdlRouterService));
- Assert.assertNotNull(sessionMapField.get(sdlRouterService));
- Assert.assertNotNull(f.get(sdlRouterService));
- Assert.assertNotNull(f2.get(sdlRouterService));
-
- // make da RPC
- UnregisterAppInterface request = new UnregisterAppInterface();
- request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
-
- // build protocol message
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte) version);
- pm = new ProtocolMessage();
- pm.setData(msgBytes);
- pm.setSessionID((byte) sessionId);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
- pm.setCorrID(request.getCorrelationID());
-
- if (request.getBulkData() != null) {
- pm.setBulkData(request.getBulkData());
- }
-
- // binary frame header
- byte[] data = new byte[12 + pm.getJsonSize()];
- binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
- System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
- System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
-
- // create packet and invoke sendPacketToRegisteredApp
- SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, 123, data);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
-
- // Since it is the same app, allow the packet to be sent
- Assert.assertTrue(success);
-
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- /**
- * Test router service correctly picks up Hash ID from start service ACK (prior to V5)
- */
- @Test
- public void testStartSessionAckHashId() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- initFields(sdlRouterService);
- addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
-
- // create packet and invoke sendPacketToRegisteredApp
- int hashId = 0x123456;
- byte[] payload = new byte[]{0x00, 0x12, 0x34, 0x56};
- SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, payload.length, 2, payload);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
-
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- method.setAccessible(true);
- Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
- Assert.assertTrue(success);
-
- // verify hash id map contains the correct ID
- Field field = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
- field.setAccessible(true);
- SparseIntArray sessionHashIdMap = (SparseIntArray)field.get(sdlRouterService);
-
- Assert.assertTrue(sessionHashIdMap.indexOfKey(sessionId) >= 0);
- int value = sessionHashIdMap.get(sessionId, -1);
- Assert.assertEquals(hashId, value);
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- /**
- * Test router service correctly acquires Hash ID from V5 start service ACK
- */
- @Test
- public void testStartSessionAckV5HashId() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- initFields(sdlRouterService);
- addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
-
- // create packet and invoke sendPacketToRegisteredApp
- int hashId = 0x123456;
- SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- packet.constructPacket(); // update 'payload' field in the packet instance
-
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- method.setAccessible(true);
- Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
- Assert.assertTrue(success);
-
- // verify hash id map contains the correct ID
- Field field = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
- field.setAccessible(true);
- SparseIntArray sessionHashIdMap = (SparseIntArray)field.get(sdlRouterService);
-
- Assert.assertTrue(sessionHashIdMap.indexOfKey(sessionId) >= 0);
- int value = sessionHashIdMap.get(sessionId, -1);
- Assert.assertEquals(hashId, value);
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- /**
- * Test router service sends a valid end service request from attemptToCleanupModule()
- */
- @Test
- public void testEndSessionV5FromAttemptToCleanupModule() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- initFields(sdlRouterService);
- addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
-
- MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
- Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
- btf.setAccessible(true);
- btf.set(sdlRouterService, mockTransport);
-
- // create packet and invoke sendPacketToRegisteredApp
- int hashId = 0x123456;
- SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- packet.constructPacket(); // update 'payload' field in the packet instance
-
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- method.setAccessible(true);
- Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
- Assert.assertTrue(success);
-
- when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
-
- // now call attemptToCleanUpModule()
- method = sdlRouterService.getClass().getDeclaredMethod("attemptToCleanUpModule", int.class, int.class, TransportType.class);
- method.setAccessible(true);
- method.invoke(sdlRouterService, sessionId, 5, TransportType.BLUETOOTH);
-
- ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
- verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
-
- List<byte[]> frames = argument.getAllValues();
-
- // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
- Assert.assertEquals(2, frames.size());
-
- // then we should receive a end service frame
- byte[] expectedBsonPayload = new byte[] {
- 0x11, 0x00, 0x00, 0x00, /* total bytes */
- 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
- 0x00, /* end of document */
- };
- byte[] actualFrame = frames.get(1);
-
- Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
- Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
- Assert.assertEquals(actualFrame[3], (byte)sessionId);
- byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
- Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- /**
- * Test router service sends a valid end service request when it receives a packet from Core
- * and the app has been unregistered
- */
- @Test
- public void testEndSessionV5WhenPacketForUnregisteredAppReceived() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- SdlRouterService sdlRouterService = new SdlRouterService();
-
- initFields(sdlRouterService);
- addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
- // The end service frame will not be sent out if there is no app in the map. Is this expected?
- addDummyRegisteredApp(sdlRouterService, "12346", 2);
-
- MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
- Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
- btf.setAccessible(true);
- btf.set(sdlRouterService, mockTransport);
-
- // create packet and invoke sendPacketToRegisteredApp
- int hashId = 0x123456;
- SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- packet.constructPacket(); // update 'payload' field in the packet instance
-
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- method.setAccessible(true);
- Boolean ret = (Boolean) method.invoke(sdlRouterService, packet);
- Assert.assertTrue(ret);
-
- // remove the app from "registeredApps" map
- Field field = sdlRouterService.getClass().getDeclaredField("registeredApps");
- field.setAccessible(true);
- HashMap<String, SdlRouterService.RegisteredApp> registeredApps = (HashMap<String,SdlRouterService.RegisteredApp>)field.get(sdlRouterService);
- registeredApps.remove("12345");
-
- when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
-
- // call sendPacketToRegisteredApp once again with a dummy packet
- byte[] dummyRegisterAppInterface = new byte[]{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, '{', '}'};
- SdlPacket dummyPacket = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0x00, sessionId, dummyRegisterAppInterface.length, 3, dummyRegisterAppInterface);
- dummyPacket.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
-
- ret = (Boolean) method.invoke(sdlRouterService, dummyPacket);
- Assert.assertFalse(ret);
-
- ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
- verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
-
- List<byte[]> frames = argument.getAllValues();
-
- // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
- Assert.assertEquals(2, frames.size());
-
- // then we should receive a end service frame
- byte[] expectedBsonPayload = new byte[] {
- 0x11, 0x00, 0x00, 0x00, /* total bytes */
- 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
- 0x00, /* end of document */
- };
- byte[] actualFrame = frames.get(1);
-
- Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
- Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
- Assert.assertEquals(actualFrame[3], (byte)sessionId);
- byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
- Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- /**
- * Test router service sends a valid end service request when it fails to deliver a message
- * to an app
- */
- @Test
- public void testEndSessionV5WhenSendMessageToClientFailed() {
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- Method method;
- try {
- SdlRouterService sdlRouterService = new SdlRouterService();
- initFields(sdlRouterService);
- addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
-
- // create packet and invoke sendPacketToRegisteredApp
- int hashId = 0x123456;
- SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
- packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
- packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH,null));
- packet.constructPacket(); // update 'payload' field in the packet instance
-
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
- method.setAccessible(true);
- Boolean ret = (Boolean) method.invoke(sdlRouterService, packet);
- Assert.assertTrue(ret);
-
- SdlRouterService.RegisteredApp mockApp = mock(SdlRouterService.RegisteredApp.class);
- when(mockApp.sendMessage(any(Message.class))).thenReturn(SdlRouterService.RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT);
- Vector<Long> dummySessionIds = new Vector<>();
- dummySessionIds.add((long)sessionId);
- when(mockApp.getSessionIds()).thenReturn(dummySessionIds);
- List<TransportType> dummyTransportTypes = new ArrayList<>();
- dummyTransportTypes.add(TransportType.BLUETOOTH);
- when(mockApp.getTransportsForSession(sessionId)).thenReturn(dummyTransportTypes);
-
- MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
- Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
- btf.setAccessible(true);
- btf.set(sdlRouterService, mockTransport);
-
- when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
-
- // invoke sendPacketMessageToClient
- method = sdlRouterService.getClass().getDeclaredMethod("sendPacketMessageToClient", SdlRouterService.RegisteredApp.class, Message.class, byte.class);
- method.setAccessible(true);
- Message dummyMessage = Message.obtain();
- ret = (Boolean) method.invoke(sdlRouterService, mockApp, dummyMessage, (byte)5);
- Assert.assertFalse(ret);
-
- ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
- verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
-
- List<byte[]> frames = argument.getAllValues();
-
- // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
- Assert.assertEquals(2, frames.size());
-
- // then we should receive a end service frame
- byte[] expectedBsonPayload = new byte[] {
- 0x11, 0x00, 0x00, 0x00, /* total bytes */
- 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
- 0x00, /* end of document */
- };
- byte[] actualFrame = frames.get(1);
-
- Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
- Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
- Assert.assertEquals(actualFrame[3], (byte)sessionId);
- byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
- Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
- } catch (Exception e) {
- Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
- }
- }
-
- private void initFields(SdlRouterService routerService) throws IllegalAccessException, NoSuchFieldException {
- // set registered apps array
- HashMap<String,SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
- Field raf = routerService.getClass().getDeclaredField("registeredApps");
- raf.setAccessible(true);
- raf.set(routerService, registeredApps);
-
- // need a session map too
- SparseArray<String> sessionMap = new SparseArray<String>();
- Field bsmf = routerService.getClass().getDeclaredField("bluetoothSessionMap");
- bsmf.setAccessible(true);
- bsmf.set(routerService, sessionMap);
-
- SparseIntArray emptyCleanedSessionMap = new SparseIntArray();
- Field csmf = routerService.getClass().getDeclaredField("cleanedSessionMap");
- csmf.setAccessible(true);
- csmf.set(routerService, emptyCleanedSessionMap);
-
- SparseIntArray emptyHashIdMap = new SparseIntArray();
- Field shmf = routerService.getClass().getDeclaredField("sessionHashIdMap");
- shmf.setAccessible(true);
- shmf.set(routerService, emptyHashIdMap);
- }
-
- private void addDummyRegisteredApp(SdlRouterService routerService, String appId, int sessionId)
- throws IllegalAccessException, NoSuchFieldException {
- Message message = Message.obtain();
- SdlRouterService.RegisteredApp app = routerService.new RegisteredApp(appId, 1, message.replyTo);
-
- Field raf = routerService.getClass().getDeclaredField("registeredApps");
- raf.setAccessible(true);
- HashMap<String, SdlRouterService.RegisteredApp> registeredApps = (HashMap<String,SdlRouterService.RegisteredApp>)raf.get(routerService);
- registeredApps.put(app.getAppId(), app);
-
- Field bsmf = routerService.getClass().getDeclaredField("bluetoothSessionMap");
- bsmf.setAccessible(true);
- SparseArray<String> sessionMap = (SparseArray<String>)bsmf.get(routerService);
- sessionMap.put(sessionId, appId);
- }
+ /**
+ * Test sending UAI to an app whose session id is the same as a removed app
+ * but is indeed a different app
+ *
+ * @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
+ */
+ @Test
+ public void testRegisterAppExistingSessionIDDifferentApp() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ // create instance of router service
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ // We need a registered app for this to work
+ Message message = Message.obtain();
+ SdlRouterService.RegisteredApp app1 = sdlRouterService.new RegisteredApp("12345", 1, message.replyTo);
+ SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344", 1, message.replyTo);
+ HashMap<String, SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
+ registeredApps.put(app1.getAppId(), app1);
+ registeredApps.put(app2.getAppId(), app2);
+
+ // set registered apps array
+ Field raf = sdlRouterService.getClass().getDeclaredField("registeredApps");
+ raf.setAccessible(true);
+ raf.set(sdlRouterService, registeredApps);
+
+ // need a session map too
+ SparseArray<String> sessionMap = new SparseArray<String>();
+ sessionMap.put(1, "12345");
+ Field sessionMapField = sdlRouterService.getClass().getDeclaredField("bluetoothSessionMap");
+ sessionMapField.setAccessible(true);
+ sessionMapField.set(sdlRouterService, sessionMap);
+
+ // set cleaned session map
+ SparseIntArray testCleanedMap = new SparseIntArray();
+ testCleanedMap.put(1, 12345);
+ Field f = sdlRouterService.getClass().getDeclaredField("cleanedSessionMap");
+ f.setAccessible(true);
+ f.set(sdlRouterService, testCleanedMap);
+
+ // set session hash id map
+ SparseIntArray testHashIdMap = new SparseIntArray();
+ testHashIdMap.put(1, 12344);
+ Field f2 = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
+ f2.setAccessible(true);
+ f2.set(sdlRouterService, testHashIdMap);
+
+ // make sure maps are set and NOT the same
+ Assert.assertNotNull(raf.get(sdlRouterService));
+ Assert.assertNotNull(sessionMapField.get(sdlRouterService));
+ Assert.assertNotNull(f.get(sdlRouterService));
+ Assert.assertNotNull(f2.get(sdlRouterService));
+
+ // make da RPC
+ UnregisterAppInterface request = new UnregisterAppInterface();
+ request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
+
+ // build protocol message
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte) version);
+ pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ pm.setSessionID((byte) sessionId);
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
+ pm.setCorrID(request.getCorrelationID());
+
+ if (request.getBulkData() != null) {
+ pm.setBulkData(request.getBulkData());
+ }
+
+ // binary frame header
+ byte[] data = new byte[12 + pm.getJsonSize()];
+ binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
+ System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
+ System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
+
+ // create packet and invoke sendPacketToRegisteredApp
+ SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, 123, data);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
+
+ // we do not want the UAI packet to be sent. make sure it is dropped
+ Assert.assertFalse(success);
+
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test sending UAI to an app whose session id is the same as a removed app
+ * but is indeed the SAME app
+ *
+ * @see SdlRouterService#sendPacketToRegisteredApp(SdlPacket)
+ */
+ @Test
+ public void testRegisterAppExistingSessionIDSameApp() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ // create instance of router service
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ // We need a registered app for this to work
+ Message message = Message.obtain();
+ SdlRouterService.RegisteredApp app1 = sdlRouterService.new RegisteredApp("12345", 1, message.replyTo);
+ SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344", 1, message.replyTo);
+ HashMap<String, SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
+ registeredApps.put(app1.getAppId(), app1);
+ registeredApps.put(app2.getAppId(), app2);
+
+ // set registered apps array
+ Field raf = sdlRouterService.getClass().getDeclaredField("registeredApps");
+ raf.setAccessible(true);
+ raf.set(sdlRouterService, registeredApps);
+
+ // need a session map too
+ SparseArray<String> sessionMap = new SparseArray<String>();
+ sessionMap.put(1, "12345");
+ Field sessionMapField = sdlRouterService.getClass().getDeclaredField("bluetoothSessionMap");
+ sessionMapField.setAccessible(true);
+ sessionMapField.set(sdlRouterService, sessionMap);
+
+ // set cleaned session map
+ SparseIntArray testCleanedMap = new SparseIntArray();
+ testCleanedMap.put(1, 12345);
+ Field f = sdlRouterService.getClass().getDeclaredField("cleanedSessionMap");
+ f.setAccessible(true);
+ f.set(sdlRouterService, testCleanedMap);
+
+ // set session hash id map
+ SparseIntArray testHashIdMap = new SparseIntArray();
+ testHashIdMap.put(1, 12345);
+ Field f2 = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
+ f2.setAccessible(true);
+ f2.set(sdlRouterService, testHashIdMap);
+
+ // make sure maps are set and NOT the same
+ Assert.assertNotNull(raf.get(sdlRouterService));
+ Assert.assertNotNull(sessionMapField.get(sdlRouterService));
+ Assert.assertNotNull(f.get(sdlRouterService));
+ Assert.assertNotNull(f2.get(sdlRouterService));
+
+ // make da RPC
+ UnregisterAppInterface request = new UnregisterAppInterface();
+ request.setCorrelationID(SAMPLE_RPC_CORRELATION_ID);
+
+ // build protocol message
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte) version);
+ pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ pm.setSessionID((byte) sessionId);
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
+ pm.setCorrID(request.getCorrelationID());
+
+ if (request.getBulkData() != null) {
+ pm.setBulkData(request.getBulkData());
+ }
+
+ // binary frame header
+ byte[] data = new byte[12 + pm.getJsonSize()];
+ binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
+ System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
+ System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
+
+ // create packet and invoke sendPacketToRegisteredApp
+ SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, 123, data);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
+
+ // Since it is the same app, allow the packet to be sent
+ Assert.assertTrue(success);
+
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test router service correctly picks up Hash ID from start service ACK (prior to V5)
+ */
+ @Test
+ public void testStartSessionAckHashId() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ initFields(sdlRouterService);
+ addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
+
+ // create packet and invoke sendPacketToRegisteredApp
+ int hashId = 0x123456;
+ byte[] payload = new byte[]{0x00, 0x12, 0x34, 0x56};
+ SdlPacket packet = new SdlPacket(4, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, payload.length, 2, payload);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ method.setAccessible(true);
+ Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
+ Assert.assertTrue(success);
+
+ // verify hash id map contains the correct ID
+ Field field = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
+ field.setAccessible(true);
+ SparseIntArray sessionHashIdMap = (SparseIntArray) field.get(sdlRouterService);
+
+ Assert.assertTrue(sessionHashIdMap.indexOfKey(sessionId) >= 0);
+ int value = sessionHashIdMap.get(sessionId, -1);
+ Assert.assertEquals(hashId, value);
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test router service correctly acquires Hash ID from V5 start service ACK
+ */
+ @Test
+ public void testStartSessionAckV5HashId() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ initFields(sdlRouterService);
+ addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
+
+ // create packet and invoke sendPacketToRegisteredApp
+ int hashId = 0x123456;
+ SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ packet.constructPacket(); // update 'payload' field in the packet instance
+
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ method.setAccessible(true);
+ Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
+ Assert.assertTrue(success);
+
+ // verify hash id map contains the correct ID
+ Field field = sdlRouterService.getClass().getDeclaredField("sessionHashIdMap");
+ field.setAccessible(true);
+ SparseIntArray sessionHashIdMap = (SparseIntArray) field.get(sdlRouterService);
+
+ Assert.assertTrue(sessionHashIdMap.indexOfKey(sessionId) >= 0);
+ int value = sessionHashIdMap.get(sessionId, -1);
+ Assert.assertEquals(hashId, value);
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test router service sends a valid end service request from attemptToCleanupModule()
+ */
+ @Test
+ public void testEndSessionV5FromAttemptToCleanupModule() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ initFields(sdlRouterService);
+ addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
+
+ MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
+ Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
+ btf.setAccessible(true);
+ btf.set(sdlRouterService, mockTransport);
+
+ // create packet and invoke sendPacketToRegisteredApp
+ int hashId = 0x123456;
+ SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ packet.constructPacket(); // update 'payload' field in the packet instance
+
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ method.setAccessible(true);
+ Boolean success = (Boolean) method.invoke(sdlRouterService, packet);
+ Assert.assertTrue(success);
+
+ when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
+
+ // now call attemptToCleanUpModule()
+ method = sdlRouterService.getClass().getDeclaredMethod("attemptToCleanUpModule", int.class, int.class, TransportType.class);
+ method.setAccessible(true);
+ method.invoke(sdlRouterService, sessionId, 5, TransportType.BLUETOOTH);
+
+ ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
+ verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
+
+ List<byte[]> frames = argument.getAllValues();
+
+ // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
+ Assert.assertEquals(2, frames.size());
+
+ // then we should receive a end service frame
+ byte[] expectedBsonPayload = new byte[]{
+ 0x11, 0x00, 0x00, 0x00, /* total bytes */
+ 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
+ 0x00, /* end of document */
+ };
+ byte[] actualFrame = frames.get(1);
+
+ Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
+ Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
+ Assert.assertEquals(actualFrame[3], (byte) sessionId);
+ byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
+ Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test router service sends a valid end service request when it receives a packet from Core
+ * and the app has been unregistered
+ */
+ @Test
+ public void testEndSessionV5WhenPacketForUnregisteredAppReceived() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ SdlRouterService sdlRouterService = new SdlRouterService();
+
+ initFields(sdlRouterService);
+ addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
+ // The end service frame will not be sent out if there is no app in the map. Is this expected?
+ addDummyRegisteredApp(sdlRouterService, "12346", 2);
+
+ MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
+ Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
+ btf.setAccessible(true);
+ btf.set(sdlRouterService, mockTransport);
+
+ // create packet and invoke sendPacketToRegisteredApp
+ int hashId = 0x123456;
+ SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ packet.constructPacket(); // update 'payload' field in the packet instance
+
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ method.setAccessible(true);
+ Boolean ret = (Boolean) method.invoke(sdlRouterService, packet);
+ Assert.assertTrue(ret);
+
+ // remove the app from "registeredApps" map
+ Field field = sdlRouterService.getClass().getDeclaredField("registeredApps");
+ field.setAccessible(true);
+ HashMap<String, SdlRouterService.RegisteredApp> registeredApps = (HashMap<String, SdlRouterService.RegisteredApp>) field.get(sdlRouterService);
+ registeredApps.remove("12345");
+
+ when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
+
+ // call sendPacketToRegisteredApp once again with a dummy packet
+ byte[] dummyRegisterAppInterface = new byte[]{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, '{', '}'};
+ SdlPacket dummyPacket = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0x00, sessionId, dummyRegisterAppInterface.length, 3, dummyRegisterAppInterface);
+ dummyPacket.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+
+ ret = (Boolean) method.invoke(sdlRouterService, dummyPacket);
+ Assert.assertFalse(ret);
+
+ ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
+ verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
+
+ List<byte[]> frames = argument.getAllValues();
+
+ // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
+ Assert.assertEquals(2, frames.size());
+
+ // then we should receive a end service frame
+ byte[] expectedBsonPayload = new byte[]{
+ 0x11, 0x00, 0x00, 0x00, /* total bytes */
+ 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
+ 0x00, /* end of document */
+ };
+ byte[] actualFrame = frames.get(1);
+
+ Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
+ Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
+ Assert.assertEquals(actualFrame[3], (byte) sessionId);
+ byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
+ Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ /**
+ * Test router service sends a valid end service request when it fails to deliver a message
+ * to an app
+ */
+ @Test
+ public void testEndSessionV5WhenSendMessageToClientFailed() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ try {
+ SdlRouterService sdlRouterService = new SdlRouterService();
+ initFields(sdlRouterService);
+ addDummyRegisteredApp(sdlRouterService, "12345", sessionId);
+
+ // create packet and invoke sendPacketToRegisteredApp
+ int hashId = 0x123456;
+ SdlPacket packet = new SdlPacket(5, false, SdlPacket.FRAME_TYPE_CONTROL, SdlPacket.SERVICE_TYPE_RPC, SdlPacket.FRAME_INFO_START_SERVICE_ACK, sessionId, 0, 2, null);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION, "5.0.0");
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID, hashId);
+ packet.putTag(ControlFrameTags.RPC.StartServiceACK.MTU, 1024);
+ packet.setTransportRecord(new TransportRecord(TransportType.BLUETOOTH, null));
+ packet.constructPacket(); // update 'payload' field in the packet instance
+
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketToRegisteredApp", SdlPacket.class);
+ method.setAccessible(true);
+ Boolean ret = (Boolean) method.invoke(sdlRouterService, packet);
+ Assert.assertTrue(ret);
+
+ SdlRouterService.RegisteredApp mockApp = mock(SdlRouterService.RegisteredApp.class);
+ when(mockApp.sendMessage(any(Message.class))).thenReturn(SdlRouterService.RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT);
+ Vector<Long> dummySessionIds = new Vector<>();
+ dummySessionIds.add((long) sessionId);
+ when(mockApp.getSessionIds()).thenReturn(dummySessionIds);
+ List<TransportType> dummyTransportTypes = new ArrayList<>();
+ dummyTransportTypes.add(TransportType.BLUETOOTH);
+ when(mockApp.getTransportsForSession(sessionId)).thenReturn(dummyTransportTypes);
+
+ MultiplexBluetoothTransport mockTransport = mock(MultiplexBluetoothTransport.class);
+ Field btf = sdlRouterService.getClass().getDeclaredField("bluetoothTransport");
+ btf.setAccessible(true);
+ btf.set(sdlRouterService, mockTransport);
+
+ when(mockTransport.getState()).thenReturn(MultiplexBluetoothTransport.STATE_CONNECTED);
+
+ // invoke sendPacketMessageToClient
+ method = sdlRouterService.getClass().getDeclaredMethod("sendPacketMessageToClient", SdlRouterService.RegisteredApp.class, Message.class, byte.class);
+ method.setAccessible(true);
+ Message dummyMessage = Message.obtain();
+ ret = (Boolean) method.invoke(sdlRouterService, mockApp, dummyMessage, (byte) 5);
+ Assert.assertFalse(ret);
+
+ ArgumentCaptor<byte[]> argument = ArgumentCaptor.forClass(byte[].class);
+ verify(mockTransport, times(2)).write(argument.capture(), eq(0), anyInt());
+
+ List<byte[]> frames = argument.getAllValues();
+
+ // First, we receive UnregisterAppInterface. Verifying the message is out of scope of this test.
+ Assert.assertEquals(2, frames.size());
+
+ // then we should receive a end service frame
+ byte[] expectedBsonPayload = new byte[]{
+ 0x11, 0x00, 0x00, 0x00, /* total bytes */
+ 0x10, 'h', 'a', 's', 'h', 'I', 'd', 0x00, 0x56, 0x34, 0x12, 0x00, /* int32: "hashId": 0x00123456 */
+ 0x00, /* end of document */
+ };
+ byte[] actualFrame = frames.get(1);
+
+ Assert.assertEquals(12 + expectedBsonPayload.length, actualFrame.length);
+ Assert.assertEquals(actualFrame[2], 0x04 /* end service */);
+ Assert.assertEquals(actualFrame[3], (byte) sessionId);
+ byte[] actualPayload = Arrays.copyOfRange(actualFrame, 12, actualFrame.length);
+ Assert.assertTrue(Arrays.equals(expectedBsonPayload, actualPayload));
+ } catch (Exception e) {
+ Assert.fail("Exception in sendPacketToRegisteredApp, " + e);
+ }
+ }
+
+ private void initFields(SdlRouterService routerService) throws IllegalAccessException, NoSuchFieldException {
+ // set registered apps array
+ HashMap<String, SdlRouterService.RegisteredApp> registeredApps = new HashMap<>();
+ Field raf = routerService.getClass().getDeclaredField("registeredApps");
+ raf.setAccessible(true);
+ raf.set(routerService, registeredApps);
+
+ // need a session map too
+ SparseArray<String> sessionMap = new SparseArray<String>();
+ Field bsmf = routerService.getClass().getDeclaredField("bluetoothSessionMap");
+ bsmf.setAccessible(true);
+ bsmf.set(routerService, sessionMap);
+
+ SparseIntArray emptyCleanedSessionMap = new SparseIntArray();
+ Field csmf = routerService.getClass().getDeclaredField("cleanedSessionMap");
+ csmf.setAccessible(true);
+ csmf.set(routerService, emptyCleanedSessionMap);
+
+ SparseIntArray emptyHashIdMap = new SparseIntArray();
+ Field shmf = routerService.getClass().getDeclaredField("sessionHashIdMap");
+ shmf.setAccessible(true);
+ shmf.set(routerService, emptyHashIdMap);
+ }
+
+ private void addDummyRegisteredApp(SdlRouterService routerService, String appId, int sessionId)
+ throws IllegalAccessException, NoSuchFieldException {
+ Message message = Message.obtain();
+ SdlRouterService.RegisteredApp app = routerService.new RegisteredApp(appId, 1, message.replyTo);
+
+ Field raf = routerService.getClass().getDeclaredField("registeredApps");
+ raf.setAccessible(true);
+ HashMap<String, SdlRouterService.RegisteredApp> registeredApps = (HashMap<String, SdlRouterService.RegisteredApp>) raf.get(routerService);
+ registeredApps.put(app.getAppId(), app);
+
+ Field bsmf = routerService.getClass().getDeclaredField("bluetoothSessionMap");
+ bsmf.setAccessible(true);
+ SparseArray<String> sessionMap = (SparseArray<String>) bsmf.get(routerService);
+ sessionMap.put(sessionId, appId);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
index 811fd8307..977bb3020 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportBrokerTest.java
@@ -23,118 +23,119 @@ import static junit.framework.TestCase.assertTrue;
@RunWith(AndroidJUnit4.class)
public class TransportBrokerTest { //FIXME this test class needs to be fixed. At this point these tests are not helpful
- RouterServiceValidator rsvp;
- // public TransportBrokerThread(Context context, String appId, ComponentName service){
-
- @Before
- public void setUp() throws Exception {
- rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
- rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
- @Override
- public void onFinishedValidation(boolean valid, ComponentName name) {
-
- }
- });
-
- }
-
- private void sleep(){
- try{
- Thread.sleep(500);
- }catch(Exception e){}
- }
-
- @Test
- public void testStart(){
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
- if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
- assertTrue(broker.start());
- }
- broker.stop();
-
- }
-
- @Test
- public void testSendPacket(){
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
-
- TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID,rsvp.getService());
-
- if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
- assertTrue(broker.start());
- }
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if(!DeviceUtil.isEmulator()){ // Cannot perform BT adapter operations in emulator
- assertNotNull(adapter);
- assertTrue(adapter.isEnabled());
- }
- //Not ideal, but not implementing callbacks just for unit tests
- int count = 0;
- while(broker.routerServiceMessenger == null && count<10){
- sleep();
- count++;
- }
- if(!DeviceUtil.isEmulator()){ // Cannot perform BT adapter operations in emulator
- assertNotNull(broker.routerServiceMessenger);
- }
-
- //assertFalse(broker.sendPacketToRouterService(null, 0, 0));
- //assertFalse(broker.sendPacketToRouterService(new byte[3], -1, 0));
- //assertFalse(broker.sendPacketToRouterService(new byte[3], 0, 4));
- //assertTrue(broker.sendPacketToRouterService(new byte[3],0, 3));
-
- broker.stop();
-
- }
-
- @Test
- public void testOnPacketReceived(){
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
- TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
- if(!DeviceUtil.isEmulator()){ // Cannot perform MBT operations in emulator
- assertTrue(broker.start());
- }
-
- }
-
- @Test
- public void testSendMessageToRouterService(){
- if (Looper.myLooper() == null) {
- Looper.prepare();
- }
-
- TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
- Handler handler = new Handler();
- Message message = new Message();
- broker.routerServiceMessenger = null;
- broker.isBound = true;
-
- assertFalse(broker.sendMessageToRouterService(message));
-
- broker.routerServiceMessenger = new Messenger(handler); //So it's not ambiguous
-
- broker.isBound = false;
-
- assertFalse(broker.sendMessageToRouterService(message));
-
- broker.isBound = true;
- broker.registeredWithRouterService = true;
-
- message = null;
-
- assertFalse(broker.sendMessageToRouterService(message));
-
- message = new Message();
-
- assertTrue(broker.sendMessageToRouterService(message));
-
- }
+ RouterServiceValidator rsvp;
+ // public TransportBrokerThread(Context context, String appId, ComponentName service){
+
+ @Before
+ public void setUp() throws Exception {
+ rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
+ rsvp.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
+ @Override
+ public void onFinishedValidation(boolean valid, ComponentName name) {
+
+ }
+ });
+
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(500);
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testStart() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+ if (!DeviceUtil.isEmulator()) { // Cannot perform MBT operations in emulator
+ assertTrue(broker.start());
+ }
+ broker.stop();
+
+ }
+
+ @Test
+ public void testSendPacket() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+
+ TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+
+ if (!DeviceUtil.isEmulator()) { // Cannot perform MBT operations in emulator
+ assertTrue(broker.start());
+ }
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if (!DeviceUtil.isEmulator()) { // Cannot perform BT adapter operations in emulator
+ assertNotNull(adapter);
+ assertTrue(adapter.isEnabled());
+ }
+ //Not ideal, but not implementing callbacks just for unit tests
+ int count = 0;
+ while (broker.routerServiceMessenger == null && count < 10) {
+ sleep();
+ count++;
+ }
+ if (!DeviceUtil.isEmulator()) { // Cannot perform BT adapter operations in emulator
+ assertNotNull(broker.routerServiceMessenger);
+ }
+
+ //assertFalse(broker.sendPacketToRouterService(null, 0, 0));
+ //assertFalse(broker.sendPacketToRouterService(new byte[3], -1, 0));
+ //assertFalse(broker.sendPacketToRouterService(new byte[3], 0, 4));
+ //assertTrue(broker.sendPacketToRouterService(new byte[3],0, 3));
+
+ broker.stop();
+
+ }
+
+ @Test
+ public void testOnPacketReceived() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+ if (!DeviceUtil.isEmulator()) { // Cannot perform MBT operations in emulator
+ assertTrue(broker.start());
+ }
+
+ }
+
+ @Test
+ public void testSendMessageToRouterService() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+
+ TransportBroker broker = new TransportBroker(getInstrumentation().getTargetContext(), SdlUnitTestContants.TEST_APP_ID, rsvp.getService());
+ Handler handler = new Handler();
+ Message message = new Message();
+ broker.routerServiceMessenger = null;
+ broker.isBound = true;
+
+ assertFalse(broker.sendMessageToRouterService(message));
+
+ broker.routerServiceMessenger = new Messenger(handler); //So it's not ambiguous
+
+ broker.isBound = false;
+
+ assertFalse(broker.sendMessageToRouterService(message));
+
+ broker.isBound = true;
+ broker.registeredWithRouterService = true;
+
+ message = null;
+
+ assertFalse(broker.sendMessageToRouterService(message));
+
+ message = new Message();
+
+ assertTrue(broker.sendMessageToRouterService(message));
+
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
index a808ba936..06a31bc59 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/TransportManagerTests.java
@@ -31,21 +31,32 @@ public class TransportManagerTests {
MultiplexTransportConfig config;
final TransportRecord defaultBtRecord = new TransportRecord(TransportType.BLUETOOTH, "12:34:56:78:90");
- final ComponentName routerServiceComponentName = new ComponentName("com.smartdevicelink.test","com.smartdevicelink.test.SdlRouterService");
- final SdlPacket defaultPacket = SdlPacketFactory.createStartSessionACK(SessionType.RPC,(byte)1,100,(byte)5);
+ final ComponentName routerServiceComponentName = new ComponentName("com.smartdevicelink.test", "com.smartdevicelink.test.SdlRouterService");
+ final SdlPacket defaultPacket = SdlPacketFactory.createStartSessionACK(SessionType.RPC, (byte) 1, 100, (byte) 5);
TransportManager.TransportEventListener defaultListener = new TransportManager.TransportEventListener() {
@Override
- public void onPacketReceived(SdlPacket packet) { assertEquals(defaultPacket,packet);}
+ public void onPacketReceived(SdlPacket packet) {
+ assertEquals(defaultPacket, packet);
+ }
+
@Override
- public void onTransportConnected(List<TransportRecord> transports) {}
+ public void onTransportConnected(List<TransportRecord> transports) {
+ }
+
@Override
- public void onTransportDisconnected(String info, TransportRecord type, List<TransportRecord> connectedTransports) {}
+ public void onTransportDisconnected(String info, TransportRecord type, List<TransportRecord> connectedTransports) {
+ }
+
@Override
- public void onError(String info) {}
+ public void onError(String info) {
+ }
+
@Override
- public boolean onLegacyModeEnabled(String info) {return false; }
+ public boolean onLegacyModeEnabled(String info) {
+ return false;
+ }
};
@@ -60,8 +71,8 @@ public class TransportManagerTests {
}
- public TransportManager createTransportManager(){
- TransportManager manager = new TransportManager(config,defaultListener);
+ public TransportManager createTransportManager() {
+ TransportManager manager = new TransportManager(config, defaultListener);
//The default listener returns false as legacy is unacceptable
assertNull(manager.legacyBluetoothHandler);
@@ -75,14 +86,14 @@ public class TransportManagerTests {
}
@Test
- public void testBase(){
- TransportManager manager = new TransportManager(config,defaultListener);
+ public void testBase() {
+ TransportManager manager = new TransportManager(config, defaultListener);
assertNotNull(manager);
}
@Test
- public void testConnectionStatus(){
- TransportManager manager = new TransportManager(config,defaultListener);
+ public void testConnectionStatus() {
+ TransportManager manager = new TransportManager(config, defaultListener);
manager.transportStatus.clear();
manager.transportStatus.add(defaultBtRecord);
@@ -100,14 +111,14 @@ public class TransportManagerTests {
assertFalse(manager.isHighBandwidthAvailable());
- manager.transportStatus.add(new TransportRecord(TransportType.USB,"test"));
+ manager.transportStatus.add(new TransportRecord(TransportType.USB, "test"));
assertTrue(manager.isHighBandwidthAvailable());
assertNotNull(manager.getTransportRecord(TransportType.USB, null));
}
@Test
- public void testOnTransportConnections(){
+ public void testOnTransportConnections() {
TransportManager manager = createTransportManager();
@@ -129,7 +140,7 @@ public class TransportManagerTests {
}
@Test
- public void testOnPacket(){
+ public void testOnPacket() {
TransportManager manager = createTransportManager();
assertNotNull(manager.transportListener);
@@ -138,5 +149,4 @@ public class TransportManagerTests {
}
-
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
index 4a80343ad..b2d1cf890 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/util/MediaStreamingStatusTests.java
@@ -35,7 +35,6 @@ import static org.mockito.Mockito.spy;
public class MediaStreamingStatusTests {
-
@Mock
private AudioManager audioManager = mock(AudioManager.class);
@@ -49,9 +48,9 @@ public class MediaStreamingStatusTests {
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
String serviceName = (String) args[0];
- if(serviceName != null && serviceName.equalsIgnoreCase(Context.AUDIO_SERVICE)){
+ if (serviceName != null && serviceName.equalsIgnoreCase(Context.AUDIO_SERVICE)) {
return audioManager;
- }else{
+ } else {
return null;
}
}
@@ -59,7 +58,7 @@ public class MediaStreamingStatusTests {
@Before
- public void setUp() throws Exception{
+ public void setUp() throws Exception {
mockedContext = mock(Context.class);
doAnswer(onGetSystemService).when(mockedContext).getSystemService(Context.AUDIO_SERVICE);
defaultMediaStreamingStatus = new MediaStreamingStatus(mockedContext, mock(MediaStreamingStatus.Callback.class));
@@ -67,7 +66,7 @@ public class MediaStreamingStatusTests {
@Test
- public void testEmptyAudioDeviceInfoList(){
+ public void testEmptyAudioDeviceInfoList() {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
assertNotNull(mockedContext);
MediaStreamingStatus mediaStreamingStatus = new MediaStreamingStatus(mockedContext, new MediaStreamingStatus.Callback() {
@@ -89,7 +88,7 @@ public class MediaStreamingStatusTests {
}
@Test
- public void testNullAudioDeviceInfoList(){
+ public void testNullAudioDeviceInfoList() {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
assertNotNull(mockedContext);
MediaStreamingStatus mediaStreamingStatus = new MediaStreamingStatus(mockedContext, mock(MediaStreamingStatus.Callback.class));
@@ -106,7 +105,7 @@ public class MediaStreamingStatusTests {
@Test
- public void testSdlManagerMedia(){
+ public void testSdlManagerMedia() {
SdlManager.Builder builder = new SdlManager.Builder(getInstrumentation().getTargetContext(), TestValues.GENERAL_FULL_APP_ID, TestValues.GENERAL_STRING, mock(SdlManagerListener.class));
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.MEDIA);
@@ -124,7 +123,7 @@ public class MediaStreamingStatusTests {
}
@Test
- public void testSdlManagerNonMedia(){
+ public void testSdlManagerNonMedia() {
SdlManager.Builder builder = new SdlManager.Builder(getInstrumentation().getTargetContext(), TestValues.GENERAL_FULL_APP_ID, TestValues.GENERAL_STRING, mock(SdlManagerListener.class));
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.DEFAULT);
@@ -142,7 +141,7 @@ public class MediaStreamingStatusTests {
}
@Test
- public void testAcceptedBTDevices(){
+ public void testAcceptedBTDevices() {
MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getInstrumentation().getTargetContext(), mock(MediaStreamingStatus.Callback.class)));
doAnswer(new Answer() {
@@ -157,7 +156,7 @@ public class MediaStreamingStatusTests {
}
@Test
- public void testAcceptedUSBDevices(){
+ public void testAcceptedUSBDevices() {
MediaStreamingStatus mediaStreamingStatus = spy(new MediaStreamingStatus(getInstrumentation().getTargetContext(), mock(MediaStreamingStatus.Callback.class)));
doAnswer(new Answer() {
@@ -175,7 +174,7 @@ public class MediaStreamingStatusTests {
}
@Test
- public void testAcceptedLineDevices(){
+ public void testAcceptedLineDevices() {
assertTrue(defaultMediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_LINE_ANALOG));
assertTrue(defaultMediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_LINE_DIGITAL));
assertTrue(defaultMediaStreamingStatus.isSupportedAudioDevice(AudioDeviceInfo.TYPE_AUX_LINE));
diff --git a/android/sdl_android/src/main/AndroidManifest.xml b/android/sdl_android/src/main/AndroidManifest.xml
index 32a1590e5..4efa349fb 100644
--- a/android/sdl_android/src/main/AndroidManifest.xml
+++ b/android/sdl_android/src/main/AndroidManifest.xml
@@ -1,4 +1,5 @@
<manifest package="com.smartdevicelink"
- xmlns:tools="http://schemas.android.com/tools">
+ xmlns:tools="http://schemas.android.com/tools">
+
<uses-sdk tools:overrideLibrary="android.arch.lifecycle, android.arch.lifecycle.extensions, android.arch.lifecycle.livedata, android.arch.lifecycle.livedata.core, android.arch.core, android.arch.lifecycle.viewmodel, android.support.fragment, android.support.coreui, android.support.coreutils, android.support.compat" />
</manifest>
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
index 5fd3f417d..7b9869a3a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
@@ -44,7 +44,7 @@ public final class EncoderUtils {
/**
* Extracts codec-specific data from MediaFormat instance
- *
+ * <p>
* Currently, only AVC is supported.
*
* @param format MediaFormat instance retrieved from MediaCodec
@@ -71,7 +71,7 @@ public final class EncoderUtils {
/**
* Extracts H.264 codec-specific data (SPS and PPS) from MediaFormat instance
- *
+ * <p>
* The codec-specific data is in byte-stream format; 4-byte start codes (0x00 0x00 0x00 0x01)
* are added in front of SPS and PPS NAL units.
*
@@ -108,5 +108,6 @@ public final class EncoderUtils {
return output;
}
- private EncoderUtils() {}
+ private EncoderUtils() {
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
index 251c3ad3a..4bff42396 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -48,217 +48,229 @@ import java.nio.ByteBuffer;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public class SdlEncoder {
- private static final String TAG = "SdlEncoder";
-
- // parameters for the encoder
- private static final String _MIME_TYPE = "video/avc"; // H.264/AVC video
- private static final long KEEPALIVE_INTERVAL_MSEC = 100;
-
- // private static final String MIME_TYPE = "video/mp4v-es"; //MPEG4 video
- private int frameRate = 30;
- private int frameInterval = 5;
- private int frameWidth = 800;
- private int frameHeight = 480;
- private int bitrate = 6000000;
-
- // encoder state
- private MediaCodec mEncoder;
- private PipedOutputStream mOutputStream;
- private IVideoStreamListener mOutputListener;
- private long mLastEmittedFrameTimestamp;
-
- // allocate one of these up front so we don't need to do it every time
- private MediaCodec.BufferInfo mBufferInfo;
-
- // Codec-specific data (SPS and PPS)
- private byte[] mH264CodecSpecificData = null;
-
- public SdlEncoder () {
- }
- public void setFrameRate(int iVal){
- frameRate = iVal;
- }
- public void setFrameInterval(int iVal){
- frameInterval = iVal;
- }
- public void setFrameWidth(int iVal){
- frameWidth = iVal;
- }
- public void setFrameHeight(int iVal){
- frameHeight = iVal;
- }
- public void setBitrate(int iVal){
- bitrate = iVal;
- }
- public void setOutputStream(PipedOutputStream mStream){
- mOutputStream = mStream;
- }
- public void setOutputListener(IVideoStreamListener listener) {
- mOutputListener = listener;
- }
- public Surface prepareEncoder () {
-
- mBufferInfo = new MediaCodec.BufferInfo();
-
- MediaFormat format = MediaFormat.createVideoFormat(_MIME_TYPE, frameWidth,
- frameHeight);
-
- // Set some properties. Failing to specify some of these can cause the
- // MediaCodec
- // configure() call to throw an unhelpful exception.
- format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
- MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
- format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
- format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
- format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, frameInterval);
-
- // Create a MediaCodec encoder, and configure it with our format. Get a
- // Surface
- // we can use for input and wrap it with a class that handles the EGL
- // work.
- //
- // If you want to have two EGL contexts -- one for display, one for
- // recording --
- // you will likely want to defer instantiation of CodecInputSurface
- // until after the
- // "display" EGL context is created, then modify the eglCreateContext
- // call to
- // take eglGetCurrentContext() as the share_context argument.
- try {
- mEncoder = MediaCodec.createEncoderByType(_MIME_TYPE);
- } catch (Exception e) {e.printStackTrace();}
-
- if(mEncoder != null) {
- mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
- return mEncoder.createInputSurface();
- } else {
- return null;
- }
- }
-
- public void startEncoder () {
- if(mEncoder != null) {
- mEncoder.start();
- }
- }
-
- /**
- * Releases encoder resources.
- */
- public void releaseEncoder() {
- if (mEncoder != null) {
- mEncoder.stop();
- mEncoder.release();
- mEncoder = null;
- }
- if (mOutputStream != null) {
- try {
- mOutputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- mOutputStream = null;
- }
- mH264CodecSpecificData = null;
- }
-
- /**
- * Extracts all pending data from the encoder
- * <p>
- * If endOfStream is not set, this returns when there is no more data to
- * drain. If it is set, we send EOS to the encoder, and then iterate until
- * we see EOS on the output. Calling this with endOfStream set should be
- * done once, right before stopping the muxer.
- */
- public void drainEncoder(boolean endOfStream) {
- final int TIMEOUT_USEC = 10000;
-
- if(mEncoder == null || (mOutputStream == null && mOutputListener == null)) {
- return;
- }
- if (endOfStream) {
- mEncoder.signalEndOfInputStream();
- }
-
- ByteBuffer[] encoderOutputBuffers = mEncoder.getOutputBuffers();
- while (true) {
- int encoderStatus = mEncoder.dequeueOutputBuffer(mBufferInfo,
- TIMEOUT_USEC);
- if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
- // no output available yet
- if (!endOfStream) {
- trySendVideoKeepalive();
- break; // out of while
- }
- } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
- // not expected for an encoder
- encoderOutputBuffers = mEncoder.getOutputBuffers();
- } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
- if (mH264CodecSpecificData == null) {
- MediaFormat format = mEncoder.getOutputFormat();
- mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
- } else {
- DebugTool.logWarning(TAG, "Output format change notified more than once, ignoring.");
- }
- } else if (encoderStatus < 0) {
- } else {
- if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
- // If we already retrieve codec specific data via OUTPUT_FORMAT_CHANGED event,
- // we do not need this data.
- if (mH264CodecSpecificData != null) {
- mBufferInfo.size = 0;
- } else {
- DebugTool.logInfo(TAG, "H264 codec specific data not retrieved yet.");
- }
- }
-
- if (mBufferInfo.size != 0) {
- ByteBuffer encoderOutputBuffer = encoderOutputBuffers[encoderStatus];
- byte[] dataToWrite;
- int dataOffset = 0;
-
- // append SPS and PPS in front of every IDR NAL unit
- if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0
- && mH264CodecSpecificData != null) {
- dataToWrite = new byte[mH264CodecSpecificData.length + mBufferInfo.size];
- System.arraycopy(mH264CodecSpecificData, 0,
- dataToWrite, 0, mH264CodecSpecificData.length);
- dataOffset = mH264CodecSpecificData.length;
- } else {
- dataToWrite = new byte[mBufferInfo.size];
- }
-
- try {
- encoderOutputBuffer.position(mBufferInfo.offset);
- encoderOutputBuffer.limit(mBufferInfo.offset + mBufferInfo.size);
-
- encoderOutputBuffer.get(dataToWrite, dataOffset, mBufferInfo.size);
+ private static final String TAG = "SdlEncoder";
+
+ // parameters for the encoder
+ private static final String _MIME_TYPE = "video/avc"; // H.264/AVC video
+ private static final long KEEPALIVE_INTERVAL_MSEC = 100;
+
+ // private static final String MIME_TYPE = "video/mp4v-es"; //MPEG4 video
+ private int frameRate = 30;
+ private int frameInterval = 5;
+ private int frameWidth = 800;
+ private int frameHeight = 480;
+ private int bitrate = 6000000;
+
+ // encoder state
+ private MediaCodec mEncoder;
+ private PipedOutputStream mOutputStream;
+ private IVideoStreamListener mOutputListener;
+ private long mLastEmittedFrameTimestamp;
+
+ // allocate one of these up front so we don't need to do it every time
+ private MediaCodec.BufferInfo mBufferInfo;
+
+ // Codec-specific data (SPS and PPS)
+ private byte[] mH264CodecSpecificData = null;
+
+ public SdlEncoder() {
+ }
+
+ public void setFrameRate(int iVal) {
+ frameRate = iVal;
+ }
+
+ public void setFrameInterval(int iVal) {
+ frameInterval = iVal;
+ }
+
+ public void setFrameWidth(int iVal) {
+ frameWidth = iVal;
+ }
+
+ public void setFrameHeight(int iVal) {
+ frameHeight = iVal;
+ }
+
+ public void setBitrate(int iVal) {
+ bitrate = iVal;
+ }
+
+ public void setOutputStream(PipedOutputStream mStream) {
+ mOutputStream = mStream;
+ }
+
+ public void setOutputListener(IVideoStreamListener listener) {
+ mOutputListener = listener;
+ }
+
+ public Surface prepareEncoder() {
+
+ mBufferInfo = new MediaCodec.BufferInfo();
+
+ MediaFormat format = MediaFormat.createVideoFormat(_MIME_TYPE, frameWidth,
+ frameHeight);
+
+ // Set some properties. Failing to specify some of these can cause the
+ // MediaCodec
+ // configure() call to throw an unhelpful exception.
+ format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
+ MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+ format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
+ format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, frameInterval);
+
+ // Create a MediaCodec encoder, and configure it with our format. Get a
+ // Surface
+ // we can use for input and wrap it with a class that handles the EGL
+ // work.
+ //
+ // If you want to have two EGL contexts -- one for display, one for
+ // recording --
+ // you will likely want to defer instantiation of CodecInputSurface
+ // until after the
+ // "display" EGL context is created, then modify the eglCreateContext
+ // call to
+ // take eglGetCurrentContext() as the share_context argument.
+ try {
+ mEncoder = MediaCodec.createEncoderByType(_MIME_TYPE);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ if (mEncoder != null) {
+ mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
+ return mEncoder.createInputSurface();
+ } else {
+ return null;
+ }
+ }
+
+ public void startEncoder() {
+ if (mEncoder != null) {
+ mEncoder.start();
+ }
+ }
+
+ /**
+ * Releases encoder resources.
+ */
+ public void releaseEncoder() {
+ if (mEncoder != null) {
+ mEncoder.stop();
+ mEncoder.release();
+ mEncoder = null;
+ }
+ if (mOutputStream != null) {
+ try {
+ mOutputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ mOutputStream = null;
+ }
+ mH264CodecSpecificData = null;
+ }
+
+ /**
+ * Extracts all pending data from the encoder
+ * <p>
+ * If endOfStream is not set, this returns when there is no more data to
+ * drain. If it is set, we send EOS to the encoder, and then iterate until
+ * we see EOS on the output. Calling this with endOfStream set should be
+ * done once, right before stopping the muxer.
+ */
+ public void drainEncoder(boolean endOfStream) {
+ final int TIMEOUT_USEC = 10000;
+
+ if (mEncoder == null || (mOutputStream == null && mOutputListener == null)) {
+ return;
+ }
+ if (endOfStream) {
+ mEncoder.signalEndOfInputStream();
+ }
+
+ ByteBuffer[] encoderOutputBuffers = mEncoder.getOutputBuffers();
+ while (true) {
+ int encoderStatus = mEncoder.dequeueOutputBuffer(mBufferInfo,
+ TIMEOUT_USEC);
+ if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
+ // no output available yet
+ if (!endOfStream) {
+ trySendVideoKeepalive();
+ break; // out of while
+ }
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ // not expected for an encoder
+ encoderOutputBuffers = mEncoder.getOutputBuffers();
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ if (mH264CodecSpecificData == null) {
+ MediaFormat format = mEncoder.getOutputFormat();
+ mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
+ } else {
+ DebugTool.logWarning(TAG, "Output format change notified more than once, ignoring.");
+ }
+ } else if (encoderStatus < 0) {
+ } else {
+ if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
+ // If we already retrieve codec specific data via OUTPUT_FORMAT_CHANGED event,
+ // we do not need this data.
+ if (mH264CodecSpecificData != null) {
+ mBufferInfo.size = 0;
+ } else {
+ DebugTool.logInfo(TAG, "H264 codec specific data not retrieved yet.");
+ }
+ }
+
+ if (mBufferInfo.size != 0) {
+ ByteBuffer encoderOutputBuffer = encoderOutputBuffers[encoderStatus];
+ byte[] dataToWrite;
+ int dataOffset = 0;
+
+ // append SPS and PPS in front of every IDR NAL unit
+ if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0
+ && mH264CodecSpecificData != null) {
+ dataToWrite = new byte[mH264CodecSpecificData.length + mBufferInfo.size];
+ System.arraycopy(mH264CodecSpecificData, 0,
+ dataToWrite, 0, mH264CodecSpecificData.length);
+ dataOffset = mH264CodecSpecificData.length;
+ } else {
+ dataToWrite = new byte[mBufferInfo.size];
+ }
+
+ try {
+ encoderOutputBuffer.position(mBufferInfo.offset);
+ encoderOutputBuffer.limit(mBufferInfo.offset + mBufferInfo.size);
+
+ encoderOutputBuffer.get(dataToWrite, dataOffset, mBufferInfo.size);
emitFrame(dataToWrite);
- } catch (Exception e) {}
- }
+ } catch (Exception e) {
+ }
+ }
- mEncoder.releaseOutputBuffer(encoderStatus, false);
+ mEncoder.releaseOutputBuffer(encoderStatus, false);
- if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
- break; // out of while
- }
- }
- }
- }
+ if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+ break; // out of while
+ }
+ }
+ }
+ }
- private void trySendVideoKeepalive() {
- if (mH264CodecSpecificData == null) {
- return;
- }
+ private void trySendVideoKeepalive() {
+ if (mH264CodecSpecificData == null) {
+ return;
+ }
try {
- long timeSinceLastEmitted = System.currentTimeMillis() - mLastEmittedFrameTimestamp;
- if (timeSinceLastEmitted >= KEEPALIVE_INTERVAL_MSEC) {
- emitFrame(mH264CodecSpecificData);
- }
- } catch (IOException e) {}
- }
+ long timeSinceLastEmitted = System.currentTimeMillis() - mLastEmittedFrameTimestamp;
+ if (timeSinceLastEmitted >= KEEPALIVE_INTERVAL_MSEC) {
+ emitFrame(mH264CodecSpecificData);
+ }
+ } catch (IOException e) {
+ }
+ }
private void emitFrame(final byte[] dataToWrite) throws IOException {
if (mOutputStream != null) {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
index de342f7c9..6a670dba3 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
@@ -76,8 +76,9 @@ public class VirtualDisplayEncoder {
/**
* Initialization method for VirtualDisplayEncoder object. MUST be called before start() or shutdown()
* Will overwrite previously set videoWeight and videoHeight
- * @param context to create the virtual display
- * @param outputListener the listener that the video frames will be sent through
+ *
+ * @param context to create the virtual display
+ * @param outputListener the listener that the video frames will be sent through
* @param streamingParams parameters to create the virtual display and encoder
* @throws Exception if the API level is <19 or supplied parameters were null
*/
@@ -101,7 +102,7 @@ public class VirtualDisplayEncoder {
initPassed = true;
}
- public VideoStreamingParameters getStreamingParams(){
+ public VideoStreamingParameters getStreamingParams() {
return this.streamingParams;
}
@@ -331,7 +332,7 @@ public class VirtualDisplayEncoder {
Thread currentThread = Thread.currentThread();
while (!currentThread.isInterrupted()) {
int encoderStatus = mVideoEncoder.dequeueOutputBuffer(mVideoBufferInfo, -1);
- if(encoderStatus < 0){
+ if (encoderStatus < 0) {
if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
// no output available yet
if (!endOfStream) {
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 8bd1f6259..99af62a74 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
@@ -35,36 +35,37 @@ package com.smartdevicelink.managers;
import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.proxy.rpc.enums.Language;
-public interface SdlManagerListener extends BaseSdlManagerListener{
+public interface SdlManagerListener extends BaseSdlManagerListener {
- /**
- * Called when a manager is ready for use
- */
- void onStart();
+ /**
+ * Called when a manager is ready for use
+ */
+ void onStart();
- /**
- * Called when the manager is destroyed
- */
- void onDestroy();
+ /**
+ * Called when the manager is destroyed
+ */
+ void onDestroy();
- /**
- * Called when the manager encounters an error
- * @param info info regarding the error
- * @param e the exception
- */
- void onError(String info, Exception e);
+ /**
+ * Called when the manager encounters an error
+ *
+ * @param info info regarding the error
+ * @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 VR+TTS language of the connected head unit the manager is trying to update the configuration.
- * @param hmiLanguage The HMI display 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, Language hmiLanguage);
+ /**
+ * 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 VR+TTS language of the connected head unit the manager is trying to update the configuration.
+ * @param hmiLanguage The HMI display 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, Language hmiLanguage);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
index 141a2b020..9d15dcbe1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoder.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -54,11 +54,12 @@ public class AudioDecoder extends BaseAudioDecoder {
/**
* Creates a new object of AudioDecoder.
+ *
* @param audioSource The audio source to decode.
- * @param context The context object to use to open the audio source.
- * @param sampleRate The desired sample rate for decoded audio data.
- * @param sampleType The desired sample type (8bit, 16bit, float).
- * @param listener A listener who receives the decoded audio.
+ * @param context The context object to use to open the audio source.
+ * @param sampleRate The desired sample rate for decoded audio data.
+ * @param sampleType The desired sample type (8bit, 16bit, float).
+ * @param listener A listener who receives the decoded audio.
*/
AudioDecoder(Uri audioSource, Context context, int sampleRate, @SampleType int sampleType, AudioDecoderListener listener) {
super(audioSource, context, sampleRate, sampleType, listener);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
index 7e32d3261..db6c56fe5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderCompat.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -56,11 +56,12 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
/**
* Creates a new object of AudioDecoder.
+ *
* @param audioSource The audio source to decode.
- * @param context The context object to use to open the audio source.
- * @param sampleRate The desired sample rate for decoded audio data.
- * @param sampleType The desired sample type (8bit, 16bit, float).
- * @param listener A listener who receives the decoded audio.
+ * @param context The context object to use to open the audio source.
+ * @param sampleRate The desired sample rate for decoded audio data.
+ * @param sampleType The desired sample type (8bit, 16bit, float).
+ * @param listener A listener who receives the decoded audio.
*/
AudioDecoderCompat(@NonNull Uri audioSource, @NonNull Context context, int sampleRate, @SampleType int sampleType, AudioDecoderListener listener) {
super(audioSource, context, sampleRate, sampleType, listener);
@@ -78,7 +79,7 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
} catch (Exception e) {
e.printStackTrace();
- if(this.listener != null) {
+ if (this.listener != null) {
this.listener.onDecoderError(e);
this.listener.onDecoderFinish(false);
}
@@ -95,12 +96,14 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
/**
* Decodes all audio data from source
+ *
* @param audioDecoderCompat instance of this class
*/
- DecoderRunnable(@NonNull AudioDecoderCompat audioDecoderCompat){
+ DecoderRunnable(@NonNull AudioDecoderCompat audioDecoderCompat) {
weakReference = new WeakReference<>(audioDecoderCompat);
}
+
@Override
public void run() {
final AudioDecoderCompat reference = weakReference.get();
@@ -115,7 +118,7 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
ByteBuffer inputBuffer, outputBuffer;
SampleBuffer sampleBuffer;
- while (reference!= null && !reference.mThread.isInterrupted()) {
+ while (reference != null && !reference.mThread.isInterrupted()) {
int inputBuffersArrayIndex = 0;
while (inputBuffersArrayIndex != MediaCodec.INFO_TRY_AGAIN_LATER) {
inputBuffersArrayIndex = reference.decoder.dequeueInputBuffer(DEQUEUE_TIMEOUT);
@@ -135,7 +138,7 @@ public class AudioDecoderCompat extends BaseAudioDecoder {
reference.decoder.releaseOutputBuffer(outputBuffersArrayIndex, false);
} else if (outputBuffer.limit() > 0) {
sampleBuffer = reference.onOutputBufferAvailable(outputBuffer);
- if(reference.listener!=null){
+ if (reference.listener != null) {
reference.listener.onAudioDataAvailable(sampleBuffer);
}
reference.decoder.releaseOutputBuffer(outputBuffersArrayIndex, false);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderListener.java
index 5962ac09e..6a53425e2 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioDecoderListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,30 +29,33 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.managers.audio;
-
-/**
- * An interface for the audio decoder classes.
- * The caller using the audio decoder will be
- * notified when the decoding is finished or if an error occurred.
- * During decoding the caller receives sample buffers with decoded audio data.
- */
-public interface AudioDecoderListener {
- /**
- * Notifies that decoded audio data is available.
- * @param sampleBuffer The sample buffer holding the decoded audio data.
- */
- void onAudioDataAvailable(SampleBuffer sampleBuffer);
-
- /**
- * Notifies that the audio decoding is finished.
- * @param success Indicates whether audio decoding was successful or if an error occurred.
- */
- void onDecoderFinish(boolean success);
-
- /**
- * Notifies the caller that an error/exception occurred during audio decoding.
- * @param e The exception storing information about the error.
- */
- void onDecoderError(Exception e);
-}
+package com.smartdevicelink.managers.audio;
+
+/**
+ * An interface for the audio decoder classes.
+ * The caller using the audio decoder will be
+ * notified when the decoding is finished or if an error occurred.
+ * During decoding the caller receives sample buffers with decoded audio data.
+ */
+public interface AudioDecoderListener {
+ /**
+ * Notifies that decoded audio data is available.
+ *
+ * @param sampleBuffer The sample buffer holding the decoded audio data.
+ */
+ void onAudioDataAvailable(SampleBuffer sampleBuffer);
+
+ /**
+ * Notifies that the audio decoding is finished.
+ *
+ * @param success Indicates whether audio decoding was successful or if an error occurred.
+ */
+ void onDecoderFinish(boolean success);
+
+ /**
+ * Notifies the caller that an error/exception occurred during audio decoding.
+ *
+ * @param e The exception storing information about the error.
+ */
+ void onDecoderError(Exception e);
+}
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 0e4a2ed2c..bb7269e57 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
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,22 +43,22 @@ import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.StreamingStateMachine;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
+import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.managers.ISdl;
-import com.smartdevicelink.protocol.ISdlServiceListener;
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.session.SdlSession;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.streaming.audio.IAudioStreamListener;
@@ -86,7 +86,8 @@ public class AudioStreamManager extends BaseAudioStreamManager {
private IAudioStreamListener sdlAudioStream;
private int sdlSampleRate;
- private @SampleType int sdlSampleType;
+ private @SampleType
+ int sdlSampleType;
private final Queue<BaseAudioDecoder> queue;
private final WeakReference<Context> context;
private final StreamingStateMachine streamingStateMachine;
@@ -109,7 +110,6 @@ public class AudioStreamManager extends BaseAudioStreamManager {
};
-
// INTERNAL INTERFACE
private final ISdlServiceListener serviceListener = new ISdlServiceListener() {
@@ -170,13 +170,13 @@ public class AudioStreamManager extends BaseAudioStreamManager {
private final OnRPCNotificationListener hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- if(notification != null){
- OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (notification != null) {
+ 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)){
+ if (hmiLevel.equals(HMILevel.HMI_FULL) || hmiLevel.equals(HMILevel.HMI_LIMITED)) {
checkState();
}
}
@@ -185,6 +185,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
/**
* Creates a new object of AudioStreamManager
+ *
* @param internalInterface The internal interface to the connected device.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
@@ -211,16 +212,16 @@ public class AudioStreamManager extends BaseAudioStreamManager {
super.start(listener);
}
- private void checkState(){
- if(audioStreamingCapabilities != null
+ private void checkState() {
+ if (audioStreamingCapabilities != null
&& isTransportAvailable
&& hmiLevel != null
- && (hmiLevel.equals(HMILevel.HMI_LIMITED) || hmiLevel.equals(HMILevel.HMI_FULL))){
+ && (hmiLevel.equals(HMILevel.HMI_LIMITED) || hmiLevel.equals(HMILevel.HMI_FULL))) {
transitionToState(READY);
}
}
- private void getAudioStreamingCapabilities(){
+ private void getAudioStreamingCapabilities() {
if (internalInterface.getSystemCapabilityManager() != null) {
internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.PCM_STREAMING, new OnSystemCapabilityListener() {
@Override
@@ -257,6 +258,7 @@ public class AudioStreamManager extends BaseAudioStreamManager {
/**
* Starts the audio service and audio stream to the connected device.
* The method is non-blocking.
+ *
* @param encrypted Specify whether or not the audio stream should be encrypted.
*/
public void startAudioStream(boolean encrypted, final CompletionListener completionListener) {
@@ -327,7 +329,8 @@ public class AudioStreamManager extends BaseAudioStreamManager {
/**
* Makes the callback to the listener
- * @param listener the listener to notify
+ *
+ * @param listener the listener to notify
* @param isSuccess flag to notify
*/
private void finish(CompletionListener listener, boolean isSuccess) {
@@ -365,7 +368,8 @@ public class AudioStreamManager extends BaseAudioStreamManager {
* Pushes the specified resource file to the playback queue.
* The audio file will be played immediately. If another audio file is currently playing
* the specified file will stay queued and automatically played when ready.
- * @param resourceId The specified resource file to be played.
+ *
+ * @param resourceId The specified resource file to be played.
* @param completionListener A completion listener that informs when the audio file is played.
*/
public void pushResource(int resourceId, final CompletionListener completionListener) {
@@ -385,7 +389,8 @@ public class AudioStreamManager extends BaseAudioStreamManager {
* Pushes the specified audio file to the playback queue.
* The audio file will be played immediately. If another audio file is currently playing
* the specified file will stay queued and automatically played when ready.
- * @param audioSource The specified audio file to be played.
+ *
+ * @param audioSource The specified audio file to be played.
* @param completionListener A completion listener that informs when the audio file is played.
*/
@SuppressWarnings("WeakerAccess")
@@ -448,7 +453,8 @@ public class AudioStreamManager extends BaseAudioStreamManager {
* Pushes raw audio data to SDL Core.
* The audio file will be played immediately. If another audio file is currently playing,
* the specified file will stay queued and automatically played when ready.
- * @param data Audio raw data to send.
+ *
+ * @param data Audio raw data to send.
* @param completionListener A completion listener that informs when the audio file is played.
*/
public void pushBuffer(ByteBuffer data, CompletionListener completionListener) {
@@ -464,17 +470,17 @@ public class AudioStreamManager extends BaseAudioStreamManager {
}
@Override
- protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail){
+ protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
isTransportAvailable = audioStreamTransportAvail;
- if(internalInterface.getProtocolVersion().isNewerThan(new Version(5,1,0)) >= 0){
- if(audioStreamTransportAvail){
+ if (internalInterface.getProtocolVersion().isNewerThan(new Version(5, 1, 0)) >= 0) {
+ if (audioStreamTransportAvail) {
checkState();
}
- }else{
+ } else {
//The protocol version doesn't support simultaneous transports.
- if(!audioStreamTransportAvail){
+ if (!audioStreamTransportAvail) {
//If video streaming isn't available on primary transport then it is not possible to
//use the video streaming manager until a complete register on a transport that
//supports video
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
index d7f4f3a7c..e35d0d113 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -54,11 +54,13 @@ public abstract class BaseAudioDecoder {
private static final String TAG = AudioDecoder.class.getSimpleName();
protected final int targetSampleRate;
- protected @SampleType final int targetSampleType;
+ protected @SampleType
+ final int targetSampleType;
private int outputChannelCount;
private int outputSampleRate;
- private @SampleType int outputSampleType;
+ private @SampleType
+ int outputSampleType;
private double lastOutputSample = 0;
@@ -73,14 +75,13 @@ public abstract class BaseAudioDecoder {
protected final AudioDecoderListener listener;
/**
- *
* @param audioSource Uri of the audio source to be converted
- * @param context the context
- * @param sampleRate can be either 8000, 16000, 22050 or 44100
+ * @param context the context
+ * @param sampleRate can be either 8000, 16000, 22050 or 44100
+ * @param sampleType can be either UNSIGNED_8_BIT, SIGNED_16_BIT, FLOAT
+ * @param listener listener for event callbacks
* @see AudioPassThruCapabilities#getSamplingRate()
- * @param sampleType can be either UNSIGNED_8_BIT, SIGNED_16_BIT, FLOAT
* @see SampleType
- * @param listener listener for event callbacks
*/
public BaseAudioDecoder(@NonNull Uri audioSource, @NonNull Context context, int sampleRate, @SampleType int sampleType, AudioDecoderListener listener) {
this.audioSource = audioSource;
@@ -92,13 +93,13 @@ public abstract class BaseAudioDecoder {
}
protected void initMediaComponents() throws Exception {
- if(targetSampleRate <= 0){
+ if (targetSampleRate <= 0) {
throw new InstantiationException("Target sample rate of " + targetSampleRate + " is unsupported");
}
extractor = new MediaExtractor();
Context contextRef = contextWeakReference.get();
- if(contextRef == null){
+ if (contextRef == null) {
throw new InstantiationException("Context reference was null");
}
extractor.setDataSource(contextRef, audioSource, null);
@@ -187,20 +188,20 @@ public abstract class BaseAudioDecoder {
protected SampleBuffer onOutputBufferAvailable(@NonNull ByteBuffer outputBuffer) {
double outputPresentationTimeUs = lastOutputPresentationTimeUs;
- double outputDurationPerSampleUs = 1000000.0 / (double)outputSampleRate;
+ double outputDurationPerSampleUs = 1000000.0 / (double) outputSampleRate;
double targetPresentationTimeUs = lastTargetPresentationTimeUs;
- double targetDurationPerSampleUs = 1000000.0 / (double)targetSampleRate;
+ double targetDurationPerSampleUs = 1000000.0 / (double) targetSampleRate;
// wrap the output buffer to make it provide audio samples
- SampleBuffer outputSampleBuffer = SampleBuffer.wrap(outputBuffer, outputSampleType, outputChannelCount, (long)outputPresentationTimeUs);
+ SampleBuffer outputSampleBuffer = SampleBuffer.wrap(outputBuffer, outputSampleType, outputChannelCount, (long) outputPresentationTimeUs);
outputSampleBuffer.position(0);
// the buffer size is related to the output and target sample rate
// add 2 samples to round up and add an extra sample
int sampleSize = outputSampleBuffer.limit() * targetSampleRate / outputSampleRate + 2;
- SampleBuffer targetSampleBuffer = SampleBuffer.allocate(sampleSize, targetSampleType, ByteOrder.LITTLE_ENDIAN, (long)targetPresentationTimeUs);
+ SampleBuffer targetSampleBuffer = SampleBuffer.allocate(sampleSize, targetSampleType, ByteOrder.LITTLE_ENDIAN, (long) targetPresentationTimeUs);
Double sample;
do {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
index 0993b2ec2..dfeb147ab 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,15 +44,17 @@ import java.nio.ByteOrder;
public class SampleBuffer {
private static final String TAG = SampleBuffer.class.getSimpleName();
- private @SampleType final int sampleType;
+ private @SampleType
+ final int sampleType;
private final ByteBuffer byteBuffer;
private final int channelCount;
private final long presentationTimeUs;
/**
* Wraps a raw (mono) byte buffer to a new sample buffer.
- * @param buffer The raw buffer to be wrapped.
- * @param sampleType The sample type of the samples in the raw buffer.
+ *
+ * @param buffer The raw buffer to be wrapped.
+ * @param sampleType The sample type of the samples in the raw buffer.
* @param presentationTimeUs The presentation time of the buffer.
* @return A new sample buffer wrapping the specified raw buffer.
*/
@@ -62,9 +64,10 @@ public class SampleBuffer {
/**
* Wraps a raw byte buffer to a new sample buffer.
- * @param buffer The raw buffer to be wrapped.
- * @param sampleType The sample type of the samples in the raw buffer.
- * @param channelCount The number of channels (1 = mono, 2 = stereo).
+ *
+ * @param buffer The raw buffer to be wrapped.
+ * @param sampleType The sample type of the samples in the raw buffer.
+ * @param channelCount The number of channels (1 = mono, 2 = stereo).
* @param presentationTimeUs The presentation time of the buffer.
* @return A new sample buffer wrapping the specified raw buffer.
*/
@@ -74,9 +77,10 @@ public class SampleBuffer {
/**
* Allocates a new sample buffer.
- * @param capacity The specified sample capacity of the sample buffer.
- * @param sampleType The sample type of the samples the buffer should store.
- * @param byteOrder The byte order for the samples (little or big endian).
+ *
+ * @param capacity The specified sample capacity of the sample buffer.
+ * @param sampleType The sample type of the samples the buffer should store.
+ * @param byteOrder The byte order for the samples (little or big endian).
* @param presentationTimeUs The presentation time for the buffer.
* @return A new and empty sample buffer.
*/
@@ -86,10 +90,11 @@ public class SampleBuffer {
/**
* Allocates a new sample buffer.
- * @param capacity The specified sample capacity of the sample buffer.
- * @param sampleType The sample type of the samples the buffer should store.
- * @param channelCount The number of channels (1 = mono, 2 = stereo).
- * @param byteOrder The byte order for the samples (little or big endian).
+ *
+ * @param capacity The specified sample capacity of the sample buffer.
+ * @param sampleType The sample type of the samples the buffer should store.
+ * @param channelCount The number of channels (1 = mono, 2 = stereo).
+ * @param byteOrder The byte order for the samples (little or big endian).
* @param presentationTimeUs The presentation time for the buffer.
* @return A new and empty sample buffer.
*/
@@ -128,6 +133,7 @@ public class SampleBuffer {
/**
* Sets the number of samples in the buffer to the new limit.
+ *
* @param newLimit The new limit of the sample buffer.
*/
public void limit(int newLimit) {
@@ -136,6 +142,7 @@ public class SampleBuffer {
/**
* Returns the current position in the buffer per channel.
+ *
* @return The position of the sample buffer.
*/
public int position() {
@@ -143,7 +150,8 @@ public class SampleBuffer {
}
/**
- *Sets the position of the sample buffer to the new index.
+ * Sets the position of the sample buffer to the new index.
+ *
* @param newPosition The new position of the sample buffer.
*/
public void position(int newPosition) {
@@ -153,6 +161,7 @@ public class SampleBuffer {
/**
* Returns the sample of the current position and then increments the position.
* The sample returned is a mixed sample getting all samples from each channel.
+ *
* @return The mixed sample.
*/
public double get() {
@@ -164,6 +173,7 @@ public class SampleBuffer {
* Returns the sample from the given index in the buffer.
* If the buffer's channel count is > 1 the sample returned
* is a mixed sample getting all samples from each channel.
+ *
* @param index The index of the sample requested.
* @return The sample requested.
*/
@@ -178,7 +188,7 @@ public class SampleBuffer {
for (int i = 0; i < channelCount; i++) {
byte b = index == -1 ? byteBuffer.get() : byteBuffer.get(internalIndex + i * sampleType);
int a = b & 0xff; // convert the 8 bits into int so we can calc > 127
- avg += a / (double)channelCount;
+ avg += a / (double) channelCount;
}
return avg * 2.0 / 255.0 - 1.0; //magic? check out SampleType
@@ -189,7 +199,7 @@ public class SampleBuffer {
// get a sample mix to mono from the index
for (int i = 0; i < channelCount; i++) {
short a = index == -1 ? byteBuffer.getShort() : byteBuffer.getShort(internalIndex + i * sampleType);
- avg += a / (double)channelCount;
+ avg += a / (double) channelCount;
}
return (avg + 32768.0) * 2.0 / 65535.0 - 1.0; //magic? check out SampleType
@@ -200,7 +210,7 @@ public class SampleBuffer {
// get a sample mix to mono from the index
for (int i = 0; i < channelCount; i++) {
double a = index == -1 ? byteBuffer.getFloat() : byteBuffer.getFloat(internalIndex + i * sampleType);
- avg += a / (double)channelCount;
+ avg += a / (double) channelCount;
}
return avg;
@@ -214,6 +224,7 @@ public class SampleBuffer {
/**
* Puts a sample to the current position and increments the position.
+ *
* @param sample The sample to put into the buffer.
*/
public void put(double sample) {
@@ -224,15 +235,16 @@ public class SampleBuffer {
* Puts a sample to the given index in the buffer.
* If the buffer's channel count is > 1 the sample
* will be stored in each channel at the given index.
- * @param index The index to put the sample.
+ *
+ * @param index The index to put the sample.
* @param sample The sample to store in the buffer.
*/
public void put(int index, double sample) {
int internalIndex = index * channelCount * sampleType;
switch (sampleType) {
case SampleType.UNSIGNED_8_BIT: {
- int a = (int)Math.round((sample + 1.0) * 255.0 / 2.0); //magic? check out SampleType
- byte b = (byte)a;
+ int a = (int) Math.round((sample + 1.0) * 255.0 / 2.0); //magic? check out SampleType
+ byte b = (byte) a;
if (index == -1) {
for (int i = 0; i < channelCount; i++) {
byteBuffer.put(b);
@@ -245,7 +257,7 @@ public class SampleBuffer {
break;
}
case SampleType.SIGNED_16_BIT: {
- short a = (short)Math.round((sample + 1.0) * 65535 / 2.0 - 32767.0); //magic? check out SampleType
+ short a = (short) Math.round((sample + 1.0) * 65535 / 2.0 - 32767.0); //magic? check out SampleType
if (index == -1) {
for (int i = 0; i < channelCount; i++) {
byteBuffer.putShort(a);
@@ -277,6 +289,7 @@ public class SampleBuffer {
/**
* Returns the raw byte buffer managed by this sample buffer.
+ *
* @return The raw byte buffer managed by this sample buffer.
*/
public ByteBuffer getByteBuffer() {
@@ -285,6 +298,7 @@ public class SampleBuffer {
/**
* Returns a copy of the bytes from position 0 to the current limit.
+ *
* @return A copy of the bytes.
*/
public byte[] getBytes() {
@@ -300,6 +314,7 @@ public class SampleBuffer {
/**
* The presentation time of this sample buffer.
+ *
* @return The presentation time of this sample buffer.
*/
public long getPresentationTimeUs() {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
index 6b98e9b58..252ee09f2 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java
@@ -50,127 +50,131 @@ import java.lang.ref.WeakReference;
/**
* <strong>FileManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The SDLFileManager uploads files and keeps track of all the uploaded files names during a session. <br>
- *
+ * <p>
* We need to add the following struct: SDLFile<br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. Getters <br>
* 2. Deletion methods <br>
* 3. Uploading Files / Artwork
*/
public class FileManager extends BaseFileManager {
- private final WeakReference<Context> context;
+ private final WeakReference<Context> context;
- /**
- * Constructor for FileManager
- * @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
- * @param context an instances of Context interface to global information for application
- * @param fileManagerConfig an instance of the FileManagerConfig gives access to artworkRetryCount and fileRetryCount to let us if those file types can be re-upload if they fail
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public FileManager(ISdl internalInterface, Context context, FileManagerConfig fileManagerConfig) {
- // setup
- super(internalInterface, fileManagerConfig);
- this.context = new WeakReference<>(context);
- }
+ /**
+ * Constructor for FileManager
+ *
+ * @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
+ * @param context an instances of Context interface to global information for application
+ * @param fileManagerConfig an instance of the FileManagerConfig gives access to artworkRetryCount and fileRetryCount to let us if those file types can be re-upload if they fail
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public FileManager(ISdl internalInterface, Context context, FileManagerConfig fileManagerConfig) {
+ // setup
+ super(internalInterface, fileManagerConfig);
+ this.context = new WeakReference<>(context);
+ }
- /**
- * Creates and returns a PutFile request that would upload a given SdlFile
- * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
- * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
- */
- @Override
- PutFile createPutFile(@NonNull final SdlFile file){
- PutFile putFile = new PutFile();
- if(file.getName() == null){
- throw new IllegalArgumentException("You must specify an file name in the SdlFile");
- }else{
- putFile.setSdlFileName(file.getName());
- }
+ /**
+ * Creates and returns a PutFile request that would upload a given SdlFile
+ *
+ * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
+ * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
+ */
+ @Override
+ PutFile createPutFile(@NonNull final SdlFile file) {
+ PutFile putFile = new PutFile();
+ if (file.getName() == null) {
+ throw new IllegalArgumentException("You must specify an file name in the SdlFile");
+ } else {
+ putFile.setSdlFileName(file.getName());
+ }
- if(file.getResourceId() > 0){
- // Use resource id to upload file
- byte[] contents = contentsOfResource(file.getResourceId());
- if(contents != null){
- putFile.setFileData(contents);
- }else{
- throw new IllegalArgumentException("Resource file id was empty");
- }
- }else if(file.getUri() != null){
- // Use URI to upload file
- byte[] contents = contentsOfUri(file.getUri());
- if(contents != null){
- putFile.setFileData(contents);
- }else{
- throw new IllegalArgumentException("Uri was empty");
- }
- }else if(file.getFileData() != null){
- // Use file data (raw bytes) to upload file
- putFile.setFileData(file.getFileData());
- }else{
- throw new IllegalArgumentException("The SdlFile to upload does " +
- "not specify its resourceId, Uri, or file data");
- }
+ if (file.getResourceId() > 0) {
+ // Use resource id to upload file
+ byte[] contents = contentsOfResource(file.getResourceId());
+ if (contents != null) {
+ putFile.setFileData(contents);
+ } else {
+ throw new IllegalArgumentException("Resource file id was empty");
+ }
+ } else if (file.getUri() != null) {
+ // Use URI to upload file
+ byte[] contents = contentsOfUri(file.getUri());
+ if (contents != null) {
+ putFile.setFileData(contents);
+ } else {
+ throw new IllegalArgumentException("Uri was empty");
+ }
+ } else if (file.getFileData() != null) {
+ // Use file data (raw bytes) to upload file
+ putFile.setFileData(file.getFileData());
+ } else {
+ throw new IllegalArgumentException("The SdlFile to upload does " +
+ "not specify its resourceId, Uri, or file data");
+ }
- if(file.getType() != null){
- putFile.setFileType(file.getType());
- }
- putFile.setPersistentFile(file.isPersistent());
+ if (file.getType() != null) {
+ putFile.setFileType(file.getType());
+ }
+ putFile.setPersistentFile(file.isPersistent());
- return putFile;
- }
+ return putFile;
+ }
- /**
- * Helper method to take resource files and turn them into byte arrays
- * @param resource Resource file id
- * @return Resulting byte array
- */
- private byte[] contentsOfResource(int resource) {
- InputStream is = null;
- try {
- is = context.get().getResources().openRawResource(resource);
- return contentsOfInputStream(is);
- } catch (Resources.NotFoundException e) {
- DebugTool.logError(TAG, "Can't read from resource", e);
- return null;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
+ /**
+ * Helper method to take resource files and turn them into byte arrays
+ *
+ * @param resource Resource file id
+ * @return Resulting byte array
+ */
+ private byte[] contentsOfResource(int resource) {
+ InputStream is = null;
+ try {
+ is = context.get().getResources().openRawResource(resource);
+ return contentsOfInputStream(is);
+ } catch (Resources.NotFoundException e) {
+ DebugTool.logError(TAG, "Can't read from resource", e);
+ return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
- /**
- * Helper method to take Uri and turn it into byte array
- * @param uri Uri for desired file
- * @return Resulting byte array
- */
- private byte[] contentsOfUri(Uri uri){
- InputStream is = null;
- try{
- is = context.get().getContentResolver().openInputStream(uri);
- return contentsOfInputStream(is);
- } catch (IOException e){
- DebugTool.logError(TAG, "Can't read from Uri", e);
- return null;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
+ /**
+ * Helper method to take Uri and turn it into byte array
+ *
+ * @param uri Uri for desired file
+ * @return Resulting byte array
+ */
+ private byte[] contentsOfUri(Uri uri) {
+ InputStream is = null;
+ try {
+ is = context.get().getContentResolver().openInputStream(uri);
+ return contentsOfInputStream(is);
+ } catch (IOException e) {
+ DebugTool.logError(TAG, "Can't read from Uri", e);
+ return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index afceb04a1..c8887d4e1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
@@ -45,20 +45,22 @@ import com.smartdevicelink.util.DebugTool;
/**
* A class that extends SdlFile, representing artwork (JPEG, PNG, or BMP) to be uploaded to core
*/
-public class SdlArtwork extends SdlFile implements Cloneable{
+public class SdlArtwork extends SdlFile implements Cloneable {
private boolean isTemplate;
private Image imageRPC;
/**
* Creates a new instance of SdlArtwork
*/
- public SdlArtwork() {}
+ public SdlArtwork() {
+ }
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param id an int value representing the android resource id of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param id an int value representing the android resource id of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, int id, boolean persistentFile) {
@@ -67,9 +69,10 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param uri a URI value representing a file's location. Currently, it only supports local files
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, Uri uri, boolean persistentFile) {
@@ -78,9 +81,10 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param data a byte array representing the data of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile) {
@@ -89,6 +93,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
+ *
* @param staticIconName a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public SdlArtwork(@NonNull StaticIconName staticIconName) {
@@ -97,32 +102,35 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Sets whether this SdlArtwork is a template image whose coloring should be decided by the HMI
+ *
* @param isTemplate boolean that tells whether this SdlArtwork is a template image
*/
- public void setTemplateImage(boolean isTemplate){
+ public void setTemplateImage(boolean isTemplate) {
this.isTemplate = isTemplate;
}
/**
* Gets whether this SdlArtwork is a template image whose coloring should be decided by the HMI
+ *
* @return boolean that tells whether this SdlArtwork is a template image
*/
- public boolean isTemplateImage(){
+ public boolean isTemplateImage() {
return isTemplate;
}
@Override
public void setType(@NonNull FileType fileType) {
- if(fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
- || fileType.equals(FileType.GRAPHIC_BMP)){
+ if (fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
+ || fileType.equals(FileType.GRAPHIC_BMP)) {
super.setType(fileType);
- }else{
+ } else {
throw new IllegalArgumentException("Only JPEG, PNG, and BMP image types are supported.");
}
}
/**
* Gets the Image RPC representing this artwork. Generally for use internally, you should instead pass an artwork to a Screen Manager method
+ *
* @return The Image RPC representing this artwork
*/
public Image getImageRPC() {
@@ -132,7 +140,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{
return imageRPC;
}
- private Image createImageRPC(){
+ private Image createImageRPC() {
Image image;
if (isStaticIcon()) {
image = new Image(getName(), ImageType.STATIC);
@@ -146,18 +154,19 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a deep copy of the object
+ *
* @return deep copy of the object, null if an exception occurred
*/
@Override
public SdlArtwork clone() {
- try{
+ try {
SdlArtwork artwork = (SdlArtwork) super.clone();
- if(artwork != null){
- artwork.imageRPC = artwork.createImageRPC();
+ if (artwork != null) {
+ artwork.imageRPC = artwork.createImageRPC();
}
return artwork;
} catch (CloneNotSupportedException e) {
- if(DebugTool.isDebugEnabled()){
+ if (DebugTool.isDebugEnabled()) {
throw new RuntimeException("Clone not supported by super class");
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
index 2b978c790..13c7d3119 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
@@ -46,7 +46,7 @@ import java.util.Arrays;
/**
* A class representing data to be uploaded to core
*/
-public class SdlFile{
+public class SdlFile {
private String fileName;
private int id = -1;
private Uri uri;
@@ -61,16 +61,18 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
*/
- public SdlFile() { }
+ public SdlFile() {
+ }
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param id an int value representing the android resource id of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param id an int value representing the android resource id of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, int id, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, int id, boolean persistentFile) {
setName(fileName);
setType(fileType);
setResourceId(id);
@@ -79,12 +81,13 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param uri a URI value representing a file's location. Currently, it only supports local files
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, Uri uri, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, Uri uri, boolean persistentFile) {
setName(fileName);
setType(fileType);
setUri(uri);
@@ -93,12 +96,13 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param data a byte array representing the data of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile) {
setName(fileName);
setType(fileType);
setFileData(data);
@@ -107,9 +111,10 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
+ *
* @param staticIconName a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
- public SdlFile(@NonNull StaticIconName staticIconName){
+ public SdlFile(@NonNull StaticIconName staticIconName) {
setName(staticIconName.toString());
setFileData(staticIconName.toString().getBytes());
setPersistent(false);
@@ -118,6 +123,7 @@ public class SdlFile{
/**
* Sets the name of the file
+ *
* @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
*/
public void setName(String fileName) {
@@ -138,17 +144,19 @@ public class SdlFile{
/**
* Gets the name of the file
+ *
* @return a String value representing the name that will be used to store the file in the head unit
*/
- public String getName(){
+ public String getName() {
return fileName;
}
/**
* Sets the resource ID of the file
+ *
* @param id an int value representing the android resource id of the file
*/
- public void setResourceId(int id){
+ public void setResourceId(int id) {
this.id = id;
if (shouldAutoGenerateName) {
this.fileName = generateFileNameFromResourceId(id);
@@ -157,17 +165,19 @@ public class SdlFile{
/**
* Gets the resource id of the file
+ *
* @return an int value representing the android resource id of the file
*/
- public int getResourceId(){
+ public int getResourceId() {
return id;
}
/**
* Sets the uri of the file
+ *
* @param uri a URI value representing a file's location. Currently, it only supports local files
*/
- public void setUri(Uri uri){
+ public void setUri(Uri uri) {
this.uri = uri;
if (shouldAutoGenerateName && uri != null) {
this.fileName = generateFileNameFromUri(uri);
@@ -176,17 +186,19 @@ public class SdlFile{
/**
* Gets the uri of the file
+ *
* @return a URI value representing a file's location. Currently, it only supports local files
*/
- public Uri getUri(){
+ public Uri getUri() {
return uri;
}
/**
* Sets the byte array that represents the content of the file
+ *
* @param data a byte array representing the data of the file
*/
- public void setFileData(byte[] data){
+ public void setFileData(byte[] data) {
this.fileData = data;
if (shouldAutoGenerateName && data != null) {
this.fileName = generateFileNameFromData(data);
@@ -195,46 +207,52 @@ public class SdlFile{
/**
* Gets the byte array that represents the content of the file
+ *
* @return a byte array representing the data of the file
*/
- public byte[] getFileData(){
+ public byte[] getFileData() {
return fileData;
}
/**
* Sets the type of the file
+ *
* @param fileType a FileType enum value representing the type of the file
*/
- public void setType(@NonNull FileType fileType){
+ public void setType(@NonNull FileType fileType) {
this.fileType = fileType;
}
/**
* Gets the type of the file
+ *
* @return a FileType enum value representing the type of the file
*/
- public FileType getType(){
+ public FileType getType() {
return fileType;
}
/**
* Sets whether the file should persist between sessions / ignition cycles
+ *
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public void setPersistent(boolean persistentFile){
+ public void setPersistent(boolean persistentFile) {
this.persistentFile = persistentFile;
}
/**
* Gets whether the file should persist between sessions / ignition cycles
+ *
* @return a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public boolean isPersistent(){
+ public boolean isPersistent() {
return this.persistentFile;
}
/**
* Sets the the name of the static file. Static files comes pre-shipped with the head unit
+ *
* @param staticIcon a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public void setStaticIcon(boolean staticIcon) {
@@ -243,6 +261,7 @@ public class SdlFile{
/**
* Gets the the name of the static file. Static files comes pre-shipped with the head unit
+ *
* @return a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public boolean isStaticIcon() {
@@ -251,6 +270,7 @@ public class SdlFile{
/**
* Gets the overwrite property for an SdlFile by default its set to false
+ *
* @return a boolean value that indicates if a file can be overwritten.
*/
public boolean getOverwrite() {
@@ -259,6 +279,7 @@ public class SdlFile{
/**
* Sets the overwrite property for an SdlFile by default its set to false
+ *
* @param overwrite a boolean value that indicates if a file can be overwritten
*/
public void setOverwrite(boolean overwrite) {
@@ -267,6 +288,7 @@ public class SdlFile{
/**
* Generates a file name from data by hashing the data and returning the last 16 chars
+ *
* @param data a byte array representing the data of the file
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -294,6 +316,7 @@ public class SdlFile{
/**
* Generates a file name from uri by hashing the uri string and returning the last 16 chars
+ *
* @param uri a URI value representing a file's location
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -303,6 +326,7 @@ public class SdlFile{
/**
* Generates a file name from resourceId by hashing the id and returning the last 16 chars
+ *
* @param id an int value representing the android resource id of the file
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -312,6 +336,7 @@ public class SdlFile{
/**
* Used to compile hashcode for SdlFile for use to compare in overridden equals method
+ *
* @return Custom hashcode of SdlFile variables
*/
@Override
@@ -329,6 +354,7 @@ public class SdlFile{
/**
* Uses our custom hashCode for SdlFile objects
+ *
* @param o - The object to compare
* @return boolean of whether the objects are the same or not
*/
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index e5aee6c3e..e53ec106c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -36,7 +36,6 @@ import android.content.Context;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.protocol.ISdlServiceListener;
@@ -44,6 +43,7 @@ import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
@@ -56,7 +56,6 @@ import java.lang.ref.WeakReference;
/**
* The lifecycle manager creates a central point for all SDL session logic to converge. It should only be used by
* the library itself. Usage outside the library is not permitted and will not be protected for in the future.
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class LifecycleManager extends BaseLifecycleManager {
@@ -78,7 +77,7 @@ public class LifecycleManager extends BaseLifecycleManager {
} else if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.TCP)) {
this.session = new SdlSession(sdlSessionListener, (TCPTransportConfig) _transportConfig);
} else {
- DebugTool.logError(TAG,"Unable to create session for transport type");
+ DebugTool.logError(TAG, "Unable to create session for transport type");
}
}
@@ -109,7 +108,7 @@ public class LifecycleManager extends BaseLifecycleManager {
super.setSdlSecurityStaticVars();
Context context = null;
- if(this.contextWeakReference != null){
+ if (this.contextWeakReference != null) {
context = contextWeakReference.get();
}
SdlSecurityBase.setContext(context);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
index e10693770..4ca79c893 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
@@ -35,7 +35,7 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>SystemCapabilityManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
*/
public class SystemCapabilityManager extends BaseSystemCapabilityManager {
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 df1db5475..c5c932a8e 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
@@ -39,7 +39,7 @@ import java.lang.annotation.RetentionPolicy;
/**
* <strong>LockScreenConfig</strong> <br>
- *
+ * <p>
* This is set during SdlManager instantiation. <br>
*
* <li> enable - if false, don't worry about the other parameters. You are responsible for creating and managing a lockscreen.
@@ -60,136 +60,152 @@ import java.lang.annotation.RetentionPolicy;
*/
public class LockScreenConfig {
- private final boolean enable;
- private boolean deviceLogo;
- private boolean 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;
- }
-
- /**
- * Set the resource int of the background color. Colors should define colors in your Colors.xml file
- * @param resourceColor resource int of the color
- */
- public void setBackgroundColor(int resourceColor){
- this.backgroundColor = resourceColor;
- }
-
- /**
- * Gets the int reference to the custom lock screen background color
- * @return the color reference
- */
- public int getBackgroundColor() {
- return backgroundColor;
- }
-
- /**
- * int of the drawable icon.
- * @param appIconInt the drawable of the icon to be displayed on the lock screen
- */
- public void setAppIcon(int appIconInt) {
- this.appIconInt = appIconInt;
- }
-
- /**
- * Gets the resource reference of the icon to be displayed on the lock screen
- * @return the icon reference
- */
- public int getAppIcon() {
- return appIconInt;
- }
-
- /**
- * Sets the reference to the custom layout to be used for the lock screen <br>
- * <strong>If set, the color and icon setters will be ignored</strong>
- * @param customViewInt the layout
- */
- public void setCustomView(int customViewInt) {
- this.customViewInt = customViewInt;
- }
-
- /**
- * Gets the reference to the custom lockscreen layout to be used
- * @return the layout reference
- */
- public int getCustomView() {
- return customViewInt;
- }
-
- /**
- * Whether or not to show the device's logo on the default lock screen <br>
- * The logo will come from the connected hardware, if set by the manufacturer <br>
- * If using a Custom View, this will be ignored.
- * @param deviceLogo - boolean
- */
- public void showDeviceLogo(boolean deviceLogo) {
- this.deviceLogo = deviceLogo;
- }
-
- /**
- * Get whether or not the device's Logo is shown on the default lock screen <br>
- * The logo will come from the connected hardware, if set by the manufacturer <br>
- * @return deviceLogo - boolean
- */
- public boolean isDeviceLogoEnabled() {
- 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;
- }
+ private final boolean enable;
+ private boolean deviceLogo;
+ private boolean 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;
+ }
+
+ /**
+ * Set the resource int of the background color. Colors should define colors in your Colors.xml file
+ *
+ * @param resourceColor resource int of the color
+ */
+ public void setBackgroundColor(int resourceColor) {
+ this.backgroundColor = resourceColor;
+ }
+
+ /**
+ * Gets the int reference to the custom lock screen background color
+ *
+ * @return the color reference
+ */
+ public int getBackgroundColor() {
+ return backgroundColor;
+ }
+
+ /**
+ * int of the drawable icon.
+ *
+ * @param appIconInt the drawable of the icon to be displayed on the lock screen
+ */
+ public void setAppIcon(int appIconInt) {
+ this.appIconInt = appIconInt;
+ }
+
+ /**
+ * Gets the resource reference of the icon to be displayed on the lock screen
+ *
+ * @return the icon reference
+ */
+ public int getAppIcon() {
+ return appIconInt;
+ }
+
+ /**
+ * Sets the reference to the custom layout to be used for the lock screen <br>
+ * <strong>If set, the color and icon setters will be ignored</strong>
+ *
+ * @param customViewInt the layout
+ */
+ public void setCustomView(int customViewInt) {
+ this.customViewInt = customViewInt;
+ }
+
+ /**
+ * Gets the reference to the custom lockscreen layout to be used
+ *
+ * @return the layout reference
+ */
+ public int getCustomView() {
+ return customViewInt;
+ }
+
+ /**
+ * Whether or not to show the device's logo on the default lock screen <br>
+ * The logo will come from the connected hardware, if set by the manufacturer <br>
+ * If using a Custom View, this will be ignored.
+ *
+ * @param deviceLogo - boolean
+ */
+ public void showDeviceLogo(boolean deviceLogo) {
+ this.deviceLogo = deviceLogo;
+ }
+
+ /**
+ * Get whether or not the device's Logo is shown on the default lock screen <br>
+ * The logo will come from the connected hardware, if set by the manufacturer <br>
+ *
+ * @return deviceLogo - boolean
+ */
+ public boolean isDeviceLogoEnabled() {
+ 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/LockScreenDeviceIconManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
index 603435800..4ab38fd92 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java
@@ -18,9 +18,8 @@ import java.security.NoSuchAlgorithmException;
/**
* <strong>LockScreenDeviceIconManager</strong> <br>
- *
+ * <p>
* The LockScreenDeviceIconManager handles the logic of caching and retrieving cached lock screen icons <br>
- *
*/
class LockScreenDeviceIconManager {
@@ -31,6 +30,7 @@ class LockScreenDeviceIconManager {
interface OnIconRetrievedListener {
void onImageRetrieved(Bitmap icon);
+
void onError(String info);
}
@@ -43,7 +43,8 @@ class LockScreenDeviceIconManager {
/**
* Will try to return a lock screen icon either from cache or downloaded
* if it fails iconRetrievedListener.OnError will be called with corresponding error message
- * @param iconURL url that the lock screen icon is downloaded from
+ *
+ * @param iconURL url that the lock screen icon is downloaded from
* @param iconRetrievedListener an interface that will implement onIconReceived and OnError methods
*/
void retrieveIcon(String iconURL, OnIconRetrievedListener iconRetrievedListener) {
@@ -87,6 +88,7 @@ class LockScreenDeviceIconManager {
/**
* Will decide if a cached icon is available and up to date
+ *
* @param iconUrl url will be hashed and used to look up last updated timestamp in shared preferences
* @return True when icon details are in shared preferences and less than 30 days old, False if icon details are too old or not found
*/
@@ -94,7 +96,7 @@ class LockScreenDeviceIconManager {
String iconHash = getMD5HashFromIconUrl(iconUrl);
SharedPreferences sharedPref = this.context.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
String iconLastUpdatedTime = sharedPref.getString(iconHash, null);
- if(iconLastUpdatedTime == null) {
+ if (iconLastUpdatedTime == null) {
DebugTool.logInfo(TAG, "No Icon Details Found In Shared Preferences");
return false;
} else {
@@ -117,7 +119,8 @@ class LockScreenDeviceIconManager {
/**
* Will try to save icon to cache
- * @param icon the icon bitmap that should be saved to cache
+ *
+ * @param icon the icon bitmap that should be saved to cache
* @param iconUrl the url where the icon was retrieved will be hashed and used for file and file details lookup
*/
private void saveFileToCache(Bitmap icon, String iconUrl) {
@@ -142,6 +145,7 @@ class LockScreenDeviceIconManager {
/**
* Will try to retrieve icon bitmap from cached directory
+ *
* @param iconUrl the url where the icon was retrieved will be hashed and used to look up file location
* @return bitmap of device icon or null if it fails to find the icon or read from shared preferences
*/
@@ -152,7 +156,7 @@ class LockScreenDeviceIconManager {
if (iconLastUpdatedTime != null) {
Bitmap cachedIcon = BitmapFactory.decodeFile(this.context.getCacheDir() + "/" + STORED_ICON_DIRECTORY_PATH + "/" + iconHash);
- if(cachedIcon == null) {
+ if (cachedIcon == null) {
DebugTool.logError(TAG, "Failed to get Bitmap from decoding file cache");
clearIconDirectory();
sharedPref.edit().clear().commit();
@@ -169,6 +173,7 @@ class LockScreenDeviceIconManager {
/**
* Will write information about the icon to shared preferences
* icon information will have a look up key of the hashed icon url and the current timestamp to indicated when the icon was last updated.
+ *
* @param iconHash the url where the icon was retrieved will be hashed and used lookup key
*/
private void writeDeviceIconParametersToSharedPreferences(String iconHash) {
@@ -180,6 +185,7 @@ class LockScreenDeviceIconManager {
/**
* Create an MD5 hash of the icon url for file storage and lookup/shared preferences look up
+ *
* @param iconUrl the url where the icon was retrieved
* @return MD5 hash of the icon URL
*/
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 56975a390..105396fa2 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
@@ -42,9 +42,9 @@ import androidx.annotation.RestrictTo;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
@@ -60,346 +60,343 @@ import java.lang.ref.WeakReference;
/**
* <strong>LockscreenManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The LockscreenManager handles the logic of showing and hiding the lock screen. <br>
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class LockScreenManager extends BaseSubManager {
- private static final String TAG = "LockScreenManager";
- private final WeakReference<Context> context;
- HMILevel hmiLevel;
- private OnRPCNotificationListener systemRequestListener, ddListener, hmiListener;
- private String deviceIconUrl;
- boolean driverDistStatus;
+ private static final String TAG = "LockScreenManager";
+ private final WeakReference<Context> context;
+ HMILevel hmiLevel;
+ private OnRPCNotificationListener systemRequestListener, ddListener, hmiListener;
+ private String deviceIconUrl;
+ boolean driverDistStatus;
boolean mIsLockscreenDismissible;
boolean enableDismissGesture;
final boolean lockScreenEnabled;
final boolean deviceLogoEnabled;
- private volatile boolean isApplicationForegrounded;
- private androidx.lifecycle.LifecycleObserver lifecycleObserver;
- final int lockScreenIcon;
+ private volatile boolean isApplicationForegrounded;
+ private androidx.lifecycle.LifecycleObserver lifecycleObserver;
+ final int lockScreenIcon;
final int lockScreenColor;
final int customView;
int displayMode;
- Bitmap deviceLogo;
- private boolean mLockScreenHasBeenDismissed, lockscreenDismissReceiverRegistered, receivedFirstDDNotification;
- private String mLockscreenWarningMsg;
- private BroadcastReceiver mLockscreenDismissedReceiver;
- private final LockScreenDeviceIconManager mLockScreenDeviceIconManager;
-
- public LockScreenManager(LockScreenConfig lockScreenConfig, Context context, ISdl internalInterface){
-
- super(internalInterface);
- this.context = new WeakReference<>(context);
- this.mLockScreenDeviceIconManager = new LockScreenDeviceIconManager(context);
-
-
- // set initial class variables
- hmiLevel = HMILevel.HMI_NONE;
- driverDistStatus = false;
-
- // setup the manager
- lockScreenIcon = lockScreenConfig.getAppIcon();
- lockScreenColor = lockScreenConfig.getBackgroundColor();
- customView = lockScreenConfig.getCustomView();
- lockScreenEnabled = lockScreenConfig.getDisplayMode() != LockScreenConfig.DISPLAY_MODE_NEVER;
- 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();
- }
-
- @Override
- public void start(CompletionListener listener) {
- transitionToState(READY);
- super.start(listener);
- }
-
- @Override
- public void dispose(){
- // 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);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_DRIVER_DISTRACTION, ddListener);
- if (deviceLogoEnabled) {
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_SYSTEM_REQUEST, systemRequestListener);
- }
- deviceLogo = null;
- deviceIconUrl = null;
-
- try {
- if (androidx.lifecycle.ProcessLifecycleOwner.get() != null && lifecycleObserver != null) {
- androidx.lifecycle.ProcessLifecycleOwner.get().getLifecycle().removeObserver(lifecycleObserver);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- lifecycleObserver = null;
-
- isApplicationForegrounded = false;
-
- super.dispose();
- }
-
- ////
- // SETUP
- ////
-
- /**
- * Adds 3 listeners that help determine whether or not a lockscreen should be shown.
- * This will change the variables that we hold in the manager to the newest values and then
- * usually call launchLockScreenActivity
- *
- * 1. ON_HMI_STATUS
- * 2. ON_DRIVER_DISTRACTION
- * 3. ON_SYSTEM_REQUEST (used for device Icon Downloading)
- */
- private void setupListeners(){
- // add hmi listener
- 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 = onHMIStatus.getHmiLevel();
- launchLockScreenActivity();
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
- // set up driver distraction listener
- ddListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- // do something with the status
- if (notification != null) {
- OnDriverDistraction ddState = (OnDriverDistraction) notification;
- Boolean isDismissible = ddState.getLockscreenDismissibility();
- DebugTool.logInfo(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
- driverDistStatus = true;
- launchLockScreenActivity();
- }else{
- // close lock screen
- driverDistStatus = false;
- closeLockScreenActivity();
- }
- receivedFirstDDNotification = true;
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_DRIVER_DISTRACTION, ddListener);
-
- // set up system request listener
- if (deviceLogoEnabled) {
- systemRequestListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- // do something with the status
- final OnSystemRequest msg = (OnSystemRequest) notification;
- if (msg.getRequestType() == RequestType.LOCK_SCREEN_ICON_URL &&
- msg.getUrl() != null) {
- // send intent to activity to download icon from core
- deviceIconUrl = msg.getUrl().replace("http://", "https://");
- downloadDeviceIcon(deviceIconUrl);
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_SYSTEM_REQUEST, systemRequestListener);
- }
-
- // Set up listener for Application Foreground / Background events
- try {
- lifecycleObserver = new androidx.lifecycle.LifecycleObserver() {
- @androidx.lifecycle.OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_START)
- public void onMoveToForeground() {
- isApplicationForegrounded = true;
- launchLockScreenActivity();
- }
-
- @androidx.lifecycle.OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_STOP)
- public void onMoveToBackground() {
- isApplicationForegrounded = false;
- }
- };
-
- if (androidx.lifecycle.ProcessLifecycleOwner.get() != null) {
- androidx.lifecycle.ProcessLifecycleOwner.get().getLifecycle().addObserver(lifecycleObserver);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- mLockscreenDismissedReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED.equals(intent.getAction())) {
- mLockScreenHasBeenDismissed = true;
- }
- }
- };
- }
-
- ////
- // LAUNCH LOCK SCREEN LOGIC
- ////
-
- /**
- * 1. Check if user wants us to manage lock screen
- * 2. If so, get the HMI level and LockScreenStatus from the method below
- * 3. Build intent and start the SDLLockScreenActivity
- *
- * 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 || 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);
-
- // Extra parameters for customization of the lock screen view
- showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_ICON_EXTRA, lockScreenIcon);
- showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_COLOR_EXTRA, lockScreenColor);
- 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));
- }
- }
- }
-
- ////
- // HELPERS
- ////
-
- /**
- * Step through some logic to determine if we need to show the lock screen or not
- * This function is usually triggered on some sort of notification.
- *
- * @return Whether or not the Lock Screen is required
- */
- synchronized LockScreenStatus getLockScreenStatus() {
-
- if ((hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
- return LockScreenStatus.OFF;
- }
- else if ( hmiLevel.equals(HMILevel.HMI_BACKGROUND)) {
- if (!driverDistStatus) {
- //we don't have driver distraction, lock screen is entirely based on if user is using the app on the head unit
- return LockScreenStatus.OFF;
- } else {
- return LockScreenStatus.REQUIRED;
- }
- }
- else if ((hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
- if (!driverDistStatus) {
- return LockScreenStatus.OPTIONAL;
- } else {
- return LockScreenStatus.REQUIRED;
- }
- }
- return LockScreenStatus.OFF;
- }
-
- private void downloadDeviceIcon(final String url){
-
- if (deviceLogo != null || context.get() == null){
- return;
- }
-
- new Thread(new Runnable(){
- @Override
- public void run(){
- mLockScreenDeviceIconManager.retrieveIcon(url, new LockScreenDeviceIconManager.OnIconRetrievedListener() {
- @Override
- public void onImageRetrieved(Bitmap icon) {
- deviceLogo = icon;
- if(deviceLogo != null) {
- Intent intent = new Intent(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_DOWNLOADED);
- intent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_EXTRA, deviceLogoEnabled);
- intent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_BITMAP, deviceLogo);
- if (context.get() != null) {
- context.get().sendBroadcast(intent);
- }
- }
- }
-
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, info);
- }
- });
- }
- }).start();
- }
+ Bitmap deviceLogo;
+ private boolean mLockScreenHasBeenDismissed, lockscreenDismissReceiverRegistered, receivedFirstDDNotification;
+ private String mLockscreenWarningMsg;
+ private BroadcastReceiver mLockscreenDismissedReceiver;
+ private final LockScreenDeviceIconManager mLockScreenDeviceIconManager;
+
+ public LockScreenManager(LockScreenConfig lockScreenConfig, Context context, ISdl internalInterface) {
+
+ super(internalInterface);
+ this.context = new WeakReference<>(context);
+ this.mLockScreenDeviceIconManager = new LockScreenDeviceIconManager(context);
+
+
+ // set initial class variables
+ hmiLevel = HMILevel.HMI_NONE;
+ driverDistStatus = false;
+
+ // setup the manager
+ lockScreenIcon = lockScreenConfig.getAppIcon();
+ lockScreenColor = lockScreenConfig.getBackgroundColor();
+ customView = lockScreenConfig.getCustomView();
+ lockScreenEnabled = lockScreenConfig.getDisplayMode() != LockScreenConfig.DISPLAY_MODE_NEVER;
+ 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();
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ transitionToState(READY);
+ super.start(listener);
+ }
+
+ @Override
+ public void dispose() {
+ // 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);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_DRIVER_DISTRACTION, ddListener);
+ if (deviceLogoEnabled) {
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_SYSTEM_REQUEST, systemRequestListener);
+ }
+ deviceLogo = null;
+ deviceIconUrl = null;
+
+ try {
+ if (androidx.lifecycle.ProcessLifecycleOwner.get() != null && lifecycleObserver != null) {
+ androidx.lifecycle.ProcessLifecycleOwner.get().getLifecycle().removeObserver(lifecycleObserver);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ lifecycleObserver = null;
+
+ isApplicationForegrounded = false;
+
+ super.dispose();
+ }
+
+ ////
+ // SETUP
+ ////
+
+ /**
+ * Adds 3 listeners that help determine whether or not a lockscreen should be shown.
+ * This will change the variables that we hold in the manager to the newest values and then
+ * usually call launchLockScreenActivity
+ * <p>
+ * 1. ON_HMI_STATUS
+ * 2. ON_DRIVER_DISTRACTION
+ * 3. ON_SYSTEM_REQUEST (used for device Icon Downloading)
+ */
+ private void setupListeners() {
+ // add hmi listener
+ 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 = onHMIStatus.getHmiLevel();
+ launchLockScreenActivity();
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ // set up driver distraction listener
+ ddListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ // do something with the status
+ if (notification != null) {
+ OnDriverDistraction ddState = (OnDriverDistraction) notification;
+ Boolean isDismissible = ddState.getLockscreenDismissibility();
+ DebugTool.logInfo(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
+ driverDistStatus = true;
+ launchLockScreenActivity();
+ } else {
+ // close lock screen
+ driverDistStatus = false;
+ closeLockScreenActivity();
+ }
+ receivedFirstDDNotification = true;
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_DRIVER_DISTRACTION, ddListener);
+
+ // set up system request listener
+ if (deviceLogoEnabled) {
+ systemRequestListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ // do something with the status
+ final OnSystemRequest msg = (OnSystemRequest) notification;
+ if (msg.getRequestType() == RequestType.LOCK_SCREEN_ICON_URL &&
+ msg.getUrl() != null) {
+ // send intent to activity to download icon from core
+ deviceIconUrl = msg.getUrl().replace("http://", "https://");
+ downloadDeviceIcon(deviceIconUrl);
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_SYSTEM_REQUEST, systemRequestListener);
+ }
+
+ // Set up listener for Application Foreground / Background events
+ try {
+ lifecycleObserver = new androidx.lifecycle.LifecycleObserver() {
+ @androidx.lifecycle.OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_START)
+ public void onMoveToForeground() {
+ isApplicationForegrounded = true;
+ launchLockScreenActivity();
+ }
+
+ @androidx.lifecycle.OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_STOP)
+ public void onMoveToBackground() {
+ isApplicationForegrounded = false;
+ }
+ };
+
+ if (androidx.lifecycle.ProcessLifecycleOwner.get() != null) {
+ androidx.lifecycle.ProcessLifecycleOwner.get().getLifecycle().addObserver(lifecycleObserver);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ mLockscreenDismissedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED.equals(intent.getAction())) {
+ mLockScreenHasBeenDismissed = true;
+ }
+ }
+ };
+ }
+
+ ////
+ // LAUNCH LOCK SCREEN LOGIC
+ ////
+
+ /**
+ * 1. Check if user wants us to manage lock screen
+ * 2. If so, get the HMI level and LockScreenStatus from the method below
+ * 3. Build intent and start the SDLLockScreenActivity
+ * <p>
+ * 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 || 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);
+
+ // Extra parameters for customization of the lock screen view
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_ICON_EXTRA, lockScreenIcon);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_COLOR_EXTRA, lockScreenColor);
+ 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));
+ }
+ }
+ }
+
+ ////
+ // HELPERS
+ ////
+
+ /**
+ * Step through some logic to determine if we need to show the lock screen or not
+ * This function is usually triggered on some sort of notification.
+ *
+ * @return Whether or not the Lock Screen is required
+ */
+ synchronized LockScreenStatus getLockScreenStatus() {
+
+ if ((hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
+ return LockScreenStatus.OFF;
+ } else if (hmiLevel.equals(HMILevel.HMI_BACKGROUND)) {
+ if (!driverDistStatus) {
+ //we don't have driver distraction, lock screen is entirely based on if user is using the app on the head unit
+ return LockScreenStatus.OFF;
+ } else {
+ return LockScreenStatus.REQUIRED;
+ }
+ } else if ((hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
+ if (!driverDistStatus) {
+ return LockScreenStatus.OPTIONAL;
+ } else {
+ return LockScreenStatus.REQUIRED;
+ }
+ }
+ return LockScreenStatus.OFF;
+ }
+
+ private void downloadDeviceIcon(final String url) {
+
+ if (deviceLogo != null || context.get() == null) {
+ return;
+ }
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ mLockScreenDeviceIconManager.retrieveIcon(url, new LockScreenDeviceIconManager.OnIconRetrievedListener() {
+ @Override
+ public void onImageRetrieved(Bitmap icon) {
+ deviceLogo = icon;
+ if (deviceLogo != null) {
+ Intent intent = new Intent(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_DOWNLOADED);
+ intent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_EXTRA, deviceLogoEnabled);
+ intent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_BITMAP, deviceLogo);
+ if (context.get() != null) {
+ context.get().sendBroadcast(intent);
+ }
+ }
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, info);
+ }
+ });
+ }
+ }).start();
+ }
}
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 3007d081a..e74e9db6e 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
@@ -55,229 +55,231 @@ import com.smartdevicelink.R;
public class SDLLockScreenActivity extends Activity {
- public static final String LOCKSCREEN_COLOR_EXTRA = "LOCKSCREEN_COLOR_EXTRA";
- public static final String LOCKSCREEN_ICON_EXTRA = "LOCKSCREEN_ICON_EXTRA";
- public static final String LOCKSCREEN_DEVICE_LOGO_EXTRA = "LOCKSCREEN_DEVICE_LOGO_EXTRA";
- public static final String LOCKSCREEN_DEVICE_LOGO_BITMAP = "LOCKSCREEN_DEVICE_LOGO_BITMAP";
- 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 int backgroundColor = Color.parseColor("#394e60");
- private boolean useWhiteIconAndTextColor;
-
-
- private final BroadcastReceiver lockScreenBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent != null){
- String action = intent.getAction();
- if (action != null){
- if (action.equalsIgnoreCase(CLOSE_LOCK_SCREEN_ACTION)){
- finish();
- } else if (action.equalsIgnoreCase(LOCKSCREEN_DEVICE_LOGO_DOWNLOADED)){
- boolean deviceLogoEnabled = intent.getBooleanExtra(LOCKSCREEN_DEVICE_LOGO_EXTRA, true);
- Bitmap deviceLogo = intent.getParcelableExtra(LOCKSCREEN_DEVICE_LOGO_BITMAP);
- if (deviceLogoEnabled && deviceLogo != null){
- setDeviceLogo(deviceLogo);
- }
- }
- }
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- 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());
-
- // create intent filter
- IntentFilter lockscreenFilter = new IntentFilter();
- lockscreenFilter.addAction(CLOSE_LOCK_SCREEN_ACTION);
- lockscreenFilter.addAction(LOCKSCREEN_DEVICE_LOGO_DOWNLOADED);
-
- // register broadcast receivers
- registerReceiver(lockScreenBroadcastReceiver, lockscreenFilter);
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (mIsDismissible) {
- return mGestureDetector.onTouchEvent(event);
- }
- return super.onTouchEvent(event);
- }
-
- @Override
- protected void onDestroy() {
- unregisterReceiver(lockScreenBroadcastReceiver);
- super.onDestroy();
- }
-
- @Override
- public void onBackPressed() {
- }
-
- @Override
- 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){
- if (intent != null){
- boolean deviceLogoEnabled = intent.getBooleanExtra(LOCKSCREEN_DEVICE_LOGO_EXTRA, true);
- int customColor = intent.getIntExtra(LOCKSCREEN_COLOR_EXTRA, 0);
- int customIcon = intent.getIntExtra(LOCKSCREEN_ICON_EXTRA, 0);
- int customView = intent.getIntExtra(LOCKSCREEN_CUSTOM_VIEW_EXTRA, 0);
- Bitmap deviceIcon = intent.getParcelableExtra(LOCKSCREEN_DEVICE_LOGO_BITMAP);
- backgroundColor = (customColor != 0) ? customColor : backgroundColor;
-
- if (customView != 0){
- setCustomView(customView);
- } else {
- setContentView(R.layout.activity_sdllock_screen);
- setBackgroundColor();
- useWhiteIconAndTextColor = shouldUseWhiteForegroundForBackgroundColor();
-
- // set Lock Screen Icon
- if (customIcon != 0){
- changeIcon(customIcon);
- } else {
- setSdlLogo();
- }
-
- 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);
- } else if (!useWhiteIconAndTextColor) {
- setTextColorBlack();
- }
- }
- }
- }
-
- /**
- * Sets the lockScreen logo
- */
- private void setSdlLogo() {
- ImageView lockScreen_iv = findViewById(R.id.lockscreen_image);
- Drawable sdlIcon = getResources().getDrawable(R.drawable.sdl_lockscreen_icon);
- // Checks color contrast and determines if the logo should be black or white
- if (useWhiteIconAndTextColor) {
- int color = Color.parseColor("#ffffff");
-
- int red = (color & 0xFF0000) / 0xFFFF;
- int green = (color & 0xFF00) / 0xFF;
- int blue = color & 0xFF;
-
- float[] matrix = {0, 0, 0, 0, red,
- 0, 0, 0, 0, green,
- 0, 0, 0, 0, blue,
- 0, 0, 0, 1, 0};
-
- ColorFilter colorFilter = new ColorMatrixColorFilter(matrix);
- sdlIcon.setColorFilter(colorFilter);
- }
- lockScreen_iv.setImageDrawable(sdlIcon);
- }
-
- /**
- * Changes the text color to white on the lockScreen
- */
- private void setTextColorBlack() {
- TextView tv = findViewById(R.id.lockscreen_text);
- tv.setTextColor(Color.parseColor("#000000"));
- }
-
- /**
- * Calculates the contrast of the background to determine if the Icon and Text color
- * should be white or black
- * @return True if Background and Icon should be white, False if black
- */
- private boolean shouldUseWhiteForegroundForBackgroundColor() {
- float r = Color.red(backgroundColor) / 255f;
- float b = Color.blue(backgroundColor) / 255f;
- float g = Color.green(backgroundColor) / 255f;
-
- // http://stackoverflow.com/a/3943023
- r = (r <= 0.3928f) ? (r / 12.92f) : (float) Math.pow(((r + 0.055f) / 1.055f), 2.4f);
- g = (g <= 0.3928f) ? (g / 12.92f) : (float) Math.pow(((g + 0.055f) / 1.055f), 2.4f);
- b = (b <= 0.3928f) ? (b / 12.92f) : (float) Math.pow(((b + 0.055f) / 1.055f), 2.4f);
-
- float luminescence = 0.2126f * r + 0.7152f * g + 0.0722f * b;
- return luminescence <= 0.179;
- }
-
- /**
- * Sets the color of the background
- * Will use default color if not set in LockScreenConfig
- */
- private void setBackgroundColor() {
- RelativeLayout layout = findViewById(R.id.lockscreen_relative_layout);
- layout.setBackgroundColor(backgroundColor);
- }
-
- /**
- * Used to change LockScreen default Icon to customIcon set in LockScreenConfig
- * @param customIcon
- */
- private void changeIcon(int customIcon) {
- ImageView lockScreen_iv = findViewById(R.id.lockscreen_image);
- lockScreen_iv.setVisibility(View.GONE);
-
- ImageView lockScreenCustom_iv = findViewById(R.id.appIcon);
- lockScreenCustom_iv.setVisibility(View.VISIBLE);
- lockScreenCustom_iv.setBackgroundResource(customIcon);
- }
-
- private void setDeviceLogo(Bitmap deviceLogo) {
- ImageView device_iv = findViewById(R.id.device_image);
- if (deviceLogo != null) {
- device_iv.setImageBitmap(deviceLogo);
- }
- }
-
- private void setLockscreenWarningMessage(String msg) {
- TextView tv = findViewById(R.id.lockscreen_text);
- if (tv != null) {
- if (!useWhiteIconAndTextColor) {
- tv.setTextColor(Color.parseColor("#000000"));
- }
- 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;
- }
- }
+ public static final String LOCKSCREEN_COLOR_EXTRA = "LOCKSCREEN_COLOR_EXTRA";
+ public static final String LOCKSCREEN_ICON_EXTRA = "LOCKSCREEN_ICON_EXTRA";
+ public static final String LOCKSCREEN_DEVICE_LOGO_EXTRA = "LOCKSCREEN_DEVICE_LOGO_EXTRA";
+ public static final String LOCKSCREEN_DEVICE_LOGO_BITMAP = "LOCKSCREEN_DEVICE_LOGO_BITMAP";
+ 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 int backgroundColor = Color.parseColor("#394e60");
+ private boolean useWhiteIconAndTextColor;
+
+
+ private final BroadcastReceiver lockScreenBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent != null) {
+ String action = intent.getAction();
+ if (action != null) {
+ if (action.equalsIgnoreCase(CLOSE_LOCK_SCREEN_ACTION)) {
+ finish();
+ } else if (action.equalsIgnoreCase(LOCKSCREEN_DEVICE_LOGO_DOWNLOADED)) {
+ boolean deviceLogoEnabled = intent.getBooleanExtra(LOCKSCREEN_DEVICE_LOGO_EXTRA, true);
+ Bitmap deviceLogo = intent.getParcelableExtra(LOCKSCREEN_DEVICE_LOGO_BITMAP);
+ if (deviceLogoEnabled && deviceLogo != null) {
+ setDeviceLogo(deviceLogo);
+ }
+ }
+ }
+ }
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ 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());
+
+ // create intent filter
+ IntentFilter lockscreenFilter = new IntentFilter();
+ lockscreenFilter.addAction(CLOSE_LOCK_SCREEN_ACTION);
+ lockscreenFilter.addAction(LOCKSCREEN_DEVICE_LOGO_DOWNLOADED);
+
+ // register broadcast receivers
+ registerReceiver(lockScreenBroadcastReceiver, lockscreenFilter);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mIsDismissible) {
+ return mGestureDetector.onTouchEvent(event);
+ }
+ return super.onTouchEvent(event);
+ }
+
+ @Override
+ protected void onDestroy() {
+ unregisterReceiver(lockScreenBroadcastReceiver);
+ super.onDestroy();
+ }
+
+ @Override
+ public void onBackPressed() {
+ }
+
+ @Override
+ 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) {
+ if (intent != null) {
+ boolean deviceLogoEnabled = intent.getBooleanExtra(LOCKSCREEN_DEVICE_LOGO_EXTRA, true);
+ int customColor = intent.getIntExtra(LOCKSCREEN_COLOR_EXTRA, 0);
+ int customIcon = intent.getIntExtra(LOCKSCREEN_ICON_EXTRA, 0);
+ int customView = intent.getIntExtra(LOCKSCREEN_CUSTOM_VIEW_EXTRA, 0);
+ Bitmap deviceIcon = intent.getParcelableExtra(LOCKSCREEN_DEVICE_LOGO_BITMAP);
+ backgroundColor = (customColor != 0) ? customColor : backgroundColor;
+
+ if (customView != 0) {
+ setCustomView(customView);
+ } else {
+ setContentView(R.layout.activity_sdllock_screen);
+ setBackgroundColor();
+ useWhiteIconAndTextColor = shouldUseWhiteForegroundForBackgroundColor();
+
+ // set Lock Screen Icon
+ if (customIcon != 0) {
+ changeIcon(customIcon);
+ } else {
+ setSdlLogo();
+ }
+
+ 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);
+ } else if (!useWhiteIconAndTextColor) {
+ setTextColorBlack();
+ }
+ }
+ }
+ }
+
+ /**
+ * Sets the lockScreen logo
+ */
+ private void setSdlLogo() {
+ ImageView lockScreen_iv = findViewById(R.id.lockscreen_image);
+ Drawable sdlIcon = getResources().getDrawable(R.drawable.sdl_lockscreen_icon);
+ // Checks color contrast and determines if the logo should be black or white
+ if (useWhiteIconAndTextColor) {
+ int color = Color.parseColor("#ffffff");
+
+ int red = (color & 0xFF0000) / 0xFFFF;
+ int green = (color & 0xFF00) / 0xFF;
+ int blue = color & 0xFF;
+
+ float[] matrix = {0, 0, 0, 0, red,
+ 0, 0, 0, 0, green,
+ 0, 0, 0, 0, blue,
+ 0, 0, 0, 1, 0};
+
+ ColorFilter colorFilter = new ColorMatrixColorFilter(matrix);
+ sdlIcon.setColorFilter(colorFilter);
+ }
+ lockScreen_iv.setImageDrawable(sdlIcon);
+ }
+
+ /**
+ * Changes the text color to white on the lockScreen
+ */
+ private void setTextColorBlack() {
+ TextView tv = findViewById(R.id.lockscreen_text);
+ tv.setTextColor(Color.parseColor("#000000"));
+ }
+
+ /**
+ * Calculates the contrast of the background to determine if the Icon and Text color
+ * should be white or black
+ *
+ * @return True if Background and Icon should be white, False if black
+ */
+ private boolean shouldUseWhiteForegroundForBackgroundColor() {
+ float r = Color.red(backgroundColor) / 255f;
+ float b = Color.blue(backgroundColor) / 255f;
+ float g = Color.green(backgroundColor) / 255f;
+
+ // http://stackoverflow.com/a/3943023
+ r = (r <= 0.3928f) ? (r / 12.92f) : (float) Math.pow(((r + 0.055f) / 1.055f), 2.4f);
+ g = (g <= 0.3928f) ? (g / 12.92f) : (float) Math.pow(((g + 0.055f) / 1.055f), 2.4f);
+ b = (b <= 0.3928f) ? (b / 12.92f) : (float) Math.pow(((b + 0.055f) / 1.055f), 2.4f);
+
+ float luminescence = 0.2126f * r + 0.7152f * g + 0.0722f * b;
+ return luminescence <= 0.179;
+ }
+
+ /**
+ * Sets the color of the background
+ * Will use default color if not set in LockScreenConfig
+ */
+ private void setBackgroundColor() {
+ RelativeLayout layout = findViewById(R.id.lockscreen_relative_layout);
+ layout.setBackgroundColor(backgroundColor);
+ }
+
+ /**
+ * Used to change LockScreen default Icon to customIcon set in LockScreenConfig
+ *
+ * @param customIcon
+ */
+ private void changeIcon(int customIcon) {
+ ImageView lockScreen_iv = findViewById(R.id.lockscreen_image);
+ lockScreen_iv.setVisibility(View.GONE);
+
+ ImageView lockScreenCustom_iv = findViewById(R.id.appIcon);
+ lockScreenCustom_iv.setVisibility(View.VISIBLE);
+ lockScreenCustom_iv.setBackgroundResource(customIcon);
+ }
+
+ private void setDeviceLogo(Bitmap deviceLogo) {
+ ImageView device_iv = findViewById(R.id.device_image);
+ if (deviceLogo != null) {
+ device_iv.setImageBitmap(deviceLogo);
+ }
+ }
+
+ private void setLockscreenWarningMessage(String msg) {
+ TextView tv = findViewById(R.id.lockscreen_text);
+ if (tv != null) {
+ if (!useWhiteIconAndTextColor) {
+ tv.setTextColor(Color.parseColor("#000000"));
+ }
+ 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/permission/PermissionManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
index 540cbbf20..2a8c892ca 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
@@ -38,13 +38,13 @@ import androidx.annotation.RestrictTo;
import com.smartdevicelink.managers.ISdl;
/**
- PermissionManager gives the developer information about what permissions are permitted in specific HMI level
- and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * PermissionManager gives the developer information about what permissions are permitted in specific HMI level
+ * and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * <p>
+ * This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
+ **/
- This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
-**/
-
- public class PermissionManager extends BasePermissionManager{
+public class PermissionManager extends BasePermissionManager {
/**
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
index 00bb57628..c8fa8cd7b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
@@ -40,13 +40,13 @@ import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>ScreenManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
-*/
+ */
public class ScreenManager extends BaseScreenManager {
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public ScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
- super(internalInterface, fileManager);
- }
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public ScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
+ super(internalInterface, fileManager);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
index eba3c9b2f..e4c05b441 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
@@ -7,9 +7,8 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>SubscribeButtonManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
class SubscribeButtonManager extends BaseSubscribeButtonManager {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
index b4154cdf0..1c665da8c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
@@ -43,25 +43,24 @@ import com.smartdevicelink.proxy.rpc.enums.FileType;
/**
* <strong>TextAndGraphicManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
class TextAndGraphicManager extends BaseTextAndGraphicManager {
- TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
- super(internalInterface, fileManager, softButtonManager);
- }
+ TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
+ super(internalInterface, fileManager, softButtonManager);
+ }
- @Override
- SdlArtwork getBlankArtwork() {
- if (blankArtwork == null) {
- blankArtwork = new SdlArtwork();
- blankArtwork.setType(FileType.GRAPHIC_PNG);
- blankArtwork.setName("blankArtwork");
- blankArtwork.setResourceId(R.drawable.transparent);
- }
- return blankArtwork;
- }
+ @Override
+ SdlArtwork getBlankArtwork() {
+ if (blankArtwork == null) {
+ blankArtwork = new SdlArtwork();
+ blankArtwork.setType(FileType.GRAPHIC_PNG);
+ blankArtwork.setName("blankArtwork");
+ blankArtwork.setResourceId(R.drawable.transparent);
+ }
+ return blankArtwork;
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
index b2055c976..ef4583968 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
@@ -39,17 +39,17 @@ import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>MenuManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the ScreenManager via the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The MenuManager takes MenuCell objects and creates and sends all necessary RPCs to build out a menu
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class MenuManager extends BaseMenuManager {
- public MenuManager(ISdl internalInterface, FileManager fileManager) {
- // setup
- super(internalInterface, fileManager);
- }
+ public MenuManager(ISdl internalInterface, FileManager fileManager) {
+ // setup
+ super(internalInterface, fileManager);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
index 641ab189e..40e2d27d7 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
@@ -38,17 +38,17 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>VoiceCommandManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the ScreenManager via the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The VoiceCommandManager takes a List of VoiceCommand objects and sets them on the Head unit for you.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class VoiceCommandManager extends BaseVoiceCommandManager {
- public VoiceCommandManager(ISdl internalInterface) {
- // setup
- super(internalInterface);
- }
+ public VoiceCommandManager(ISdl internalInterface) {
+ // setup
+ super(internalInterface);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/HapticInterfaceManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/HapticInterfaceManager.java
index 36863bc99..e17d3f3c7 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/HapticInterfaceManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/HapticInterfaceManager.java
@@ -37,7 +37,7 @@ import java.util.List;
/**
* Created on 9/22/2017.
- *
+ * <p>
* Manages haptic data used to render focusable areas on the HU screen. App developers can
* over-ride the default logic used to find focusable Views by passing their own data to
* {@link #setHapticData(List)}
@@ -56,12 +56,11 @@ class HapticInterfaceManager extends BaseHapticInterfaceManager {
* Sets haptic data and sends update to the HU. To be used by app code instead of letting
* Presentation find the Views and automatically send to HU.
*
- * @param hapticData
- * Rect data indicating "focusable" screen elements or areas
+ * @param hapticData Rect data indicating "focusable" screen elements or areas
*/
void setHapticData(List<HapticRect> hapticData) {
userHapticData = hapticData;
- if(proxyHolder.get() != null) {
+ if (proxyHolder.get() != null) {
ISdl proxy = proxyHolder.get();
SendHapticData msg = new SendHapticData();
msg.setHapticRectData(userHapticData);
@@ -72,12 +71,11 @@ class HapticInterfaceManager extends BaseHapticInterfaceManager {
/**
* Sends haptic data found by searching for focusable and clickable Views in the view hierarchy
* to the HU. Should be called by Presentation's OnShowListener.
- *
- * @param root
- * the root or parent View
+ *
+ * @param root the root or parent View
*/
void refreshHapticData(View root) {
- if(proxyHolder.get() != null) {
+ if (proxyHolder.get() != null) {
ISdl proxy = proxyHolder.get();
if (userHapticData == null) {
List<HapticRect> hapticRects = new ArrayList<>();
@@ -108,7 +106,7 @@ class HapticInterfaceManager extends BaseHapticInterfaceManager {
}
}
- int [] loc = new int[2];
+ int[] loc = new int[2];
int id = 0;
for (View view : focusables) {
int w = view.getWidth();
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 a8c3a74be..714005041 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
@@ -42,7 +42,6 @@ import android.view.MotionEvent;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
@@ -69,6 +68,7 @@ import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
@@ -89,707 +89,720 @@ import java.util.concurrent.FutureTask;
@TargetApi(19)
public class VideoStreamManager extends BaseVideoStreamManager {
- private static final String TAG = "VideoStreamManager";
-
- private WeakReference<Context> context;
- private volatile VirtualDisplayEncoder virtualDisplayEncoder;
- private Class<? extends SdlRemoteDisplay> remoteDisplayClass = null;
- private SdlRemoteDisplay remoteDisplay;
- private final float[] touchScalar = {1.0f,1.0f}; //x, y
- private HapticInterfaceManager hapticManager;
- private SdlMotionEvent sdlMotionEvent = null;
- private OnHMIStatus currentOnHMIStatus;
- private final StreamingStateMachine stateMachine;
- private VideoStreamingParameters parameters;
- private IVideoStreamListener streamListener;
- private boolean isTransportAvailable = false;
- private boolean hasStarted;
- private String vehicleMake = null;
- private AbstractPacketizer videoPacketizer;
-
- // INTERNAL INTERFACES
-
- private final ISdlServiceListener serviceListener = new ISdlServiceListener() {
- @Override
- public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
- if(SessionType.NAV.equals(type)){
- if (session != null && session.getAcceptedVideoParams() != null) {
- parameters = session.getAcceptedVideoParams();
- VideoStreamManager.this.streamListener = startVideoStream(session.getAcceptedVideoParams(), session);
- }
-
- if (VideoStreamManager.this.streamListener == null) {
- DebugTool.logError(TAG, "Error starting video stream");
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- return;
- }
- VideoStreamingCapability capability = null;
- if (internalInterface.getSystemCapabilityManager() != null) {
- capability = (VideoStreamingCapability) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, null, false);
- }
- if(capability != null && Boolean.TRUE.equals(capability.getIsHapticSpatialDataSupported())){
- hapticManager = new HapticInterfaceManager(internalInterface);
- }
- startEncoder();
- stateMachine.transitionToState(StreamingStateMachine.STARTED);
- hasStarted = true;
- }
- }
-
- @Override
- public void onServiceEnded(SdlSession session, SessionType type) {
- if(SessionType.NAV.equals(type)){
- stopVideoStream();
- if(remoteDisplay!=null){
- stopStreaming();
- }
- stateMachine.transitionToState(StreamingStateMachine.NONE);
- transitionToState(SETTING_UP);
- }
- }
-
- @Override
- public void onServiceError(SdlSession session, SessionType type, String reason) {
- DebugTool.logError(TAG, "Unable to start video service: " + reason);
- stopVideoStream();
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- transitionToState(BaseSubManager.ERROR);
- }
- };
-
- private final OnRPCNotificationListener hmiListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- if(notification != null){
- OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
- if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- return;
- }
- OnHMIStatus prevOnHMIStatus = currentOnHMIStatus;
- currentOnHMIStatus = onHMIStatus;
- if (!HMILevel.HMI_NONE.equals(currentOnHMIStatus.getHmiLevel()) && VideoStreamManager.this.parameters == null) {
- getVideoStreamingParams();
- }
- checkState();
- if (hasStarted && (isHMIStateVideoStreamCapable(prevOnHMIStatus)) && (!isHMIStateVideoStreamCapable(currentOnHMIStatus))) {
- stopVideoStream();
- }
- }
- }
- };
-
- private final OnRPCNotificationListener touchListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- if(notification != null && remoteDisplay != null){
- List<MotionEvent> motionEventList = convertTouchEvent((OnTouchEvent)notification);
- if (motionEventList != null && !motionEventList.isEmpty()) {
- for (MotionEvent motionEvent : motionEventList) {
- remoteDisplay.handleMotionEvent(motionEvent);
- }
- }
- }
- }
- };
-
- // MANAGER APIs
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public VideoStreamManager(ISdl internalInterface){
- super(internalInterface);
-
- if(internalInterface != null && internalInterface.getRegisterAppInterfaceResponse() != null &&
- internalInterface.getRegisterAppInterfaceResponse().getVehicleType() != null) {
- vehicleMake = internalInterface.getRegisterAppInterfaceResponse().getVehicleType().getMake();
- }
- virtualDisplayEncoder = new VirtualDisplayEncoder();
-
- // Listen for video service events
- internalInterface.addServiceListener(SessionType.NAV, serviceListener);
- // Take care of the touch events
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
- // Listen for HMILevel changes
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
- stateMachine = new StreamingStateMachine();
- }
-
- @Override
- public void start(CompletionListener listener) {
- isTransportAvailable = internalInterface.isTransportForServiceAvailable(SessionType.NAV);
- checkState();
- super.start(listener);
- }
-
- private synchronized void checkState(){
- if(this.getState() == SETTING_UP
- && isTransportAvailable
- && isHMIStateVideoStreamCapable(currentOnHMIStatus)
- && parameters != null){
- stateMachine.transitionToState(StreamingStateMachine.READY);
- transitionToState(READY);
- }
- }
-
- boolean isHMIStateVideoStreamCapable(OnHMIStatus onHMIStatus) {
- HMILevel hmiLevel = (onHMIStatus != null && onHMIStatus.getHmiLevel() != null) ? onHMIStatus.getHmiLevel() : HMILevel.HMI_NONE;
- VideoStreamingState videoStreamingState = (onHMIStatus != null && onHMIStatus.getVideoStreamingState() != null) ? onHMIStatus.getVideoStreamingState() : VideoStreamingState.STREAMABLE;
- return (hmiLevel.equals(HMILevel.HMI_FULL) || hmiLevel.equals(HMILevel.HMI_LIMITED)) && videoStreamingState.equals(VideoStreamingState.STREAMABLE);
- }
-
- private void getVideoStreamingParams(){
- if(internalInterface.getProtocolVersion().getMajor() >= 5) {
- if (internalInterface.getSystemCapabilityManager() != null) {
- internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- VideoStreamingParameters params = new VideoStreamingParameters();
- params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream
- VideoStreamManager.this.parameters = params;
-
- checkState();
-
- }
-
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- transitionToState(ERROR);
- }
- }, false);
- }
- }else{
- //We just use default video streaming params
- VideoStreamingParameters params = new VideoStreamingParameters();
- DisplayCapabilities dispCap = null;
- if (internalInterface.getSystemCapabilityManager() != null) {
- dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
- }
- if(dispCap !=null){
- params.setResolution(dispCap.getScreenParams().getImageResolution());
- }
-
- this.parameters = params;
- checkState();
- }
- }
-
- /**
- * Starts streaming a remote display to the module if there is a connected session. This method of streaming requires the device to be on API level 19 or higher
- * @param context a context that can be used to create the remote display
- * @param remoteDisplayClass class object of the remote display. This class will be used to create an instance of the remote display and will be projected to the module
- * @param parameters streaming parameters to be used when streaming. If null is sent in, the default/optimized options will be used.
- * If you are unsure about what parameters to be used it is best to just send null and let the system determine what
- * works best for the currently connected module.
- *
- * @param encrypted a flag of if the stream should be encrypted. Only set if you have a supplied encryption library that the module can understand.
- */
- public void startRemoteDisplayStream(Context context, Class<? extends SdlRemoteDisplay> remoteDisplayClass, VideoStreamingParameters parameters, final boolean encrypted){
- this.context = new WeakReference<>(context);
- this.remoteDisplayClass = remoteDisplayClass;
- int majorProtocolVersion = internalInterface.getProtocolVersion().getMajor();
- boolean isCapabilitySupported = internalInterface.getSystemCapabilityManager() != null && internalInterface.getSystemCapabilityManager().isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING);
- if(majorProtocolVersion >= 5 && !isCapabilitySupported){
- DebugTool.logError(TAG, "Video streaming not supported on this module");
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- return;
- }
- if(parameters == null){
- if(majorProtocolVersion >= 5) {
- if (internalInterface.getSystemCapabilityManager() != null) {
- internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- VideoStreamingParameters params = new VideoStreamingParameters();
- params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream
- startStreaming(params, encrypted);
- }
-
- @Override
- public void onError(String info) {
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
- }
- }, false);
- }
- }else{
- //We just use default video streaming params
- VideoStreamingParameters params = new VideoStreamingParameters();
- DisplayCapabilities dispCap = null;
- if (internalInterface.getSystemCapabilityManager() != null) {
- dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
- }
- if(dispCap !=null){
- params.setResolution(dispCap.getScreenParams().getImageResolution());
- }
- startStreaming(params, encrypted);
- }
- }else{
- startStreaming(parameters, encrypted);
- }
- }
-
-
- /**
- * Starts video service, sets up encoder, haptic manager, and remote display. Begins streaming the remote display.
- * @param parameters Video streaming parameters including: codec which will be used for streaming (currently, only
- * VideoStreamingCodec.H264 is accepted), height and width of the video in pixels.
- * @param encrypted Specify true if packets on this service have to be encrypted
- */
- protected void startStreaming(VideoStreamingParameters parameters, boolean encrypted){
- this.parameters = parameters;
- if (!isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
- DebugTool.logError(TAG, "Cannot start video service in the current HMI status");
- return;
- }
- //Start the video service
- this.internalInterface.startVideoService(parameters, encrypted);
- }
-
- /**
- * Initializes and starts the virtual display encoder and creates the remote display
- */
- private void startEncoder(){
- try {
- virtualDisplayEncoder.init(this.context.get(), streamListener, parameters);
- //We are all set so we can start streaming at at this point
- virtualDisplayEncoder.start();
- //Encoder should be up and running
- createRemoteDisplay(virtualDisplayEncoder.getVirtualDisplay());
- stateMachine.transitionToState(StreamingStateMachine.STARTED);
- hasStarted = true;
- } catch (Exception e) {
- stateMachine.transitionToState(StreamingStateMachine.ERROR);
- e.printStackTrace();
- }
- }
-
- /**
- * Stops streaming from the remote display. To restart, call
- * @see #resumeStreaming()
- */
- public void stopStreaming(){
- if(remoteDisplay!=null){
- remoteDisplay.stop();
- }
- if(virtualDisplayEncoder!=null){
- virtualDisplayEncoder.shutDown();
- }
- stateMachine.transitionToState(StreamingStateMachine.STOPPED);
- }
-
- /**
- * Resumes streaming after calling
- * @see #startRemoteDisplayStream(android.content.Context, Class, com.smartdevicelink.streaming.video.VideoStreamingParameters, boolean)
- * followed by a call to
- * @see #stopStreaming()
- */
- public void resumeStreaming(){
- if(stateMachine.getState() != StreamingStateMachine.STOPPED){
- return;
- }
- startEncoder();
- }
-
- /**
- * Stops streaming, ends video streaming service and removes service listeners.
- */
- @Override
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public void dispose(){
- stopStreaming();
-
- hapticManager = null;
- remoteDisplay = null;
- parameters = null;
- virtualDisplayEncoder = null;
- if (internalInterface != null) {
- // Remove listeners
- internalInterface.removeServiceListener(SessionType.NAV, serviceListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- }
-
- stopVideoStream();
-
-
- stateMachine.transitionToState(StreamingStateMachine.NONE);
- super.dispose();
- }
-
- // PUBLIC METHODS FOR CHECKING STATE
-
- /**
- * Check if a video service is currently active
- * @return boolean (true = active, false = inactive)
- */
- public boolean isServiceActive(){
- return (stateMachine.getState() == StreamingStateMachine.READY) ||
- (stateMachine.getState() == StreamingStateMachine.STARTED) ||
- (stateMachine.getState() == StreamingStateMachine.STOPPED);
- }
-
- /**
- * Check if video is currently streaming and visible
- * @return boolean (true = yes, false = no)
- */
- public boolean isStreaming(){
- return (stateMachine.getState() == StreamingStateMachine.STARTED) && (isHMIStateVideoStreamCapable(currentOnHMIStatus));
- }
-
- /**
- * Check if video streaming has been paused due to app moving to background or manually stopped
- * @return boolean (true = not paused, false = paused)
- */
- public boolean isPaused(){
- return (hasStarted && stateMachine.getState() == StreamingStateMachine.STOPPED) || (!isHMIStateVideoStreamCapable(currentOnHMIStatus));
- }
-
- /**
- * Gets the current video streaming state as defined in @StreamingStateMachine
- * @return int representing StreamingStateMachine.StreamingState
- */
- public @StreamingStateMachine.StreamingState int currentVideoStreamState(){
- return stateMachine.getState();
- }
-
- // HELPER METHODS
-
- private void createRemoteDisplay(final Display disp){
- try{
- if (disp == null){
- return;
- }
-
- // Dismiss the current presentation if the display has changed.
- if (remoteDisplay != null && remoteDisplay.getDisplay() != disp) {
- remoteDisplay.dismissPresentation();
- }
-
- FutureTask<Boolean> fTask = new FutureTask<>(new SdlRemoteDisplay.Creator(context.get(), disp, remoteDisplay, remoteDisplayClass, new SdlRemoteDisplay.Callback() {
- @Override
- public void onCreated(final SdlRemoteDisplay remoteDisplay) {
- //Remote display has been created.
- //Now is a good time to do parsing for spatial data
- VideoStreamManager.this.remoteDisplay = remoteDisplay;
- if (hapticManager != null) {
- remoteDisplay.getMainView().post(new Runnable() {
- @Override
- public void run() {
- hapticManager.refreshHapticData(remoteDisplay.getMainView());
- }
- });
- }
- //Get touch scalars
- ImageResolution resolution = null;
- if (internalInterface.getProtocolVersion().getMajor() >= 5) { //At this point we should already have the capability
- VideoStreamingCapability capability = null;
- if (internalInterface.getSystemCapabilityManager() != null) {
- capability = (VideoStreamingCapability) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, null, false);
- }
- if (capability != null) {
- resolution = capability.getPreferredResolution();
- }
- }
-
- if (resolution == null) { //Either the protocol version is too low to access video streaming caps, or they were null
- DisplayCapabilities dispCap = null;
- if (internalInterface.getSystemCapabilityManager() != null) {
- dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
- }
- if (dispCap != null) {
- resolution = (dispCap.getScreenParams().getImageResolution());
- }
- }
-
- if (resolution != null) {
- DisplayMetrics displayMetrics = new DisplayMetrics();
- disp.getMetrics(displayMetrics);
- createTouchScalar(resolution, displayMetrics);
- }
-
- }
-
- @Override
- public void onInvalidated(final SdlRemoteDisplay remoteDisplay) {
- //Our view has been invalidated
- //A good time to refresh spatial data
- if (hapticManager != null) {
- remoteDisplay.getMainView().post(new Runnable() {
- @Override
- public void run() {
- hapticManager.refreshHapticData(remoteDisplay.getMainView());
- }
- });
- }
- }
- }));
- Thread showPresentation = new Thread(fTask);
- showPresentation.setName("RmtDispThread");
-
- showPresentation.start();
- } catch (Exception ex) {
- DebugTool.logError(TAG, "Unable to create Virtual Display.");
- if(DebugTool.isDebugEnabled()){
- ex.printStackTrace();
- }
- }
- }
-
- @Override
- protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail){
-
- isTransportAvailable = videoStreamTransportAvail;
-
- if(internalInterface.getProtocolVersion().isNewerThan(new Version(5,1,0)) >= 0){
- if(videoStreamTransportAvail){
- checkState();
- }
- }else{
- //The protocol version doesn't support simultaneous transports.
- if(!videoStreamTransportAvail){
- //If video streaming isn't available on primary transport then it is not possible to
- //use the video streaming manager until a complete register on a transport that
- //supports video
- transitionToState(ERROR);
- }
- }
- }
+ private static final String TAG = "VideoStreamManager";
+
+ private WeakReference<Context> context;
+ private volatile VirtualDisplayEncoder virtualDisplayEncoder;
+ private Class<? extends SdlRemoteDisplay> remoteDisplayClass = null;
+ private SdlRemoteDisplay remoteDisplay;
+ private final float[] touchScalar = {1.0f, 1.0f}; //x, y
+ private HapticInterfaceManager hapticManager;
+ private SdlMotionEvent sdlMotionEvent = null;
+ private OnHMIStatus currentOnHMIStatus;
+ private final StreamingStateMachine stateMachine;
+ private VideoStreamingParameters parameters;
+ private IVideoStreamListener streamListener;
+ private boolean isTransportAvailable = false;
+ private boolean hasStarted;
+ private String vehicleMake = null;
+ private AbstractPacketizer videoPacketizer;
+
+ // INTERNAL INTERFACES
+
+ private final ISdlServiceListener serviceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+ if (SessionType.NAV.equals(type)) {
+ if (session != null && session.getAcceptedVideoParams() != null) {
+ parameters = session.getAcceptedVideoParams();
+ VideoStreamManager.this.streamListener = startVideoStream(session.getAcceptedVideoParams(), session);
+ }
+
+ if (VideoStreamManager.this.streamListener == null) {
+ DebugTool.logError(TAG, "Error starting video stream");
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ return;
+ }
+ VideoStreamingCapability capability = null;
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ capability = (VideoStreamingCapability) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, null, false);
+ }
+ if (capability != null && Boolean.TRUE.equals(capability.getIsHapticSpatialDataSupported())) {
+ hapticManager = new HapticInterfaceManager(internalInterface);
+ }
+ startEncoder();
+ stateMachine.transitionToState(StreamingStateMachine.STARTED);
+ hasStarted = true;
+ }
+ }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ if (SessionType.NAV.equals(type)) {
+ stopVideoStream();
+ if (remoteDisplay != null) {
+ stopStreaming();
+ }
+ stateMachine.transitionToState(StreamingStateMachine.NONE);
+ transitionToState(SETTING_UP);
+ }
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ DebugTool.logError(TAG, "Unable to start video service: " + reason);
+ stopVideoStream();
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ transitionToState(BaseSubManager.ERROR);
+ }
+ };
+
+ private final OnRPCNotificationListener hmiListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ if (notification != null) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ OnHMIStatus prevOnHMIStatus = currentOnHMIStatus;
+ currentOnHMIStatus = onHMIStatus;
+ if (!HMILevel.HMI_NONE.equals(currentOnHMIStatus.getHmiLevel()) && VideoStreamManager.this.parameters == null) {
+ getVideoStreamingParams();
+ }
+ checkState();
+ if (hasStarted && (isHMIStateVideoStreamCapable(prevOnHMIStatus)) && (!isHMIStateVideoStreamCapable(currentOnHMIStatus))) {
+ stopVideoStream();
+ }
+ }
+ }
+ };
+
+ private final OnRPCNotificationListener touchListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ if (notification != null && remoteDisplay != null) {
+ List<MotionEvent> motionEventList = convertTouchEvent((OnTouchEvent) notification);
+ if (motionEventList != null && !motionEventList.isEmpty()) {
+ for (MotionEvent motionEvent : motionEventList) {
+ remoteDisplay.handleMotionEvent(motionEvent);
+ }
+ }
+ }
+ }
+ };
+
+ // MANAGER APIs
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public VideoStreamManager(ISdl internalInterface) {
+ super(internalInterface);
+
+ if (internalInterface != null && internalInterface.getRegisterAppInterfaceResponse() != null &&
+ internalInterface.getRegisterAppInterfaceResponse().getVehicleType() != null) {
+ vehicleMake = internalInterface.getRegisterAppInterfaceResponse().getVehicleType().getMake();
+ }
+ virtualDisplayEncoder = new VirtualDisplayEncoder();
+
+ // Listen for video service events
+ internalInterface.addServiceListener(SessionType.NAV, serviceListener);
+ // Take care of the touch events
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
+ // Listen for HMILevel changes
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ stateMachine = new StreamingStateMachine();
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ isTransportAvailable = internalInterface.isTransportForServiceAvailable(SessionType.NAV);
+ checkState();
+ super.start(listener);
+ }
+
+ private synchronized void checkState() {
+ if (this.getState() == SETTING_UP
+ && isTransportAvailable
+ && isHMIStateVideoStreamCapable(currentOnHMIStatus)
+ && parameters != null) {
+ stateMachine.transitionToState(StreamingStateMachine.READY);
+ transitionToState(READY);
+ }
+ }
+
+ boolean isHMIStateVideoStreamCapable(OnHMIStatus onHMIStatus) {
+ HMILevel hmiLevel = (onHMIStatus != null && onHMIStatus.getHmiLevel() != null) ? onHMIStatus.getHmiLevel() : HMILevel.HMI_NONE;
+ VideoStreamingState videoStreamingState = (onHMIStatus != null && onHMIStatus.getVideoStreamingState() != null) ? onHMIStatus.getVideoStreamingState() : VideoStreamingState.STREAMABLE;
+ return (hmiLevel.equals(HMILevel.HMI_FULL) || hmiLevel.equals(HMILevel.HMI_LIMITED)) && videoStreamingState.equals(VideoStreamingState.STREAMABLE);
+ }
+
+ private void getVideoStreamingParams() {
+ if (internalInterface.getProtocolVersion().getMajor() >= 5) {
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream
+ VideoStreamManager.this.parameters = params;
+
+ checkState();
+
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ transitionToState(ERROR);
+ }
+ }, false);
+ }
+ } else {
+ //We just use default video streaming params
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ DisplayCapabilities dispCap = null;
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
+ }
+ if (dispCap != null) {
+ params.setResolution(dispCap.getScreenParams().getImageResolution());
+ }
+
+ this.parameters = params;
+ checkState();
+ }
+ }
+
+ /**
+ * Starts streaming a remote display to the module if there is a connected session. This method of streaming requires the device to be on API level 19 or higher
+ *
+ * @param context a context that can be used to create the remote display
+ * @param remoteDisplayClass class object of the remote display. This class will be used to create an instance of the remote display and will be projected to the module
+ * @param parameters streaming parameters to be used when streaming. If null is sent in, the default/optimized options will be used.
+ * If you are unsure about what parameters to be used it is best to just send null and let the system determine what
+ * works best for the currently connected module.
+ * @param encrypted a flag of if the stream should be encrypted. Only set if you have a supplied encryption library that the module can understand.
+ */
+ public void startRemoteDisplayStream(Context context, Class<? extends SdlRemoteDisplay> remoteDisplayClass, VideoStreamingParameters parameters, final boolean encrypted) {
+ this.context = new WeakReference<>(context);
+ this.remoteDisplayClass = remoteDisplayClass;
+ int majorProtocolVersion = internalInterface.getProtocolVersion().getMajor();
+ boolean isCapabilitySupported = internalInterface.getSystemCapabilityManager() != null && internalInterface.getSystemCapabilityManager().isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING);
+ if (majorProtocolVersion >= 5 && !isCapabilitySupported) {
+ DebugTool.logError(TAG, "Video streaming not supported on this module");
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ return;
+ }
+ if (parameters == null) {
+ if (majorProtocolVersion >= 5) {
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ params.update((VideoStreamingCapability) capability, vehicleMake); //Streaming parameters are ready time to stream
+ startStreaming(params, encrypted);
+ }
+
+ @Override
+ public void onError(String info) {
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
+ }
+ }, false);
+ }
+ } else {
+ //We just use default video streaming params
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ DisplayCapabilities dispCap = null;
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
+ }
+ if (dispCap != null) {
+ params.setResolution(dispCap.getScreenParams().getImageResolution());
+ }
+ startStreaming(params, encrypted);
+ }
+ } else {
+ startStreaming(parameters, encrypted);
+ }
+ }
+
+
+ /**
+ * Starts video service, sets up encoder, haptic manager, and remote display. Begins streaming the remote display.
+ *
+ * @param parameters Video streaming parameters including: codec which will be used for streaming (currently, only
+ * VideoStreamingCodec.H264 is accepted), height and width of the video in pixels.
+ * @param encrypted Specify true if packets on this service have to be encrypted
+ */
+ protected void startStreaming(VideoStreamingParameters parameters, boolean encrypted) {
+ this.parameters = parameters;
+ if (!isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
+ DebugTool.logError(TAG, "Cannot start video service in the current HMI status");
+ return;
+ }
+ //Start the video service
+ this.internalInterface.startVideoService(parameters, encrypted);
+ }
+
+ /**
+ * Initializes and starts the virtual display encoder and creates the remote display
+ */
+ private void startEncoder() {
+ try {
+ virtualDisplayEncoder.init(this.context.get(), streamListener, parameters);
+ //We are all set so we can start streaming at at this point
+ virtualDisplayEncoder.start();
+ //Encoder should be up and running
+ createRemoteDisplay(virtualDisplayEncoder.getVirtualDisplay());
+ stateMachine.transitionToState(StreamingStateMachine.STARTED);
+ hasStarted = true;
+ } catch (Exception e) {
+ stateMachine.transitionToState(StreamingStateMachine.ERROR);
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Stops streaming from the remote display. To restart, call
+ *
+ * @see #resumeStreaming()
+ */
+ public void stopStreaming() {
+ if (remoteDisplay != null) {
+ remoteDisplay.stop();
+ }
+ if (virtualDisplayEncoder != null) {
+ virtualDisplayEncoder.shutDown();
+ }
+ stateMachine.transitionToState(StreamingStateMachine.STOPPED);
+ }
+
+ /**
+ * Resumes streaming after calling
+ *
+ * @see #startRemoteDisplayStream(android.content.Context, Class, com.smartdevicelink.streaming.video.VideoStreamingParameters, boolean)
+ * followed by a call to
+ * @see #stopStreaming()
+ */
+ public void resumeStreaming() {
+ if (stateMachine.getState() != StreamingStateMachine.STOPPED) {
+ return;
+ }
+ startEncoder();
+ }
+
+ /**
+ * Stops streaming, ends video streaming service and removes service listeners.
+ */
+ @Override
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public void dispose() {
+ stopStreaming();
+
+ hapticManager = null;
+ remoteDisplay = null;
+ parameters = null;
+ virtualDisplayEncoder = null;
+ if (internalInterface != null) {
+ // Remove listeners
+ internalInterface.removeServiceListener(SessionType.NAV, serviceListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+ }
+
+ stopVideoStream();
+
+
+ stateMachine.transitionToState(StreamingStateMachine.NONE);
+ super.dispose();
+ }
+
+ // PUBLIC METHODS FOR CHECKING STATE
+
+ /**
+ * Check if a video service is currently active
+ *
+ * @return boolean (true = active, false = inactive)
+ */
+ public boolean isServiceActive() {
+ return (stateMachine.getState() == StreamingStateMachine.READY) ||
+ (stateMachine.getState() == StreamingStateMachine.STARTED) ||
+ (stateMachine.getState() == StreamingStateMachine.STOPPED);
+ }
+
+ /**
+ * Check if video is currently streaming and visible
+ *
+ * @return boolean (true = yes, false = no)
+ */
+ public boolean isStreaming() {
+ return (stateMachine.getState() == StreamingStateMachine.STARTED) && (isHMIStateVideoStreamCapable(currentOnHMIStatus));
+ }
+
+ /**
+ * Check if video streaming has been paused due to app moving to background or manually stopped
+ *
+ * @return boolean (true = not paused, false = paused)
+ */
+ public boolean isPaused() {
+ return (hasStarted && stateMachine.getState() == StreamingStateMachine.STOPPED) || (!isHMIStateVideoStreamCapable(currentOnHMIStatus));
+ }
+
+ /**
+ * Gets the current video streaming state as defined in @StreamingStateMachine
+ *
+ * @return int representing StreamingStateMachine.StreamingState
+ */
+ public @StreamingStateMachine.StreamingState
+ int currentVideoStreamState() {
+ return stateMachine.getState();
+ }
+
+ // HELPER METHODS
+
+ private void createRemoteDisplay(final Display disp) {
+ try {
+ if (disp == null) {
+ return;
+ }
+
+ // Dismiss the current presentation if the display has changed.
+ if (remoteDisplay != null && remoteDisplay.getDisplay() != disp) {
+ remoteDisplay.dismissPresentation();
+ }
+
+ FutureTask<Boolean> fTask = new FutureTask<>(new SdlRemoteDisplay.Creator(context.get(), disp, remoteDisplay, remoteDisplayClass, new SdlRemoteDisplay.Callback() {
+ @Override
+ public void onCreated(final SdlRemoteDisplay remoteDisplay) {
+ //Remote display has been created.
+ //Now is a good time to do parsing for spatial data
+ VideoStreamManager.this.remoteDisplay = remoteDisplay;
+ if (hapticManager != null) {
+ remoteDisplay.getMainView().post(new Runnable() {
+ @Override
+ public void run() {
+ hapticManager.refreshHapticData(remoteDisplay.getMainView());
+ }
+ });
+ }
+ //Get touch scalars
+ ImageResolution resolution = null;
+ if (internalInterface.getProtocolVersion().getMajor() >= 5) { //At this point we should already have the capability
+ VideoStreamingCapability capability = null;
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ capability = (VideoStreamingCapability) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.VIDEO_STREAMING, null, false);
+ }
+ if (capability != null) {
+ resolution = capability.getPreferredResolution();
+ }
+ }
+
+ if (resolution == null) { //Either the protocol version is too low to access video streaming caps, or they were null
+ DisplayCapabilities dispCap = null;
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ dispCap = (DisplayCapabilities) internalInterface.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY, null, false);
+ }
+ if (dispCap != null) {
+ resolution = (dispCap.getScreenParams().getImageResolution());
+ }
+ }
+
+ if (resolution != null) {
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ disp.getMetrics(displayMetrics);
+ createTouchScalar(resolution, displayMetrics);
+ }
+
+ }
+
+ @Override
+ public void onInvalidated(final SdlRemoteDisplay remoteDisplay) {
+ //Our view has been invalidated
+ //A good time to refresh spatial data
+ if (hapticManager != null) {
+ remoteDisplay.getMainView().post(new Runnable() {
+ @Override
+ public void run() {
+ hapticManager.refreshHapticData(remoteDisplay.getMainView());
+ }
+ });
+ }
+ }
+ }));
+ Thread showPresentation = new Thread(fTask);
+ showPresentation.setName("RmtDispThread");
+
+ showPresentation.start();
+ } catch (Exception ex) {
+ DebugTool.logError(TAG, "Unable to create Virtual Display.");
+ if (DebugTool.isDebugEnabled()) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
+
+ isTransportAvailable = videoStreamTransportAvail;
+
+ if (internalInterface.getProtocolVersion().isNewerThan(new Version(5, 1, 0)) >= 0) {
+ if (videoStreamTransportAvail) {
+ checkState();
+ }
+ } else {
+ //The protocol version doesn't support simultaneous transports.
+ if (!videoStreamTransportAvail) {
+ //If video streaming isn't available on primary transport then it is not possible to
+ //use the video streaming manager until a complete register on a transport that
+ //supports video
+ transitionToState(ERROR);
+ }
+ }
+ }
void createTouchScalar(ImageResolution resolution, DisplayMetrics displayMetrics) {
- touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
- touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
+ touchScalar[0] = ((float) displayMetrics.widthPixels) / resolution.getResolutionWidth();
+ touchScalar[1] = ((float) displayMetrics.heightPixels) / resolution.getResolutionHeight();
}
- List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent){
- List<MotionEvent> motionEventList = new ArrayList<>();
-
- List<TouchEvent> touchEventList = onTouchEvent.getEvent();
- if (touchEventList == null || touchEventList.size() == 0) return null;
-
- TouchType touchType = onTouchEvent.getType();
- if (touchType == null) { return null; }
-
- if(sdlMotionEvent == null) {
- if (touchType == TouchType.BEGIN) {
- sdlMotionEvent = new SdlMotionEvent();
- } else{
- return null;
- }
- }
-
- SdlMotionEvent.Pointer pointer;
- MotionEvent motionEvent;
-
- for (TouchEvent touchEvent : touchEventList) {
- if (touchEvent == null || touchEvent.getId() == null) {
- continue;
- }
-
- List<TouchCoord> touchCoordList = touchEvent.getTouchCoordinates();
- if (touchCoordList == null || touchCoordList.size() == 0) {
- continue;
- }
-
- TouchCoord touchCoord = touchCoordList.get(touchCoordList.size() - 1);
- if (touchCoord == null) {
- continue;
- }
-
- int motionEventAction = sdlMotionEvent.getMotionEventAction(touchType, touchEvent);
- long downTime = sdlMotionEvent.downTime;
- long eventTime = sdlMotionEvent.eventTime;
- pointer = sdlMotionEvent.getPointerById(touchEvent.getId());
- if (pointer != null) {
- pointer.setCoords(touchCoord.getX() * touchScalar[0], touchCoord.getY() * touchScalar[1]);
- }
-
- MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[sdlMotionEvent.pointers.size()];
- MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[sdlMotionEvent.pointers.size()];
-
- for (int i = 0; i < sdlMotionEvent.pointers.size(); i++) {
- pointerProperties[i] = new MotionEvent.PointerProperties();
- pointerProperties[i].id = sdlMotionEvent.getPointerByIndex(i).id;
- pointerProperties[i].toolType = MotionEvent.TOOL_TYPE_FINGER;
-
- pointerCoords[i] = new MotionEvent.PointerCoords();
- pointerCoords[i].x = sdlMotionEvent.getPointerByIndex(i).x;
- pointerCoords[i].y = sdlMotionEvent.getPointerByIndex(i).y;
- pointerCoords[i].orientation = 0;
- pointerCoords[i].pressure = 1.0f;
- pointerCoords[i].size = 1;
- }
-
- motionEvent = MotionEvent.obtain(downTime, eventTime, motionEventAction,
- sdlMotionEvent.pointers.size(), pointerProperties, pointerCoords, 0, 0, 1,
- 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
- motionEventList.add(motionEvent);
-
- if(motionEventAction == MotionEvent.ACTION_UP || motionEventAction == MotionEvent.ACTION_CANCEL){
- //If the motion event should be finished we should clear our reference
- sdlMotionEvent.pointers.clear();
- sdlMotionEvent = null;
- break;
- } else if((motionEventAction & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP){
- sdlMotionEvent.removePointerById(touchEvent.getId());
- }
- }
-
- return motionEventList;
- }
-
- /**
- * Keeps track of the current motion event for VPM
- */
- private static class SdlMotionEvent {
- class Pointer {
- final int id;
- float x;
- float y;
- Pointer (int id) {
- this.id = id;
- this.x = 0.0f;
- this.y = 0.0f;
- }
- void setCoords(float x, float y) {
- this.x = x;
- this.y = y;
- }
- }
-
- private final CopyOnWriteArrayList<Pointer> pointers = new CopyOnWriteArrayList<>();
- private long downTime;
- private long downTimeOnHMI;
- private long eventTime;
-
- SdlMotionEvent(){
- downTimeOnHMI = 0;
- }
-
- /**
- * Handles the SDL Touch Event to keep track of pointer status and returns the appropriate
- * Android MotionEvent according to this events status
- * @param touchType The SDL TouchType that was received from the module
- * @param touchEvent The SDL TouchEvent that was received from the module
- * @return the correct native Android MotionEvent action to dispatch
- */
- synchronized int getMotionEventAction(TouchType touchType, TouchEvent touchEvent){
- eventTime = 0;
- int motionEventAction = -1;
- switch (touchType){
- case BEGIN:
- if(pointers.size() == 0){
- //The motion event has just begun
- motionEventAction = MotionEvent.ACTION_DOWN;
- downTime = SystemClock.uptimeMillis();
- downTimeOnHMI = touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1);
- eventTime = downTime;
- } else{
- motionEventAction = MotionEvent.ACTION_POINTER_DOWN | pointers.size() << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- }
- pointers.add(new Pointer(touchEvent.getId()));
- break;
- case MOVE:
- motionEventAction = MotionEvent.ACTION_MOVE;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- case END:
- if(pointers.size() <= 1){
- //The motion event has just ended
- motionEventAction = MotionEvent.ACTION_UP;
- } else {
- int pointerIndex = pointers.indexOf(getPointerById(touchEvent.getId()));
- if (pointerIndex != -1) {
- motionEventAction = MotionEvent.ACTION_POINTER_UP | pointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
- } else {
- motionEventAction = MotionEvent.ACTION_UP;
- }
- }
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- case CANCEL:
- //Assuming this cancels the entire event
- motionEventAction = MotionEvent.ACTION_CANCEL;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- default:
- break;
- }
- return motionEventAction;
- }
-
- Pointer getPointerById(int id){
- if (pointers != null && !pointers.isEmpty()){
- for (Pointer pointer : pointers){
- if (pointer.id == id){
- return pointer;
- }
- }
- }
- return null;
- }
-
- Pointer getPointerByIndex(int index){
- return pointers.get(index);
- }
-
- void removePointerById(int id){
- pointers.remove(getPointerById(id));
- }
- }
-
- private VideoStreamingProtocol getAcceptedProtocol(VideoStreamingParameters params) {
- if (params != null) {
- VideoStreamingFormat format = params.getFormat();
- if (format != null && format.getProtocol() != null) {
- return format.getProtocol();
- }
- }
- //Returns default protocol if none are found
- return new VideoStreamingParameters().getFormat().getProtocol();
-
- }
-
- protected IVideoStreamListener startVideoStream(VideoStreamingParameters params, final SdlSession session) {
- VideoStreamingProtocol protocol = getAcceptedProtocol(params);
-
- IStreamListener iStreamListener = new IStreamListener() {
- @Override
- public void sendStreamPacket(ProtocolMessage pm) {
- session.sendMessage(pm);
- }
- };
-
- try {
- switch (protocol) {
- case RAW: {
- videoPacketizer = new StreamPacketizer(iStreamListener, null, SessionType.NAV, (byte) session.getSessionId(), session);
- videoPacketizer.start();
- return (IVideoStreamListener) videoPacketizer;
- }
- case RTP: {
- //FIXME why is this not an extension of StreamPacketizer?
- videoPacketizer = new RTPH264Packetizer(iStreamListener, SessionType.NAV, (byte) session.getSessionId(), session);
- videoPacketizer.start();
- return (IVideoStreamListener) videoPacketizer;
- }
- default:
- DebugTool.logError(TAG, "Protocol " + protocol + " is not supported.");
- return null;
- }
- } catch (IOException e) {
- return null;
- }
-
- }
-
- protected boolean stopVideoStream() {
- if (videoPacketizer != null) {
- videoPacketizer.stop();
- return true;
- }
- return false;
- }
+ List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent) {
+ List<MotionEvent> motionEventList = new ArrayList<>();
+
+ List<TouchEvent> touchEventList = onTouchEvent.getEvent();
+ if (touchEventList == null || touchEventList.size() == 0) return null;
+
+ TouchType touchType = onTouchEvent.getType();
+ if (touchType == null) {
+ return null;
+ }
+
+ if (sdlMotionEvent == null) {
+ if (touchType == TouchType.BEGIN) {
+ sdlMotionEvent = new SdlMotionEvent();
+ } else {
+ return null;
+ }
+ }
+
+ SdlMotionEvent.Pointer pointer;
+ MotionEvent motionEvent;
+
+ for (TouchEvent touchEvent : touchEventList) {
+ if (touchEvent == null || touchEvent.getId() == null) {
+ continue;
+ }
+
+ List<TouchCoord> touchCoordList = touchEvent.getTouchCoordinates();
+ if (touchCoordList == null || touchCoordList.size() == 0) {
+ continue;
+ }
+
+ TouchCoord touchCoord = touchCoordList.get(touchCoordList.size() - 1);
+ if (touchCoord == null) {
+ continue;
+ }
+
+ int motionEventAction = sdlMotionEvent.getMotionEventAction(touchType, touchEvent);
+ long downTime = sdlMotionEvent.downTime;
+ long eventTime = sdlMotionEvent.eventTime;
+ pointer = sdlMotionEvent.getPointerById(touchEvent.getId());
+ if (pointer != null) {
+ pointer.setCoords(touchCoord.getX() * touchScalar[0], touchCoord.getY() * touchScalar[1]);
+ }
+
+ MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[sdlMotionEvent.pointers.size()];
+ MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[sdlMotionEvent.pointers.size()];
+
+ for (int i = 0; i < sdlMotionEvent.pointers.size(); i++) {
+ pointerProperties[i] = new MotionEvent.PointerProperties();
+ pointerProperties[i].id = sdlMotionEvent.getPointerByIndex(i).id;
+ pointerProperties[i].toolType = MotionEvent.TOOL_TYPE_FINGER;
+
+ pointerCoords[i] = new MotionEvent.PointerCoords();
+ pointerCoords[i].x = sdlMotionEvent.getPointerByIndex(i).x;
+ pointerCoords[i].y = sdlMotionEvent.getPointerByIndex(i).y;
+ pointerCoords[i].orientation = 0;
+ pointerCoords[i].pressure = 1.0f;
+ pointerCoords[i].size = 1;
+ }
+
+ motionEvent = MotionEvent.obtain(downTime, eventTime, motionEventAction,
+ sdlMotionEvent.pointers.size(), pointerProperties, pointerCoords, 0, 0, 1,
+ 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
+ motionEventList.add(motionEvent);
+
+ if (motionEventAction == MotionEvent.ACTION_UP || motionEventAction == MotionEvent.ACTION_CANCEL) {
+ //If the motion event should be finished we should clear our reference
+ sdlMotionEvent.pointers.clear();
+ sdlMotionEvent = null;
+ break;
+ } else if ((motionEventAction & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP) {
+ sdlMotionEvent.removePointerById(touchEvent.getId());
+ }
+ }
+
+ return motionEventList;
+ }
+
+ /**
+ * Keeps track of the current motion event for VPM
+ */
+ private static class SdlMotionEvent {
+ class Pointer {
+ final int id;
+ float x;
+ float y;
+
+ Pointer(int id) {
+ this.id = id;
+ this.x = 0.0f;
+ this.y = 0.0f;
+ }
+
+ void setCoords(float x, float y) {
+ this.x = x;
+ this.y = y;
+ }
+ }
+
+ private final CopyOnWriteArrayList<Pointer> pointers = new CopyOnWriteArrayList<>();
+ private long downTime;
+ private long downTimeOnHMI;
+ private long eventTime;
+
+ SdlMotionEvent() {
+ downTimeOnHMI = 0;
+ }
+
+ /**
+ * Handles the SDL Touch Event to keep track of pointer status and returns the appropriate
+ * Android MotionEvent according to this events status
+ *
+ * @param touchType The SDL TouchType that was received from the module
+ * @param touchEvent The SDL TouchEvent that was received from the module
+ * @return the correct native Android MotionEvent action to dispatch
+ */
+ synchronized int getMotionEventAction(TouchType touchType, TouchEvent touchEvent) {
+ eventTime = 0;
+ int motionEventAction = -1;
+ switch (touchType) {
+ case BEGIN:
+ if (pointers.size() == 0) {
+ //The motion event has just begun
+ motionEventAction = MotionEvent.ACTION_DOWN;
+ downTime = SystemClock.uptimeMillis();
+ downTimeOnHMI = touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1);
+ eventTime = downTime;
+ } else {
+ motionEventAction = MotionEvent.ACTION_POINTER_DOWN | pointers.size() << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
+ eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
+ }
+ pointers.add(new Pointer(touchEvent.getId()));
+ break;
+ case MOVE:
+ motionEventAction = MotionEvent.ACTION_MOVE;
+ eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
+ break;
+ case END:
+ if (pointers.size() <= 1) {
+ //The motion event has just ended
+ motionEventAction = MotionEvent.ACTION_UP;
+ } else {
+ int pointerIndex = pointers.indexOf(getPointerById(touchEvent.getId()));
+ if (pointerIndex != -1) {
+ motionEventAction = MotionEvent.ACTION_POINTER_UP | pointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
+ } else {
+ motionEventAction = MotionEvent.ACTION_UP;
+ }
+ }
+ eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
+ break;
+ case CANCEL:
+ //Assuming this cancels the entire event
+ motionEventAction = MotionEvent.ACTION_CANCEL;
+ eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
+ break;
+ default:
+ break;
+ }
+ return motionEventAction;
+ }
+
+ Pointer getPointerById(int id) {
+ if (pointers != null && !pointers.isEmpty()) {
+ for (Pointer pointer : pointers) {
+ if (pointer.id == id) {
+ return pointer;
+ }
+ }
+ }
+ return null;
+ }
+
+ Pointer getPointerByIndex(int index) {
+ return pointers.get(index);
+ }
+
+ void removePointerById(int id) {
+ pointers.remove(getPointerById(id));
+ }
+ }
+
+ private VideoStreamingProtocol getAcceptedProtocol(VideoStreamingParameters params) {
+ if (params != null) {
+ VideoStreamingFormat format = params.getFormat();
+ if (format != null && format.getProtocol() != null) {
+ return format.getProtocol();
+ }
+ }
+ //Returns default protocol if none are found
+ return new VideoStreamingParameters().getFormat().getProtocol();
+
+ }
+
+ protected IVideoStreamListener startVideoStream(VideoStreamingParameters params, final SdlSession session) {
+ VideoStreamingProtocol protocol = getAcceptedProtocol(params);
+
+ IStreamListener iStreamListener = new IStreamListener() {
+ @Override
+ public void sendStreamPacket(ProtocolMessage pm) {
+ session.sendMessage(pm);
+ }
+ };
+
+ try {
+ switch (protocol) {
+ case RAW: {
+ videoPacketizer = new StreamPacketizer(iStreamListener, null, SessionType.NAV, (byte) session.getSessionId(), session);
+ videoPacketizer.start();
+ return (IVideoStreamListener) videoPacketizer;
+ }
+ case RTP: {
+ //FIXME why is this not an extension of StreamPacketizer?
+ videoPacketizer = new RTPH264Packetizer(iStreamListener, SessionType.NAV, (byte) session.getSessionId(), session);
+ videoPacketizer.start();
+ return (IVideoStreamListener) videoPacketizer;
+ }
+ default:
+ DebugTool.logError(TAG, "Protocol " + protocol + " is not supported.");
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+
+ }
+
+ protected boolean stopVideoStream() {
+ if (videoPacketizer != null) {
+ videoPacketizer.stop();
+ return true;
+ }
+ return false;
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
index 707f55c01..4c4633776 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -11,21 +11,21 @@ import com.smartdevicelink.util.DebugTool;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SdlPacket extends BaseSdlPacket implements Parcelable {
private static final String TAG = "SdlPacket";
- private static final int EXTRA_PARCEL_DATA_LENGTH = 24;
+ private static final int EXTRA_PARCEL_DATA_LENGTH = 24;
public SdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload) {
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload);
}
public SdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload, offset, bytesToWrite);
}
- protected SdlPacket() {
+ protected SdlPacket() {
super();
}
@@ -38,7 +38,6 @@ public class SdlPacket extends BaseSdlPacket implements Parcelable {
*****************************************************************************************************************************************************/
-
//I think this is FIFO...right?
public SdlPacket(Parcel p) {
this.version = p.readInt();
@@ -49,14 +48,14 @@ public class SdlPacket extends BaseSdlPacket implements Parcelable {
this.sessionId = p.readInt();
this.dataSize = p.readInt();
this.messageId = p.readInt();
- if(p.readInt() == 1){ //We should have a payload attached
+ if (p.readInt() == 1) { //We should have a payload attached
payload = new byte[dataSize];
p.readByteArray(payload);
}
this.priorityCoefficient = p.readInt();
- if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0
+ if (p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0
try {
messagingVersion = p.readInt();
if (messagingVersion >= 2) {
@@ -64,7 +63,7 @@ public class SdlPacket extends BaseSdlPacket implements Parcelable {
this.transportRecord = p.readParcelable(TransportRecord.class.getClassLoader());
}
}
- }catch (RuntimeException e){
+ } catch (RuntimeException e) {
DebugTool.logError(TAG, "Error creating packet from parcel", e);
}
}
@@ -80,26 +79,26 @@ public class SdlPacket extends BaseSdlPacket implements Parcelable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(version);
- dest.writeInt(encryption? 1 : 0);
+ dest.writeInt(encryption ? 1 : 0);
dest.writeInt(frameType);
dest.writeInt(serviceType);
dest.writeInt(frameInfo);
dest.writeInt(sessionId);
dest.writeInt(dataSize);
dest.writeInt(messageId);
- dest.writeInt(payload!=null? 1 : 0);
- if(payload!=null){
+ dest.writeInt(payload != null ? 1 : 0);
+ if (payload != null) {
dest.writeByteArray(payload);
}
dest.writeInt(priorityCoefficient);
///Additions after initial creation
- if(messagingVersion > 1){
+ if (messagingVersion > 1) {
dest.writeInt(messagingVersion);
- dest.writeInt(transportRecord!=null? 1 : 0);
- if(transportRecord != null){
- dest.writeParcelable(transportRecord,0);
+ dest.writeInt(transportRecord != null ? 1 : 0);
+ if (transportRecord != null) {
+ dest.writeParcelable(transportRecord, 0);
}
}
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 2f5771548..b2b04b2dd 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
@@ -48,24 +48,24 @@ import java.util.Collections;
@SuppressWarnings("WeakerAccess")
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SdlProtocol extends SdlProtocolBase {
- private static final String TAG ="SdlProtocol";
+ private static final String TAG = "SdlProtocol";
public SdlProtocol(@NonNull ISdlProtocol iSdlProtocol, @NonNull MultiplexTransportConfig config) {
- super(iSdlProtocol,config);
+ super(iSdlProtocol, config);
this.requestedPrimaryTransports = config.getPrimaryTransports();
this.requestedSecondaryTransports = config.getSecondaryTransports();
this.requiresHighBandwidth = config.requiresHighBandwidth();
- this.setTransportManager(new TransportManager(config,transportEventListener));
+ this.setTransportManager(new TransportManager(config, transportEventListener));
}
public SdlProtocol(@NonNull ISdlProtocol iSdlProtocol, @NonNull TCPTransportConfig config) {
- super(iSdlProtocol,config);
+ super(iSdlProtocol, config);
this.requestedPrimaryTransports = Collections.singletonList(TransportType.TCP);
this.requestedSecondaryTransports = null;
- this.requiresHighBandwidth =false;
- this.setTransportManager(new TCPTransportManager(config,transportEventListener));
+ this.requiresHighBandwidth = false;
+ this.setTransportManager(new TCPTransportManager(config, transportEventListener));
}
/**
@@ -73,8 +73,8 @@ public class SdlProtocol extends SdlProtocolBase {
* call the onTransportEvent method.
*/
@Override
- void notifyDevTransportListener (){
- if(TransportType.MULTIPLEX.equals(transportConfig.getTransportType() )) {
+ void notifyDevTransportListener() {
+ 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/protocol/heartbeat/HeartbeatMonitor.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
index b0fcc73f3..c60cdaadf 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,7 +40,7 @@ import androidx.annotation.RestrictTo;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class HeartbeatMonitor implements IHeartbeatMonitor {
- public static final int HEARTBEAT_INTERVAL = 5000;
+ public static final int HEARTBEAT_INTERVAL = 5000;
public static final int HEARTBEAT_INTERVAL_MAX = Integer.MAX_VALUE;
private final Object heartbeatThreadHandlerLock = new Object();
@@ -61,33 +61,36 @@ public class HeartbeatMonitor implements IHeartbeatMonitor {
// Methods used to retrieve values for unit testing only.
// See com/smartdevicelink/tests/protocol/heartbeat/HeartbeatMonitorTests.
- public Runnable getHeartbeatRunnable () { return heartbeatTimeoutRunnable; }
- public boolean isHeartbeatReceived () { return isHeartbeatReceived; }
-
+ public Runnable getHeartbeatRunnable() {
+ return heartbeatTimeoutRunnable;
+ }
+
+ public boolean isHeartbeatReceived() {
+ return isHeartbeatReceived;
+ }
+
private final Runnable heartbeatTimeoutRunnable = new Runnable() {
@Override
- public void run() {
- try{
- synchronized (listenerLock) {
- if (isHeartbeatReceived) {
- if (mListener != null) {
- mListener.sendHeartbeat(HeartbeatMonitor.this);
- } else {
-
- }
- isHeartbeatReceived = false;
- } else {
- if (mListener != null) {
- mListener.heartbeatTimedOut(HeartbeatMonitor.this);
- }
- }
- }
- }
- catch(Exception ex)
- {
- stop();
- }
+ public void run() {
+ try {
+ synchronized (listenerLock) {
+ if (isHeartbeatReceived) {
+ if (mListener != null) {
+ mListener.sendHeartbeat(HeartbeatMonitor.this);
+ } else {
+
+ }
+ isHeartbeatReceived = false;
+ } else {
+ if (mListener != null) {
+ mListener.heartbeatTimedOut(HeartbeatMonitor.this);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ stop();
+ }
}
};
@@ -95,30 +98,27 @@ public class HeartbeatMonitor implements IHeartbeatMonitor {
@Override
public void run() {
-
- try
- {
- synchronized (listenerLock) {
- if (mIsAckReceived) {
- if (mListener != null) {
- mListener.sendHeartbeat(HeartbeatMonitor.this);
- } else {
- }
- mIsAckReceived = false;
- } else {
- if (mListener != null) {
- mListener.heartbeatTimedOut(HeartbeatMonitor.this);
- }
- stop();
- }
- }
-
- }
- catch(Exception ex)
- {
- stop();
- }
-
+
+ try {
+ synchronized (listenerLock) {
+ if (mIsAckReceived) {
+ if (mListener != null) {
+ mListener.sendHeartbeat(HeartbeatMonitor.this);
+ } else {
+ }
+ mIsAckReceived = false;
+ } else {
+ if (mListener != null) {
+ mListener.heartbeatTimedOut(HeartbeatMonitor.this);
+ }
+ stop();
+ }
+ }
+
+ } catch (Exception ex) {
+ stop();
+ }
+
rescheduleHeartbeat();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
index 68e8709f4..0c1f9d251 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -84,7 +84,7 @@ public interface IHeartbeatMonitor {
* Notifies the monitor about a received heartbeat ACK message.
*/
void heartbeatACKReceived();
-
+
/**
* Notifies the monitor about a received heartbeat message.
*/
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitorListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitorListener.java
index e95a6a5ec..38c35e06f 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitorListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitorListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
index 2e1ac540c..6ef9d081f 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,9 +33,9 @@ package com.smartdevicelink.security;
import android.content.Context;
-public abstract class SdlSecurityBase extends AbstractSdlSecurityBase{
+public abstract class SdlSecurityBase extends AbstractSdlSecurityBase {
- protected static Context context;
+ protected static Context context;
public static Context getContext() {
return context;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
index 7bd091596..d6c6550fe 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,10 +33,10 @@ package com.smartdevicelink.streaming;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.audio.IAudioStreamListener;
import com.smartdevicelink.streaming.video.IVideoStreamListener;
import com.smartdevicelink.util.DebugTool;
@@ -48,149 +48,140 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@RestrictTo(RestrictTo.Scope.LIBRARY)
-public class StreamPacketizer extends AbstractPacketizer implements IVideoStreamListener, IAudioStreamListener, Runnable{
+public class StreamPacketizer extends AbstractPacketizer implements IVideoStreamListener, IAudioStreamListener, Runnable {
- public final static String TAG = "StreamPacketizer";
+ public final static String TAG = "StreamPacketizer";
- private Thread t = null;
+ private Thread t = null;
- private final static int TLS_MAX_RECORD_SIZE = 16384;
- private final static int TLS_RECORD_HEADER_SIZE = 5;
- private final static int TLS_RECORD_MES_AUTH_CDE_SIZE = 32;
- private final static int TLS_MAX_RECORD_PADDING_SIZE = 256;
+ private final static int TLS_MAX_RECORD_SIZE = 16384;
+ private final static int TLS_RECORD_HEADER_SIZE = 5;
+ private final static int TLS_RECORD_MES_AUTH_CDE_SIZE = 32;
+ private final static int TLS_MAX_RECORD_PADDING_SIZE = 256;
- private final static int BUFF_READ_SIZE = TLS_MAX_RECORD_SIZE - TLS_RECORD_HEADER_SIZE - TLS_RECORD_MES_AUTH_CDE_SIZE - TLS_MAX_RECORD_PADDING_SIZE;
+ private final static int BUFF_READ_SIZE = TLS_MAX_RECORD_SIZE - TLS_RECORD_HEADER_SIZE - TLS_RECORD_MES_AUTH_CDE_SIZE - TLS_MAX_RECORD_PADDING_SIZE;
- // Approximate size of data that mOutputQueue can hold in bytes.
- // By adding a buffer, we accept underlying transport being stuck for a short time. By setting
- // a limit of the buffer size, we avoid buffer overflows when underlying transport is too slow.
- private static final int MAX_QUEUE_SIZE = 256 * 1024;
+ // Approximate size of data that mOutputQueue can hold in bytes.
+ // By adding a buffer, we accept underlying transport being stuck for a short time. By setting
+ // a limit of the buffer size, we avoid buffer overflows when underlying transport is too slow.
+ private static final int MAX_QUEUE_SIZE = 256 * 1024;
private final Object mPauseLock = new Object();
private boolean mPaused;
private boolean isServiceProtected = false;
private BlockingQueue<ByteBufferWithListener> mOutputQueue;
- public StreamPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID, SdlSession session) throws IOException {
- super(streamListener, is, sType, rpcSessionID, session);
+ public StreamPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID, SdlSession session) throws IOException {
+ super(streamListener, is, sType, rpcSessionID, session);
mPaused = false;
isServiceProtected = _session.isServiceProtected(_serviceType);
- if (bufferSize == 0) {
- // fail safe
- bufferSize = BUFF_READ_SIZE;
- buffer = new byte[bufferSize];
- }
- if(isServiceProtected){ //If our service is encrypted we can only use 1024 as the max buffer size.
- bufferSize = BUFF_READ_SIZE;
- buffer = new byte[bufferSize];
- }
- mOutputQueue = new LinkedBlockingQueue<>(MAX_QUEUE_SIZE / bufferSize);
- }
-
- public void start() throws IOException {
- if (t == null) {
- t = new Thread(this);
- t.start();
- }
- }
-
- public void stop() {
-
- if (t != null)
- {
- t.interrupt();
- t = null;
- }
-
- }
-
- public void run() {
- int length;
- try
- {
- while (t != null && !t.isInterrupted())
- {
- synchronized(mPauseLock)
- {
- while (mPaused)
- {
- try
- {
- mPauseLock.wait();
+ if (bufferSize == 0) {
+ // fail safe
+ bufferSize = BUFF_READ_SIZE;
+ buffer = new byte[bufferSize];
+ }
+ if (isServiceProtected) { //If our service is encrypted we can only use 1024 as the max buffer size.
+ bufferSize = BUFF_READ_SIZE;
+ buffer = new byte[bufferSize];
+ }
+ mOutputQueue = new LinkedBlockingQueue<>(MAX_QUEUE_SIZE / bufferSize);
+ }
+
+ public void start() throws IOException {
+ if (t == null) {
+ t = new Thread(this);
+ t.start();
+ }
+ }
+
+ public void stop() {
+
+ if (t != null) {
+ t.interrupt();
+ t = null;
+ }
+
+ }
+
+ public void run() {
+ int length;
+ try {
+ while (t != null && !t.isInterrupted()) {
+ synchronized (mPauseLock) {
+ while (mPaused) {
+ try {
+ mPauseLock.wait();
+ } catch (InterruptedException e) {
}
- catch (InterruptedException e) {}
}
}
- if (is != null) { // using InputStream interface
- length = is.read(buffer, 0, bufferSize);
-
- if (length >= 0) {
- ProtocolMessage pm = new ProtocolMessage();
- pm.setSessionID(_rpcSessionID);
- pm.setSessionType(_serviceType);
- pm.setFunctionID(0);
- pm.setCorrID(0);
- pm.setData(buffer, length);
- pm.setPayloadProtected(isServiceProtected);
-
- if (t != null && !t.isInterrupted()) {
- _streamListener.sendStreamPacket(pm);
- }
- }
- } else { // using sendFrame interface
- ByteBufferWithListener byteBufferWithListener;
- ByteBuffer frame;
- CompletionListener completionListener;
- try {
- byteBufferWithListener = mOutputQueue.take();
- frame = byteBufferWithListener.byteBuffer;
- completionListener = byteBufferWithListener.completionListener;
- } catch (InterruptedException e) {
- if(DebugTool.isDebugEnabled()){
- e.printStackTrace();
- }
- Thread.currentThread().interrupt();
- break;
- }
-
- while (frame.hasRemaining()) {
- int len = Math.min(frame.remaining(), bufferSize);
-
- ProtocolMessage pm = new ProtocolMessage();
- pm.setSessionID(_rpcSessionID);
- pm.setSessionType(_serviceType);
- pm.setFunctionID(0);
- pm.setCorrID(0);
- pm.setData(frame.array(), frame.arrayOffset() + frame.position(), len);
- pm.setPayloadProtected(isServiceProtected);
-
- if (t != null && !t.isInterrupted()) {
- _streamListener.sendStreamPacket(pm);
- }
-
- frame.position(frame.position() + len);
- }
-
- if (completionListener != null){
- completionListener.onComplete(true);
- }
- }
- }
- } catch (IOException e)
- {
- e.printStackTrace();
- }
- finally
- {
- _session.endService(_serviceType);
- }
- }
+ if (is != null) { // using InputStream interface
+ length = is.read(buffer, 0, bufferSize);
+
+ if (length >= 0) {
+ ProtocolMessage pm = new ProtocolMessage();
+ pm.setSessionID(_rpcSessionID);
+ pm.setSessionType(_serviceType);
+ pm.setFunctionID(0);
+ pm.setCorrID(0);
+ pm.setData(buffer, length);
+ pm.setPayloadProtected(isServiceProtected);
+
+ if (t != null && !t.isInterrupted()) {
+ _streamListener.sendStreamPacket(pm);
+ }
+ }
+ } else { // using sendFrame interface
+ ByteBufferWithListener byteBufferWithListener;
+ ByteBuffer frame;
+ CompletionListener completionListener;
+ try {
+ byteBufferWithListener = mOutputQueue.take();
+ frame = byteBufferWithListener.byteBuffer;
+ completionListener = byteBufferWithListener.completionListener;
+ } catch (InterruptedException e) {
+ if (DebugTool.isDebugEnabled()) {
+ e.printStackTrace();
+ }
+ Thread.currentThread().interrupt();
+ break;
+ }
+
+ while (frame.hasRemaining()) {
+ int len = Math.min(frame.remaining(), bufferSize);
+
+ ProtocolMessage pm = new ProtocolMessage();
+ pm.setSessionID(_rpcSessionID);
+ pm.setSessionType(_serviceType);
+ pm.setFunctionID(0);
+ pm.setCorrID(0);
+ pm.setData(frame.array(), frame.arrayOffset() + frame.position(), len);
+ pm.setPayloadProtected(isServiceProtected);
+
+ if (t != null && !t.isInterrupted()) {
+ _streamListener.sendStreamPacket(pm);
+ }
+
+ frame.position(frame.position() + len);
+ }
+
+ if (completionListener != null) {
+ completionListener.onComplete(true);
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ _session.endService(_serviceType);
+ }
+ }
@Override
- public void pause() {
+ public void pause() {
synchronized (mPauseLock) {
mPaused = true;
}
@@ -204,90 +195,91 @@ public class StreamPacketizer extends AbstractPacketizer implements IVideoStream
}
}
- /**
- * Called by the app.
- *
- * @see IVideoStreamListener#sendFrame(byte[], int, int, long)
- */
- @Override
- public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
- throws ArrayIndexOutOfBoundsException {
- sendArrayData(data, offset, length);
- }
-
- /**
- * Called by the app.
- *
- * @see IVideoStreamListener#sendFrame(ByteBuffer, long)
- */
- @Override
- public void sendFrame(ByteBuffer data, long presentationTimeUs) {
- sendByteBufferData(data, null);
- }
-
- /**
- * Called by the app.
- *
- * @see IAudioStreamListener#sendAudio(byte[], int, int, long)
- */
- @Override
- public void sendAudio(byte[] data, int offset, int length, long presentationTimeUs)
- throws ArrayIndexOutOfBoundsException {
- sendArrayData(data, offset, length);
- }
-
- /**
- * Called by the app.
- *
- * @see IAudioStreamListener#sendAudio(ByteBuffer, long, CompletionListener)
- */
- @Override
- public void sendAudio(ByteBuffer data, long presentationTimeUs, CompletionListener completionListener) {
- sendByteBufferData(data, completionListener);
- }
-
- private void sendArrayData(byte[] data, int offset, int length)
- throws ArrayIndexOutOfBoundsException {
- if (offset < 0 || offset > data.length || length <= 0 || offset + length > data.length) {
- throw new ArrayIndexOutOfBoundsException();
- }
-
- // StreamPacketizer does not need to split a video frame into NAL units
- ByteBuffer buffer = ByteBuffer.allocate(length);
- buffer.put(data, offset, length);
- buffer.flip();
-
- try {
- mOutputQueue.put(new ByteBufferWithListener(buffer, null));
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- private void sendByteBufferData(ByteBuffer data, CompletionListener completionListener) {
- if (data == null || data.remaining() == 0) {
- return;
- }
-
- // copy the whole buffer, so that even if the app modifies original ByteBuffer after
- // sendFrame() or sendAudio() call, our buffer will stay intact
- ByteBuffer buffer = ByteBuffer.allocate(data.remaining());
- buffer.put(data);
- buffer.flip();
-
- try {
- mOutputQueue.put(new ByteBufferWithListener(buffer, completionListener));
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- private class ByteBufferWithListener{
- final ByteBuffer byteBuffer;
- final CompletionListener completionListener;
- ByteBufferWithListener (ByteBuffer byteBuffer, CompletionListener completionListener){
- this.byteBuffer = byteBuffer;
- this.completionListener = completionListener;
- }
- }
+ /**
+ * Called by the app.
+ *
+ * @see IVideoStreamListener#sendFrame(byte[], int, int, long)
+ */
+ @Override
+ public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
+ throws ArrayIndexOutOfBoundsException {
+ sendArrayData(data, offset, length);
+ }
+
+ /**
+ * Called by the app.
+ *
+ * @see IVideoStreamListener#sendFrame(ByteBuffer, long)
+ */
+ @Override
+ public void sendFrame(ByteBuffer data, long presentationTimeUs) {
+ sendByteBufferData(data, null);
+ }
+
+ /**
+ * Called by the app.
+ *
+ * @see IAudioStreamListener#sendAudio(byte[], int, int, long)
+ */
+ @Override
+ public void sendAudio(byte[] data, int offset, int length, long presentationTimeUs)
+ throws ArrayIndexOutOfBoundsException {
+ sendArrayData(data, offset, length);
+ }
+
+ /**
+ * Called by the app.
+ *
+ * @see IAudioStreamListener#sendAudio(ByteBuffer, long, CompletionListener)
+ */
+ @Override
+ public void sendAudio(ByteBuffer data, long presentationTimeUs, CompletionListener completionListener) {
+ sendByteBufferData(data, completionListener);
+ }
+
+ private void sendArrayData(byte[] data, int offset, int length)
+ throws ArrayIndexOutOfBoundsException {
+ if (offset < 0 || offset > data.length || length <= 0 || offset + length > data.length) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
+ // StreamPacketizer does not need to split a video frame into NAL units
+ ByteBuffer buffer = ByteBuffer.allocate(length);
+ buffer.put(data, offset, length);
+ buffer.flip();
+
+ try {
+ mOutputQueue.put(new ByteBufferWithListener(buffer, null));
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private void sendByteBufferData(ByteBuffer data, CompletionListener completionListener) {
+ if (data == null || data.remaining() == 0) {
+ return;
+ }
+
+ // copy the whole buffer, so that even if the app modifies original ByteBuffer after
+ // sendFrame() or sendAudio() call, our buffer will stay intact
+ ByteBuffer buffer = ByteBuffer.allocate(data.remaining());
+ buffer.put(data);
+ buffer.flip();
+
+ try {
+ mOutputQueue.put(new ByteBufferWithListener(buffer, completionListener));
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private class ByteBufferWithListener {
+ final ByteBuffer byteBuffer;
+ final CompletionListener completionListener;
+
+ ByteBufferWithListener(ByteBuffer byteBuffer, CompletionListener completionListener) {
+ this.byteBuffer = byteBuffer;
+ this.completionListener = completionListener;
+ }
+ }
}
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 e22fbb9c6..f704bf769 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
@@ -78,7 +78,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
super.onCreate(savedInstanceState);
setTitle(TAG);
- w = getWindow();
+ w = getWindow();
startRefreshTask();
@@ -97,7 +97,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
protected final Runnable mStartRefreshTaskCallback = new Runnable() {
public void run() {
- if(mainView == null){
+ if (mainView == null) {
mainView = w.getDecorView().findViewById(android.R.id.content);
}
if (mainView != null) {
@@ -108,21 +108,21 @@ public abstract class SdlRemoteDisplay extends Presentation {
}
};
- public View getMainView(){
- if(mainView == null){
+ public View getMainView() {
+ if (mainView == null) {
mainView = w.getDecorView().findViewById(android.R.id.content);
}
return this.mainView;
}
- public void invalidate(){
+ public void invalidate() {
// let listeners know the view has been invalidated
- if(callback != null){
+ if (callback != null) {
callback.onInvalidated(this);
}
}
- public void handleMotionEvent(final MotionEvent motionEvent){
+ public void handleMotionEvent(final MotionEvent motionEvent) {
uiHandler.post(new Runnable() {
@Override
public void run() {
@@ -131,7 +131,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
});
}
- public void stop(){
+ public void stop() {
stopRefreshTask();
dismissPresentation();
}
@@ -144,8 +144,10 @@ public abstract class SdlRemoteDisplay extends Presentation {
}
});
}
- public interface Callback{
+
+ public interface Callback {
void onCreated(SdlRemoteDisplay remoteDisplay);
+
void onInvalidated(SdlRemoteDisplay remoteDisplay);
}
@@ -159,7 +161,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
private final Callback callback;
- public Creator(Context context, Display display, SdlRemoteDisplay remoteDisplay, Class<? extends SdlRemoteDisplay> remoteDisplayClass, Callback callback){
+ public Creator(Context context, Display display, SdlRemoteDisplay remoteDisplay, Class<? extends SdlRemoteDisplay> remoteDisplayClass, Callback callback) {
this.context = context;
this.mDisplay = display;
this.remoteDisplay = remoteDisplay;
@@ -175,8 +177,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((mDisplay!=null) && (remoteDisplay == null || remoteDisplay.getDisplay() != mDisplay))
- {
+ if ((mDisplay != null) && (remoteDisplay == null || remoteDisplay.getDisplay() != mDisplay)) {
try {
Constructor constructor = remoteDisplayClass.getConstructor(Context.class, Display.class);
remoteDisplay = (SdlRemoteDisplay) constructor.newInstance(context, mDisplay);
@@ -190,7 +191,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
try {
remoteDisplay.show();
remoteDisplay.callback = callback;
- if(callback!=null){
+ if (callback != null) {
callback.onCreated(remoteDisplay);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
index 956985128..d8c50f2cd 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -48,59 +48,59 @@ import java.sql.Timestamp;
@SuppressLint("DefaultLocale")
public class SdlTrace extends SdlTraceBase {
- private static String getPid(){
- return String.valueOf(android.os.Process.myPid());
- }
+ private static String getPid() {
+ return String.valueOf(android.os.Process.myPid());
+ }
- @SuppressLint("MissingPermission")
- public static String getBTDeviceInfo(BluetoothDevice btDevice) {
- StringBuilder sb = new StringBuilder();
- sb.append("<btp>");
- String btdn = btDevice.getName();
- sb.append("<btn>");
- sb.append(SdlTrace.B64EncodeForXML(btdn));
- sb.append("</btn>");
- sb.append("<bta>").append(btDevice.getAddress()).append("</bta>");
- sb.append("<bts>").append(btDevice.getBondState()).append("</bts>");
- sb.append("</btp>");
- return sb.toString();
- } // end-method
+ @SuppressLint("MissingPermission")
+ public static String getBTDeviceInfo(BluetoothDevice btDevice) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<btp>");
+ String btdn = btDevice.getName();
+ sb.append("<btn>");
+ sb.append(SdlTrace.B64EncodeForXML(btdn));
+ sb.append("</btn>");
+ sb.append("<bta>").append(btDevice.getAddress()).append("</bta>");
+ sb.append("<bts>").append(btDevice.getBondState()).append("</bts>");
+ sb.append("</btp>");
+ return sb.toString();
+ } // end-method
- // Package-scoped
- @SuppressWarnings("deprecation")
- public static String getLogHeader(String dumpReason, int seqNo) {
- final String Sep = "-";
- StringBuilder write = new StringBuilder("<?xml version=\"1.0\"?>" + "<logs>");
- write.append("<info>");
- StringBuilder infoBlock = new StringBuilder();
- String hostInfo = Build.BRAND + Sep + Build.MANUFACTURER + Sep + Build.MODEL + "(" + Build.HOST + ")";
- infoBlock.append("<host>").append(SdlTrace.B64EncodeForXML(hostInfo)).append("</host>");
- String osv = Build.VERSION.RELEASE + " (" + Build.VERSION.CODENAME + ")";
- infoBlock.append("<osv>").append(SdlTrace.B64EncodeForXML(osv)).append("</osv>");
- infoBlock.append(TraceDeviceInfo.getTelephonyHeader());
+ // Package-scoped
+ @SuppressWarnings("deprecation")
+ public static String getLogHeader(String dumpReason, int seqNo) {
+ final String Sep = "-";
+ StringBuilder write = new StringBuilder("<?xml version=\"1.0\"?>" + "<logs>");
+ write.append("<info>");
+ StringBuilder infoBlock = new StringBuilder();
+ String hostInfo = Build.BRAND + Sep + Build.MANUFACTURER + Sep + Build.MODEL + "(" + Build.HOST + ")";
+ infoBlock.append("<host>").append(SdlTrace.B64EncodeForXML(hostInfo)).append("</host>");
+ String osv = Build.VERSION.RELEASE + " (" + Build.VERSION.CODENAME + ")";
+ infoBlock.append("<osv>").append(SdlTrace.B64EncodeForXML(osv)).append("</osv>");
+ infoBlock.append(TraceDeviceInfo.getTelephonyHeader());
- long heapSize = Debug.getNativeHeapFreeSize() / 1024;
- long heapAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
- infoBlock.append("<mem><hf>").append(heapSize).append("KB</hf><ha>").append(heapAllocated).append("KB</ha></mem>");
- infoBlock.append("<np>").append(Runtime.getRuntime().availableProcessors()).append("</np>");
- infoBlock.append("<pid>").append(getPid()).append("</pid>");
- infoBlock.append("<tid>").append(Thread.currentThread().getId()).append("</tid>");
+ long heapSize = Debug.getNativeHeapFreeSize() / 1024;
+ long heapAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
+ infoBlock.append("<mem><hf>").append(heapSize).append("KB</hf><ha>").append(heapAllocated).append("KB</ha></mem>");
+ infoBlock.append("<np>").append(Runtime.getRuntime().availableProcessors()).append("</np>");
+ infoBlock.append("<pid>").append(getPid()).append("</pid>");
+ infoBlock.append("<tid>").append(Thread.currentThread().getId()).append("</tid>");
- // String dateStamp = (String)
- // DateFormat.format("yy-MM-dd hh:mm:ss SSS", new Timestamp(baseTics));
- Timestamp stamp = new Timestamp(SdlTrace.getBaseTics());
- String GMTtime = stamp.toGMTString().substring(0, 19);
- long fracSec = stamp.getNanos() / 1000000; // divide by a million
- String fracSecStr = String.format("%03d", fracSec);
- infoBlock.append("<utc>").append(GMTtime).append(".").append(fracSecStr).append("</utc>");
+ // String dateStamp = (String)
+ // DateFormat.format("yy-MM-dd hh:mm:ss SSS", new Timestamp(baseTics));
+ Timestamp stamp = new Timestamp(SdlTrace.getBaseTics());
+ String GMTtime = stamp.toGMTString().substring(0, 19);
+ long fracSec = stamp.getNanos() / 1000000; // divide by a million
+ String fracSecStr = String.format("%03d", fracSec);
+ infoBlock.append("<utc>").append(GMTtime).append(".").append(fracSecStr).append("</utc>");
- infoBlock.append(TraceDeviceInfo.getLogHeaderBluetoothPairs());
- infoBlock.append(getSmartDeviceLinkTraceRoot(dumpReason, seqNo));
+ infoBlock.append(TraceDeviceInfo.getLogHeaderBluetoothPairs());
+ infoBlock.append(getSmartDeviceLinkTraceRoot(dumpReason, seqNo));
- write.append(infoBlock);
+ write.append(infoBlock);
- write.append("</info>" + "<msgs>");
- return write.toString();
- } // end-method
+ write.append("</info>" + "<msgs>");
+ return write.toString();
+ } // end-method
} // end-class \ No newline at end of file
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java b/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
index 5f2452125..50f27d1ae 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/trace/TraceDeviceInfo.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,116 +37,114 @@ import android.telephony.TelephonyManager;
import com.smartdevicelink.util.DebugTool;
-import java.util.Iterator;
import java.util.Set;
/**
* @author vvolkman
- *
*/
public class TraceDeviceInfo {
- // http://developer.android.com/guide/topics/data/data-storage.html
-
- private static final String TAG = "TraceDeviceInfo";
- private static TelephonyManager m_telephonyManager;
-
- // Constructor
- public TraceDeviceInfo(TelephonyManager telephonyManager) {
- m_telephonyManager = telephonyManager;
- }
-
- public static void setTelephonyManager(TelephonyManager telephonyManager) {
- m_telephonyManager = telephonyManager;
- }
-
- public static TelephonyManager getTelephonyManager() {
- return m_telephonyManager;
- }
-
- // package scoped
- static String getTelephonyHeader() {
- // Telephony manager can tell us a few things...
- String info = "";
-
- if (m_telephonyManager != null) {
- try { // getDeviceId() requires android.permission.READ_PHONE_STATE
- info = "<deviceid>" + m_telephonyManager.getDeviceId() + "</deviceid>";
- } catch (Exception e1) {
- DebugTool.logError(TAG, "Failure getting telephony device ID: " + e1.toString(), e1);
- }
-
- info = "<pt>";
- switch (m_telephonyManager.getPhoneType()) {
- case TelephonyManager.PHONE_TYPE_NONE:
- info += "NONE";
- break;
- case TelephonyManager.PHONE_TYPE_GSM:
- info += "GSM";
- break;
- case TelephonyManager.PHONE_TYPE_CDMA:
- info += "CDMA";
- break;
- default:
- info += "UNKNOWN";
- } // end-switch
-
- info += "</pt>" + "<nt>";
-
- switch (m_telephonyManager.getNetworkType()) {
- case TelephonyManager.NETWORK_TYPE_UNKNOWN:
- info += "UKNOWN";
- break;
- case TelephonyManager.NETWORK_TYPE_GPRS:
- info += "GPRS";
- break;
- case TelephonyManager.NETWORK_TYPE_EDGE:
- info += "EDGE";
- break;
- case TelephonyManager.NETWORK_TYPE_UMTS:
- info += "UMTS";
- break;
- case TelephonyManager.NETWORK_TYPE_HSDPA:
- info += "HSDPA";
- break;
- case TelephonyManager.NETWORK_TYPE_HSUPA:
- info += "HSUPA";
- break;
- case TelephonyManager.NETWORK_TYPE_HSPA:
- info += "HSPA";
- break;
- case TelephonyManager.NETWORK_TYPE_CDMA:
- info += "CDMA";
- break;
- case TelephonyManager.NETWORK_TYPE_EVDO_0:
- info += "EVDO_O";
- break;
- case TelephonyManager.NETWORK_TYPE_EVDO_A:
- info += "EVDO_A";
- break;
- case TelephonyManager.NETWORK_TYPE_1xRTT:
- info += "1xRTT";
- break;
- default:
- info += "UNKNOWN";
- break;
- } // end-switch
-
- info += "</nt>";
- } // end-if
- return info;
- } // end-method
-
- // Package scoped
- static String getLogHeaderBluetoothPairs() {
- Set<BluetoothDevice> btDevices = BluetoothAdapter.getDefaultAdapter()
- .getBondedDevices();
-
- StringBuilder write = new StringBuilder("<btpairs>");
- for (BluetoothDevice btDevice : btDevices) {
- write.append(SdlTrace.getBTDeviceInfo(btDevice));
- }
- write.append("</btpairs>");
-
- return write.toString();
- } // end-method
+ // http://developer.android.com/guide/topics/data/data-storage.html
+
+ private static final String TAG = "TraceDeviceInfo";
+ private static TelephonyManager m_telephonyManager;
+
+ // Constructor
+ public TraceDeviceInfo(TelephonyManager telephonyManager) {
+ m_telephonyManager = telephonyManager;
+ }
+
+ public static void setTelephonyManager(TelephonyManager telephonyManager) {
+ m_telephonyManager = telephonyManager;
+ }
+
+ public static TelephonyManager getTelephonyManager() {
+ return m_telephonyManager;
+ }
+
+ // package scoped
+ static String getTelephonyHeader() {
+ // Telephony manager can tell us a few things...
+ String info = "";
+
+ if (m_telephonyManager != null) {
+ try { // getDeviceId() requires android.permission.READ_PHONE_STATE
+ info = "<deviceid>" + m_telephonyManager.getDeviceId() + "</deviceid>";
+ } catch (Exception e1) {
+ DebugTool.logError(TAG, "Failure getting telephony device ID: " + e1.toString(), e1);
+ }
+
+ info = "<pt>";
+ switch (m_telephonyManager.getPhoneType()) {
+ case TelephonyManager.PHONE_TYPE_NONE:
+ info += "NONE";
+ break;
+ case TelephonyManager.PHONE_TYPE_GSM:
+ info += "GSM";
+ break;
+ case TelephonyManager.PHONE_TYPE_CDMA:
+ info += "CDMA";
+ break;
+ default:
+ info += "UNKNOWN";
+ } // end-switch
+
+ info += "</pt>" + "<nt>";
+
+ switch (m_telephonyManager.getNetworkType()) {
+ case TelephonyManager.NETWORK_TYPE_UNKNOWN:
+ info += "UKNOWN";
+ break;
+ case TelephonyManager.NETWORK_TYPE_GPRS:
+ info += "GPRS";
+ break;
+ case TelephonyManager.NETWORK_TYPE_EDGE:
+ info += "EDGE";
+ break;
+ case TelephonyManager.NETWORK_TYPE_UMTS:
+ info += "UMTS";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSDPA:
+ info += "HSDPA";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSUPA:
+ info += "HSUPA";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSPA:
+ info += "HSPA";
+ break;
+ case TelephonyManager.NETWORK_TYPE_CDMA:
+ info += "CDMA";
+ break;
+ case TelephonyManager.NETWORK_TYPE_EVDO_0:
+ info += "EVDO_O";
+ break;
+ case TelephonyManager.NETWORK_TYPE_EVDO_A:
+ info += "EVDO_A";
+ break;
+ case TelephonyManager.NETWORK_TYPE_1xRTT:
+ info += "1xRTT";
+ break;
+ default:
+ info += "UNKNOWN";
+ break;
+ } // end-switch
+
+ info += "</nt>";
+ } // end-if
+ return info;
+ } // end-method
+
+ // Package scoped
+ static String getLogHeaderBluetoothPairs() {
+ Set<BluetoothDevice> btDevices = BluetoothAdapter.getDefaultAdapter()
+ .getBondedDevices();
+
+ StringBuilder write = new StringBuilder("<btpairs>");
+ for (BluetoothDevice btDevice : btDevices) {
+ write.append(SdlTrace.getBTDeviceInfo(btDevice));
+ }
+ write.append("</btpairs>");
+
+ return write.toString();
+ } // end-method
} // end-class \ No newline at end of file
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBaseTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBaseTransport.java
index a8eecd484..6ae1258b1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBaseTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBaseTransport.java
@@ -42,15 +42,15 @@ import com.smartdevicelink.transport.utl.TransportRecord;
public abstract class MultiplexBaseTransport {
// Constants that indicate the current connection state
- public static final int STATE_NONE = 0; // we're doing nothing
- public static final int STATE_LISTEN = 1; // now listening for incoming connections
- public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
- public static final int STATE_CONNECTED = 3; // now connected to a remote device
- public static final int STATE_ERROR = 4; // Something bad happened, we wil not try to restart the thread
+ public static final int STATE_NONE = 0; // we're doing nothing
+ public static final int STATE_LISTEN = 1; // now listening for incoming connections
+ public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
+ public static final int STATE_CONNECTED = 3; // now connected to a remote device
+ public static final int STATE_ERROR = 4; // Something bad happened, we wil not try to restart the thread
public static final String ERROR_REASON_KEY = "ERROR_REASON";
- public static final byte REASON_SPP_ERROR = 0x01; // REASON = SPP error, which is sent through bundle.
- public static final byte REASON_NONE = 0x0;
+ public static final byte REASON_SPP_ERROR = 0x01; // REASON = SPP error, which is sent through bundle.
+ public static final byte REASON_NONE = 0x0;
public static final String LOG = "log";
public static final String DEVICE_NAME = "device_name";
@@ -65,7 +65,7 @@ public abstract class MultiplexBaseTransport {
public String connectedDeviceAddress = null;
- protected MultiplexBaseTransport(Handler handler, TransportType transportType){
+ protected MultiplexBaseTransport(Handler handler, TransportType transportType) {
this.handler = handler;
this.transportType = transportType;
}
@@ -75,7 +75,7 @@ public abstract class MultiplexBaseTransport {
}
protected synchronized void setState(int state, Bundle bundle) {
- if(state == mState){
+ if (state == mState) {
return; //State hasn't changed. Will not updated listeners.
}
//Log.d(TAG, "Setting state from: " +mState + " to: " +state);
@@ -89,33 +89,34 @@ public abstract class MultiplexBaseTransport {
msg.sendToTarget();
}
- public String getAddress(){
+ public String getAddress() {
return connectedDeviceAddress;
}
- public String getDeviceName(){
+ public String getDeviceName() {
return connectedDeviceName;
}
/**
* Should only be called after a connection has been established
+ *
* @return
*/
public TransportRecord getTransportRecord() {
- if(transportRecord == null){
- transportRecord = new TransportRecord(transportType,connectedDeviceAddress);
+ if (transportRecord == null) {
+ transportRecord = new TransportRecord(transportType, connectedDeviceAddress);
}
return transportRecord;
}
/**
- * Return the current connection state. */
+ * Return the current connection state.
+ */
public synchronized int getState() {
return mState;
}
- public boolean isConnected()
- {
+ public boolean isConnected() {
return (mState == STATE_CONNECTED);
}
@@ -124,8 +125,10 @@ public abstract class MultiplexBaseTransport {
}
protected abstract void stop(int state);
- protected void stop(int state, byte error) {}
- public abstract void write(byte[] out, int offset, int count);
+ protected void stop(int state, byte error) {
+ }
+
+ public abstract void write(byte[] out, int offset, int count);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
index 7995b7bde..6f02088cc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
@@ -51,20 +51,19 @@ import java.util.UUID;
* connections with other devices. It has a thread that listens for
* incoming connections, a thread for connecting with a device, and a
* thread for performing data transmissions when connected.
- *
+ *
* @author Joey Grover
- *
*/
-public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
+public class MultiplexBluetoothTransport extends MultiplexBaseTransport {
//finals
- private static final String TAG = "Bluetooth Transport";
- private static final UUID SERVER_UUID= new UUID(0x936DA01F9ABD4D9DL, 0x80C702AF85C822A8L);
+ private static final String TAG = "Bluetooth Transport";
+ private static final UUID SERVER_UUID = new UUID(0x936DA01F9ABD4D9DL, 0x80C702AF85C822A8L);
// Name for the SDP record when creating server socket
- private static final String NAME_SECURE =" SdlRouterService";
+ private static final String NAME_SECURE = " SdlRouterService";
// Key names received from the BluetoothSerialServer Handler
private static final long MS_TILL_TIMEOUT = 2500;
private static final int READ_BUFFER_SIZE = 4096;
- private final Object THREAD_LOCK = new Object();
+ private final Object THREAD_LOCK = new Object();
protected static final String SHARED_PREFS = "sdl.bluetoothprefs";
@@ -81,115 +80,139 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
/**
* Constructor. Prepares a new BluetoothChat session.
- * @param handler A Handler to send messages back to the UI Activity
+ *
+ * @param handler A Handler to send messages back to the UI Activity
*/
public MultiplexBluetoothTransport(Handler handler) {
super(handler, TransportType.BLUETOOTH);
}
//These methods are used so we can have a semi-static reference to the Accept Thread (Static reference inherited by housing class)
- private synchronized AcceptThread getAcceptThread(){
- return mSecureAcceptThread;
+ private synchronized AcceptThread getAcceptThread() {
+ return mSecureAcceptThread;
}
- private synchronized void setAcceptThread(AcceptThread aThread){
- mSecureAcceptThread = aThread;
+
+ private synchronized void setAcceptThread(AcceptThread aThread) {
+ mSecureAcceptThread = aThread;
}
- protected synchronized void setStateManually(int state){
+
+ protected synchronized void setStateManually(int state) {
//Log.d(TAG, "Setting state from: " +mState + " to: " +state);
mState = state;
}
/**
- * Return the current connection state. */
+ * Return the current connection state.
+ */
public synchronized int getState() {
return mState;
}
- public void setKeepSocketAlive(boolean keepSocketAlive){
- this.keepSocketAlive = keepSocketAlive;
+ public void setKeepSocketAlive(boolean keepSocketAlive) {
+ this.keepSocketAlive = keepSocketAlive;
}
-
+
/**
* Start the chat service. Specifically start AcceptThread to begin a
- * session in listening (server) mode. Called by the Activity onResume() */
+ * session in listening (server) mode. Called by the Activity onResume()
+ */
@SuppressLint("MissingPermission")
@RequiresPermission(Manifest.permission.BLUETOOTH)
public synchronized void start() {
- //Log.d(TAG, "Starting up Bluetooth Server to Listen");
+ //Log.d(TAG, "Starting up Bluetooth Server to Listen");
// Cancel any thread attempting to make a connection
- if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
// Cancel any thread currently running a connection
- if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
- if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+ if (mConnectedWriteThread != null) {
+ mConnectedWriteThread.cancel();
+ mConnectedWriteThread = null;
+ }
-
// Start the thread to listen on a BluetoothServerSocket
if (getAcceptThread() == null
- && mAdapter != null
- && mAdapter.isEnabled()) {
- //Log.d(TAG, "Secure thread was null, attempting to create new");
- setAcceptThread(new AcceptThread(true));
- if(getAcceptThread()!=null){
- setState(STATE_LISTEN);
- getAcceptThread().start();
+ && mAdapter != null
+ && mAdapter.isEnabled()) {
+ //Log.d(TAG, "Secure thread was null, attempting to create new");
+ setAcceptThread(new AcceptThread(true));
+ if (getAcceptThread() != null) {
+ setState(STATE_LISTEN);
+ getAcceptThread().start();
}
}
}
/**
* Start the ConnectThread to initiate a connection to a remote device.
- * @param device The BluetoothDevice to connect
+ *
+ * @param device The BluetoothDevice to connect
*/
public synchronized void connect(BluetoothDevice device) {
// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
- if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
}
// Cancel any thread currently running a connection
- if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
- if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+ if (mConnectedWriteThread != null) {
+ mConnectedWriteThread.cancel();
+ mConnectedWriteThread = null;
+ }
+
-
// Cancel the accept thread because we only want to connect to one device
- if (mSecureAcceptThread != null) {
+ if (mSecureAcceptThread != null) {
mSecureAcceptThread.cancel();
mSecureAcceptThread = null;
}
-
+
// Start the thread to connect with the given device
- mConnectThread = new ConnectThread(device);
- mConnectThread.start();
- setState(STATE_CONNECTING);
+ mConnectThread = new ConnectThread(device);
+ mConnectThread.start();
+ setState(STATE_CONNECTING);
}
/**
* Start the ConnectedThread to begin managing a Bluetooth connection
- * @param socket The BluetoothSocket on which the connection was made
- * @param device The BluetoothDevice that has been connected
+ *
+ * @param socket The BluetoothSocket on which the connection was made
+ * @param device The BluetoothDevice that has been connected
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public synchronized void connected(BluetoothSocket socket, BluetoothDevice device) {
// Cancel the thread that completed the connection
if (mConnectThread != null) {
- mConnectThread.cancel();
- mConnectThread = null;
+ mConnectThread.cancel();
+ mConnectThread = null;
}
-
+
// Cancel any thread currently running a connection
if (mConnectedThread != null) {
- mConnectedThread.cancel();
- mConnectedThread = null;
+ mConnectedThread.cancel();
+ mConnectedThread = null;
}
if (mConnectedWriteThread != null) {
- mConnectedWriteThread.cancel();
- mConnectedWriteThread = null;
+ mConnectedWriteThread.cancel();
+ mConnectedWriteThread = null;
}
// Cancel the accept thread because we only want to connect to one device
if (!keepSocketAlive && mSecureAcceptThread != null) {
- mSecureAcceptThread.cancel();
+ mSecureAcceptThread.cancel();
mSecureAcceptThread = null;
}
@@ -201,19 +224,19 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
mConnectedWriteThread.start();
//Store a static name of the device that is connected.
- if(device != null){
- connectedDeviceName = device.getName();
+ if (device != null) {
+ connectedDeviceName = device.getName();
connectedDeviceAddress = device.getAddress();
- if(connectedDeviceAddress!=null){
+ if (connectedDeviceAddress != null) {
//Update the transport record with the address
transportRecord = new TransportRecord(transportType, connectedDeviceAddress);
}
}
-
+
// Send the name of the connected device back to the UI Activity
Message msg = handler.obtainMessage(SdlRouterService.MESSAGE_DEVICE_NAME);
Bundle bundle = new Bundle();
- if(connectedDeviceName != null) {
+ if (connectedDeviceName != null) {
bundle.putString(DEVICE_NAME, connectedDeviceName);
bundle.putString(DEVICE_ADDRESS, connectedDeviceAddress);
}
@@ -226,48 +249,53 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
* Stop all threads
*/
public synchronized void stop() {
- stop(STATE_NONE, REASON_NONE);
+ stop(STATE_NONE, REASON_NONE);
}
- protected synchronized void stop(int stateToTransitionTo) {
- this.stop(stateToTransitionTo, REASON_NONE);
- }
- @Override
- protected synchronized void stop(int stateToTransitionTo, byte error) {
- super.stop(stateToTransitionTo, error);
+ protected synchronized void stop(int stateToTransitionTo) {
+ this.stop(stateToTransitionTo, REASON_NONE);
+ }
+
+ @Override
+ protected synchronized void stop(int stateToTransitionTo, byte error) {
+ super.stop(stateToTransitionTo, error);
DebugTool.logInfo(TAG, "Attempting to close the bluetooth serial server");
- if (mConnectThread != null) {
- mConnectThread.cancel();
- mConnectThread = null;
- }
-
- if (mConnectedThread != null) {
- mConnectedThread.cancel();
- mConnectedThread = null;
- }
- if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
-
- if (mSecureAcceptThread != null) {
- mSecureAcceptThread.cancel();
- mSecureAcceptThread = null;
- }
-
- if (stateToTransitionTo == MultiplexBaseTransport.STATE_ERROR) {
- Bundle bundle = new Bundle();
- bundle.putByte(ERROR_REASON_KEY, error);
- setState(stateToTransitionTo, bundle);
- } else {
- setState(stateToTransitionTo, null);
- }
- }
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
+ }
+
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+ if (mConnectedWriteThread != null) {
+ mConnectedWriteThread.cancel();
+ mConnectedWriteThread = null;
+ }
+
+ if (mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
+ }
+
+ if (stateToTransitionTo == MultiplexBaseTransport.STATE_ERROR) {
+ Bundle bundle = new Bundle();
+ bundle.putByte(ERROR_REASON_KEY, error);
+ setState(stateToTransitionTo, bundle);
+ } else {
+ setState(stateToTransitionTo, null);
+ }
+ }
/**
* Write to the ConnectedThread in an unsynchronized manner
+ *
* @param out The bytes to write
- * @see ConnectedWriteThread#write(byte[],int,int)
+ * @see ConnectedWriteThread#write(byte[], int, int)
*/
- public void write(byte[] out, int offset, int count) {
+ public void write(byte[] out, int offset, int count) {
// Create temporary object
ConnectedWriteThread r;
// Synchronize a copy of the ConnectedThread
@@ -277,14 +305,14 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//r.write(out,offset,count);
}
// Perform the write unsynchronized
- r.write(out,offset,count);
+ r.write(out, offset, count);
}
-
+
/**
* Indicate that the connection attempt failed and notify the UI Activity.
*/
private void connectionFailed() {
- // Send a failure message back to the Activity
+ // Send a failure message back to the Activity
Message msg = handler.obtainMessage(SdlRouterService.MESSAGE_LOG);
Bundle bundle = new Bundle();
bundle.putString(LOG, "Unable to connect device");
@@ -292,7 +320,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
handler.sendMessage(msg);
// Start the service over to restart listening mode
- // BluetoothSerialServer.this.start();
+ // BluetoothSerialServer.this.start();
}
/**
@@ -308,23 +336,22 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
stop();
}
-
- private void timerDelayRemoveDialog(final BluetoothSocket sock){
- timeOutHandler = new Handler();
- socketRunnable = new Runnable() {
+
+ private void timerDelayRemoveDialog(final BluetoothSocket sock) {
+ timeOutHandler = new Handler();
+ socketRunnable = new Runnable() {
public void run() {
- //Log.e(TAG, "BLUETOOTH SOCKET CONNECT TIMEOUT - ATTEMPT TO CLOSE SOCKET");
- try {
- sock.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ //Log.e(TAG, "BLUETOOTH SOCKET CONNECT TIMEOUT - ATTEMPT TO CLOSE SOCKET");
+ try {
+ sock.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
};
timeOutHandler.postDelayed(socketRunnable, MS_TILL_TIMEOUT);
}
-
-
+
/**
* This thread runs while listening for incoming connections. It behaves
@@ -334,116 +361,115 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
private class AcceptThread extends Thread {
// The local server socket
private final String mSocketType;
- final BluetoothServerSocket mmServerSocket;
-
+ final BluetoothServerSocket mmServerSocket;
+
@SuppressLint("NewApi")
@RequiresPermission(Manifest.permission.BLUETOOTH)
public AcceptThread(boolean secure) {
- synchronized(THREAD_LOCK){
- //Log.d(TAG, "Creating an Accept Thread");
- BluetoothServerSocket tmp = null;
- mSocketType = secure ? "Secure":"Insecure";
- // Create a new listening server socket
- try {
- if (secure) {
- tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, SERVER_UUID);
- }
- } catch (IOException e) {
- //Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
- MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_SPP_ERROR);
- //Let's try to shut down this thread
- }catch(SecurityException e2){
- //Log.e(TAG, "<LIVIO> Security Exception in Accept Thread - "+e2.toString());
- interrupt();
- }
- mmServerSocket = tmp;
- //Should only log on debug
- //BluetoothSocket mySock = getBTSocket(mmServerSocket);
- //Log.d(TAG, "Accepting Connections on SDP Server Port Number: " + getChannel(mySock) + "\r\n");
+ synchronized (THREAD_LOCK) {
+ //Log.d(TAG, "Creating an Accept Thread");
+ BluetoothServerSocket tmp = null;
+ mSocketType = secure ? "Secure" : "Insecure";
+ // Create a new listening server socket
+ try {
+ if (secure) {
+ tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, SERVER_UUID);
+ }
+ } catch (IOException e) {
+ //Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_SPP_ERROR);
+ //Let's try to shut down this thread
+ } catch (SecurityException e2) {
+ //Log.e(TAG, "<LIVIO> Security Exception in Accept Thread - "+e2.toString());
+ interrupt();
+ }
+ mmServerSocket = tmp;
+ //Should only log on debug
+ //BluetoothSocket mySock = getBTSocket(mmServerSocket);
+ //Log.d(TAG, "Accepting Connections on SDP Server Port Number: " + getChannel(mySock) + "\r\n");
}
}
@RequiresPermission(Manifest.permission.BLUETOOTH)
public void run() {
- synchronized(THREAD_LOCK){
+ synchronized (THREAD_LOCK) {
DebugTool.logInfo(TAG, "Socket Type: " + mSocketType +
- " BEGIN mAcceptThread" + this);
- setName("AcceptThread" + mSocketType);
-
- BluetoothSocket socket;
- int listenAttempts = 0;
-
- // Listen to the server socket if we're not connected
- while (mState != STATE_CONNECTED) {
- try {
- if(listenAttempts>=5){
- DebugTool.logError(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
- MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
- return;
- }
- listenAttempts++;
- DebugTool.logInfo(TAG, "SDL Bluetooth Accept thread is running.");
+ " BEGIN mAcceptThread" + this);
+ setName("AcceptThread" + mSocketType);
- // This is a blocking call and will only return on a
- // successful connection or an exception
- if(mmServerSocket!=null){
-
- socket = mmServerSocket.accept();
-
- }
- else{
- DebugTool.logError(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
- MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
- return;
- }
- } catch (IOException e) {
- DebugTool.logError(TAG, "Socket Type: " + mSocketType + "accept() failed");
- MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_SPP_ERROR);
- return;
- }
+ BluetoothSocket socket;
+ int listenAttempts = 0;
- // If a connection was accepted
- if (socket != null) {
- synchronized (MultiplexBluetoothTransport.this) {
- switch (mState) {
- case STATE_LISTEN:
- case STATE_CONNECTING:
- // Situation normal. Start the connected thread.
- connected(socket, socket.getRemoteDevice());
-
- break;
- case STATE_NONE:
- case STATE_CONNECTED:
- // Either not ready or already connected. Terminate new socket.
- try {
- DebugTool.logInfo(TAG, "Close unwanted socket");
- socket.close();
- } catch (IOException e) {
- DebugTool.logError(TAG, "Could not close unwanted socket", e);
+ // Listen to the server socket if we're not connected
+ while (mState != STATE_CONNECTED) {
+ try {
+ if (listenAttempts >= 5) {
+ DebugTool.logError(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
+ return;
+ }
+ listenAttempts++;
+ DebugTool.logInfo(TAG, "SDL Bluetooth Accept thread is running.");
+
+ // This is a blocking call and will only return on a
+ // successful connection or an exception
+ if (mmServerSocket != null) {
+
+ socket = mmServerSocket.accept();
+
+ } else {
+ DebugTool.logError(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_NONE);
+ return;
+ }
+ } catch (IOException e) {
+ DebugTool.logError(TAG, "Socket Type: " + mSocketType + "accept() failed");
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR, REASON_SPP_ERROR);
+ return;
+ }
+
+ // If a connection was accepted
+ if (socket != null) {
+ synchronized (MultiplexBluetoothTransport.this) {
+ switch (mState) {
+ case STATE_LISTEN:
+ case STATE_CONNECTING:
+ // Situation normal. Start the connected thread.
+ connected(socket, socket.getRemoteDevice());
+
+ break;
+ case STATE_NONE:
+ case STATE_CONNECTED:
+ // Either not ready or already connected. Terminate new socket.
+ try {
+ DebugTool.logInfo(TAG, "Close unwanted socket");
+ socket.close();
+ } catch (IOException e) {
+ DebugTool.logError(TAG, "Could not close unwanted socket", e);
+ }
+ break;
}
- break;
}
}
}
- }
DebugTool.logInfo(TAG, mState + " END mAcceptThread, socket Type: " + mSocketType);
- }
+ }
}
public synchronized void cancel() {
DebugTool.logInfo(TAG, mState + " Socket Type " + mSocketType + " cancel ");
try {
- if(mmServerSocket != null){
- mmServerSocket.close();
- }
-
+ if (mmServerSocket != null) {
+ mmServerSocket.close();
+ }
+
} catch (IOException e) {
- DebugTool.logError(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ Arrays.toString(e.getStackTrace()));
+ DebugTool.logError(TAG, mState + " Socket Type " + mSocketType + " close() of server failed " + Arrays.toString(e.getStackTrace()));
}
}
}
-
+
/**
* This thread runs while attempting to make an outgoing connection
* with a device. It runs straight through; the connection either
@@ -452,6 +478,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
private class ConnectThread extends Thread {
private BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;
+
public ConnectThread(BluetoothDevice device) {
mmDevice = device;
//Log.d(TAG, "Attempting to connect to " + device.getName());
@@ -460,12 +487,12 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
- public void attemptCancelDiscovery(){
- try{
- mAdapter.cancelDiscovery();
- }catch(SecurityException e2){
+ public void attemptCancelDiscovery() {
+ try {
+ mAdapter.cancelDiscovery();
+ } catch (SecurityException e2) {
DebugTool.logError(TAG, "Don't have required permission to cancel discovery. Moving on");
- }
+ }
}
@RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
@@ -643,10 +670,10 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
private class ConnectedWriteThread extends Thread {
private final BluetoothSocket mmSocket;
private final OutputStream mmOutStream;
-
+
public ConnectedWriteThread(BluetoothSocket socket) {
- //Log.d(TAG, "Creating a Connected - Write Thread");
+ //Log.d(TAG, "Creating a Connected - Write Thread");
mmSocket = socket;
OutputStream tmpOut = null;
setName("SDL Router BT Write Thread");
@@ -659,53 +686,56 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
mmOutStream = tmpOut;
-
+
}
+
/**
* Write to the connected OutStream.
- * @param buffer The bytes to write
+ *
+ * @param buffer The bytes to write
*/
public void write(byte[] buffer, int offset, int count) {
try {
- if(buffer==null){
+ if (buffer == null) {
DebugTool.logWarning(TAG, "Can't write to device, nothing to send");
- return;
- }
- //This would be a good spot to log out all bytes received
- mmOutStream.write(buffer, offset, count);
- //Log.w(TAG, "Wrote out to device: bytes = "+ count);
- } catch (IOException|NullPointerException e) { // STRICTLY to catch mmOutStream NPE
+ return;
+ }
+ //This would be a good spot to log out all bytes received
+ mmOutStream.write(buffer, offset, count);
+ //Log.w(TAG, "Wrote out to device: bytes = "+ count);
+ } catch (IOException | NullPointerException e) { // STRICTLY to catch mmOutStream NPE
// Exception during write
- //OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
+ //OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
DebugTool.logError(TAG, "Error sending bytes to connected device!");
- connectionLost();
+ connectionLost();
}
}
public synchronized void cancel() {
try {
- if(mmOutStream!=null){
- mmOutStream.flush();
- mmOutStream.close();
-
- }
- if(mmSocket!=null){
- mmSocket.close();
- }
+ if (mmOutStream != null) {
+ mmOutStream.flush();
+ mmOutStream.close();
+
+ }
+ if (mmSocket != null) {
+ mmSocket.close();
+ }
} catch (IOException e) {
// close() of connect socket failed
DebugTool.logInfo(TAG, "Write Thread: " + e.getMessage());
}
}
}
-
+
private class ConnectedThread extends Thread {
private final BluetoothSocket mmSocket;
private final InputStream mmInStream;
- final SdlPsm psm;
+ final SdlPsm psm;
+
public ConnectedThread(BluetoothSocket socket) {
- this.psm = new SdlPsm();
- //Log.d(TAG, "Creating a Connected - Read Thread");
+ this.psm = new SdlPsm();
+ //Log.d(TAG, "Creating a Connected - Read Thread");
mmSocket = socket;
InputStream tmpIn = null;
setName("SDL Router BT Read Thread");
@@ -714,27 +744,27 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
tmpIn = socket.getInputStream();
} catch (IOException e) {
// temp sockets not created
- DebugTool.logError(TAG, "Connected Read Thread: "+e.getMessage());
+ DebugTool.logError(TAG, "Connected Read Thread: " + e.getMessage());
}
mmInStream = tmpIn;
-
+
}
-
- @SuppressLint("NewApi")
- public void run() {
+
+ @SuppressLint("NewApi")
+ public void run() {
DebugTool.logInfo(TAG, "Running the Connected Thread");
byte input = 0;
int bytesRead = 0;
byte[] buffer = new byte[READ_BUFFER_SIZE];
// Keep listening to the InputStream while connected
boolean stateProgress;
-
+
psm.reset();
-
+
while (true) {
try {
bytesRead = mmInStream.read(buffer);
- // Log.i(getClass().getName(), "Received " + bytesRead + " bytes from Bluetooth");
+ // Log.i(getClass().getName(), "Received " + bytesRead + " bytes from Bluetooth");
for (int i = 0; i < bytesRead; i++) {
input = buffer[i];
@@ -754,12 +784,12 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
psm.reset();
}
}
- } catch (IOException|NullPointerException e) { // NPE is ONLY to catch error on mmInStream
+ } catch (IOException | NullPointerException e) { // NPE is ONLY to catch error on mmInStream
DebugTool.logError(TAG, "Lost connection in the Connected Thread");
- if(DebugTool.isDebugEnabled()){
- e.printStackTrace();
+ if (DebugTool.isDebugEnabled()) {
+ e.printStackTrace();
}
- connectionLost();
+ connectionLost();
break;
}
}
@@ -768,77 +798,76 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
public synchronized void cancel() {
try {
- //Log.d(TAG, "Calling Cancel in the Read thread");
- if(mmInStream!=null){
- mmInStream.close();
- }
- if(mmSocket!=null){
- mmSocket.close();
+ //Log.d(TAG, "Calling Cancel in the Read thread");
+ if (mmInStream != null) {
+ mmInStream.close();
+ }
+ if (mmSocket != null) {
+ mmSocket.close();
}
-
- } catch (IOException|NullPointerException e) { // NPE is ONLY to catch error on mmInStream
- // Log.trace(TAG, "Read Thread: " + e.getMessage());
+
+ } catch (IOException | NullPointerException e) { // NPE is ONLY to catch error on mmInStream
+ // Log.trace(TAG, "Read Thread: " + e.getMessage());
// Socket or stream is already closed
}
}
}
-
-
-
- public BluetoothSocket getBTSocket(BluetoothServerSocket bsSocket){
- if(bsSocket == null){
- return null;
- }
- Field[] f = bsSocket.getClass().getDeclaredFields();
-
- //int channel = -1;
- BluetoothSocket mySocket;
- for (Field field : f) {
- if(field.getName().equals("mSocket")){
- field.setAccessible(true);
- try {
-
- mySocket = (BluetoothSocket) field.get(bsSocket);
- return mySocket;
- //channel = field.getInt(bsSocket);
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- field.setAccessible(false);
- }
- }
-
- return null;
- }
-
- public int getChannel(BluetoothSocket bsSocket){
-
- int channel = -1;
- if (bsSocket == null){
- return channel;
- }
-
- Field[] f = bsSocket.getClass().getDeclaredFields();
-
- for (Field field : f) {
- if(field.getName().equals("mPort")){
- field.setAccessible(true);
- try {
-
-
- channel = field.getInt(bsSocket);
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- field.setAccessible(false);
- }
- }
-
- return channel;
- }
-
+
+
+ public BluetoothSocket getBTSocket(BluetoothServerSocket bsSocket) {
+ if (bsSocket == null) {
+ return null;
+ }
+ Field[] f = bsSocket.getClass().getDeclaredFields();
+
+ //int channel = -1;
+ BluetoothSocket mySocket;
+ for (Field field : f) {
+ if (field.getName().equals("mSocket")) {
+ field.setAccessible(true);
+ try {
+
+ mySocket = (BluetoothSocket) field.get(bsSocket);
+ return mySocket;
+ //channel = field.getInt(bsSocket);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ field.setAccessible(false);
+ }
+ }
+
+ return null;
+ }
+
+ public int getChannel(BluetoothSocket bsSocket) {
+
+ int channel = -1;
+ if (bsSocket == null) {
+ return channel;
+ }
+
+ Field[] f = bsSocket.getClass().getDeclaredFields();
+
+ for (Field field : f) {
+ if (field.getName().equals("mPort")) {
+ field.setAccessible(true);
+ try {
+
+
+ channel = field.getInt(bsSocket);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ field.setAccessible(false);
+ }
+ }
+
+ return channel;
+ }
+
}
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 c640f67ba..7c39ce638 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
@@ -56,393 +56,395 @@ import static com.smartdevicelink.util.NativeLogTool.logInfo;
public class MultiplexTcpTransport extends MultiplexBaseTransport {
- private static final String TAG = "MultiplexTcpTransport";
+ private static final String TAG = "MultiplexTcpTransport";
- private static final int READ_BUFFER_SIZE = 4096;
- private static final int RECONNECT_DELAY = 5000;
- private static final int RECONNECT_RETRY_COUNT = 30;
+ private static final int READ_BUFFER_SIZE = 4096;
+ private static final int RECONNECT_DELAY = 5000;
+ private static final int RECONNECT_RETRY_COUNT = 30;
private final String ipAddress;
- private final int port;
- private final boolean autoReconnect;
- private Socket mSocket = null;
- private InputStream mInputStream = null;
- private OutputStream mOutputStream = null;
- private MultiplexTcpTransport.TcpTransportThread mThread = null;
- private WriterThread writerThread;
- private final Context mContext;
-
-
- public MultiplexTcpTransport(int port, String ipAddress, boolean autoReconnect, Handler handler, Context context) {
- super(handler, TransportType.TCP);
- this.ipAddress = ipAddress;
- this.port = port;
+ private final int port;
+ private final boolean autoReconnect;
+ private Socket mSocket = null;
+ private InputStream mInputStream = null;
+ private OutputStream mOutputStream = null;
+ private MultiplexTcpTransport.TcpTransportThread mThread = null;
+ private WriterThread writerThread;
+ private final Context mContext;
+
+
+ public MultiplexTcpTransport(int port, String ipAddress, boolean autoReconnect, Handler handler, Context context) {
+ super(handler, TransportType.TCP);
+ this.ipAddress = ipAddress;
+ this.port = port;
connectedDeviceAddress = ipAddress + ":" + port;
- this.autoReconnect = autoReconnect;
- mContext = context;
- setState(STATE_NONE);
- }
-
- public synchronized void start(){
- if(getState() == STATE_NONE) {
- synchronized (this) {
- setState(STATE_CONNECTING);
- logInfo("TCPTransport: openConnection request accepted. Starting transport thread");
- try {
- mThread = new MultiplexTcpTransport.TcpTransportThread();
- mThread.setDaemon(true);
- mThread.start();
-
- // Initialize the SiphonServer
- if (SiphonServer.getSiphonEnabledStatus()) {
- SiphonServer.init();
- }
-
- } catch (Exception e) {
- logError(TAG, "TCPTransport: Exception during transport thread starting", e);
- }
- }
- } else {
- logInfo("TCPTransport: openConnection request rejected. Another connection is not finished");
- }
-
- // Send the name of the connected device back to the UI Activity
- Message msg = handler.obtainMessage(SdlRouterService.MESSAGE_DEVICE_NAME);
- Bundle bundle = new Bundle();
- bundle.putString(DEVICE_NAME, connectedDeviceName);
- bundle.putString(DEVICE_ADDRESS, connectedDeviceAddress);
- msg.setData(bundle);
- handler.sendMessage(msg);
- }
-
-
- @Override
- protected void stop(int state) {
- try {
- if(mThread != null) {
- mThread.halt();
- mThread.interrupt();
- }
-
- if (writerThread != null) {
- writerThread.cancel();
- writerThread = null;
- }
-
- if(mSocket != null){
- mSocket.close();
- }
- mSocket = null;
- } catch (IOException e) {
- logError(TAG,"TCPTransport.disconnect: Exception during disconnect: " + e.getMessage());
- }
-
- setState(state);
- }
-
- @Override
- public void write(byte[] out, int offset, int count) {
- // Create temporary object
- MultiplexTcpTransport.WriterThread r;
- // Synchronize a copy of the ConnectedThread
- synchronized (this) {
- if (mState != STATE_CONNECTED) return;
- r = writerThread;
- //r.write(out,offset,count);
- }
- // Perform the write unsynchronized
- r.write(out,offset,count);
- }
-
- /**
- * Implementation of waiting required delay that cannot be interrupted
- * @param timeMs Time in milliseconds of required delay
- */
- private void waitFor(long timeMs) {
- long endTime = System.currentTimeMillis() +timeMs;
- while (System.currentTimeMillis() < endTime) {
- synchronized (this) {
- try {
- wait(endTime - System.currentTimeMillis());
- } catch (Exception e) {
- // Nothing To Do, simple wait
- }
- }
- }
- }
-
- private void startWriteThread() {
- if (writerThread == null) {
- writerThread = new MultiplexTcpTransport.WriterThread();
- writerThread.start();
- }
- }
-
- /**
- * Internal class that represents separate thread, that does actual work, related to connecting/reading/writing data
- */
- private class TcpTransportThread extends Thread {
- final SdlPsm psm;
- public TcpTransportThread(){
- psm = new SdlPsm();
- }
- /**
- * Represents current thread state - halted or not. This flag is used to change internal behavior depending
- * on current state.
- */
- private Boolean isHalted = false;
-
- /**
- * Method that marks thread as halted.
- */
- public void halt() {
- isHalted = true;
- }
-
- /**
- * Tries to connect to the SmartDeviceLink core. Behavior depends autoReconnect configuration param:
- * a) If autoReconnect is false, then only one connect try will be performed.
- * b) If autoReconnect is true, then in case of connection error continuous reconnect will be performed
- * after short delay until connection will be established or retry count will be reached
- *
- * @return true if connection established and false otherwise
- */
- private boolean connect() {
- boolean bConnected;
- int remainingRetry = RECONNECT_RETRY_COUNT;
-
- synchronized (MultiplexTcpTransport.this) {
- do {
- try {
-
- if ((null != mSocket) && (!mSocket.isClosed())) {
- logInfo("TCPTransport.connect: Socket is not closed. Trying to close it");
- mSocket.close();
- }
-
- logInfo(String.format("TCPTransport.connect: Socket is closed. Trying to connect to %s", getAddress()));
- mSocket = WiFiSocketFactory.createSocket(mContext);
- mSocket.connect(new InetSocketAddress(ipAddress, port));
- mOutputStream = mSocket.getOutputStream();
- mInputStream = mSocket.getInputStream();
- startWriteThread();
- } catch (IOException e) {
- logError(TAG, "TCPTransport.connect: Exception during connect stage: " + e.getMessage());
- }
-
- bConnected = (null != mSocket) && mSocket.isConnected();
-
- if(bConnected){
- logInfo("TCPTransport.connect: Socket connected");
- setState(STATE_CONNECTED);
- }else{
- if(autoReconnect){
- remainingRetry--;
- logInfo(String.format(Locale.US,"TCPTransport.connect: Socket not connected. AutoReconnect is ON. retryCount is: %d. Waiting for reconnect delay: %d"
- , remainingRetry, RECONNECT_DELAY));
- waitFor(RECONNECT_DELAY);
- } else {
- logInfo("TCPTransport.connect: Socket not connected. AutoReconnect is OFF");
- }
- }
- } while ((!bConnected) && (autoReconnect) && (remainingRetry > 0) && (!isHalted));
-
- return bConnected;
- }
- }
-
- /**
- * Performs actual thread work
- */
- @Override
- public void run() {
- logInfo("TCPTransport.run: transport thread created. Starting connect stage");
- psm.reset();
- while(!isHalted) {
- setState(STATE_CONNECTING);
- if(!connect()){
- if (isHalted) {
- logInfo("TCPTransport.run: Connection failed, but thread already halted");
- } else {
- MultiplexTcpTransport.this.stop(STATE_NONE);
- }
- break;
- }
-
- synchronized (MultiplexTcpTransport.this) {
- setState(STATE_CONNECTED);
- }
-
- byte input;
- byte[] buffer = new byte[READ_BUFFER_SIZE];
- int bytesRead;
- boolean stateProgress = false;
- while (!isHalted) {
- //logInfo("TCPTransport.run: Waiting for data...");
- try {
- //input = (byte) mInputStream.read();
- bytesRead = mInputStream.read(buffer);
- } catch (IOException e) {
- internalHandleStreamReadError();
- break;
- }
-
- if (bytesRead == -1) {
- // Javadoc says -1 indicates end of input stream. In TCP case this means loss
- // of connection from HU (no exception is thrown when HU connection is lost).
- internalHandleStreamReadError();
- break;
- }
-
- synchronized (MultiplexTcpTransport.this) {
- if (mThread.isInterrupted()) {
- logInfo("TCPTransport.run: Got new data but thread is interrupted");
- break;
- }
- }
- for (int i = 0; i < bytesRead; i++) {
- //logInfo("TCPTransport.run: Got new data");
- // Send the response of what we received
- input = buffer[i];
- stateProgress = psm.handleByte(input);
- if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
-
- //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
- psm.reset();
- }
-
- if (psm.getState() == SdlPsm.FINISHED_STATE)
- {
- synchronized (MultiplexTcpTransport.this) {
- DebugTool.logInfo(TAG, "Packet formed, sending off");
- SdlPacket packet = psm.getFormedPacket();
- packet.setTransportRecord(getTransportRecord());
- handler.obtainMessage(SdlRouterService.MESSAGE_READ, packet).sendToTarget();
- }
- //We put a trace statement in the message read so we can avoid all the extra bytes
- psm.reset();
- }
- //FIXME logInfo(String.format("TCPTransport.run: Received %d bytes", bytesRead));
- }
- }
- }
-
- logInfo("TCPTransport.run: Thread terminated");
- setState(STATE_NONE);
- }
-
- /**
- * Internal handling of Tcp disconnection
- */
- private void internalHandleTCPDisconnect() {
- if(isHalted){
- logInfo("TCPTransport.run: TCP disconnect received, but thread already halted");
- } else {
- logInfo("TCPTransport.run: TCP disconnect received");
- MultiplexTcpTransport.this.stop(STATE_NONE);
- }
- }
-
- /**
- * Internal handling of reading data from input stream
- */
- private void internalHandleStreamReadError() {
- if(isHalted){
- logError(TAG, "TCPTransport.run: Exception during reading data, but thread already halted");
- } else {
- logError(TAG, "TCPTransport.run: Exception during reading data");
- MultiplexTcpTransport.this.stop(STATE_NONE);
- }
- }
- }
-
- private class WriterThread extends Thread {
- private boolean isHalted = false;
- private final 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(TAG, "TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
- }
- } else {
- if (isHalted) {
- logError(TAG, "TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
- } else {
- logError(TAG, "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)) {
- logInfo("TCPTransport.sendBytesOverTransport: nothing to send");
- return;
- }
-
- if (offset + count > msgBytes.length) {
- count = msgBytes.length - offset;
- }
- packetQueue.add(new OutPacket(msgBytes, offset, count));
-
- }
-
- public synchronized void cancel() {
- isHalted = true;
- if (mOutputStream != null) {
- synchronized (MultiplexTcpTransport.this) {
- try {
- mOutputStream.flush();
- } catch (IOException e) {
- logError(TAG, "TCPTransport flushing output stream failed: " + e.getMessage());
- }
-
- try {
- mOutputStream.close();
- } catch (IOException e) {
- logError(TAG, "TCPTransport closing output stream failed: " + e.getMessage());
- }
- mOutputStream = null;
- }
- }
- }
- }
-
- private final class OutPacket{
- final byte[] bytes;
- final int count;
- final int offset;
-
- OutPacket(byte[] bytes, int offset, int count){
- this.bytes = bytes;
- this.offset = offset;
- this.count = count;
- }
- }
+ this.autoReconnect = autoReconnect;
+ mContext = context;
+ setState(STATE_NONE);
+ }
+
+ public synchronized void start() {
+ if (getState() == STATE_NONE) {
+ synchronized (this) {
+ setState(STATE_CONNECTING);
+ logInfo("TCPTransport: openConnection request accepted. Starting transport thread");
+ try {
+ mThread = new MultiplexTcpTransport.TcpTransportThread();
+ mThread.setDaemon(true);
+ mThread.start();
+
+ // Initialize the SiphonServer
+ if (SiphonServer.getSiphonEnabledStatus()) {
+ SiphonServer.init();
+ }
+
+ } catch (Exception e) {
+ logError(TAG, "TCPTransport: Exception during transport thread starting", e);
+ }
+ }
+ } else {
+ logInfo("TCPTransport: openConnection request rejected. Another connection is not finished");
+ }
+
+ // Send the name of the connected device back to the UI Activity
+ Message msg = handler.obtainMessage(SdlRouterService.MESSAGE_DEVICE_NAME);
+ Bundle bundle = new Bundle();
+ bundle.putString(DEVICE_NAME, connectedDeviceName);
+ bundle.putString(DEVICE_ADDRESS, connectedDeviceAddress);
+ msg.setData(bundle);
+ handler.sendMessage(msg);
+ }
+
+
+ @Override
+ protected void stop(int state) {
+ try {
+ if (mThread != null) {
+ mThread.halt();
+ mThread.interrupt();
+ }
+
+ if (writerThread != null) {
+ writerThread.cancel();
+ writerThread = null;
+ }
+
+ if (mSocket != null) {
+ mSocket.close();
+ }
+ mSocket = null;
+ } catch (IOException e) {
+ logError(TAG, "TCPTransport.disconnect: Exception during disconnect: " + e.getMessage());
+ }
+
+ setState(state);
+ }
+
+ @Override
+ public void write(byte[] out, int offset, int count) {
+ // Create temporary object
+ MultiplexTcpTransport.WriterThread r;
+ // Synchronize a copy of the ConnectedThread
+ synchronized (this) {
+ if (mState != STATE_CONNECTED) return;
+ r = writerThread;
+ //r.write(out,offset,count);
+ }
+ // Perform the write unsynchronized
+ r.write(out, offset, count);
+ }
+
+ /**
+ * Implementation of waiting required delay that cannot be interrupted
+ *
+ * @param timeMs Time in milliseconds of required delay
+ */
+ private void waitFor(long timeMs) {
+ long endTime = System.currentTimeMillis() + timeMs;
+ while (System.currentTimeMillis() < endTime) {
+ synchronized (this) {
+ try {
+ wait(endTime - System.currentTimeMillis());
+ } catch (Exception e) {
+ // Nothing To Do, simple wait
+ }
+ }
+ }
+ }
+
+ private void startWriteThread() {
+ if (writerThread == null) {
+ writerThread = new MultiplexTcpTransport.WriterThread();
+ writerThread.start();
+ }
+ }
+
+ /**
+ * Internal class that represents separate thread, that does actual work, related to connecting/reading/writing data
+ */
+ private class TcpTransportThread extends Thread {
+ final SdlPsm psm;
+
+ public TcpTransportThread() {
+ psm = new SdlPsm();
+ }
+
+ /**
+ * Represents current thread state - halted or not. This flag is used to change internal behavior depending
+ * on current state.
+ */
+ private Boolean isHalted = false;
+
+ /**
+ * Method that marks thread as halted.
+ */
+ public void halt() {
+ isHalted = true;
+ }
+
+ /**
+ * Tries to connect to the SmartDeviceLink core. Behavior depends autoReconnect configuration param:
+ * a) If autoReconnect is false, then only one connect try will be performed.
+ * b) If autoReconnect is true, then in case of connection error continuous reconnect will be performed
+ * after short delay until connection will be established or retry count will be reached
+ *
+ * @return true if connection established and false otherwise
+ */
+ private boolean connect() {
+ boolean bConnected;
+ int remainingRetry = RECONNECT_RETRY_COUNT;
+
+ synchronized (MultiplexTcpTransport.this) {
+ do {
+ try {
+
+ if ((null != mSocket) && (!mSocket.isClosed())) {
+ logInfo("TCPTransport.connect: Socket is not closed. Trying to close it");
+ mSocket.close();
+ }
+
+ logInfo(String.format("TCPTransport.connect: Socket is closed. Trying to connect to %s", getAddress()));
+ mSocket = WiFiSocketFactory.createSocket(mContext);
+ mSocket.connect(new InetSocketAddress(ipAddress, port));
+ mOutputStream = mSocket.getOutputStream();
+ mInputStream = mSocket.getInputStream();
+ startWriteThread();
+ } catch (IOException e) {
+ logError(TAG, "TCPTransport.connect: Exception during connect stage: " + e.getMessage());
+ }
+
+ bConnected = (null != mSocket) && mSocket.isConnected();
+
+ if (bConnected) {
+ logInfo("TCPTransport.connect: Socket connected");
+ setState(STATE_CONNECTED);
+ } else {
+ if (autoReconnect) {
+ remainingRetry--;
+ logInfo(String.format(Locale.US, "TCPTransport.connect: Socket not connected. AutoReconnect is ON. retryCount is: %d. Waiting for reconnect delay: %d"
+ , remainingRetry, RECONNECT_DELAY));
+ waitFor(RECONNECT_DELAY);
+ } else {
+ logInfo("TCPTransport.connect: Socket not connected. AutoReconnect is OFF");
+ }
+ }
+ } while ((!bConnected) && (autoReconnect) && (remainingRetry > 0) && (!isHalted));
+
+ return bConnected;
+ }
+ }
+
+ /**
+ * Performs actual thread work
+ */
+ @Override
+ public void run() {
+ logInfo("TCPTransport.run: transport thread created. Starting connect stage");
+ psm.reset();
+ while (!isHalted) {
+ setState(STATE_CONNECTING);
+ if (!connect()) {
+ if (isHalted) {
+ logInfo("TCPTransport.run: Connection failed, but thread already halted");
+ } else {
+ MultiplexTcpTransport.this.stop(STATE_NONE);
+ }
+ break;
+ }
+
+ synchronized (MultiplexTcpTransport.this) {
+ setState(STATE_CONNECTED);
+ }
+
+ byte input;
+ byte[] buffer = new byte[READ_BUFFER_SIZE];
+ int bytesRead;
+ boolean stateProgress = false;
+ while (!isHalted) {
+ //logInfo("TCPTransport.run: Waiting for data...");
+ try {
+ //input = (byte) mInputStream.read();
+ bytesRead = mInputStream.read(buffer);
+ } catch (IOException e) {
+ internalHandleStreamReadError();
+ break;
+ }
+
+ if (bytesRead == -1) {
+ // Javadoc says -1 indicates end of input stream. In TCP case this means loss
+ // of connection from HU (no exception is thrown when HU connection is lost).
+ internalHandleStreamReadError();
+ break;
+ }
+
+ synchronized (MultiplexTcpTransport.this) {
+ if (mThread.isInterrupted()) {
+ logInfo("TCPTransport.run: Got new data but thread is interrupted");
+ break;
+ }
+ }
+ for (int i = 0; i < bytesRead; i++) {
+ //logInfo("TCPTransport.run: Got new data");
+ // Send the response of what we received
+ input = buffer[i];
+ stateProgress = psm.handleByte(input);
+ if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
+
+ //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ psm.reset();
+ }
+
+ if (psm.getState() == SdlPsm.FINISHED_STATE) {
+ synchronized (MultiplexTcpTransport.this) {
+ DebugTool.logInfo(TAG, "Packet formed, sending off");
+ SdlPacket packet = psm.getFormedPacket();
+ packet.setTransportRecord(getTransportRecord());
+ handler.obtainMessage(SdlRouterService.MESSAGE_READ, packet).sendToTarget();
+ }
+ //We put a trace statement in the message read so we can avoid all the extra bytes
+ psm.reset();
+ }
+ //FIXME logInfo(String.format("TCPTransport.run: Received %d bytes", bytesRead));
+ }
+ }
+ }
+
+ logInfo("TCPTransport.run: Thread terminated");
+ setState(STATE_NONE);
+ }
+
+ /**
+ * Internal handling of Tcp disconnection
+ */
+ private void internalHandleTCPDisconnect() {
+ if (isHalted) {
+ logInfo("TCPTransport.run: TCP disconnect received, but thread already halted");
+ } else {
+ logInfo("TCPTransport.run: TCP disconnect received");
+ MultiplexTcpTransport.this.stop(STATE_NONE);
+ }
+ }
+
+ /**
+ * Internal handling of reading data from input stream
+ */
+ private void internalHandleStreamReadError() {
+ if (isHalted) {
+ logError(TAG, "TCPTransport.run: Exception during reading data, but thread already halted");
+ } else {
+ logError(TAG, "TCPTransport.run: Exception during reading data");
+ MultiplexTcpTransport.this.stop(STATE_NONE);
+ }
+ }
+ }
+
+ private class WriterThread extends Thread {
+ private boolean isHalted = false;
+ private final 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(TAG, "TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
+ }
+ } else {
+ if (isHalted) {
+ logError(TAG, "TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
+ } else {
+ logError(TAG, "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)) {
+ logInfo("TCPTransport.sendBytesOverTransport: nothing to send");
+ return;
+ }
+
+ if (offset + count > msgBytes.length) {
+ count = msgBytes.length - offset;
+ }
+ packetQueue.add(new OutPacket(msgBytes, offset, count));
+
+ }
+
+ public synchronized void cancel() {
+ isHalted = true;
+ if (mOutputStream != null) {
+ synchronized (MultiplexTcpTransport.this) {
+ try {
+ mOutputStream.flush();
+ } catch (IOException e) {
+ logError(TAG, "TCPTransport flushing output stream failed: " + e.getMessage());
+ }
+
+ try {
+ mOutputStream.close();
+ } catch (IOException e) {
+ logError(TAG, "TCPTransport closing output stream failed: " + e.getMessage());
+ }
+ mOutputStream = null;
+ }
+ }
+ }
+ }
+
+ private final class OutPacket {
+ final byte[] bytes;
+ final int count;
+ final 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/MultiplexTransportConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransportConfig.java
index e2dd06521..343aa6c97 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransportConfig.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTransportConfig.java
@@ -42,247 +42,259 @@ import java.util.Arrays;
import java.util.List;
@SuppressWarnings("WeakerAccess")
-public class MultiplexTransportConfig extends BaseTransportConfig{
+public class MultiplexTransportConfig extends BaseTransportConfig {
/**
* Multiplexing security will be turned off. All router services will be trusted.
*/
- public static final int FLAG_MULTI_SECURITY_OFF = 0x00;
+ public static final int FLAG_MULTI_SECURITY_OFF = 0x00;
/**
- * Multiplexing security will be minimal. Only trusted router services will be used. Trusted router list will be obtain from
- * server. List will be refreshed every <b>30 days</b> or during next connection session if an SDL enabled app has been
- * installed or uninstalled.
+ * Multiplexing security will be minimal. Only trusted router services will be used. Trusted router list will be obtain from
+ * server. List will be refreshed every <b>30 days</b> or during next connection session if an SDL enabled app has been
+ * installed or uninstalled.
*/
- public static final int FLAG_MULTI_SECURITY_LOW = 0x10;
+ public static final int FLAG_MULTI_SECURITY_LOW = 0x10;
/**
- * Multiplexing security will be on at a normal level. Only trusted router services will be used. Trusted router list will be obtain from
- * server. List will be refreshed every <b>7 days</b> or during next connection session if an SDL enabled app has been
- * installed or uninstalled.
+ * Multiplexing security will be on at a normal level. Only trusted router services will be used. Trusted router list will be obtain from
+ * server. List will be refreshed every <b>7 days</b> or during next connection session if an SDL enabled app has been
+ * installed or uninstalled.
*/
- public static final int FLAG_MULTI_SECURITY_MED = 0x20;
+ public static final int FLAG_MULTI_SECURITY_MED = 0x20;
/**
- * Multiplexing security will be very strict. Only trusted router services installed from trusted app stores will
- * be used. Trusted router list will be obtain from server. List will be refreshed every <b>7 days</b>
- * or during next connection session if an SDL enabled app has been installed or uninstalled.
+ * Multiplexing security will be very strict. Only trusted router services installed from trusted app stores will
+ * be used. Trusted router list will be obtain from server. List will be refreshed every <b>7 days</b>
+ * or during next connection session if an SDL enabled app has been installed or uninstalled.
*/
- public static final int FLAG_MULTI_SECURITY_HIGH = 0x30;
-
- final Context context;
- final String appId;
- ComponentName service;
- int securityLevel;
-
- List<TransportType> primaryTransports, secondaryTransports;
- boolean requiresHighBandwidth = false;
- Boolean requiresAudioSupport = null;
- TransportListener transportListener;
-
-
- public MultiplexTransportConfig(Context context, String appId) {
- this.context = context;
- this.appId = appId;
- this.securityLevel = FLAG_MULTI_SECURITY_MED;
- this.primaryTransports = Arrays.asList(TransportType.USB, TransportType.BLUETOOTH);
- this.secondaryTransports = Arrays.asList(TransportType.TCP, TransportType.USB, TransportType.BLUETOOTH);
-
- }
-
- public MultiplexTransportConfig(Context context, String appId, int securityLevel) {
- this.context = context;
- this.appId = appId;
- this.securityLevel = securityLevel;
- this.primaryTransports = Arrays.asList(TransportType.USB, TransportType.BLUETOOTH);
- this.secondaryTransports = Arrays.asList(TransportType.TCP, TransportType.USB, TransportType.BLUETOOTH);
- }
-
- /**
- * Overridden abstract method which returns specific type of this transport configuration.
- *
- * @return Constant value TransportType.MULTIPLEX.
- *
- * @see TransportType
- */
- public TransportType getTransportType() {
- return TransportType.MULTIPLEX;
- }
-
- /**
- * Gets the context attached to this config
- * @return context supplied during creation
- */
- public Context getContext(){
- return this.context;
- }
-
- /**
- * Gets the ComponentName of the router service attached to this config
- * @return ComponentName of the router service that will be bound to
- */
- public ComponentName getService() {
- return service;
- }
-
- /**
- * Supplies the config with the router service that should be bound to
- * @param service the router service that should be bound to
- */
- public void setService(ComponentName service) {
- this.service = service;
- }
-
- /**
- * Sets the security level that should be used to verify a router service that is to be bound
- * @param securityLevel the security level that will be used to perform certain tests
- * @see #FLAG_MULTI_SECURITY_OFF
- * @see #FLAG_MULTI_SECURITY_LOW
- * @see #FLAG_MULTI_SECURITY_MED
- * @see #FLAG_MULTI_SECURITY_HIGH
- */
- public void setSecurityLevel(int securityLevel){
- this.securityLevel = securityLevel;
- }
-
- /**
- * Get the security level that will be used to verify a router service before binding
- * @return the set security level
- * @see #FLAG_MULTI_SECURITY_OFF
- * @see #FLAG_MULTI_SECURITY_LOW
- * @see #FLAG_MULTI_SECURITY_MED
- * @see #FLAG_MULTI_SECURITY_HIGH
- */
- public int getSecurityLevel(){
- return securityLevel;
- }
-
- /**
- * Set whether or not this app requires the use of a transport that supports high bandwidth
- * services. Common use is when an app uses the video/audio streaming services and there is no
- * other integration that could be useful to the user.
- * <br><br> <b>For example:</b>
- * <br><b>1. </b>If an app intends to perform audio or video streaming and does not wish
- * to appear on the module when that isn't possible, a value of true should be sent.
- * <br><b>2. </b>If the same app wishes to appear on the module even when those services aren't available
- * a value of true should be sent. In this case, the app could display a message prompting the
- * user to "Please connect USB or Wifi" or it could have a separate integration like giving turn
- * by turn directions in place of streaming the full navigation map.
- * @param requiresHighBandwidth whether the app should be treated as requiring a high
- * bandwidth transport.
- */
- public void setRequiresHighBandwidth(boolean requiresHighBandwidth){
- this.requiresHighBandwidth = requiresHighBandwidth;
- }
-
- /**
- * Get the setting from this config to see whether the app should be treated as requiring a high
- * bandwidth transport.
- * @return whether the app should be treated as requiring a high
- * bandwidth transport.
- */
- public boolean requiresHighBandwidth(){
- return this.requiresHighBandwidth;
- }
-
- /**
- * Set whether or not this app requires the use of an audio streaming output device
- *
- * @param requiresAudioSupport whether the app should be treated as requiring an audio streaming
- * output device
- */
- public void setRequiresAudioSupport(boolean requiresAudioSupport){
- this.requiresAudioSupport = requiresAudioSupport;
- }
-
- /**
- * Get the setting from this config to see whether the app should be treated as requiring an
- * audio streaming output device
- *
- * @return whether the app should be treated as requiring an audio streaming output device
- */
- public Boolean requiresAudioSupport(){
- return this.requiresAudioSupport;
- }
-
-
-
- /**
- * This will set the order in which a primary transport is determined to be accepted or not.
- * In the case of previous protocol versions ( < 5.1)
- * @param transports list of transports that can be used as primary
- */
- public void setPrimaryTransports(List<TransportType> transports){
- if(transports != null){
- //Sanitize
- transports.remove(TransportType.MULTIPLEX);
- this.primaryTransports = transports;
- }
- }
-
- /**
- * Get the list of primary transports that are set to be accepted by this config
- * @return acceptable primary transports
- */
- public List<TransportType> getPrimaryTransports(){
- return this.primaryTransports;
- }
-
- /**
- * This will set the order in which a primary transport is determined to be accepted or not.
- * In the case of previous protocol versions ( < 5.1)
- * @param transports list of transports that can be used as secondary
- **/
- public void setSecondaryTransports(List<TransportType> transports){
- if(transports != null){
- //Sanitize
- transports.remove(TransportType.MULTIPLEX);
- this.secondaryTransports = transports;
- }
- }
-
- /**
- * Get the list of secondary transports that are set to be accepted by this config
- * @return acceptable secondary transports
- */
- public List<TransportType> getSecondaryTransports(){
- return this.secondaryTransports;
- }
-
- /**
- * Set a lister for transport events. Useful when connected high bandwidth services like audio
- * or video streaming
- * @param listener the TransportListener that will be called back when transport events happen
- */
- public void setTransportListener(TransportListener listener){
- this.transportListener = listener;
- }
-
- /**
- * Getter for the supplied transport listener
- * @return the transport listener if any
- */
- public TransportListener getTransportListener(){
- return this.transportListener;
- }
-
- /**
- * Callback to be used if the state of the transports needs to be monitored for any reason.
- */
- public interface TransportListener{
- /**
- * Gets called whenever there is a change in the available transports for use
- * @param connectedTransports the currently connected transports
- * @param audioStreamTransportAvail true if there is either an audio streaming supported
- * transport currently connected or a transport is
- * available to connect with. False if there is no
- * transport connected to support audio streaming and
- * no possibility in the foreseeable future.
- * @param videoStreamTransportAvail true if there is either a video streaming supported
- * transport currently connected or a transport is
- * available to connect with. False if there is no
- * transport connected to support video streaming and
- * no possibility in the foreseeable future.
- */
- void onTransportEvent(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail,boolean videoStreamTransportAvail);
- }
+ public static final int FLAG_MULTI_SECURITY_HIGH = 0x30;
+
+ final Context context;
+ final String appId;
+ ComponentName service;
+ int securityLevel;
+
+ List<TransportType> primaryTransports, secondaryTransports;
+ boolean requiresHighBandwidth = false;
+ Boolean requiresAudioSupport = null;
+ TransportListener transportListener;
+
+
+ public MultiplexTransportConfig(Context context, String appId) {
+ this.context = context;
+ this.appId = appId;
+ this.securityLevel = FLAG_MULTI_SECURITY_MED;
+ this.primaryTransports = Arrays.asList(TransportType.USB, TransportType.BLUETOOTH);
+ this.secondaryTransports = Arrays.asList(TransportType.TCP, TransportType.USB, TransportType.BLUETOOTH);
+
+ }
+
+ public MultiplexTransportConfig(Context context, String appId, int securityLevel) {
+ this.context = context;
+ this.appId = appId;
+ this.securityLevel = securityLevel;
+ this.primaryTransports = Arrays.asList(TransportType.USB, TransportType.BLUETOOTH);
+ this.secondaryTransports = Arrays.asList(TransportType.TCP, TransportType.USB, TransportType.BLUETOOTH);
+ }
+
+ /**
+ * Overridden abstract method which returns specific type of this transport configuration.
+ *
+ * @return Constant value TransportType.MULTIPLEX.
+ * @see TransportType
+ */
+ public TransportType getTransportType() {
+ return TransportType.MULTIPLEX;
+ }
+
+ /**
+ * Gets the context attached to this config
+ *
+ * @return context supplied during creation
+ */
+ public Context getContext() {
+ return this.context;
+ }
+
+ /**
+ * Gets the ComponentName of the router service attached to this config
+ *
+ * @return ComponentName of the router service that will be bound to
+ */
+ public ComponentName getService() {
+ return service;
+ }
+
+ /**
+ * Supplies the config with the router service that should be bound to
+ *
+ * @param service the router service that should be bound to
+ */
+ public void setService(ComponentName service) {
+ this.service = service;
+ }
+
+ /**
+ * Sets the security level that should be used to verify a router service that is to be bound
+ *
+ * @param securityLevel the security level that will be used to perform certain tests
+ * @see #FLAG_MULTI_SECURITY_OFF
+ * @see #FLAG_MULTI_SECURITY_LOW
+ * @see #FLAG_MULTI_SECURITY_MED
+ * @see #FLAG_MULTI_SECURITY_HIGH
+ */
+ public void setSecurityLevel(int securityLevel) {
+ this.securityLevel = securityLevel;
+ }
+
+ /**
+ * Get the security level that will be used to verify a router service before binding
+ *
+ * @return the set security level
+ * @see #FLAG_MULTI_SECURITY_OFF
+ * @see #FLAG_MULTI_SECURITY_LOW
+ * @see #FLAG_MULTI_SECURITY_MED
+ * @see #FLAG_MULTI_SECURITY_HIGH
+ */
+ public int getSecurityLevel() {
+ return securityLevel;
+ }
+
+ /**
+ * Set whether or not this app requires the use of a transport that supports high bandwidth
+ * services. Common use is when an app uses the video/audio streaming services and there is no
+ * other integration that could be useful to the user.
+ * <br><br> <b>For example:</b>
+ * <br><b>1. </b>If an app intends to perform audio or video streaming and does not wish
+ * to appear on the module when that isn't possible, a value of true should be sent.
+ * <br><b>2. </b>If the same app wishes to appear on the module even when those services aren't available
+ * a value of true should be sent. In this case, the app could display a message prompting the
+ * user to "Please connect USB or Wifi" or it could have a separate integration like giving turn
+ * by turn directions in place of streaming the full navigation map.
+ *
+ * @param requiresHighBandwidth whether the app should be treated as requiring a high
+ * bandwidth transport.
+ */
+ public void setRequiresHighBandwidth(boolean requiresHighBandwidth) {
+ this.requiresHighBandwidth = requiresHighBandwidth;
+ }
+
+ /**
+ * Get the setting from this config to see whether the app should be treated as requiring a high
+ * bandwidth transport.
+ *
+ * @return whether the app should be treated as requiring a high
+ * bandwidth transport.
+ */
+ public boolean requiresHighBandwidth() {
+ return this.requiresHighBandwidth;
+ }
+
+ /**
+ * Set whether or not this app requires the use of an audio streaming output device
+ *
+ * @param requiresAudioSupport whether the app should be treated as requiring an audio streaming
+ * output device
+ */
+ public void setRequiresAudioSupport(boolean requiresAudioSupport) {
+ this.requiresAudioSupport = requiresAudioSupport;
+ }
+
+ /**
+ * Get the setting from this config to see whether the app should be treated as requiring an
+ * audio streaming output device
+ *
+ * @return whether the app should be treated as requiring an audio streaming output device
+ */
+ public Boolean requiresAudioSupport() {
+ return this.requiresAudioSupport;
+ }
+
+
+ /**
+ * This will set the order in which a primary transport is determined to be accepted or not.
+ * In the case of previous protocol versions ( < 5.1)
+ *
+ * @param transports list of transports that can be used as primary
+ */
+ public void setPrimaryTransports(List<TransportType> transports) {
+ if (transports != null) {
+ //Sanitize
+ transports.remove(TransportType.MULTIPLEX);
+ this.primaryTransports = transports;
+ }
+ }
+
+ /**
+ * Get the list of primary transports that are set to be accepted by this config
+ *
+ * @return acceptable primary transports
+ */
+ public List<TransportType> getPrimaryTransports() {
+ return this.primaryTransports;
+ }
+
+ /**
+ * This will set the order in which a primary transport is determined to be accepted or not.
+ * In the case of previous protocol versions ( < 5.1)
+ *
+ * @param transports list of transports that can be used as secondary
+ **/
+ public void setSecondaryTransports(List<TransportType> transports) {
+ if (transports != null) {
+ //Sanitize
+ transports.remove(TransportType.MULTIPLEX);
+ this.secondaryTransports = transports;
+ }
+ }
+
+ /**
+ * Get the list of secondary transports that are set to be accepted by this config
+ *
+ * @return acceptable secondary transports
+ */
+ public List<TransportType> getSecondaryTransports() {
+ return this.secondaryTransports;
+ }
+
+ /**
+ * Set a lister for transport events. Useful when connected high bandwidth services like audio
+ * or video streaming
+ *
+ * @param listener the TransportListener that will be called back when transport events happen
+ */
+ public void setTransportListener(TransportListener listener) {
+ this.transportListener = listener;
+ }
+
+ /**
+ * Getter for the supplied transport listener
+ *
+ * @return the transport listener if any
+ */
+ public TransportListener getTransportListener() {
+ return this.transportListener;
+ }
+
+ /**
+ * Callback to be used if the state of the transports needs to be monitored for any reason.
+ */
+ public interface TransportListener {
+ /**
+ * Gets called whenever there is a change in the available transports for use
+ *
+ * @param connectedTransports the currently connected transports
+ * @param audioStreamTransportAvail true if there is either an audio streaming supported
+ * transport currently connected or a transport is
+ * available to connect with. False if there is no
+ * transport connected to support audio streaming and
+ * no possibility in the foreseeable future.
+ * @param videoStreamTransportAvail true if there is either a video streaming supported
+ * transport currently connected or a transport is
+ * available to connect with. False if there is no
+ * transport connected to support video streaming and
+ * no possibility in the foreseeable future.
+ */
+ void onTransportEvent(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
index e76f2180c..78e3d3b4b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
@@ -48,16 +48,16 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-public class MultiplexUsbTransport extends MultiplexBaseTransport{
+public class MultiplexUsbTransport extends MultiplexBaseTransport {
private static final String TAG = "MultiplexUsbTransport";
- public static final String MANUFACTURER = "manufacturer";
- public static final String MODEL = "model";
- public static final String VERSION = "version";
- public static final String URI = "uri";
- public static final String SERIAL = "serial";
- public static final String DESCRIPTION = "description";
+ public static final String MANUFACTURER = "manufacturer";
+ public static final String MODEL = "model";
+ public static final String VERSION = "version";
+ public static final String URI = "uri";
+ public static final String SERIAL = "serial";
+ public static final String DESCRIPTION = "description";
private final Bundle deviceInfo;
private ReaderThread readerThread;
@@ -65,22 +65,22 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
private ParcelFileDescriptor parcelFileDescriptor;
private Boolean connectionSuccessful = null;
- MultiplexUsbTransport(ParcelFileDescriptor parcelFileDescriptor, Handler handler, Bundle bundle){
+ MultiplexUsbTransport(ParcelFileDescriptor parcelFileDescriptor, Handler handler, Bundle bundle) {
super(handler, TransportType.USB);
- if(parcelFileDescriptor == null){
+ if (parcelFileDescriptor == null) {
DebugTool.logError(TAG, "Error with object");
this.parcelFileDescriptor = null;
throw new ExceptionInInitializerError("ParcelFileDescriptor can't be null");
- }else{
+ } else {
this.parcelFileDescriptor = parcelFileDescriptor;
connectedDeviceName = "USB";
deviceInfo = bundle;
- if(deviceInfo != null){
+ if (deviceInfo != null) {
//Fill in info
connectedDeviceAddress = bundle.getString(SERIAL);
- if(connectedDeviceAddress == null){
+ if (connectedDeviceAddress == null) {
connectedDeviceAddress = bundle.getString(URI);
- if(connectedDeviceAddress == null) {
+ if (connectedDeviceAddress == null) {
connectedDeviceAddress = bundle.getString(DESCRIPTION);
if (connectedDeviceAddress == null) {
connectedDeviceAddress = bundle.getString(MODEL);
@@ -91,16 +91,16 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
}
}
- }else{
+ } else {
connectedDeviceAddress = "USB";
}
}
}
- public synchronized void start(){
+ public synchronized void start() {
setState(STATE_CONNECTING);
FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
- if(fileDescriptor == null || !fileDescriptor.valid()){
+ if (fileDescriptor == null || !fileDescriptor.valid()) {
DebugTool.logError(TAG, "USB FD was null or not valid,");
setState(STATE_NONE);
return;
@@ -138,8 +138,8 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
readerThread = null;
}
- if( (connectionSuccessful== null || connectionSuccessful == true ) //else, the connection was bad. Not closing the PFD helps recover
- && parcelFileDescriptor != null){
+ if ((connectionSuccessful == null || connectionSuccessful == true) //else, the connection was bad. Not closing the PFD helps recover
+ && parcelFileDescriptor != null) {
try {
parcelFileDescriptor.close();
} catch (IOException e) {
@@ -156,9 +156,10 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
/**
* Write to the ConnectedThread in an unsynchronized manner
+ *
* @param out The bytes to write
*/
- public void write(byte[] out, int offset, int count) {
+ public void write(byte[] out, int offset, int count) {
// Create temporary object
MultiplexUsbTransport.WriterThread r;
// Synchronize a copy of the ConnectedThread
@@ -168,7 +169,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
//r.write(out,offset,count);
}
// Perform the write unsynchronized
- r.write(out,offset,count);
+ r.write(out, offset, count);
}
/**
@@ -204,12 +205,12 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
}, 250);
}
- private class ReaderThread extends Thread{
+ private class ReaderThread extends Thread {
final SdlPsm psm;
final InputStream inputStream;
- public ReaderThread(final FileDescriptor fileDescriptor){
+ public ReaderThread(final FileDescriptor fileDescriptor) {
psm = new SdlPsm();
inputStream = new FileInputStream(fileDescriptor);
}
@@ -228,31 +229,31 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
bytesRead = inputStream.read(buffer);
if (bytesRead == -1) {
if (isInterrupted()) {
- DebugTool.logError(TAG,"EOF reached, and thread is interrupted");
+ DebugTool.logError(TAG, "EOF reached, and thread is interrupted");
} else {
- DebugTool.logInfo(TAG,"EOF reached, disconnecting!");
+ DebugTool.logInfo(TAG, "EOF reached, disconnecting!");
connectionLost();
}
return;
}
if (isInterrupted()) {
- DebugTool.logWarning(TAG,"Read some data, but thread is interrupted");
+ DebugTool.logWarning(TAG, "Read some data, but thread is interrupted");
return;
}
- if(connectionSuccessful != null && connectionSuccessful == false){
+ if (connectionSuccessful != null && connectionSuccessful == false) {
connectionSuccessful = true;
}
byte input;
- for(int i=0;i<bytesRead; i++){
- input=buffer[i];
+ for (int i = 0; i < bytesRead; i++) {
+ input = buffer[i];
stateProgress = psm.handleByte(input);
- if(!stateProgress){//We are trying to weed through the bad packet info until we get something
+ if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
//Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
psm.reset();
continue; //Move to the next iteration of the loop
}
- if(psm.getState() == SdlPsm.FINISHED_STATE){
+ if (psm.getState() == SdlPsm.FINISHED_STATE) {
synchronized (MultiplexUsbTransport.this) {
//Log.d(TAG, "Packet formed, sending off");
SdlPacket packet = psm.getFormedPacket();
@@ -268,13 +269,13 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
if (isInterrupted()) {
- DebugTool.logWarning(TAG,"Can't read data, and thread is interrupted");
+ DebugTool.logWarning(TAG, "Can't read data, and thread is interrupted");
} else {
- DebugTool.logWarning(TAG,"Can't read data, disconnecting!");
+ DebugTool.logWarning(TAG, "Can't read data, disconnecting!");
connectionLost();
}
return;
- } catch (Exception e){
+ } catch (Exception e) {
connectionLost();
}
}
@@ -284,11 +285,11 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
public synchronized void cancel() {
try {
//Log.d(TAG, "Calling Cancel in the Read thread");
- if(inputStream!=null){
+ if (inputStream != null) {
inputStream.close();
}
- } catch (IOException|NullPointerException e) { // NPE is ONLY to catch error on mmInStream
+ } catch (IOException | NullPointerException e) { // NPE is ONLY to catch error on mmInStream
// Log.trace(TAG, "Read Thread: " + e.getMessage());
// Socket or stream is already closed
}
@@ -314,21 +315,22 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
/**
* Write to the connected OutStream.
- * @param buffer The bytes to write
+ *
+ * @param buffer The bytes to write
*/
public void write(byte[] buffer, int offset, int count) {
try {
- if(buffer==null){
+ if (buffer == null) {
DebugTool.logWarning(TAG, "Can't write to device, nothing to send");
return;
}
//This would be a good spot to log out all bytes received
mmOutStream.write(buffer, offset, count);
- if(connectionSuccessful == null){
+ if (connectionSuccessful == null) {
connectionSuccessful = false;
}
//Log.w(TAG, "Wrote out to device: bytes = "+ count);
- } catch (IOException|NullPointerException e) { // STRICTLY to catch mmOutStream NPE
+ } catch (IOException | NullPointerException e) { // STRICTLY to catch mmOutStream NPE
// Exception during write
//OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
DebugTool.logError(TAG, "Error sending bytes to connected device!");
@@ -338,14 +340,14 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
public synchronized void cancel() {
try {
- if(mmOutStream!=null){
+ if (mmOutStream != null) {
mmOutStream.flush();
mmOutStream.close();
}
} catch (IOException e) {
// close() of connect socket failed
- DebugTool.logInfo(TAG, "Write Thread: " + e.getMessage());
+ DebugTool.logInfo(TAG, "Write Thread: " + e.getMessage());
}
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
index 39f5909b5..e29ebf1d3 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
@@ -77,776 +77,813 @@ import java.util.concurrent.atomic.AtomicInteger;
* After that, you have the option to set if you want to test in a production setting. If not, it will default to a debug setting.
* Once you are ready to check if the router service is trusted you simply call routerServiceValidator.validate();
* <br><br> This validator should be passed into the multiplexing transport construction as well.
- * @author Joey Grover
*
+ * @author Joey Grover
*/
public class RouterServiceValidator {
- private static final String TAG = "RSVP";
- public static final String ROUTER_SERVICE_PACKAGE = "com.sdl.router";
-
- private static final String REQUEST_PREFIX = "https://woprjr.smartdevicelink.com/api/1/applications/queryTrustedRouters";
-
- private static final String DEFAULT_APP_LIST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
-
-
- private static final String JSON_RESPONSE_OBJECT_TAG = "response";
- private static final String JSON_RESPONSE_APP_VERSIONS_TAG = "versionBlacklist";
-
- private static final String JSON_PUT_ARRAY_TAG = "installedApps";
- private static final String JSON_APP_PACKAGE_TAG = "packageName";
- private static final String JSON_APP_VERSION_TAG = "version";
-
-
- private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
-
- private static final String SDL = "sdl";
- private static final String SDL_PACKAGE_LIST = "sdl_package_list";
- private static final String SDL_PACKAGE_LIST_TIMESTAMP = "sdl_package_list_timestamp";
- private static final String SDL_LAST_REQUEST = "sdl_last_request";
- private static final String SDL_RSVP_SECURITY_LEVEL = "sdl_rsvp_security_level";
-
-
- //Flags to aid in debugging and production checks
- public static final int FLAG_DEBUG_NONE = 0x00;
- public static final int FLAG_DEBUG_PACKAGE_CHECK = 0x01;
- /**
- * This will flag the validator to check for app version during debugging.
- * <br><br><b>NOTE: This flag will include a package check as well.
- */
- public static final int FLAG_DEBUG_VERSION_CHECK = 0x03; //We use 3 because version check will be 2, but since a version check implies a package check we do 2+1=3;
- public static final int FLAG_DEBUG_INSTALLED_FROM_CHECK = 0x04;
- public static final int FLAG_DEBUG_USE_TIMESTAMP_CHECK = 0x05;
-
- public static final int FLAG_DEBUG_PERFORM_ALL_CHECKS = 0xFF;
-
-
- private int flags = FLAG_DEBUG_NONE;
-
- private Context context;
- private boolean inDebugMode = false;
- private static boolean pendingListRefresh = false;
-
- private ComponentName service;//This is how we can save different routers over another in a waterfall method if we choose to.
-
- private static int securityLevel = -1;
-
- public RouterServiceValidator(Context context){
- this.context = context;
- inDebugMode = inDebugMode();
- }
-
- public RouterServiceValidator(Context context, ComponentName service){
- this.context = context;
- inDebugMode = inDebugMode();
- this.service = service;
- }
-
- public RouterServiceValidator(@NonNull MultiplexTransportConfig config){
- this.context = config.context;
- this.service = config.service;
- setSecurityLevel(config.securityLevel);
- inDebugMode = inDebugMode();
- }
-
- /**
- * Asynchronously validate the target RouterService, which includes finding the right RouterService.
- * @param callback: callback gets called when validation finishes.
- */
- public void validateAsync(final ValidationStatusCallback callback) {
- if(securityLevel == -1){
- securityLevel = getSecurityLevel(context);
- }
-
- final PackageManager pm = context.getPackageManager();
- //Grab the package for the currently running router service. We need this call regardless of if we are in debug mode or not.
-
- if(this.service != null){
- DebugTool.logInfo(TAG, "Supplied service name of " + this.service.getClassName());
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !isServiceRunning(context,this.service)){
- //This means our service isn't actually running, so set to null. Hopefully we can find a real router service after this.
- service = null;
- DebugTool.logWarning(TAG, "Supplied service is not actually running.");
- } else {
- // If the running router service is created by this app, the validation is good by default
- if (this.service.getPackageName().equals(context.getPackageName()) && callback != null) {
- callback.onFinishedValidation(true, this.service);
- return;
- }
- }
- }
-
- if(this.service == null){
- DebugTool.logInfo(TAG, "about finding the best Router by using retrieveBestRouterServiceName");
- new FindRouterTask(new FindConnectedRouterCallback() {
- @Override
- public void onFound(ComponentName component) {
- DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFound got called. Package=" + component);
- checkTrustedRouter(callback, pm, component);
- }
-
- @Override
- public void onFailed() {
- DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFailed was called");
- if (callback != null) {
- callback.onFinishedValidation(false, null);
- }
- }
- }).execute(this.context);
- } else {
- // already found the RouterService
- checkTrustedRouter(callback, pm, service);
- }
-
- }
-
- /**
- * checkTrustedRouter: This checks to see if the given component is Trusted RouterService,
- * and calls ValidationStatusCallback#onFinishedValidation.
- *
- * @param callback
- * @param pm
- * @param component
- */
- private void checkTrustedRouter(final ValidationStatusCallback callback, final PackageManager pm, final ComponentName component) {
- String packageName = appPackageForComponentName(component, pm);
- boolean valid = (securityLevel == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
-
- if(!valid && packageName!=null){//Make sure there is a service running
- if(wasInstalledByAppStore(packageName)){ //Was this package installed from a trusted app store
- if( isTrustedPackage(packageName, pm)){//Is this package on the list of trusted apps.
- valid = true;
- }
- }
- }
- if (callback != null) {
- callback.onFinishedValidation(valid, component);
- if (valid) {
- synchronized (this) {
- this.service = component;
- }
- }
- }
- }
- /**
- * This method retrieves the best routerservice name asynchronously.
- * @param context
- */
- //private void retrieveBestRouterServiceName(Context context) {
- // FindRouterTask task = new FindRouterTask(null);
- // task.execute(context);
- //}
-
- /**
- * FindRouterTask: AsyncTask to find the connected RouterService.
- */
- class FindRouterTask extends AsyncTask<Context, Void, ComponentName> {
- final FindConnectedRouterCallback mCallback;
- final Handler mHandler = new Handler(Looper.getMainLooper());
- final Integer TIMEOUT_MSEC = 10000; // 10 sec
-
- FindRouterTask(FindConnectedRouterCallback callback) {
- mCallback = callback;
- }
-
- @Override
- protected ComponentName doInBackground(final Context... contexts) {
- // let's use ServiceFinder here
- final BlockingQueue<ComponentName> serviceQueue = new LinkedBlockingQueue<>();
- final AtomicInteger _counter = new AtomicInteger(0);
- Context context = contexts[0];
- final Thread _currentThread = Thread.currentThread();
- new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
- @Override
- public void onComplete(Vector<ComponentName> routerServices) {
- // OK, we found the routerServices. Let's see one-by-one.
- if (routerServices == null || routerServices.isEmpty()) {
- _currentThread.interrupt();
- return;
- }
-
-
- final int numServices = routerServices.size();
- for (ComponentName name: routerServices) {
- final SdlRouterStatusProvider provider = new SdlRouterStatusProvider(contexts[0], name, new SdlRouterStatusProvider.ConnectedStatusCallback() {
- @Override
- public void onConnectionStatusUpdate(final boolean connected, final ComponentName service, final Context context) {
- // make sure this part runs on main thread.
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- _counter.incrementAndGet();
- if (connected) {
- DebugTool.logInfo(TAG, "We found the connected service (" + service + "); currentThread is " + Thread.currentThread().getName());
- serviceQueue.add(service);
- } else if (_counter.get() == numServices) {
- DebugTool.logInfo(TAG, "SdlRouterStatusProvider returns service=" + service + "; connected=" + connected);
- _currentThread.interrupt();
- }
- }
- });
- }
- });
- DebugTool.logInfo(TAG, "about checkIsConnected; thread=" + Thread.currentThread().getName());
- provider.checkIsConnected();
- }
- }
- });
-
- try {
- ComponentName found = serviceQueue.poll(TIMEOUT_MSEC, TimeUnit.MILLISECONDS);
- return found;
- } catch(InterruptedException e) {
- DebugTool.logInfo(TAG,"FindRouterTask was interrupted because connected Router cannot be found");
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(ComponentName componentName) {
- DebugTool.logInfo(TAG,"onPostExecute componentName=" + componentName);
- super.onPostExecute(componentName);
- if (mCallback != null) {
- if (componentName != null && componentName.getPackageName() != null && componentName.getPackageName().length() != 0) {
- mCallback.onFound(componentName);
- } else {
- mCallback.onFailed();
- }
- }
- }
-
- }
-
- /**
- * FindConnectedRouterCallback
- * Used internally for validating router service.
- */
- private interface FindConnectedRouterCallback {
- void onFound(ComponentName component);
- void onFailed();
- }
-
- interface ValidationStatusCallback {
- void onFinishedValidation(boolean valid, ComponentName name);
- }
-
- /**
- * This will ensure that all router services are aware that there are no valid router services running and should start up
- */
- private void wakeUpRouterServices(){
- if(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
- Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
- intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- AndroidTools.sendExplicitBroadcast(context,intent,null);
- }
- }
- public ComponentName getService(){
- return this.service;
- }
-
- private boolean shouldOverrideVersionCheck(){
- return (this.inDebugMode && ((this.flags & FLAG_DEBUG_VERSION_CHECK) != FLAG_DEBUG_VERSION_CHECK));
- }
-
- private boolean shouldOverridePackageName(){
- return (this.inDebugMode && ((this.flags & FLAG_DEBUG_PACKAGE_CHECK) != FLAG_DEBUG_PACKAGE_CHECK));
- }
-
- private boolean shouldOverrideInstalledFrom(){
- return securityLevel< MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH
- || (this.inDebugMode && ((this.flags & FLAG_DEBUG_INSTALLED_FROM_CHECK) != FLAG_DEBUG_INSTALLED_FROM_CHECK));
- }
-
- private boolean shouldOverrideTimeCheck(){
- return (this.inDebugMode && ((this.flags & FLAG_DEBUG_USE_TIMESTAMP_CHECK) != FLAG_DEBUG_USE_TIMESTAMP_CHECK));
- }
-
-
- /**
- * Use this method if you would like to test your app in a production setting rather than defaulting to a
- * debug mode where you connect to whatever router service is running.
- * <br><br><b>These flags are only used in debugging mode. During production they will be ignored.</b>
- * @param flags
- */
- public void setFlags(int flags){
- this.flags = flags;
- }
-
- public void setSecurityLevel(int securityLevel){
- RouterServiceValidator.securityLevel = securityLevel;
- cacheSecurityLevel(this.context,securityLevel);
- }
-
- protected static long getRefreshRate(){
- switch(securityLevel){
- case MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW:
- return 30 * REFRESH_TRUSTED_APP_LIST_TIME_DAY;
- case MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH:
- case MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED:
- default:
- return 7 * REFRESH_TRUSTED_APP_LIST_TIME_DAY;
-
- }
- }
-
- /**
- * This method will find which router service is running. Use that info to find out more about that app and service.
- * It will store the found service for later use and return the package name if found.
- * @param pm An instance of a package manager. This is no longer used so null can be sent.
- * @return
- */
- public ComponentName componentNameForServiceRunning(PackageManager pm){
- if(context==null){
- return null;
- }
- ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- //PackageManager pm = context.getPackageManager();
-
- if (manager != null) {
- for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
- //Log.d(TAG, service.service.getClassName());
- //We will check to see if it contains this name, should be pretty specific
- if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SdlBroadcastReceiver.SDL_ROUTER_SERVICE_CLASS_NAME)) {
- //this.service = service.service; //This is great
- if (service.started && service.restarting == 0) { //If this service has been started and is not crashed
- return service.service; //appPackageForComponenetName(service.service,pm);
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns the package name for the component name
- * @param cn
- * @param pm
- * @return
- */
- private String appPackageForComponentName(ComponentName cn,PackageManager pm ){
- if(cn!=null && pm!=null){
- ServiceInfo info;
- try {
- info = pm.getServiceInfo(cn, 0);
- return info.applicationInfo.packageName;
- } catch (NameNotFoundException e) {
- e.printStackTrace();
- }
- }
- return null;
-
- }
-
- /**
- * Check to see if the app was installed from a trusted app store.
- * @param packageName the package name of the app to be tested
- * @return whether or not the app was installed from a trusted app store
- */
- public boolean wasInstalledByAppStore(String packageName){
- if(shouldOverrideInstalledFrom()){
- return true;
- }
- PackageManager packageManager = context.getPackageManager();
- try {
- final ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
- if(TrustedAppStore.isTrustedStore(packageManager.getInstallerPackageName(applicationInfo.packageName))){
- // App was installed by trusted app store
- return true;
- }
- } catch (final NameNotFoundException e) {
- e.printStackTrace();
- return false;
- }
- return false;
- }
-
- /**
- * This method will check to see if this app is a debug build. If it is, we will attempt to connect to any router service.
- * If false, it will only connect to approved apps with router services.
- * @return
- */
- public boolean inDebugMode(){
- return (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
- }
-
-
- private boolean isTrustedPackage(String packageName, PackageManager pm){
- if(packageName == null){
- return false;
- }
-
- if(shouldOverridePackageName()){ //If we don't care about package names, just return true;
- return true;
- }
-
- int version = -1;
- try {version = pm.getPackageInfo(packageName,0).versionCode;} catch (NameNotFoundException e1) {e1.printStackTrace(); return false;}
-
- JSONObject trustedApps = stringToJson(getTrustedList(context));
- JSONArray versions;
- JSONObject app;
-
- try {
- app = trustedApps.getJSONObject(packageName);
- } catch (JSONException e) {
- e.printStackTrace();
- return false;
- }
-
- if(app!=null){
- //At this point, an app object was found in the JSON list that matches the package name
- if(shouldOverrideVersionCheck()){ //If we don't care about versions, just return true
- return true;
- }
- try { versions = app.getJSONArray(JSON_RESPONSE_APP_VERSIONS_TAG); } catch (JSONException e) { e.printStackTrace();return false;}
- return verifyVersion(version, versions);
- }
-
- return false;
- }
-
- protected boolean verifyVersion(int version, JSONArray versions){
- if(version<0){
- return false;
- }
- if(versions == null || versions.length()==0){
- return true;
- }
- for(int i=0;i<versions.length();i++){
- try {
- if(version == versions.getInt(i)){
- return false;
- }
- } catch (JSONException e) {
- continue;
- }
- }//We didn't find our version in the black list.
- return true;
- }
-
- /**
- * Using the knowledge that all SDL enabled apps have an SDL Broadcast Receiver that has an intent filter that includes a specific
- * intent.
- * @return
- */
- private static List<SdlApp> findAllSdlApps(Context context){
- List<SdlApp> apps = new ArrayList<>();
- PackageManager packageManager = context.getPackageManager();
- Intent intent = new Intent();
- intent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
- List<ResolveInfo> infoList = packageManager.queryBroadcastReceivers(intent, 0);
- //We want to sort our list so that we know it's the same every time
- Collections.sort(infoList,new Comparator<ResolveInfo>() {
- @Override
- public int compare(ResolveInfo lhs, ResolveInfo rhs) {
- return lhs.activityInfo.packageName.compareTo(rhs.activityInfo.packageName);
- }
- });
- if(infoList!=null){
- String packageName;
- for(ResolveInfo info : infoList){
- //Log.i(TAG, "SDL apps: " + info.activityInfo.packageName);
- packageName = info.activityInfo.packageName;
- try {
- apps.add(new SdlApp(packageName,packageManager.getPackageInfo(packageName,0).versionCode));
- } catch (NameNotFoundException e) {
- e.printStackTrace();
- }
- }
-
- return apps;
- }else{
- DebugTool.logInfo(TAG, "No SDL apps, list was null");
- return null;
- }
- }
-
- /**
- * Performs a look up against installed SDL apps that support the router service.
- * When it receives a list back from the server it will store it for later use.
- * @param context
- */
- public static boolean createTrustedListRequest(final Context context, boolean forceRefresh){
- return createTrustedListRequest(context,forceRefresh,null,null);
- }
- public static boolean createTrustedListRequest(final Context context, boolean forceRefresh, TrustedListCallback listCallback){DebugTool.logInfo(TAG,"Checking to make sure we have a list");
- return createTrustedListRequest(context,forceRefresh,null,listCallback);
- }
-
- protected static boolean createTrustedListRequest(final Context context, boolean forceRefresh,HttpRequestTask.HttpRequestTaskCallback cb, final TrustedListCallback listCallback ){
- if(context == null){
- return false;
- }
- else if(getSecurityLevel(context) == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF){ //If security is off, we can just return now
- if(listCallback!=null){
- listCallback.onListObtained(true);
- }
- return false;
- }
-
- pendingListRefresh = true;
- //Might want to store a flag letting this class know a request is currently pending
- StringBuilder builder = new StringBuilder();
- builder.append(REQUEST_PREFIX);
-
- List<SdlApp> apps = findAllSdlApps(context);
-
- final JSONObject object = new JSONObject();
- JSONArray array = new JSONArray();
- JSONObject jsonApp;
-
- if(apps != null) {
- for (SdlApp app : apps) { //Format all the apps into a JSON object and add it to the JSON array
- try {
- jsonApp = new JSONObject();
- jsonApp.put(JSON_APP_PACKAGE_TAG, app.packageName);
- jsonApp.put(JSON_APP_VERSION_TAG, app.versionCode);
- array.put(jsonApp);
- } catch (JSONException e) {
- e.printStackTrace();
- continue;
- }
- }
- }
-
- try {object.put(JSON_PUT_ARRAY_TAG, array);} catch (JSONException e) {e.printStackTrace();}
-
- if(!forceRefresh && (System.currentTimeMillis()-getTrustedAppListTimeStamp(context))<getRefreshRate()){
- if(object.toString().equals(getLastRequest(context))){
- //Our list should still be ok for now so we will skip the request
- pendingListRefresh = false;
- if(listCallback!=null){
- listCallback.onListObtained(true);
- }
- return false;
- }else{
- DebugTool.logInfo(TAG, "Sdl apps have changed. Need to request new trusted router service list.");
- }
- }
-
- if (cb == null) {
- cb = new HttpRequestTaskCallback() {
-
- @Override
- public void httpCallComplete(String response) {
- // Might want to check if this list is ok
- //Log.d(TAG, "APPS! " + response);
- setTrustedList(context, response);
- setLastRequest(context, object.toString()); //Save our last request
- pendingListRefresh = false;
- if(listCallback!=null){listCallback.onListObtained(true);}
- }
-
- @Override
- public void httpFailure(int statusCode) {
- DebugTool.logError(TAG, "Error while requesting trusted app list: "
- + statusCode);
- pendingListRefresh = false;
- if(listCallback!=null){listCallback.onListObtained(false);}
- }
- };
- }
-
- new HttpRequestTask(cb).execute(REQUEST_PREFIX,HttpRequestTask.REQUEST_TYPE_POST,object.toString(),"application/json","application/json");
-
- return true;
- }
-
- /**
- * This method will determine if our supplied component name is really running.
- * @param context
- * @param service
- * @return
- */
- protected boolean isServiceRunning(Context context, ComponentName service){
- ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- if (manager != null) {
- for (RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
- if (serviceInfo.service.equals(service)) {
- return true;
- }
- }
- }
- return false;
- }
-
-
- /**
- * Parses a string into a JSON array
- * @param json
- * @return
- */
- protected JSONObject stringToJson(String json){
- if(json==null){
- return stringToJson(DEFAULT_APP_LIST);
- }
- try {
- JSONObject object = new JSONObject(json);
- return object.getJSONObject(JSON_RESPONSE_OBJECT_TAG);
-
- } catch (JSONException e) {
- e.printStackTrace();
- if(!json.equalsIgnoreCase(DEFAULT_APP_LIST)){ //Since we were unable to parse, let's fall back to at least our last known good list. If this list is somehow messed up, just quit.
- return stringToJson(DEFAULT_APP_LIST);
- }else{
- return null;
- }
- }
- }
-
- public static boolean invalidateList(Context context){
- if(context == null){
- return false;
- }
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- // Write the new prefs
- SharedPreferences.Editor prefAdd = pref.edit();
- prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, 0); //This will be the last time we updated
- return prefAdd.commit();
- }
- /******************************************************************
- *
- * Saving the list for later!!!
- *
- ******************************************************************/
-
- /**
- * Saves the list of available applications into user's shared prefs.
- * @param context The application's environment
- * @param jsonString The JSON string to save.
- */
- protected static boolean setTrustedList(Context context, String jsonString){
- if(jsonString!=null && context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- // Write the new prefs
- SharedPreferences.Editor prefAdd = pref.edit();
- prefAdd.putString(SDL_PACKAGE_LIST, jsonString);
- prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, System.currentTimeMillis()); //This will be the last time we updated
- return prefAdd.commit();
- }
- return false;
- }
-
- /**
- * Retrieves the list of available applications from user's shared prefs.
- * @param context The application's environment.
- * @return The JSON string that was retrieved.
- */
- protected static String getTrustedList(Context context){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- return pref.getString(SDL_PACKAGE_LIST, DEFAULT_APP_LIST);
- }
- return null;
- }
-
- /**
- * Retrieves the time stamp from the user's shared prefs.
- * @param context The application's environment.
- * @return The time stamp that was retrieved.
- */
- protected static Long getTrustedAppListTimeStamp(Context context){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- return pref.getLong(SDL_PACKAGE_LIST_TIMESTAMP, 0);
- }
- return -1L;
- }
-
- protected static boolean setLastRequest(Context context, String request){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- SharedPreferences.Editor prefAdd = pref.edit();
- prefAdd.putString(SDL_LAST_REQUEST, request);
- return prefAdd.commit();
- }
- return false;
- }
-
- /**
- * Gets the last request JSON object we sent to the RSVP server. It basically contains a list of sdl enabled apps
- * @param context
- * @return
- */
- protected static String getLastRequest(Context context){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- return pref.getString(SDL_LAST_REQUEST, null);
- }
- return null;
- }
-
- protected static boolean cacheSecurityLevel(Context context, int securityLevel){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- SharedPreferences.Editor prefAdd = pref.edit();
- prefAdd.putInt(SDL_RSVP_SECURITY_LEVEL, securityLevel);
- return prefAdd.commit();
- }
- return false;
- }
-
- protected static int getSecurityLevel(Context context){
- if(context!=null){
- SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
- return pref.getInt(SDL_RSVP_SECURITY_LEVEL, MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
- }
- return MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED;
- }
-
- /**
- * Class that holds all the info we want to send/receive from the validation server
- */
- public static class SdlApp{
- final String packageName;
- final int versionCode;
-
- SdlApp(String packageName, int versionCode){
- this.packageName = packageName;
- this.versionCode = versionCode;
- }
- }
-
- public enum TrustedAppStore{
- PLAY_STORE("com.android.vending"),
- AMAZON("com.amazon.venezia"),
- XIAOMI("com.xiaomi.market"),
- SAMSUNG("com.sec.android.app.samsungapps"),
- WANDOUJIA("com.wandoujia.phoenix2"),
- BAIDU_APP_SEARCH("com.baidu.appsearch"),
- HIAPK("com.hiapk.marketpho"),
- ;
-
- final String packageString;
- private TrustedAppStore(String packageString){
- this.packageString = packageString;
- }
-
- /**
- * Test if the supplied store package is one of the trusted app stores
- * @param packageString
- * @return
- */
- public static boolean isTrustedStore(String packageString){
- if(packageString == null){
- return false;
- }
- TrustedAppStore[] stores = TrustedAppStore.values();
- for (TrustedAppStore store : stores) {
- if (packageString.equalsIgnoreCase(store.packageString)) {
- return true;
- }
- }
- return false;
- }
-
- }
- /**
- * This interface is used as a callback to know when we have either obtained a list or at least returned from our attempt.
- *
- */
- public interface TrustedListCallback{
- void onListObtained(boolean successful);
- }
+ private static final String TAG = "RSVP";
+ public static final String ROUTER_SERVICE_PACKAGE = "com.sdl.router";
+
+ private static final String REQUEST_PREFIX = "https://woprjr.smartdevicelink.com/api/1/applications/queryTrustedRouters";
+
+ private static final String DEFAULT_APP_LIST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] },\"com.ford.fordpass\" : { \"versionBlacklist\":[] } }}";
+
+
+ private static final String JSON_RESPONSE_OBJECT_TAG = "response";
+ private static final String JSON_RESPONSE_APP_VERSIONS_TAG = "versionBlacklist";
+
+ private static final String JSON_PUT_ARRAY_TAG = "installedApps";
+ private static final String JSON_APP_PACKAGE_TAG = "packageName";
+ private static final String JSON_APP_VERSION_TAG = "version";
+
+
+ private static final long REFRESH_TRUSTED_APP_LIST_TIME_DAY = 3600000 * 24; // A day in ms
+
+ private static final String SDL = "sdl";
+ private static final String SDL_PACKAGE_LIST = "sdl_package_list";
+ private static final String SDL_PACKAGE_LIST_TIMESTAMP = "sdl_package_list_timestamp";
+ private static final String SDL_LAST_REQUEST = "sdl_last_request";
+ private static final String SDL_RSVP_SECURITY_LEVEL = "sdl_rsvp_security_level";
+
+
+ //Flags to aid in debugging and production checks
+ public static final int FLAG_DEBUG_NONE = 0x00;
+ public static final int FLAG_DEBUG_PACKAGE_CHECK = 0x01;
+ /**
+ * This will flag the validator to check for app version during debugging.
+ * <br><br><b>NOTE: This flag will include a package check as well.
+ */
+ public static final int FLAG_DEBUG_VERSION_CHECK = 0x03; //We use 3 because version check will be 2, but since a version check implies a package check we do 2+1=3;
+ public static final int FLAG_DEBUG_INSTALLED_FROM_CHECK = 0x04;
+ public static final int FLAG_DEBUG_USE_TIMESTAMP_CHECK = 0x05;
+
+ public static final int FLAG_DEBUG_PERFORM_ALL_CHECKS = 0xFF;
+
+
+ private int flags = FLAG_DEBUG_NONE;
+
+ private Context context;
+ private boolean inDebugMode = false;
+ private static boolean pendingListRefresh = false;
+
+ private ComponentName service;//This is how we can save different routers over another in a waterfall method if we choose to.
+
+ private static int securityLevel = -1;
+
+ public RouterServiceValidator(Context context) {
+ this.context = context;
+ inDebugMode = inDebugMode();
+ }
+
+ public RouterServiceValidator(Context context, ComponentName service) {
+ this.context = context;
+ inDebugMode = inDebugMode();
+ this.service = service;
+ }
+
+ public RouterServiceValidator(@NonNull MultiplexTransportConfig config) {
+ this.context = config.context;
+ this.service = config.service;
+ setSecurityLevel(config.securityLevel);
+ inDebugMode = inDebugMode();
+ }
+
+ /**
+ * Asynchronously validate the target RouterService, which includes finding the right RouterService.
+ *
+ * @param callback: callback gets called when validation finishes.
+ */
+ public void validateAsync(final ValidationStatusCallback callback) {
+ if (securityLevel == -1) {
+ securityLevel = getSecurityLevel(context);
+ }
+
+ final PackageManager pm = context.getPackageManager();
+ //Grab the package for the currently running router service. We need this call regardless of if we are in debug mode or not.
+
+ if (this.service != null) {
+ DebugTool.logInfo(TAG, "Supplied service name of " + this.service.getClassName());
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !isServiceRunning(context, this.service)) {
+ //This means our service isn't actually running, so set to null. Hopefully we can find a real router service after this.
+ service = null;
+ DebugTool.logWarning(TAG, "Supplied service is not actually running.");
+ } else {
+ // If the running router service is created by this app, the validation is good by default
+ if (this.service.getPackageName().equals(context.getPackageName()) && callback != null) {
+ callback.onFinishedValidation(true, this.service);
+ return;
+ }
+ }
+ }
+
+ if (this.service == null) {
+ DebugTool.logInfo(TAG, "about finding the best Router by using retrieveBestRouterServiceName");
+ new FindRouterTask(new FindConnectedRouterCallback() {
+ @Override
+ public void onFound(ComponentName component) {
+ DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFound got called. Package=" + component);
+ checkTrustedRouter(callback, pm, component);
+ }
+
+ @Override
+ public void onFailed() {
+ DebugTool.logInfo(TAG, "FindConnectedRouterCallback.onFailed was called");
+ if (callback != null) {
+ callback.onFinishedValidation(false, null);
+ }
+ }
+ }).execute(this.context);
+ } else {
+ // already found the RouterService
+ checkTrustedRouter(callback, pm, service);
+ }
+
+ }
+
+ /**
+ * checkTrustedRouter: This checks to see if the given component is Trusted RouterService,
+ * and calls ValidationStatusCallback#onFinishedValidation.
+ *
+ * @param callback
+ * @param pm
+ * @param component
+ */
+ private void checkTrustedRouter(final ValidationStatusCallback callback, final PackageManager pm, final ComponentName component) {
+ String packageName = appPackageForComponentName(component, pm);
+ boolean valid = (securityLevel == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
+
+ if (!valid && packageName != null) {//Make sure there is a service running
+ if (wasInstalledByAppStore(packageName)) { //Was this package installed from a trusted app store
+ if (isTrustedPackage(packageName, pm)) {//Is this package on the list of trusted apps.
+ valid = true;
+ }
+ }
+ }
+ if (callback != null) {
+ callback.onFinishedValidation(valid, component);
+ if (valid) {
+ synchronized (this) {
+ this.service = component;
+ }
+ }
+ }
+ }
+ /**
+ * This method retrieves the best routerservice name asynchronously.
+ * @param context
+ */
+ //private void retrieveBestRouterServiceName(Context context) {
+ // FindRouterTask task = new FindRouterTask(null);
+ // task.execute(context);
+ //}
+
+ /**
+ * FindRouterTask: AsyncTask to find the connected RouterService.
+ */
+ class FindRouterTask extends AsyncTask<Context, Void, ComponentName> {
+ final FindConnectedRouterCallback mCallback;
+ final Handler mHandler = new Handler(Looper.getMainLooper());
+ final Integer TIMEOUT_MSEC = 10000; // 10 sec
+
+ FindRouterTask(FindConnectedRouterCallback callback) {
+ mCallback = callback;
+ }
+
+ @Override
+ protected ComponentName doInBackground(final Context... contexts) {
+ // let's use ServiceFinder here
+ final BlockingQueue<ComponentName> serviceQueue = new LinkedBlockingQueue<>();
+ final AtomicInteger _counter = new AtomicInteger(0);
+ Context context = contexts[0];
+ final Thread _currentThread = Thread.currentThread();
+ new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
+ @Override
+ public void onComplete(Vector<ComponentName> routerServices) {
+ // OK, we found the routerServices. Let's see one-by-one.
+ if (routerServices == null || routerServices.isEmpty()) {
+ _currentThread.interrupt();
+ return;
+ }
+
+
+ final int numServices = routerServices.size();
+ for (ComponentName name : routerServices) {
+ final SdlRouterStatusProvider provider = new SdlRouterStatusProvider(contexts[0], name, new SdlRouterStatusProvider.ConnectedStatusCallback() {
+ @Override
+ public void onConnectionStatusUpdate(final boolean connected, final ComponentName service, final Context context) {
+ // make sure this part runs on main thread.
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _counter.incrementAndGet();
+ if (connected) {
+ DebugTool.logInfo(TAG, "We found the connected service (" + service + "); currentThread is " + Thread.currentThread().getName());
+ serviceQueue.add(service);
+ } else if (_counter.get() == numServices) {
+ DebugTool.logInfo(TAG, "SdlRouterStatusProvider returns service=" + service + "; connected=" + connected);
+ _currentThread.interrupt();
+ }
+ }
+ });
+ }
+ });
+ DebugTool.logInfo(TAG, "about checkIsConnected; thread=" + Thread.currentThread().getName());
+ provider.checkIsConnected();
+ }
+ }
+ });
+
+ try {
+ ComponentName found = serviceQueue.poll(TIMEOUT_MSEC, TimeUnit.MILLISECONDS);
+ return found;
+ } catch (InterruptedException e) {
+ DebugTool.logInfo(TAG, "FindRouterTask was interrupted because connected Router cannot be found");
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(ComponentName componentName) {
+ DebugTool.logInfo(TAG, "onPostExecute componentName=" + componentName);
+ super.onPostExecute(componentName);
+ if (mCallback != null) {
+ if (componentName != null && componentName.getPackageName() != null && componentName.getPackageName().length() != 0) {
+ mCallback.onFound(componentName);
+ } else {
+ mCallback.onFailed();
+ }
+ }
+ }
+
+ }
+
+ /**
+ * FindConnectedRouterCallback
+ * Used internally for validating router service.
+ */
+ private interface FindConnectedRouterCallback {
+ void onFound(ComponentName component);
+
+ void onFailed();
+ }
+
+ interface ValidationStatusCallback {
+ void onFinishedValidation(boolean valid, ComponentName name);
+ }
+
+ /**
+ * This will ensure that all router services are aware that there are no valid router services running and should start up
+ */
+ private void wakeUpRouterServices() {
+ if (BluetoothAdapter.getDefaultAdapter() != null && BluetoothAdapter.getDefaultAdapter().isEnabled()) {
+ Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
+ AndroidTools.sendExplicitBroadcast(context, intent, null);
+ }
+ }
+
+ public ComponentName getService() {
+ return this.service;
+ }
+
+ private boolean shouldOverrideVersionCheck() {
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_VERSION_CHECK) != FLAG_DEBUG_VERSION_CHECK));
+ }
+
+ private boolean shouldOverridePackageName() {
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_PACKAGE_CHECK) != FLAG_DEBUG_PACKAGE_CHECK));
+ }
+
+ private boolean shouldOverrideInstalledFrom() {
+ return securityLevel < MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH
+ || (this.inDebugMode && ((this.flags & FLAG_DEBUG_INSTALLED_FROM_CHECK) != FLAG_DEBUG_INSTALLED_FROM_CHECK));
+ }
+
+ private boolean shouldOverrideTimeCheck() {
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_USE_TIMESTAMP_CHECK) != FLAG_DEBUG_USE_TIMESTAMP_CHECK));
+ }
+
+
+ /**
+ * Use this method if you would like to test your app in a production setting rather than defaulting to a
+ * debug mode where you connect to whatever router service is running.
+ * <br><br><b>These flags are only used in debugging mode. During production they will be ignored.</b>
+ *
+ * @param flags
+ */
+ public void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ public void setSecurityLevel(int securityLevel) {
+ RouterServiceValidator.securityLevel = securityLevel;
+ cacheSecurityLevel(this.context, securityLevel);
+ }
+
+ protected static long getRefreshRate() {
+ switch (securityLevel) {
+ case MultiplexTransportConfig.FLAG_MULTI_SECURITY_LOW:
+ return 30 * REFRESH_TRUSTED_APP_LIST_TIME_DAY;
+ case MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH:
+ case MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED:
+ default:
+ return 7 * REFRESH_TRUSTED_APP_LIST_TIME_DAY;
+
+ }
+ }
+
+ /**
+ * This method will find which router service is running. Use that info to find out more about that app and service.
+ * It will store the found service for later use and return the package name if found.
+ *
+ * @param pm An instance of a package manager. This is no longer used so null can be sent.
+ * @return
+ */
+ public ComponentName componentNameForServiceRunning(PackageManager pm) {
+ if (context == null) {
+ return null;
+ }
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ //PackageManager pm = context.getPackageManager();
+
+ if (manager != null) {
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ //Log.d(TAG, service.service.getClassName());
+ //We will check to see if it contains this name, should be pretty specific
+ if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SdlBroadcastReceiver.SDL_ROUTER_SERVICE_CLASS_NAME)) {
+ //this.service = service.service; //This is great
+ if (service.started && service.restarting == 0) { //If this service has been started and is not crashed
+ return service.service; //appPackageForComponenetName(service.service,pm);
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the package name for the component name
+ *
+ * @param cn
+ * @param pm
+ * @return
+ */
+ private String appPackageForComponentName(ComponentName cn, PackageManager pm) {
+ if (cn != null && pm != null) {
+ ServiceInfo info;
+ try {
+ info = pm.getServiceInfo(cn, 0);
+ return info.applicationInfo.packageName;
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * Check to see if the app was installed from a trusted app store.
+ *
+ * @param packageName the package name of the app to be tested
+ * @return whether or not the app was installed from a trusted app store
+ */
+ public boolean wasInstalledByAppStore(String packageName) {
+ if (shouldOverrideInstalledFrom()) {
+ return true;
+ }
+ PackageManager packageManager = context.getPackageManager();
+ try {
+ final ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
+ if (TrustedAppStore.isTrustedStore(packageManager.getInstallerPackageName(applicationInfo.packageName))) {
+ // App was installed by trusted app store
+ return true;
+ }
+ } catch (final NameNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * This method will check to see if this app is a debug build. If it is, we will attempt to connect to any router service.
+ * If false, it will only connect to approved apps with router services.
+ *
+ * @return
+ */
+ public boolean inDebugMode() {
+ return (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
+ }
+
+
+ private boolean isTrustedPackage(String packageName, PackageManager pm) {
+ if (packageName == null) {
+ return false;
+ }
+
+ if (shouldOverridePackageName()) { //If we don't care about package names, just return true;
+ return true;
+ }
+
+ int version = -1;
+ try {
+ version = pm.getPackageInfo(packageName, 0).versionCode;
+ } catch (NameNotFoundException e1) {
+ e1.printStackTrace();
+ return false;
+ }
+
+ JSONObject trustedApps = stringToJson(getTrustedList(context));
+ JSONArray versions;
+ JSONObject app;
+
+ try {
+ app = trustedApps.getJSONObject(packageName);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ if (app != null) {
+ //At this point, an app object was found in the JSON list that matches the package name
+ if (shouldOverrideVersionCheck()) { //If we don't care about versions, just return true
+ return true;
+ }
+ try {
+ versions = app.getJSONArray(JSON_RESPONSE_APP_VERSIONS_TAG);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return verifyVersion(version, versions);
+ }
+
+ return false;
+ }
+
+ protected boolean verifyVersion(int version, JSONArray versions) {
+ if (version < 0) {
+ return false;
+ }
+ if (versions == null || versions.length() == 0) {
+ return true;
+ }
+ for (int i = 0; i < versions.length(); i++) {
+ try {
+ if (version == versions.getInt(i)) {
+ return false;
+ }
+ } catch (JSONException e) {
+ continue;
+ }
+ }//We didn't find our version in the black list.
+ return true;
+ }
+
+ /**
+ * Using the knowledge that all SDL enabled apps have an SDL Broadcast Receiver that has an intent filter that includes a specific
+ * intent.
+ *
+ * @return
+ */
+ private static List<SdlApp> findAllSdlApps(Context context) {
+ List<SdlApp> apps = new ArrayList<>();
+ PackageManager packageManager = context.getPackageManager();
+ Intent intent = new Intent();
+ intent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ List<ResolveInfo> infoList = packageManager.queryBroadcastReceivers(intent, 0);
+ //We want to sort our list so that we know it's the same every time
+ Collections.sort(infoList, new Comparator<ResolveInfo>() {
+ @Override
+ public int compare(ResolveInfo lhs, ResolveInfo rhs) {
+ return lhs.activityInfo.packageName.compareTo(rhs.activityInfo.packageName);
+ }
+ });
+ if (infoList != null) {
+ String packageName;
+ for (ResolveInfo info : infoList) {
+ //Log.i(TAG, "SDL apps: " + info.activityInfo.packageName);
+ packageName = info.activityInfo.packageName;
+ try {
+ apps.add(new SdlApp(packageName, packageManager.getPackageInfo(packageName, 0).versionCode));
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return apps;
+ } else {
+ DebugTool.logInfo(TAG, "No SDL apps, list was null");
+ return null;
+ }
+ }
+
+ /**
+ * Performs a look up against installed SDL apps that support the router service.
+ * When it receives a list back from the server it will store it for later use.
+ *
+ * @param context
+ */
+ public static boolean createTrustedListRequest(final Context context, boolean forceRefresh) {
+ return createTrustedListRequest(context, forceRefresh, null, null);
+ }
+
+ public static boolean createTrustedListRequest(final Context context, boolean forceRefresh, TrustedListCallback listCallback) {
+ DebugTool.logInfo(TAG, "Checking to make sure we have a list");
+ return createTrustedListRequest(context, forceRefresh, null, listCallback);
+ }
+
+ protected static boolean createTrustedListRequest(final Context context, boolean forceRefresh, HttpRequestTask.HttpRequestTaskCallback cb, final TrustedListCallback listCallback) {
+ if (context == null) {
+ return false;
+ } else if (getSecurityLevel(context) == MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF) { //If security is off, we can just return now
+ if (listCallback != null) {
+ listCallback.onListObtained(true);
+ }
+ return false;
+ }
+
+ pendingListRefresh = true;
+ //Might want to store a flag letting this class know a request is currently pending
+ StringBuilder builder = new StringBuilder();
+ builder.append(REQUEST_PREFIX);
+
+ List<SdlApp> apps = findAllSdlApps(context);
+
+ final JSONObject object = new JSONObject();
+ JSONArray array = new JSONArray();
+ JSONObject jsonApp;
+
+ if (apps != null) {
+ for (SdlApp app : apps) { //Format all the apps into a JSON object and add it to the JSON array
+ try {
+ jsonApp = new JSONObject();
+ jsonApp.put(JSON_APP_PACKAGE_TAG, app.packageName);
+ jsonApp.put(JSON_APP_VERSION_TAG, app.versionCode);
+ array.put(jsonApp);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ continue;
+ }
+ }
+ }
+
+ try {
+ object.put(JSON_PUT_ARRAY_TAG, array);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ if (!forceRefresh && (System.currentTimeMillis() - getTrustedAppListTimeStamp(context)) < getRefreshRate()) {
+ if (object.toString().equals(getLastRequest(context))) {
+ //Our list should still be ok for now so we will skip the request
+ pendingListRefresh = false;
+ if (listCallback != null) {
+ listCallback.onListObtained(true);
+ }
+ return false;
+ } else {
+ DebugTool.logInfo(TAG, "Sdl apps have changed. Need to request new trusted router service list.");
+ }
+ }
+
+ if (cb == null) {
+ cb = new HttpRequestTaskCallback() {
+
+ @Override
+ public void httpCallComplete(String response) {
+ // Might want to check if this list is ok
+ //Log.d(TAG, "APPS! " + response);
+ setTrustedList(context, response);
+ setLastRequest(context, object.toString()); //Save our last request
+ pendingListRefresh = false;
+ if (listCallback != null) {
+ listCallback.onListObtained(true);
+ }
+ }
+
+ @Override
+ public void httpFailure(int statusCode) {
+ DebugTool.logError(TAG, "Error while requesting trusted app list: "
+ + statusCode);
+ pendingListRefresh = false;
+ if (listCallback != null) {
+ listCallback.onListObtained(false);
+ }
+ }
+ };
+ }
+
+ new HttpRequestTask(cb).execute(REQUEST_PREFIX, HttpRequestTask.REQUEST_TYPE_POST, object.toString(), "application/json", "application/json");
+
+ return true;
+ }
+
+ /**
+ * This method will determine if our supplied component name is really running.
+ *
+ * @param context
+ * @param service
+ * @return
+ */
+ protected boolean isServiceRunning(Context context, ComponentName service) {
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ if (manager != null) {
+ for (RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (serviceInfo.service.equals(service)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Parses a string into a JSON array
+ *
+ * @param json
+ * @return
+ */
+ protected JSONObject stringToJson(String json) {
+ if (json == null) {
+ return stringToJson(DEFAULT_APP_LIST);
+ }
+ try {
+ JSONObject object = new JSONObject(json);
+ return object.getJSONObject(JSON_RESPONSE_OBJECT_TAG);
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ if (!json.equalsIgnoreCase(DEFAULT_APP_LIST)) { //Since we were unable to parse, let's fall back to at least our last known good list. If this list is somehow messed up, just quit.
+ return stringToJson(DEFAULT_APP_LIST);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public static boolean invalidateList(Context context) {
+ if (context == null) {
+ return false;
+ }
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ // Write the new prefs
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, 0); //This will be the last time we updated
+ return prefAdd.commit();
+ }
+ /******************************************************************
+ *
+ * Saving the list for later!!!
+ *
+ ******************************************************************/
+
+ /**
+ * Saves the list of available applications into user's shared prefs.
+ *
+ * @param context The application's environment
+ * @param jsonString The JSON string to save.
+ */
+ protected static boolean setTrustedList(Context context, String jsonString) {
+ if (jsonString != null && context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ // Write the new prefs
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putString(SDL_PACKAGE_LIST, jsonString);
+ prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, System.currentTimeMillis()); //This will be the last time we updated
+ return prefAdd.commit();
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the list of available applications from user's shared prefs.
+ *
+ * @param context The application's environment.
+ * @return The JSON string that was retrieved.
+ */
+ protected static String getTrustedList(Context context) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getString(SDL_PACKAGE_LIST, DEFAULT_APP_LIST);
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the time stamp from the user's shared prefs.
+ *
+ * @param context The application's environment.
+ * @return The time stamp that was retrieved.
+ */
+ protected static Long getTrustedAppListTimeStamp(Context context) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getLong(SDL_PACKAGE_LIST_TIMESTAMP, 0);
+ }
+ return -1L;
+ }
+
+ protected static boolean setLastRequest(Context context, String request) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putString(SDL_LAST_REQUEST, request);
+ return prefAdd.commit();
+ }
+ return false;
+ }
+
+ /**
+ * Gets the last request JSON object we sent to the RSVP server. It basically contains a list of sdl enabled apps
+ *
+ * @param context
+ * @return
+ */
+ protected static String getLastRequest(Context context) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getString(SDL_LAST_REQUEST, null);
+ }
+ return null;
+ }
+
+ protected static boolean cacheSecurityLevel(Context context, int securityLevel) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putInt(SDL_RSVP_SECURITY_LEVEL, securityLevel);
+ return prefAdd.commit();
+ }
+ return false;
+ }
+
+ protected static int getSecurityLevel(Context context) {
+ if (context != null) {
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getInt(SDL_RSVP_SECURITY_LEVEL, MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED);
+ }
+ return MultiplexTransportConfig.FLAG_MULTI_SECURITY_MED;
+ }
+
+ /**
+ * Class that holds all the info we want to send/receive from the validation server
+ */
+ public static class SdlApp {
+ final String packageName;
+ final int versionCode;
+
+ SdlApp(String packageName, int versionCode) {
+ this.packageName = packageName;
+ this.versionCode = versionCode;
+ }
+ }
+
+ public enum TrustedAppStore {
+ PLAY_STORE("com.android.vending"),
+ AMAZON("com.amazon.venezia"),
+ XIAOMI("com.xiaomi.market"),
+ SAMSUNG("com.sec.android.app.samsungapps"),
+ WANDOUJIA("com.wandoujia.phoenix2"),
+ BAIDU_APP_SEARCH("com.baidu.appsearch"),
+ HIAPK("com.hiapk.marketpho"),
+ ;
+
+ final String packageString;
+
+ private TrustedAppStore(String packageString) {
+ this.packageString = packageString;
+ }
+
+ /**
+ * Test if the supplied store package is one of the trusted app stores
+ *
+ * @param packageString
+ * @return
+ */
+ public static boolean isTrustedStore(String packageString) {
+ if (packageString == null) {
+ return false;
+ }
+ TrustedAppStore[] stores = TrustedAppStore.values();
+ for (TrustedAppStore store : stores) {
+ if (packageString.equalsIgnoreCase(store.packageString)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ }
+
+ /**
+ * This interface is used as a callback to know when we have either obtained a list or at least returned from our attempt.
+ */
+ public interface TrustedListCallback {
+ void onListObtained(boolean successful);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 3229d4abd..605200ce5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -65,551 +65,560 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import static com.smartdevicelink.transport.TransportConstants.FOREGROUND_EXTRA;
-public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
-
- private static final String TAG = "Sdl Broadcast Receiver";
-
- protected static final String SDL_ROUTER_SERVICE_CLASS_NAME = "sdlrouterservice";
-
- public static final String LOCAL_ROUTER_SERVICE_EXTRA = "router_service";
- public static final String LOCAL_ROUTER_SERVICE_DID_START_OWN = "did_start";
-
- public static final String TRANSPORT_GLOBAL_PREFS = "SdlTransportPrefs";
- public static final String IS_TRANSPORT_CONNECTED = "isTransportConnected";
-
- public static Vector<ComponentName> runningBluetoothServicePackage = null;
+public abstract class SdlBroadcastReceiver extends BroadcastReceiver {
+
+ private static final String TAG = "Sdl Broadcast Receiver";
+
+ protected static final String SDL_ROUTER_SERVICE_CLASS_NAME = "sdlrouterservice";
+
+ public static final String LOCAL_ROUTER_SERVICE_EXTRA = "router_service";
+ public static final String LOCAL_ROUTER_SERVICE_DID_START_OWN = "did_start";
+
+ public static final String TRANSPORT_GLOBAL_PREFS = "SdlTransportPrefs";
+ public static final String IS_TRANSPORT_CONNECTED = "isTransportConnected";
+
+ public static Vector<ComponentName> runningBluetoothServicePackage = null;
@SuppressWarnings("rawtypes")
- private static Class localRouterClass;
+ private static Class localRouterClass;
private static final Object QUEUED_SERVICE_LOCK = new Object();
private static ComponentName queuedService = null;
- private static Thread.UncaughtExceptionHandler foregroundExceptionHandler = null;
+ private static Thread.UncaughtExceptionHandler foregroundExceptionHandler = null;
private static final Object DEVICE_LISTENER_LOCK = new Object();
- private static SdlDeviceListener sdlDeviceListener;
-
- public int getRouterServiceVersion(){
- return SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER;
- }
-
- @Override
- @CallSuper
- public void onReceive(Context context, Intent intent) {
- //Log.i(TAG, "Sdl Receiver Activated");
- final String action = intent.getAction();
- if(action == null){
- return;
- }
-
- BluetoothDevice device = null;
-
- if(action.equalsIgnoreCase(Intent.ACTION_PACKAGE_ADDED)
- || action.equalsIgnoreCase(Intent.ACTION_PACKAGE_REPLACED)){
- //The package manager has sent out a new broadcast.
- RouterServiceValidator.invalidateList(context);
- return;
- }
-
- if(!(action.equalsIgnoreCase(BluetoothDevice.ACTION_ACL_CONNECTED)
- || action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)
- || action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION))){
- //We don't want anything else here if the child class called super and has different intent filters
- //Log.i(TAG, "Unwanted intent from child class");
- return;
+ private static SdlDeviceListener sdlDeviceListener;
+
+ public int getRouterServiceVersion() {
+ return SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER;
+ }
+
+ @Override
+ @CallSuper
+ public void onReceive(Context context, Intent intent) {
+ //Log.i(TAG, "Sdl Receiver Activated");
+ final String action = intent.getAction();
+ if (action == null) {
+ return;
+ }
+
+ BluetoothDevice device = null;
+
+ if (action.equalsIgnoreCase(Intent.ACTION_PACKAGE_ADDED)
+ || action.equalsIgnoreCase(Intent.ACTION_PACKAGE_REPLACED)) {
+ //The package manager has sent out a new broadcast.
+ RouterServiceValidator.invalidateList(context);
+ return;
+ }
+
+ if (!(action.equalsIgnoreCase(BluetoothDevice.ACTION_ACL_CONNECTED)
+ || action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)
+ || action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION))) {
+ //We don't want anything else here if the child class called super and has different intent filters
+ //Log.i(TAG, "Unwanted intent from child class");
+ return;
}
-
- if(action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)){
- DebugTool.logInfo(TAG,"Usb connected");
- intent.setAction(null);
- onSdlEnabled(context, intent);
- return;
+
+ if (action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)) {
+ DebugTool.logInfo(TAG, "Usb connected");
+ intent.setAction(null);
+ onSdlEnabled(context, intent);
+ return;
+ }
+
+ if (intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)) { //Grab the bluetooth device if available
+ device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ }
+
+ boolean didStart = false;
+ if (localRouterClass == null) {
+ localRouterClass = defineLocalSdlRouterClass();
+ // we need to check this again because for USB apps, the returned class can still be null
+ if (AndroidTools.isDebugMode(context)) {
+ IntegrationValidator.ValidationResult result = IntegrationValidator.validate(context, localRouterClass, 0);
+ if (!result.isSuccessful()) {
+ throw new RuntimeException(result.getResultText());
+ }
+ }
+ }
+
+ if (localRouterClass != null && localRouterClass.getName().equalsIgnoreCase(com.smartdevicelink.transport.SdlRouterService.class.getName())) {
+ DebugTool.logError(TAG, "You cannot use the default SdlRouterService class, it must be extended in your project. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ }
+
+ //This will only be true if we are being told to reopen our SDL service because SDL is enabled
+ if (action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION)) {
+ if (intent.hasExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA)) {
+ if (intent.getBooleanExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, false)) {
+ String packageName = intent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE);
+ final ComponentName componentName = intent.getParcelableExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME);
+ if (componentName != null) {
+ final Intent finalIntent = intent;
+ final Context finalContext = context;
+ RouterServiceValidator.createTrustedListRequest(context, false, new TrustedListCallback() {
+ @Override
+ public void onListObtained(boolean successful) {
+ //Log.v(TAG, "SDL enabled by router service from " + packageName + " component package " + componentName.getPackageName() + " - " + componentName.getClassName());
+ //List obtained. Let's start our service
+ queuedService = componentName;
+ finalIntent.setAction("com.sdl.noaction"); //Replace what's there so we do go into some unintended loop
+ String transportType = finalIntent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_TRANSPORT_CONNECTED);
+ if (transportType != null) {
+ if (TransportType.USB.toString().equals(transportType)) {
+ finalIntent.putExtra(UsbManager.EXTRA_ACCESSORY, (Parcelable) null);
+ }
+ }
+ onSdlEnabled(finalContext, finalIntent);
+ }
+
+ });
+ }
+
+ }
+ return;
+ } else if (intent.getBooleanExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, false)) {
+ //We were told to wake up our router services
+ boolean altServiceWake = intent.getBooleanExtra(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT, false);
+ didStart = wakeUpRouterService(context, false, altServiceWake, device);
+
+ }
}
- if(intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)){ //Grab the bluetooth device if available
- device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
- }
-
- boolean didStart = false;
- if (localRouterClass == null){
- localRouterClass = defineLocalSdlRouterClass();
- // we need to check this again because for USB apps, the returned class can still be null
- if (AndroidTools.isDebugMode(context)) {
- IntegrationValidator.ValidationResult result = IntegrationValidator.validate(context, localRouterClass, 0);
- if(!result.isSuccessful()){
- throw new RuntimeException(result.getResultText());
- }
- }
- }
-
- if(localRouterClass != null && localRouterClass.getName().equalsIgnoreCase(com.smartdevicelink.transport.SdlRouterService.class.getName())){
- DebugTool.logError(TAG, "You cannot use the default SdlRouterService class, it must be extended in your project. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
- }
-
- //This will only be true if we are being told to reopen our SDL service because SDL is enabled
- if(action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION)){
- if(intent.hasExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA)){
- if(intent.getBooleanExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, false)){
- String packageName = intent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE);
- final ComponentName componentName = intent.getParcelableExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME);
- if(componentName!=null){
- final Intent finalIntent = intent;
- final Context finalContext = context;
- RouterServiceValidator.createTrustedListRequest(context, false, new TrustedListCallback(){
- @Override
- public void onListObtained(boolean successful) {
- //Log.v(TAG, "SDL enabled by router service from " + packageName + " component package " + componentName.getPackageName() + " - " + componentName.getClassName());
- //List obtained. Let's start our service
- queuedService = componentName;
- finalIntent.setAction("com.sdl.noaction"); //Replace what's there so we do go into some unintended loop
- String transportType = finalIntent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_TRANSPORT_CONNECTED);
- if(transportType!= null ){
- if(TransportType.USB.toString().equals(transportType)){
- finalIntent.putExtra(UsbManager.EXTRA_ACCESSORY, (Parcelable)null);
- }
- }
- onSdlEnabled(finalContext, finalIntent);
- }
-
- });
- }
-
- }
- return;
- }else if(intent.getBooleanExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, false)){
- //We were told to wake up our router services
- boolean altServiceWake = intent.getBooleanExtra(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT, false);
- didStart = wakeUpRouterService(context, false,altServiceWake,device );
-
- }
- }
-
-
- DebugTool.logInfo(TAG, "Check for local router");
- if(localRouterClass!=null){ //If there is a supplied router service lets run some logic regarding starting one
-
- if(!didStart){DebugTool.logInfo(TAG, "attempting to wake up router service");
- didStart = wakeUpRouterService(context, true,false, device);
- }
-
- //So even though we started our own version, on some older phones we find that two services are started up so we want to make sure we send our version that we are working with
- //We will send it an intent with the version number of the local instance and an intent to start this instance
-
- Intent serviceIntent = new Intent(context, localRouterClass);
- SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
- Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
- restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
- restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, didStart);
- context.sendBroadcast(restart);
- }
- }
+
+ DebugTool.logInfo(TAG, "Check for local router");
+ if (localRouterClass != null) { //If there is a supplied router service lets run some logic regarding starting one
+
+ if (!didStart) {
+ DebugTool.logInfo(TAG, "attempting to wake up router service");
+ didStart = wakeUpRouterService(context, true, false, device);
+ }
+
+ //So even though we started our own version, on some older phones we find that two services are started up so we want to make sure we send our version that we are working with
+ //We will send it an intent with the version number of the local instance and an intent to start this instance
+
+ Intent serviceIntent = new Intent(context, localRouterClass);
+ SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
+ Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, didStart);
+ context.sendBroadcast(restart);
+ }
+ }
/**
* This method will attempt to start the router service.
- * @param context to be used to start the service and send broadcasts
- * @param componentName the router service that should be started
+ *
+ * @param context to be used to start the service and send broadcasts
+ * @param componentName the router service that should be started
* @param altTransportWake if the alt transport flag should be set. Only used in debug
- * @param device the connected bluetooth device
+ * @param device the connected bluetooth device
*/
- private static void startRouterService(Context context, ComponentName componentName, boolean altTransportWake, BluetoothDevice device, boolean confirmedDevice) {
- if (componentName == null) {
- return;
- }
+ private static void startRouterService(Context context, ComponentName componentName, boolean altTransportWake, BluetoothDevice device, boolean confirmedDevice) {
+ if (componentName == null) {
+ return;
+ }
- Intent serviceIntent = new Intent();
- serviceIntent.setComponent(componentName);
+ Intent serviceIntent = new Intent();
+ serviceIntent.setComponent(componentName);
- if (altTransportWake) {
- serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
- }
+ if (altTransportWake) {
+ serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
+ }
- if (device != null) {
- serviceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
- }
+ if (device != null) {
+ serviceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+ }
- if (confirmedDevice) {
- serviceIntent.putExtra(TransportConstants.CONFIRMED_SDL_DEVICE, confirmedDevice);
+ if (confirmedDevice) {
+ serviceIntent.putExtra(TransportConstants.CONFIRMED_SDL_DEVICE, confirmedDevice);
}
- try {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- context.startService(serviceIntent);
- } else {
- serviceIntent.putExtra(FOREGROUND_EXTRA, true);
- DebugTool.logInfo(TAG, "Attempting to startForegroundService - " + System.currentTimeMillis());
- setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
- context.startForegroundService(serviceIntent);
-
- }
- //Make sure to send this out for old apps to close down
- SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
- Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
- restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
- restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, true);
- context.sendBroadcast(restart);
-
- } catch (SecurityException e) {
+ try {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ context.startService(serviceIntent);
+ } else {
+ serviceIntent.putExtra(FOREGROUND_EXTRA, true);
+ DebugTool.logInfo(TAG, "Attempting to startForegroundService - " + System.currentTimeMillis());
+ setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
+ context.startForegroundService(serviceIntent);
+
+ }
+ //Make sure to send this out for old apps to close down
+ SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
+ Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, true);
+ context.sendBroadcast(restart);
+
+ } catch (SecurityException e) {
DebugTool.logError(TAG, "Security exception, process is bad");
- }
- }
-
- private boolean wakeUpRouterService(final Context context, final boolean ping, final boolean altTransportWake, final BluetoothDevice device){
- new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
- @Override
- public void onComplete(Vector<ComponentName> routerServices) {
- runningBluetoothServicePackage = new Vector<>();
- runningBluetoothServicePackage.addAll(routerServices);
- if (runningBluetoothServicePackage.isEmpty()) {
- //If there isn't a service running we should try to start one
- //We will try to sort the SDL enabled apps and find the one that's been installed the longest
- final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
- synchronized (DEVICE_LISTENER_LOCK) {
- final boolean sdlDeviceListenerEnabled = SdlDeviceListener.isFeatureSupported(sdlAppInfoList);
- if (sdlDeviceListenerEnabled) {
- String myPackage = context.getPackageName();
- String routerServicePackage = null;
- if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty() && sdlAppInfoList.get(0).getRouterServiceComponentName() != null) {
- routerServicePackage = sdlAppInfoList.get(0).getRouterServiceComponentName().getPackageName();
- }
- DebugTool.logInfo(TAG, ": This app's package: " + myPackage);
- DebugTool.logInfo(TAG, ": Router service app's package: " + routerServicePackage);
- if (myPackage != null && myPackage.equalsIgnoreCase(routerServicePackage)) {
- SdlDeviceListener sdlDeviceListener = getSdlDeviceListener(context, device);
- if (!sdlDeviceListener.isRunning()) {
- sdlDeviceListener.start();
- }
- } else {
- DebugTool.logInfo(TAG, ": Not the app to start the router service nor device listener");
- }
- return;
- }
- }
-
- if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
- startRouterService(context, sdlAppInfoList.get(0).getRouterServiceComponentName(), altTransportWake, device, false);
- } else{
- DebugTool.logInfo(TAG, "No SDL Router Services found");
- DebugTool.logInfo(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
- return;
- }
-
- } else { //There are currently running services
- if(DebugTool.isDebugEnabled()){
- for(ComponentName service : runningBluetoothServicePackage){
- DebugTool.logInfo(TAG, "Currently running router service: " + service.getPackageName());
- }
- }
- if (altTransportWake) {
- wakeRouterServiceAltTransport(context);
- return;
- }else{
- for(ComponentName service : runningBluetoothServicePackage){
- pingRouterService(context,service.getPackageName(),service.getClassName());
- }
- }
- return;
- }
- }
- });
- return true;
- }
-
- private void wakeRouterServiceAltTransport(Context context){
- Intent serviceIntent = new Intent();
- serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
- for (ComponentName compName : runningBluetoothServicePackage) {
- serviceIntent.setComponent(compName);
- try{
- context.startService(serviceIntent);
- } catch (Exception e){
- DebugTool.logError(TAG, "Can't start router service for alt transport");
- }
-
- }
- }
-
- /**
- * This method will set a new UncaughtExceptionHandler for the current thread. The only
- * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
- * SdlRouterService can't be started fast enough by the system after calling
- * startForegroundService so the onCreate method doesn't get called before the foreground promise
- * timer expires. The new UncaughtExceptionHandler will catch that specific exception and tell the
- * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
- * an ANR to the app that makes the startForegroundService call.
- */
- static protected void setForegroundExceptionHandler() {
- final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
- if(defaultUncaughtExceptionHandler != foregroundExceptionHandler){
- foregroundExceptionHandler = new Thread.UncaughtExceptionHandler() {
- @Override
- public void uncaughtException(Thread t, Throwable e) {
- if (e != null
- && e instanceof AndroidRuntimeException
- && "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
- && e.getMessage() != null
- && e.getMessage().contains("SdlRouterService")) {
-
- DebugTool.logInfo(TAG, "Handling failed startForegroundService call");
- Looper.loop();
- } else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
- defaultUncaughtExceptionHandler.uncaughtException(t, e);
- }
- }
- };
- Thread.setDefaultUncaughtExceptionHandler(foregroundExceptionHandler);
- }
- }
-
- /**
- * Determines if an instance of the Router Service is currently running on the device.<p>
- * <b>Note:</b> This method no longer works on Android Oreo or newer
- * @param context A context to access Android system services through.
- * @return True if a SDL Router Service is currently running, false otherwise.
- */
- private static boolean isRouterServiceRunning(Context context){
- if(context == null){
- DebugTool.logError(TAG, "Can't look for router service, context supplied was null");
- return false;
- }
- if (runningBluetoothServicePackage == null) {
- runningBluetoothServicePackage = new Vector<>();
- } else {
- runningBluetoothServicePackage.clear();
- }
- ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- if (manager != null) {
- manager.getRunningAppProcesses();
- }
- List<RunningServiceInfo> runningServices;
- try {
- runningServices = manager.getRunningServices(Integer.MAX_VALUE);
- } catch (NullPointerException e) {
- DebugTool.logError(TAG, "Can't get list of running services");
- return false;
- }
- for (RunningServiceInfo service : runningServices) {
- //We will check to see if it contains this name, should be pretty specific
- //Log.d(TAG, "Found Service: "+ service.service.getClassName());
- if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SDL_ROUTER_SERVICE_CLASS_NAME) && AndroidTools.isServiceExported(context, service.service)) {
- runningBluetoothServicePackage.add(service.service); //Store which instance is running
- }
- }
- return runningBluetoothServicePackage.size() > 0;
-
- }
-
- /**
- * Attempts to ping a running router service. It does call startForegroundService so it is
+ }
+ }
+
+ private boolean wakeUpRouterService(final Context context, final boolean ping, final boolean altTransportWake, final BluetoothDevice device) {
+ new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
+ @Override
+ public void onComplete(Vector<ComponentName> routerServices) {
+ runningBluetoothServicePackage = new Vector<>();
+ runningBluetoothServicePackage.addAll(routerServices);
+ if (runningBluetoothServicePackage.isEmpty()) {
+ //If there isn't a service running we should try to start one
+ //We will try to sort the SDL enabled apps and find the one that's been installed the longest
+ final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ synchronized (DEVICE_LISTENER_LOCK) {
+ final boolean sdlDeviceListenerEnabled = SdlDeviceListener.isFeatureSupported(sdlAppInfoList);
+ if (sdlDeviceListenerEnabled) {
+ String myPackage = context.getPackageName();
+ String routerServicePackage = null;
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty() && sdlAppInfoList.get(0).getRouterServiceComponentName() != null) {
+ routerServicePackage = sdlAppInfoList.get(0).getRouterServiceComponentName().getPackageName();
+ }
+ DebugTool.logInfo(TAG, ": This app's package: " + myPackage);
+ DebugTool.logInfo(TAG, ": Router service app's package: " + routerServicePackage);
+ if (myPackage != null && myPackage.equalsIgnoreCase(routerServicePackage)) {
+ SdlDeviceListener sdlDeviceListener = getSdlDeviceListener(context, device);
+ if (!sdlDeviceListener.isRunning()) {
+ sdlDeviceListener.start();
+ }
+ } else {
+ DebugTool.logInfo(TAG, ": Not the app to start the router service nor device listener");
+ }
+ return;
+ }
+ }
+
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
+ startRouterService(context, sdlAppInfoList.get(0).getRouterServiceComponentName(), altTransportWake, device, false);
+ } else {
+ DebugTool.logInfo(TAG, "No SDL Router Services found");
+ DebugTool.logInfo(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ return;
+ }
+
+ } else { //There are currently running services
+ if (DebugTool.isDebugEnabled()) {
+ for (ComponentName service : runningBluetoothServicePackage) {
+ DebugTool.logInfo(TAG, "Currently running router service: " + service.getPackageName());
+ }
+ }
+ if (altTransportWake) {
+ wakeRouterServiceAltTransport(context);
+ return;
+ } else {
+ for (ComponentName service : runningBluetoothServicePackage) {
+ pingRouterService(context, service.getPackageName(), service.getClassName());
+ }
+ }
+ return;
+ }
+ }
+ });
+ return true;
+ }
+
+ private void wakeRouterServiceAltTransport(Context context) {
+ Intent serviceIntent = new Intent();
+ serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
+ for (ComponentName compName : runningBluetoothServicePackage) {
+ serviceIntent.setComponent(compName);
+ try {
+ context.startService(serviceIntent);
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Can't start router service for alt transport");
+ }
+
+ }
+ }
+
+ /**
+ * This method will set a new UncaughtExceptionHandler for the current thread. The only
+ * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
+ * SdlRouterService can't be started fast enough by the system after calling
+ * startForegroundService so the onCreate method doesn't get called before the foreground promise
+ * timer expires. The new UncaughtExceptionHandler will catch that specific exception and tell the
+ * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
+ * an ANR to the app that makes the startForegroundService call.
+ */
+ static protected void setForegroundExceptionHandler() {
+ final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+ if (defaultUncaughtExceptionHandler != foregroundExceptionHandler) {
+ foregroundExceptionHandler = new Thread.UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ if (e != null
+ && e instanceof AndroidRuntimeException
+ && "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
+ && e.getMessage() != null
+ && e.getMessage().contains("SdlRouterService")) {
+
+ DebugTool.logInfo(TAG, "Handling failed startForegroundService call");
+ Looper.loop();
+ } else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
+ defaultUncaughtExceptionHandler.uncaughtException(t, e);
+ }
+ }
+ };
+ Thread.setDefaultUncaughtExceptionHandler(foregroundExceptionHandler);
+ }
+ }
+
+ /**
+ * Determines if an instance of the Router Service is currently running on the device.<p>
+ * <b>Note:</b> This method no longer works on Android Oreo or newer
+ *
+ * @param context A context to access Android system services through.
+ * @return True if a SDL Router Service is currently running, false otherwise.
+ */
+ private static boolean isRouterServiceRunning(Context context) {
+ if (context == null) {
+ DebugTool.logError(TAG, "Can't look for router service, context supplied was null");
+ return false;
+ }
+ if (runningBluetoothServicePackage == null) {
+ runningBluetoothServicePackage = new Vector<>();
+ } else {
+ runningBluetoothServicePackage.clear();
+ }
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ if (manager != null) {
+ manager.getRunningAppProcesses();
+ }
+ List<RunningServiceInfo> runningServices;
+ try {
+ runningServices = manager.getRunningServices(Integer.MAX_VALUE);
+ } catch (NullPointerException e) {
+ DebugTool.logError(TAG, "Can't get list of running services");
+ return false;
+ }
+ for (RunningServiceInfo service : runningServices) {
+ //We will check to see if it contains this name, should be pretty specific
+ //Log.d(TAG, "Found Service: "+ service.service.getClassName());
+ if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SDL_ROUTER_SERVICE_CLASS_NAME) && AndroidTools.isServiceExported(context, service.service)) {
+ runningBluetoothServicePackage.add(service.service); //Store which instance is running
+ }
+ }
+ return runningBluetoothServicePackage.size() > 0;
+
+ }
+
+ /**
+ * Attempts to ping a running router service. It does call startForegroundService so it is
* important to only call this as a ping if the service is already started.
- * @param context A context to access Android system services through.
- * @param packageName Package name for service to ping
- * @param className Class name for service to ping
- */
- protected static void pingRouterService(Context context, String packageName, String className){
- if(context == null || packageName == null || className == null){
- return;
- }
- try{
- Intent intent = new Intent();
- intent.setClassName(packageName, className);
- intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
- intent.putExtra(FOREGROUND_EXTRA, true);
- DebugTool.logInfo(TAG, "Attempting to startForegroundService - " + System.currentTimeMillis());
- setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
- context.startForegroundService(intent);
- }else {
- context.startService(intent);
- }
- }catch(SecurityException e){
- DebugTool.logError(TAG, "Security exception, process is bad");
- // This service could not be started
- }
- }
-
- /**
- * This call will reach out to all SDL related router services to check if they're connected. If a the router service is connected, it will react by pinging all clients. This receiver will then
- * receive that ping and if the router service is trusted, the onSdlEnabled method will be called.
- * @param context
- */
- public static void queryForConnectedService(final Context context){
- if (AndroidTools.isDebugMode(context)) {
- int flag = 0;
- if(localRouterClass == null) {
- flag = IntegrationValidator.FLAG_SKIP_ROUTER_SERVICE_CHECK;
- }
-
- IntegrationValidator.ValidationResult result = IntegrationValidator.validate(context, localRouterClass, flag);
- if(!result.isSuccessful()){
- throw new RuntimeException(result.getResultText());
- }
- }
- //Leverage existing call. Include ping bit
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
- ServiceFinder finder = new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
- @Override
- public void onComplete(Vector<ComponentName> routerServices) {
- runningBluetoothServicePackage = new Vector<>();
- runningBluetoothServicePackage.addAll(routerServices);
- requestTransportStatus(context,null,true,false);
- }
- });
-
- }else{
- requestTransportStatus(context,null,true,true);
- }
- }
- /**
- * If a Router Service is running, this method determines if that service is connected to a device over some form of transport.
- * @param context A context to access Android system services through. If null is passed, this will always return false
- * @param callback Use this callback to find out if the router service is connected or not.
- */
- private static void requestTransportStatus(Context context, final SdlRouterStatusProvider.ConnectedStatusCallback callback, final boolean triggerRouterServicePing, final boolean lookForServices){
- if(context == null){
- if(callback!=null){
- callback.onConnectionStatusUpdate(false, null,context);
- }
- return;
- }
- if((!lookForServices || isRouterServiceRunning(context)) && !runningBluetoothServicePackage.isEmpty()){ //So there is a service up, let's see if it's connected
- final ConcurrentLinkedQueue<ComponentName> list = new ConcurrentLinkedQueue<>(runningBluetoothServicePackage);
- final SdlRouterStatusProvider.ConnectedStatusCallback sdlBrCallback = new SdlRouterStatusProvider.ConnectedStatusCallback() {
-
- @Override
- public void onConnectionStatusUpdate(boolean connected, ComponentName service,Context context) {
- if(!connected && !list.isEmpty()){
- SdlRouterStatusProvider provider = new SdlRouterStatusProvider(context,list.poll(), this);
- if(triggerRouterServicePing){provider.setFlags(TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING); }
- provider.checkIsConnected();
- }else{
- if(service!=null){
- DebugTool.logInfo(TAG, service.getPackageName() + " is connected = " + connected);
- }else{
- DebugTool.logInfo(TAG, "No service is connected/running");
- }
- if(callback!=null){
- callback.onConnectionStatusUpdate(connected, service,context);
- }
- list.clear();
- }
-
- }
- };
- final SdlRouterStatusProvider provider = new SdlRouterStatusProvider(context,list.poll(),sdlBrCallback);
- if(triggerRouterServicePing){
- provider.setFlags(TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING);
- }
- //Lets ensure we have a current list of trusted router services
- RouterServiceValidator.createTrustedListRequest(context, false, new TrustedListCallback(){
- @Override
- public void onListObtained(boolean successful) {
- //This will kick off our check of router services
- provider.checkIsConnected();
- }
- });
-
- }else{
- DebugTool.logWarning(TAG, "Router service isn't running, returning false.");
- if(isBluetoothConnected()){
- DebugTool.logInfo(TAG, "Bluetooth is connected. Attempting to ping Router Service");
- Intent serviceIntent = new Intent();
- serviceIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
- serviceIntent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- AndroidTools.sendExplicitBroadcast(context, serviceIntent,null);
- }
-
- if(callback!=null){
- callback.onConnectionStatusUpdate(false, null,context);
- }
- }
- }
-
- @SuppressWarnings({"MissingPermission"})
- private static boolean isBluetoothConnected() {
- BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- if(bluetoothAdapter != null && bluetoothAdapter.isEnabled()) {
- int a2dpState = bluetoothAdapter.getProfileConnectionState(BluetoothProfile.A2DP);
- int headSetState = bluetoothAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
-
- return ((a2dpState == BluetoothAdapter.STATE_CONNECTED || a2dpState == BluetoothAdapter.STATE_CONNECTING)
- && (headSetState == BluetoothAdapter.STATE_CONNECTED || headSetState == BluetoothAdapter.STATE_CONNECTING));
- }
- return false;
- }
-
-
- private static SdlDeviceListener getSdlDeviceListener(Context context, BluetoothDevice bluetoothDevice){
-
- synchronized (DEVICE_LISTENER_LOCK){
- if (sdlDeviceListener == null){
- sdlDeviceListener = new SdlDeviceListener(context, bluetoothDevice, new SdlDeviceListener.Callback() {
- @Override
- public boolean onTransportConnected(Context context, BluetoothDevice bluetoothDevice) {
-
- synchronized (DEVICE_LISTENER_LOCK){
- sdlDeviceListener = null;
- if(context != null) {
- final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
- if(sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
- ComponentName routerService = sdlAppInfoList.get(0).getRouterServiceComponentName();
- startRouterService(context, routerService, false, bluetoothDevice, true);
- }
- }
- }
-
- return false;
- }
-
- @Override
- public void onTransportDisconnected(BluetoothDevice bluetoothDevice) {
- synchronized (DEVICE_LISTENER_LOCK){
- sdlDeviceListener = null;
- }
- }
-
- @Override
- public void onTransportError(BluetoothDevice bluetoothDevice) {
- synchronized (DEVICE_LISTENER_LOCK){
- sdlDeviceListener = null;
- }
- }
- });
- }
- }
-
- return sdlDeviceListener;
- }
-
- public static ComponentName consumeQueuedRouterService(){
- synchronized(QUEUED_SERVICE_LOCK){
- ComponentName retVal = queuedService;
- queuedService = null;
- return retVal;
- }
- }
-
- /**
- * We need to define this for local copy of the Sdl Router Service class.
- * It will be the main point of connection for Sdl enabled apps
- * @return Return the local copy of SdlRouterService.class
- * {@inheritDoc}
- */
- public abstract Class<? extends SdlRouterService> defineLocalSdlRouterClass();
-
-
-
- /**
- *
- * The developer will need to define exactly what should happen when Sdl is enabled.
- * This method will only get called when a Sdl session is initiated.
- * <p> The most useful code here would be to start the activity or service that handles most of the Livio
- * Connect code.
- * @param context this is the context that was passed to this receiver when it was called.
- * @param intent this is the intent that alerted this broadcast. Make sure to pass all extra it came with to your service/activity
- * {@inheritDoc}
- */
- public abstract void onSdlEnabled(Context context, Intent intent);
-
- //public abstract void onSdlDisabled(Context context); //Removing for now until we're able to abstract from developer
+ *
+ * @param context A context to access Android system services through.
+ * @param packageName Package name for service to ping
+ * @param className Class name for service to ping
+ */
+ protected static void pingRouterService(Context context, String packageName, String className) {
+ if (context == null || packageName == null || className == null) {
+ return;
+ }
+ try {
+ Intent intent = new Intent();
+ intent.setClassName(packageName, className);
+ intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ intent.putExtra(FOREGROUND_EXTRA, true);
+ DebugTool.logInfo(TAG, "Attempting to startForegroundService - " + System.currentTimeMillis());
+ setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
+ context.startForegroundService(intent);
+ } else {
+ context.startService(intent);
+ }
+ } catch (SecurityException e) {
+ DebugTool.logError(TAG, "Security exception, process is bad");
+ // This service could not be started
+ }
+ }
+
+ /**
+ * This call will reach out to all SDL related router services to check if they're connected. If a the router service is connected, it will react by pinging all clients. This receiver will then
+ * receive that ping and if the router service is trusted, the onSdlEnabled method will be called.
+ *
+ * @param context
+ */
+ public static void queryForConnectedService(final Context context) {
+ if (AndroidTools.isDebugMode(context)) {
+ int flag = 0;
+ if (localRouterClass == null) {
+ flag = IntegrationValidator.FLAG_SKIP_ROUTER_SERVICE_CHECK;
+ }
+
+ IntegrationValidator.ValidationResult result = IntegrationValidator.validate(context, localRouterClass, flag);
+ if (!result.isSuccessful()) {
+ throw new RuntimeException(result.getResultText());
+ }
+ }
+ //Leverage existing call. Include ping bit
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ ServiceFinder finder = new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
+ @Override
+ public void onComplete(Vector<ComponentName> routerServices) {
+ runningBluetoothServicePackage = new Vector<>();
+ runningBluetoothServicePackage.addAll(routerServices);
+ requestTransportStatus(context, null, true, false);
+ }
+ });
+
+ } else {
+ requestTransportStatus(context, null, true, true);
+ }
+ }
+
+ /**
+ * If a Router Service is running, this method determines if that service is connected to a device over some form of transport.
+ *
+ * @param context A context to access Android system services through. If null is passed, this will always return false
+ * @param callback Use this callback to find out if the router service is connected or not.
+ */
+ private static void requestTransportStatus(Context context, final SdlRouterStatusProvider.ConnectedStatusCallback callback, final boolean triggerRouterServicePing, final boolean lookForServices) {
+ if (context == null) {
+ if (callback != null) {
+ callback.onConnectionStatusUpdate(false, null, context);
+ }
+ return;
+ }
+ if ((!lookForServices || isRouterServiceRunning(context)) && !runningBluetoothServicePackage.isEmpty()) { //So there is a service up, let's see if it's connected
+ final ConcurrentLinkedQueue<ComponentName> list = new ConcurrentLinkedQueue<>(runningBluetoothServicePackage);
+ final SdlRouterStatusProvider.ConnectedStatusCallback sdlBrCallback = new SdlRouterStatusProvider.ConnectedStatusCallback() {
+
+ @Override
+ public void onConnectionStatusUpdate(boolean connected, ComponentName service, Context context) {
+ if (!connected && !list.isEmpty()) {
+ SdlRouterStatusProvider provider = new SdlRouterStatusProvider(context, list.poll(), this);
+ if (triggerRouterServicePing) {
+ provider.setFlags(TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING);
+ }
+ provider.checkIsConnected();
+ } else {
+ if (service != null) {
+ DebugTool.logInfo(TAG, service.getPackageName() + " is connected = " + connected);
+ } else {
+ DebugTool.logInfo(TAG, "No service is connected/running");
+ }
+ if (callback != null) {
+ callback.onConnectionStatusUpdate(connected, service, context);
+ }
+ list.clear();
+ }
+
+ }
+ };
+ final SdlRouterStatusProvider provider = new SdlRouterStatusProvider(context, list.poll(), sdlBrCallback);
+ if (triggerRouterServicePing) {
+ provider.setFlags(TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING);
+ }
+ //Lets ensure we have a current list of trusted router services
+ RouterServiceValidator.createTrustedListRequest(context, false, new TrustedListCallback() {
+ @Override
+ public void onListObtained(boolean successful) {
+ //This will kick off our check of router services
+ provider.checkIsConnected();
+ }
+ });
+
+ } else {
+ DebugTool.logWarning(TAG, "Router service isn't running, returning false.");
+ if (isBluetoothConnected()) {
+ DebugTool.logInfo(TAG, "Bluetooth is connected. Attempting to ping Router Service");
+ Intent serviceIntent = new Intent();
+ serviceIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ serviceIntent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
+ AndroidTools.sendExplicitBroadcast(context, serviceIntent, null);
+ }
+
+ if (callback != null) {
+ callback.onConnectionStatusUpdate(false, null, context);
+ }
+ }
+ }
+
+ @SuppressWarnings({"MissingPermission"})
+ private static boolean isBluetoothConnected() {
+ BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (bluetoothAdapter != null && bluetoothAdapter.isEnabled()) {
+ int a2dpState = bluetoothAdapter.getProfileConnectionState(BluetoothProfile.A2DP);
+ int headSetState = bluetoothAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
+
+ return ((a2dpState == BluetoothAdapter.STATE_CONNECTED || a2dpState == BluetoothAdapter.STATE_CONNECTING)
+ && (headSetState == BluetoothAdapter.STATE_CONNECTED || headSetState == BluetoothAdapter.STATE_CONNECTING));
+ }
+ return false;
+ }
+
+
+ private static SdlDeviceListener getSdlDeviceListener(Context context, BluetoothDevice bluetoothDevice) {
+
+ synchronized (DEVICE_LISTENER_LOCK) {
+ if (sdlDeviceListener == null) {
+ sdlDeviceListener = new SdlDeviceListener(context, bluetoothDevice, new SdlDeviceListener.Callback() {
+ @Override
+ public boolean onTransportConnected(Context context, BluetoothDevice bluetoothDevice) {
+
+ synchronized (DEVICE_LISTENER_LOCK) {
+ sdlDeviceListener = null;
+ if (context != null) {
+ final List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
+ ComponentName routerService = sdlAppInfoList.get(0).getRouterServiceComponentName();
+ startRouterService(context, routerService, false, bluetoothDevice, true);
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void onTransportDisconnected(BluetoothDevice bluetoothDevice) {
+ synchronized (DEVICE_LISTENER_LOCK) {
+ sdlDeviceListener = null;
+ }
+ }
+
+ @Override
+ public void onTransportError(BluetoothDevice bluetoothDevice) {
+ synchronized (DEVICE_LISTENER_LOCK) {
+ sdlDeviceListener = null;
+ }
+ }
+ });
+ }
+ }
+
+ return sdlDeviceListener;
+ }
+
+ public static ComponentName consumeQueuedRouterService() {
+ synchronized (QUEUED_SERVICE_LOCK) {
+ ComponentName retVal = queuedService;
+ queuedService = null;
+ return retVal;
+ }
+ }
+
+ /**
+ * We need to define this for local copy of the Sdl Router Service class.
+ * It will be the main point of connection for Sdl enabled apps
+ *
+ * @return Return the local copy of SdlRouterService.class
+ * {@inheritDoc}
+ */
+ public abstract Class<? extends SdlRouterService> defineLocalSdlRouterClass();
+
+
+ /**
+ * The developer will need to define exactly what should happen when Sdl is enabled.
+ * This method will only get called when a Sdl session is initiated.
+ * <p> The most useful code here would be to start the activity or service that handles most of the Livio
+ * Connect code.
+ *
+ * @param context this is the context that was passed to this receiver when it was called.
+ * @param intent this is the intent that alerted this broadcast. Make sure to pass all extra it came with to your service/activity
+ * {@inheritDoc}
+ */
+ public abstract void onSdlEnabled(Context context, Intent intent);
+
+ //public abstract void onSdlDisabled(Context context); //Removing for now until we're able to abstract from developer
}
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 8f569e7a2..49de58abf 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
@@ -130,32 +130,34 @@ import static com.smartdevicelink.transport.TransportConstants.TRANSPORT_DISCONN
/**
* <b>This class should not be modified by anyone outside of the approved contributors of the SmartDeviceLink project.</b>
* This service is a central point of communication between hardware and the registered clients. It will multiplex a single transport
- * to provide a connection for a theoretical infinite amount of SDL sessions.
- * @author Joey Grover
+ * to provide a connection for a theoretical infinite amount of SDL sessions.
*
+ * @author Joey Grover
*/
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess", "Convert2Diamond", "deprecation"})
-public class SdlRouterService extends Service{
-
- private static final String TAG = "Sdl Router Service";
- /**
- * <b> NOTE: DO NOT MODIFY THIS UNLESS YOU KNOW WHAT YOU'RE DOING.</b>
- */
- protected static final int ROUTER_SERVICE_VERSION_NUMBER = 13;
-
- private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
-
- private static final int FOREGROUND_SERVICE_ID = 849;
-
- private static final long CLIENT_PING_DELAY = 1000;
-
- public static final String REGISTER_NEWER_SERVER_INSTANCE_ACTION = "com.sdl.android.newservice";
-
- public static final String SDL_NOTIFICATION_FAQS_PAGE = "https://smartdevicelink.com/en/guides/android/frequently-asked-questions/sdl-notifications/";
-
- public static final String REGISTER_WITH_ROUTER_ACTION = "com.sdl.android.register";
-
- /** Message types sent from the BluetoothReadService Handler */
+public class SdlRouterService extends Service {
+
+ private static final String TAG = "Sdl Router Service";
+ /**
+ * <b> NOTE: DO NOT MODIFY THIS UNLESS YOU KNOW WHAT YOU'RE DOING.</b>
+ */
+ protected static final int ROUTER_SERVICE_VERSION_NUMBER = 13;
+
+ private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
+
+ private static final int FOREGROUND_SERVICE_ID = 849;
+
+ private static final long CLIENT_PING_DELAY = 1000;
+
+ public static final String REGISTER_NEWER_SERVER_INSTANCE_ACTION = "com.sdl.android.newservice";
+
+ public static final String SDL_NOTIFICATION_FAQS_PAGE = "https://smartdevicelink.com/en/guides/android/frequently-asked-questions/sdl-notifications/";
+
+ public static final String REGISTER_WITH_ROUTER_ACTION = "com.sdl.android.register";
+
+ /**
+ * Message types sent from the BluetoothReadService Handler
+ */
public static final int MESSAGE_STATE_CHANGE = 1;
public static final int MESSAGE_READ = 2;
public static final int MESSAGE_WRITE = 3;
@@ -163,1742 +165,1748 @@ public class SdlRouterService extends Service{
public static final int MESSAGE_LOG = 5;
@SuppressWarnings("FieldCanBeLocal")
- private final int UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
-
- /* Bluetooth Transport */
- private MultiplexBluetoothTransport bluetoothTransport = null;
- private final Handler bluetoothHandler = new TransportHandler(this);
+ private final int UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
- /* USB Transport */
- private MultiplexUsbTransport usbTransport;
- private final Handler usbHandler = new TransportHandler(this);
+ /* Bluetooth Transport */
+ private MultiplexBluetoothTransport bluetoothTransport = null;
+ private final Handler bluetoothHandler = new TransportHandler(this);
- /* TCP Transport */
- private MultiplexTcpTransport tcpTransport;
- private final Handler tcpHandler = new TransportHandler(this);
-
- /**
- * Preference location where the service stores known SDL status based on device address
- */
- protected static final String SDL_DEVICE_STATUS_SHARED_PREFS = "sdl.device.status";
- /**
- * Preference location where generic key/values can be stored
- */
- protected static final String SDL_ROUTER_SERVICE_PREFS = "sdl.router.service.prefs";
- protected static final String KEY_AVOID_NOTIFICATION_CHANNEL_DELETE = "avoidNotificationChannelDelete";
+ /* USB Transport */
+ private MultiplexUsbTransport usbTransport;
+ private final Handler usbHandler = new TransportHandler(this);
+ /* TCP Transport */
+ private MultiplexTcpTransport tcpTransport;
+ private final Handler tcpHandler = new TransportHandler(this);
+ /**
+ * Preference location where the service stores known SDL status based on device address
+ */
+ protected static final String SDL_DEVICE_STATUS_SHARED_PREFS = "sdl.device.status";
+ /**
+ * Preference location where generic key/values can be stored
+ */
+ protected static final String SDL_ROUTER_SERVICE_PREFS = "sdl.router.service.prefs";
+ protected static final String KEY_AVOID_NOTIFICATION_CHANNEL_DELETE = "avoidNotificationChannelDelete";
- private static boolean connectAsClient = false;
- private static boolean closing = false;
- private static Thread.UncaughtExceptionHandler routerServiceExceptionHandler = null;
+ private static boolean connectAsClient = false;
+ private static boolean closing = false;
+ private static Thread.UncaughtExceptionHandler routerServiceExceptionHandler = null;
- private Handler altTransportTimerHandler, foregroundTimeoutHandler;
- private Runnable altTransportTimerRunnable, foregroundTimeoutRunnable;
+ private Handler altTransportTimerHandler, foregroundTimeoutHandler;
+ private Runnable altTransportTimerRunnable, foregroundTimeoutRunnable;
private final static int ALT_TRANSPORT_TIMEOUT_RUNNABLE = 30000, FOREGROUND_TIMEOUT = 10000;
private boolean wrongProcess = false;
- private boolean initPassed = false;
- private boolean hasCalledStartForeground = false;
-
- public static HashMap<String,RegisteredApp> registeredApps;
- private SparseArray<String> bluetoothSessionMap, usbSessionMap, tcpSessionMap;
- private SparseIntArray sessionHashIdMap;
- private SparseIntArray cleanedSessionMap;
- private final Object SESSION_LOCK = new Object(), REGISTERED_APPS_LOCK = new Object(),
- PING_COUNT_LOCK = new Object(), FOREGROUND_NOTIFICATION_LOCK = new Object();
-
- private static Messenger altTransportService = null;
-
- private boolean startSequenceComplete = false;
-
- private ExecutorService packetExecutor = null;
- ConcurrentHashMap<TransportType, PacketWriteTaskMaster> packetWriteTaskMasterMap = null;
-
-
- /**
- * This flag is to keep track of if we are currently acting as a foreground service
- */
- private boolean isForeground = false;
-
- private int cachedModuleVersion = -1;
-
- /**
- * Executor for making sure clients are still running during trying times
- */
- private ScheduledExecutorService clientPingExecutor = null;
- Intent pingIntent = null;
- private boolean isPingingClients = false;
- int pingCount = 0;
-
-
- /* **************************************************************************************************************************************
- ****************************************************************************************************************************************
- *********************************************** Broadcast Receivers START **************************************************************
- ****************************************************************************************************************************************
- ****************************************************************************************************************************************/
-
- /** create our receiver from the router service */
- final BroadcastReceiver mainServiceReceiver = new BroadcastReceiver()
- {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- //Let's grab where to reply to this intent at. We will keep it temp right now because we may have to deny registration
- String action =intent.getStringExtra(SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME);
- sendBroadcast(prepareRegistrationIntent(action));
- }
- };
-
- private Intent prepareRegistrationIntent(String action){
- Intent registrationIntent = new Intent();
- registrationIntent.setAction(action);
- registrationIntent.putExtra(TransportConstants.BIND_LOCATION_PACKAGE_NAME_EXTRA, this.getPackageName());
- registrationIntent.putExtra(TransportConstants.BIND_LOCATION_CLASS_NAME_EXTRA, this.getClass().getName());
- registrationIntent.setFlags((Intent.FLAG_RECEIVER_FOREGROUND));
- return registrationIntent;
- }
-
- private void onAppRegistered(RegisteredApp app){
- //Log.enableDebug(receivedIntent.getBooleanExtra(LOG_BASIC_DEBUG_BOOLEAN_EXTRA, false));
- //Log.enableBluetoothTraceLogging(receivedIntent.getBooleanExtra(LOG_TRACE_BT_DEBUG_BOOLEAN_EXTRA, false));
- //Ok this is where we should do some authenticating...maybe.
- //Should we ask for all relevant data in this packet?
- if(bluetoothAvailable()){
- if(startSequenceComplete &&
- !connectAsClient && (bluetoothTransport ==null
- || bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_NONE)){
- DebugTool.logError(TAG, "Serial service not initialized while registering app");
- //Maybe we should try to do a connect here instead
- DebugTool.logInfo(TAG, "Serial service being restarted");
- initBluetoothSerialService();
-
-
- }
- }
-
- DebugTool.logInfo(TAG, app.appId + " has just been registered with SDL Router Service");
- }
-
- /**
- * If the user disconnects the bluetooth device we will want to stop SDL and our current
- * connection through RFCOMM
- */
- final BroadcastReceiver mListenForDisconnect = new BroadcastReceiver()
- {
- @Override
- @SuppressWarnings("MissingPermission")
- public void onReceive(Context context, Intent intent)
- {
- String action = intent.getAction();
- if(action == null){
- DebugTool.logInfo(TAG, "Disconnect received with no action.");
- }else {
- DebugTool.logInfo(TAG, "Disconnect received. Action: " + intent.getAction());
-
- if(action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
- int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
- switch (bluetoothState) {
- case BluetoothAdapter.STATE_TURNING_ON:
- case BluetoothAdapter.STATE_ON:
- //There is nothing to do in the case the adapter is turning on or just switched to on
- return;
- case BluetoothAdapter.STATE_TURNING_OFF:
- case BluetoothAdapter.STATE_OFF:
- DebugTool.logInfo(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
- connectAsClient = false;
- if(!shouldServiceRemainOpen(intent)){
- closeSelf();
- }
- return;
- default:
- break;
- }
- }
- //Otherwise
- connectAsClient = false;
- if (legacyModeEnabled) {
- DebugTool.logInfo(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
- enableLegacyMode(false);
- onTransportDisconnected(new TransportRecord(TransportType.BLUETOOTH,null));
- initBluetoothSerialService();
- }
- }
- }
- };
-
-/* **************************************************************************************************************************************
-*********************************************** Broadcast Receivers End **************************************************************
-****************************************************************************************************************************************/
-
- /* **************************************************************************************************************************************
- *********************************************** Handlers for bound clients **************************************************************
- ****************************************************************************************************************************************/
-
-
- /**
- * Target we publish for clients to send messages to RouterHandler.
- */
- final Messenger routerMessenger = new Messenger(new RouterHandler(this));
-
- /**
- * Handler of incoming messages from clients.
- */
- @SuppressWarnings("Convert2Diamond")
- static class RouterHandler extends Handler {
- final WeakReference<SdlRouterService> provider;
-
- public RouterHandler(SdlRouterService provider){
- this.provider = new WeakReference<SdlRouterService>(provider);
- }
-
- @Override
- public void handleMessage(Message msg) {
- if(this.provider.get() == null){
- return;
- }
- final Bundle receivedBundle = msg.getData();
- Bundle returnBundle;
- final SdlRouterService service = this.provider.get();
-
- switch (msg.what) {
- case TransportConstants.ROUTER_REQUEST_BT_CLIENT_CONNECT:
- if(receivedBundle.getBoolean(TransportConstants.CONNECT_AS_CLIENT_BOOLEAN_EXTRA, false)
- && !connectAsClient){ //We check this flag to make sure we don't try to connect over and over again. On D/C we should set to false
- //Log.d(TAG,"Attempting to connect as bt client");
- BluetoothDevice device = receivedBundle.getParcelable(BluetoothDevice.EXTRA_DEVICE);
- connectAsClient = true;
- if(device==null || !service.bluetoothConnect(device)){
- DebugTool.logError(TAG, "Unable to connect to bluetooth device");
- connectAsClient = false;
- }
- }
- //**************** We don't break here so we can let the app register as well
- case TransportConstants.ROUTER_REGISTER_CLIENT: //msg.arg1 is appId
- //pingClients();
- Message message = Message.obtain();
- message.what = TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE;
- message.arg1 = TransportConstants.REGISTRATION_RESPONSE_SUCESS;
- String appId = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(appId == null){
- appId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
- if(appId.length()<=0 || msg.replyTo == null){
- DebugTool.logWarning(TAG, "Unable to register app as no id or messenger was included");
- if(msg.replyTo!=null){
- message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED;
- try {
- msg.replyTo.send(message);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- break;
- }
- if(service.legacyModeEnabled){
- DebugTool.logWarning(TAG, "Unable to register app as legacy mode is enabled");
- if(msg.replyTo!=null){
- message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED;
- try {
- msg.replyTo.send(message);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- break;
- }
-
- int routerMessagingVersion = receivedBundle.getInt(TransportConstants.ROUTER_MESSAGING_VERSION,1);
-
- RegisteredApp app = service.new RegisteredApp(appId, routerMessagingVersion, msg.replyTo);
-
- synchronized(service.REGISTERED_APPS_LOCK){
- RegisteredApp old = registeredApps.put(app.getAppId(), app);
- if(old!=null){
- DebugTool.logWarning(TAG, "Replacing already existing app with this app id");
- service.removeAllSessionsForApp(old, true);
- old.close();
- }
- }
- service.onAppRegistered(app);
-
- returnBundle = new Bundle();
- //Add params if connected
- if(service.isPrimaryTransportConnected()){
- ArrayList<TransportRecord> records = service.getConnectedTransports();
- returnBundle.putString(TransportConstants.HARDWARE_CONNECTED, records.get(records.size()-1).getType().name());
- if(app.routerMessagingVersion > 1) {
- returnBundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED, records);
- }
-
- if(service.bluetoothTransport != null){
- returnBundle.putString(CONNECTED_DEVICE_STRING_EXTRA_NAME, service.bluetoothTransport.getDeviceName());
- }
- }
- //Add the version of this router service
- returnBundle.putInt(TransportConstants.ROUTER_SERVICE_VERSION, SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER);
-
- message.setData(returnBundle);
-
- int result = app.sendMessage(message);
- if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
- synchronized(service.REGISTERED_APPS_LOCK){
- registeredApps.remove(appId);
- }
- }
- break;
- case TransportConstants.ROUTER_UNREGISTER_CLIENT:
- String appIdToUnregister = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(appIdToUnregister == null){
- appIdToUnregister = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
- DebugTool.logInfo(TAG, "Unregistering client: " + appIdToUnregister);
- RegisteredApp unregisteredApp;
- synchronized(service.REGISTERED_APPS_LOCK){
- unregisteredApp = registeredApps.remove(appIdToUnregister);
- }
- Message response = Message.obtain();
- response.what = TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE;
- if(unregisteredApp == null){
- response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND;
- service.removeAllSessionsWithAppId(appIdToUnregister);
- }else{
- response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_SUCESS;
- service.removeAllSessionsForApp(unregisteredApp,false);
- }
- DebugTool.logInfo(TAG, "Unregistering client response: " + response.arg1 );
- try {
- msg.replyTo.send(response); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
- } catch (RemoteException e) {
- e.printStackTrace();
-
- }catch(NullPointerException e2){
- DebugTool.logError(TAG, "No reply address included, can't send a reply");
- }
-
- break;
- case TransportConstants.ROUTER_SEND_PACKET:
- //Log.d(TAG, "Received packet to send");
- if(receivedBundle!=null){
- Runnable packetRun = new Runnable(){
- @Override
- public void run() {
- String buffAppId = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(buffAppId == null){
- buffAppId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
+ private boolean initPassed = false;
+ private boolean hasCalledStartForeground = false;
+
+ public static HashMap<String, RegisteredApp> registeredApps;
+ private SparseArray<String> bluetoothSessionMap, usbSessionMap, tcpSessionMap;
+ private SparseIntArray sessionHashIdMap;
+ private SparseIntArray cleanedSessionMap;
+ private final Object SESSION_LOCK = new Object(), REGISTERED_APPS_LOCK = new Object(),
+ PING_COUNT_LOCK = new Object(), FOREGROUND_NOTIFICATION_LOCK = new Object();
+
+ private static Messenger altTransportService = null;
+
+ private boolean startSequenceComplete = false;
+
+ private ExecutorService packetExecutor = null;
+ ConcurrentHashMap<TransportType, PacketWriteTaskMaster> packetWriteTaskMasterMap = null;
+
- RegisteredApp buffApp;
- synchronized(service.REGISTERED_APPS_LOCK){
- buffApp = registeredApps.get(buffAppId);
+ /**
+ * This flag is to keep track of if we are currently acting as a foreground service
+ */
+ private boolean isForeground = false;
+
+ private int cachedModuleVersion = -1;
+
+ /**
+ * Executor for making sure clients are still running during trying times
+ */
+ private ScheduledExecutorService clientPingExecutor = null;
+ Intent pingIntent = null;
+ private boolean isPingingClients = false;
+ int pingCount = 0;
+
+
+ /* **************************************************************************************************************************************
+ ****************************************************************************************************************************************
+ *********************************************** Broadcast Receivers START **************************************************************
+ ****************************************************************************************************************************************
+ ****************************************************************************************************************************************/
+
+ /**
+ * create our receiver from the router service
+ */
+ final BroadcastReceiver mainServiceReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ //Let's grab where to reply to this intent at. We will keep it temp right now because we may have to deny registration
+ String action = intent.getStringExtra(SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME);
+ sendBroadcast(prepareRegistrationIntent(action));
+ }
+ };
+
+ private Intent prepareRegistrationIntent(String action) {
+ Intent registrationIntent = new Intent();
+ registrationIntent.setAction(action);
+ registrationIntent.putExtra(TransportConstants.BIND_LOCATION_PACKAGE_NAME_EXTRA, this.getPackageName());
+ registrationIntent.putExtra(TransportConstants.BIND_LOCATION_CLASS_NAME_EXTRA, this.getClass().getName());
+ registrationIntent.setFlags((Intent.FLAG_RECEIVER_FOREGROUND));
+ return registrationIntent;
+ }
+
+ private void onAppRegistered(RegisteredApp app) {
+ //Log.enableDebug(receivedIntent.getBooleanExtra(LOG_BASIC_DEBUG_BOOLEAN_EXTRA, false));
+ //Log.enableBluetoothTraceLogging(receivedIntent.getBooleanExtra(LOG_TRACE_BT_DEBUG_BOOLEAN_EXTRA, false));
+ //Ok this is where we should do some authenticating...maybe.
+ //Should we ask for all relevant data in this packet?
+ if (bluetoothAvailable()) {
+ if (startSequenceComplete &&
+ !connectAsClient && (bluetoothTransport == null
+ || bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_NONE)) {
+ DebugTool.logError(TAG, "Serial service not initialized while registering app");
+ //Maybe we should try to do a connect here instead
+ DebugTool.logInfo(TAG, "Serial service being restarted");
+ initBluetoothSerialService();
+
+
+ }
+ }
+
+ DebugTool.logInfo(TAG, app.appId + " has just been registered with SDL Router Service");
+ }
+
+ /**
+ * If the user disconnects the bluetooth device we will want to stop SDL and our current
+ * connection through RFCOMM
+ */
+ final BroadcastReceiver mListenForDisconnect = new BroadcastReceiver() {
+ @Override
+ @SuppressWarnings("MissingPermission")
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (action == null) {
+ DebugTool.logInfo(TAG, "Disconnect received with no action.");
+ } else {
+ DebugTool.logInfo(TAG, "Disconnect received. Action: " + intent.getAction());
+
+ if (action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+ int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ switch (bluetoothState) {
+ case BluetoothAdapter.STATE_TURNING_ON:
+ case BluetoothAdapter.STATE_ON:
+ //There is nothing to do in the case the adapter is turning on or just switched to on
+ return;
+ case BluetoothAdapter.STATE_TURNING_OFF:
+ case BluetoothAdapter.STATE_OFF:
+ DebugTool.logInfo(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
+ connectAsClient = false;
+ if (!shouldServiceRemainOpen(intent)) {
+ closeSelf();
+ }
+ return;
+ default:
+ break;
+ }
+ }
+ //Otherwise
+ connectAsClient = false;
+ if (legacyModeEnabled) {
+ DebugTool.logInfo(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
+ enableLegacyMode(false);
+ onTransportDisconnected(new TransportRecord(TransportType.BLUETOOTH, null));
+ initBluetoothSerialService();
+ }
+ }
+ }
+ };
+
+ /* **************************************************************************************************************************************
+ *********************************************** Broadcast Receivers End **************************************************************
+ ****************************************************************************************************************************************/
+
+ /* **************************************************************************************************************************************
+ *********************************************** Handlers for bound clients **************************************************************
+ ****************************************************************************************************************************************/
+
+
+ /**
+ * Target we publish for clients to send messages to RouterHandler.
+ */
+ final Messenger routerMessenger = new Messenger(new RouterHandler(this));
+
+ /**
+ * Handler of incoming messages from clients.
+ */
+ @SuppressWarnings("Convert2Diamond")
+ static class RouterHandler extends Handler {
+ final WeakReference<SdlRouterService> provider;
+
+ public RouterHandler(SdlRouterService provider) {
+ this.provider = new WeakReference<SdlRouterService>(provider);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ final Bundle receivedBundle = msg.getData();
+ Bundle returnBundle;
+ final SdlRouterService service = this.provider.get();
+
+ switch (msg.what) {
+ case TransportConstants.ROUTER_REQUEST_BT_CLIENT_CONNECT:
+ if (receivedBundle.getBoolean(TransportConstants.CONNECT_AS_CLIENT_BOOLEAN_EXTRA, false)
+ && !connectAsClient) { //We check this flag to make sure we don't try to connect over and over again. On D/C we should set to false
+ //Log.d(TAG,"Attempting to connect as bt client");
+ BluetoothDevice device = receivedBundle.getParcelable(BluetoothDevice.EXTRA_DEVICE);
+ connectAsClient = true;
+ if (device == null || !service.bluetoothConnect(device)) {
+ DebugTool.logError(TAG, "Unable to connect to bluetooth device");
+ connectAsClient = false;
+ }
+ }
+ //**************** We don't break here so we can let the app register as well
+ case TransportConstants.ROUTER_REGISTER_CLIENT: //msg.arg1 is appId
+ //pingClients();
+ Message message = Message.obtain();
+ message.what = TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE;
+ message.arg1 = TransportConstants.REGISTRATION_RESPONSE_SUCESS;
+ String appId = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
+ if (appId == null) {
+ appId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ }
+ if (appId.length() <= 0 || msg.replyTo == null) {
+ DebugTool.logWarning(TAG, "Unable to register app as no id or messenger was included");
+ if (msg.replyTo != null) {
+ message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ }
+ if (service.legacyModeEnabled) {
+ DebugTool.logWarning(TAG, "Unable to register app as legacy mode is enabled");
+ if (msg.replyTo != null) {
+ message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ }
+
+ int routerMessagingVersion = receivedBundle.getInt(TransportConstants.ROUTER_MESSAGING_VERSION, 1);
+
+ RegisteredApp app = service.new RegisteredApp(appId, routerMessagingVersion, msg.replyTo);
+
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ RegisteredApp old = registeredApps.put(app.getAppId(), app);
+ if (old != null) {
+ DebugTool.logWarning(TAG, "Replacing already existing app with this app id");
+ service.removeAllSessionsForApp(old, true);
+ old.close();
+ }
+ }
+ service.onAppRegistered(app);
+
+ returnBundle = new Bundle();
+ //Add params if connected
+ if (service.isPrimaryTransportConnected()) {
+ ArrayList<TransportRecord> records = service.getConnectedTransports();
+ returnBundle.putString(TransportConstants.HARDWARE_CONNECTED, records.get(records.size() - 1).getType().name());
+ if (app.routerMessagingVersion > 1) {
+ returnBundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED, records);
+ }
+
+ if (service.bluetoothTransport != null) {
+ returnBundle.putString(CONNECTED_DEVICE_STRING_EXTRA_NAME, service.bluetoothTransport.getDeviceName());
+ }
+ }
+ //Add the version of this router service
+ returnBundle.putInt(TransportConstants.ROUTER_SERVICE_VERSION, SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER);
+
+ message.setData(returnBundle);
+
+ int result = app.sendMessage(message);
+ if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) {
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ registeredApps.remove(appId);
+ }
+ }
+ break;
+ case TransportConstants.ROUTER_UNREGISTER_CLIENT:
+ String appIdToUnregister = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
+ if (appIdToUnregister == null) {
+ appIdToUnregister = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ }
+ DebugTool.logInfo(TAG, "Unregistering client: " + appIdToUnregister);
+ RegisteredApp unregisteredApp;
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ unregisteredApp = registeredApps.remove(appIdToUnregister);
+ }
+ Message response = Message.obtain();
+ response.what = TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE;
+ if (unregisteredApp == null) {
+ response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND;
+ service.removeAllSessionsWithAppId(appIdToUnregister);
+ } else {
+ response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_SUCESS;
+ service.removeAllSessionsForApp(unregisteredApp, false);
+ }
+ DebugTool.logInfo(TAG, "Unregistering client response: " + response.arg1);
+ try {
+ msg.replyTo.send(response); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+
+ } catch (NullPointerException e2) {
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
+ }
+
+ break;
+ case TransportConstants.ROUTER_SEND_PACKET:
+ //Log.d(TAG, "Received packet to send");
+ if (receivedBundle != null) {
+ Runnable packetRun = new Runnable() {
+ @Override
+ public void run() {
+ String buffAppId = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
+ if (buffAppId == null) {
+ buffAppId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ }
+
+ RegisteredApp buffApp;
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ buffApp = registeredApps.get(buffAppId);
+ }
+
+ if (buffApp != null) {
+ buffApp.handleIncommingClientMessage(receivedBundle);
+ } else {
+ TransportType transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
+ if (transportType == null) {
+
+ /* We check bluetooth first because we assume if this value
+ * isn't included it is an older version of the proxy and
+ * therefore will be expecting this to be bluetooth.
+ */
+ if (service.bluetoothTransport != null && service.bluetoothTransport.isConnected()) {
+ transportType = TransportType.BLUETOOTH;
+ } else if (service.usbTransport != null && service.usbTransport.isConnected()) {
+ transportType = TransportType.USB;
+ } else if (service.tcpTransport != null && service.tcpTransport.isConnected()) {
+ transportType = TransportType.TCP;
+ } else {
+ // This means no transport is connected. Likely the
+ // router service has already disconnected and this
+ // is now just executing.
+ DebugTool.logError(TAG, "Can't send packet, no transport specified and none are connected.");
+ return;
+ }
+ //Log.d(TAG, "Transport type was null, so router set it to " + transportType.name());
+ if (transportType != null) {
+ receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
+ }
+ }
+ service.writeBytesToTransport(receivedBundle);
+ }
+ }
+ };
+ if (service.packetExecutor != null) {
+ service.packetExecutor.execute(packetRun);
+ }
+ }
+ break;
+ case TransportConstants.ROUTER_REQUEST_NEW_SESSION:
+ String appIdRequesting = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
+ if (appIdRequesting == null) {
+ appIdRequesting = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ }
+ Message extraSessionResponse = Message.obtain();
+ extraSessionResponse.what = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE;
+ if (appIdRequesting.length() > 0) {
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ if (registeredApps != null) {
+ RegisteredApp appRequesting = registeredApps.get(appIdRequesting);
+ if (appRequesting != null) {
+ //Retrieve the transport the app is requesting a new session
+ String transport = receivedBundle.getString(TransportConstants.TRANSPORT_TYPE);
+ TransportType requestingTransport = null;
+ if (transport != null) {
+ try {
+ requestingTransport = TransportType.valueOf(transport);
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ if (requestingTransport == null) {
+ /* We check bluetooth first because we assume if this value
+ * isn't included it is an older version of the proxy and
+ * therefore will be expecting this to be bluetooth.
+ */
+ if (service.bluetoothTransport != null && service.bluetoothTransport.isConnected()) {
+ requestingTransport = TransportType.BLUETOOTH;
+ } else if (service.usbTransport != null && service.usbTransport.isConnected()) {
+ requestingTransport = TransportType.USB;
+ } else if (service.tcpTransport != null && service.tcpTransport.isConnected()) {
+ requestingTransport = TransportType.TCP;
+ }
+ }
+ appRequesting.getSessionIds().add((long) -1); //Adding an extra session
+ appRequesting.getAwaitingSession().add(requestingTransport);
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS;
+ } else {
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
+ }
+ }
+ }
+ } else {
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
+ }
+ try {
+ msg.replyTo.send(extraSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e2) {
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
+ }
+ break;
+ case TransportConstants.ROUTER_REMOVE_SESSION:
+ String appIdWithSession = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
+ if (appIdWithSession == null) {
+ appIdWithSession = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ }
+ long sessionId = receivedBundle.getLong(TransportConstants.SESSION_ID_EXTRA, -1);
+
+ Message removeSessionResponse = Message.obtain();
+ removeSessionResponse.what = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE;
+ if (appIdWithSession.length() > 0) {
+ if (sessionId >= 0) {
+ synchronized (service.REGISTERED_APPS_LOCK) {
+ if (registeredApps != null) {
+ RegisteredApp appRequesting = registeredApps.get(appIdWithSession);
+ if (appRequesting != null) {
+ //Might need to check which session is on which transport
+ service.removeSessionFromMap((int) sessionId, appRequesting.getTransportsForSession((int) sessionId));
+ if (appRequesting.removeSession(sessionId)) {
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_SUCESS;
+ } else {
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND;
+ }
+ } else {
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
+ }
+ }
+ }
+ } else {
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL;
+ }
+ } else {
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
+ }
+ try {
+ msg.replyTo.send(removeSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e2) {
+ DebugTool.logError(TAG, "No reply address included, can't send a reply");
+ }
+ break;
+ case TransportConstants.ROUTER_REQUEST_SECONDARY_TRANSPORT_CONNECTION:
+ // Currently this only handles one TCP connection
+
+ String ipAddress = receivedBundle.getString(ControlFrameTags.RPC.TransportEventUpdate.TCP_IP_ADDRESS);
+ int port = receivedBundle.getInt(ControlFrameTags.RPC.TransportEventUpdate.TCP_PORT);
+
+ if (ipAddress != null) {
+ if (service.tcpTransport != null) {
+ switch (service.tcpTransport.getState()) {
+ case MultiplexBaseTransport.STATE_CONNECTED:
+ case MultiplexBaseTransport.STATE_CONNECTING:
+ // A TCP connection is currently active. This version of the
+ // router service can't handle multiple TCP transports so just
+ // return a connected message to requester.
+ if (msg.replyTo != null) {
+ // Send a transport connect message to the app that requested
+ // the tcp transport
+ try {
+ msg.replyTo.send(service.createHardwareConnectedMessage(service.tcpTransport.transportRecord));
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
}
+ //Nothing else to do, so return out of this method
+ return;
+
+ case MultiplexBaseTransport.STATE_NONE:
+ case MultiplexBaseTransport.STATE_LISTEN:
+ case MultiplexBaseTransport.STATE_ERROR:
+ //Clear out tcp transport
+ service.tcpTransport.stop(MultiplexBaseTransport.STATE_NONE);
+ service.tcpTransport = null;
+ //Do not return, need to create a new TCP connection
+ }
+
+ }//else { TCP transport does not exists.}
+
+ //TCP transport either doesn't exist or is not connected. Start one up.
+ service.tcpTransport = new MultiplexTcpTransport(port, ipAddress, true, service.tcpHandler, service);
+ service.tcpTransport.start();
+
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+ }
+ }
+
+
+ /**
+ * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
+ */
+ final Messenger altTransportMessenger = new Messenger(new AltTransportHandler(this));
+
+ /**
+ * Handler of incoming messages from an alternative transport (USB).
+ */
+ @SuppressWarnings("Convert2Diamond")
+ static class AltTransportHandler extends Handler {
+ final ClassLoader loader;
+ final WeakReference<SdlRouterService> provider;
+
+ public AltTransportHandler(SdlRouterService provider) {
+ this.provider = new WeakReference<SdlRouterService>(provider);
+ loader = getClass().getClassLoader();
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ SdlRouterService service = this.provider.get();
+ Bundle receivedBundle = msg.getData();
+ switch (msg.what) {
+ case TransportConstants.HARDWARE_CONNECTION_EVENT:
+ if (receivedBundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
+ //We should shut down, so call
+ if (altTransportService != null
+ && altTransportService.equals(msg.replyTo)) {
+ //The same transport that was connected to the router service is now telling us it's disconnected. Let's inform clients and clear our saved messenger
+ altTransportService = null;
+ service.onTransportDisconnected(new TransportRecord(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_DISCONNECTED)), null));
+ service.shouldServiceRemainOpen(null); //this will close the service if bluetooth is not available
+ }
+ } else if (receivedBundle.containsKey(TransportConstants.HARDWARE_CONNECTED)) {
+ Message retMsg = Message.obtain();
+ retMsg.what = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE;
+ if (altTransportService == null) { //Ok no other transport is connected, this is good
+ DebugTool.logInfo(TAG, "Alt transport connected.");
+ if (msg.replyTo == null) {
+ break;
+ }
+ altTransportService = msg.replyTo;
+ //Clear out the timer to make sure the service knows we're good to go
+ if (service.altTransportTimerHandler != null && service.altTransportTimerRunnable != null) {
+ service.altTransportTimerHandler.removeCallbacks(service.altTransportTimerRunnable);
+ }
+ service.altTransportTimerHandler = null;
+ service.altTransportTimerRunnable = null;
+
+ //Let the alt transport know they are good to go
+ retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS;
+ service.onTransportConnected(new TransportRecord(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_CONNECTED)), null));
+
+ } else { //There seems to be some other transport connected
+ //Error
+ retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED;
+ }
+ if (msg.replyTo != null) {
+ try {
+ msg.replyTo.send(retMsg);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ break;
+ case TransportConstants.ROUTER_RECEIVED_PACKET:
+ if (receivedBundle != null) {
+ receivedBundle.setClassLoader(loader);//We do this because loading a custom parcelable object isn't possible without it
+ if (receivedBundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)) {
+ SdlPacket packet = receivedBundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
+ if (packet != null) {
+ service.onPacketRead(packet);
+ } else {
+ DebugTool.logWarning(TAG, "Received null packet from alt transport service");
+ }
+ } else {
+ DebugTool.logWarning(TAG, "False positive packet reception");
+ }
+ } else {
+ DebugTool.logError(TAG, "Bundle was null while sending packet to router service from alt transport");
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+
+ }
+ }
+
+ /**
+ * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
+ */
+ final Messenger routerStatusMessenger = new Messenger(new RouterStatusHandler(this));
+
+ /**
+ * Handler of incoming messages from an alternative transport (USB).
+ */
+ @SuppressWarnings("Convert2Diamond")
+ static class RouterStatusHandler extends Handler {
+ final WeakReference<SdlRouterService> provider;
+
+ public RouterStatusHandler(SdlRouterService provider) {
+ this.provider = new WeakReference<SdlRouterService>(provider);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ SdlRouterService service = this.provider.get();
+ switch (msg.what) {
+ case TransportConstants.ROUTER_STATUS_CONNECTED_STATE_REQUEST:
+ int flags = msg.arg1;
+ if (msg.replyTo != null) {
+ Message message = Message.obtain();
+ message.what = TransportConstants.ROUTER_STATUS_CONNECTED_STATE_RESPONSE;
+ message.arg1 = (service.isPrimaryTransportConnected()) ? 1 : 0;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ if (service.isPrimaryTransportConnected() && ((TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING & flags) == TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING)) {
+ if (service.pingIntent == null) {
+ service.initPingIntent();
+ }
+ AndroidTools.sendExplicitBroadcast(service.getApplicationContext(), service.pingIntent, null);
+ }
+ break;
+ default:
+ DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
+ break;
+ }
+ }
+ }
+
- if(buffApp !=null){
- buffApp.handleIncommingClientMessage(receivedBundle);
- }else{
- TransportType transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
- if(transportType == null){
-
- /* We check bluetooth first because we assume if this value
- * isn't included it is an older version of the proxy and
- * therefore will be expecting this to be bluetooth.
- */
- if(service.bluetoothTransport != null && service.bluetoothTransport.isConnected()){
- transportType = TransportType.BLUETOOTH;
- } else if(service.usbTransport!= null && service.usbTransport.isConnected()){
- transportType = TransportType.USB;
- } else if(service.tcpTransport != null && service.tcpTransport.isConnected()){
- transportType = TransportType.TCP;
- }else{
- // This means no transport is connected. Likely the
- // router service has already disconnected and this
- // is now just executing.
- DebugTool.logError(TAG, "Can't send packet, no transport specified and none are connected.");
- return;
- }
- //Log.d(TAG, "Transport type was null, so router set it to " + transportType.name());
- if(transportType != null){
- receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
- }
- }
- service.writeBytesToTransport(receivedBundle);
+ /**
+ * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
+ */
+ final Messenger usbTransferMessenger = new Messenger(new UsbTransferHandler(this));
+
+ /**
+ * Handler of incoming messages from an alternative transport (USB).
+ */
+ @SuppressWarnings("Convert2Diamond")
+ static class UsbTransferHandler extends Handler {
+ final WeakReference<SdlRouterService> provider;
+ Runnable usbCableDisconnectRunnable;
+ BroadcastReceiver usbCableDisconnectBroadcastReceiver;
+
+ public UsbTransferHandler(SdlRouterService provider) {
+ this.provider = new WeakReference<SdlRouterService>(provider);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ SdlRouterService service = this.provider.get();
+ switch (msg.what) {
+ case TransportConstants.USB_CONNECTED_WITH_DEVICE:
+ service.enterForeground("Opening USB connection", FOREGROUND_TIMEOUT, false);
+ service.resetForegroundTimeOut(FOREGROUND_TIMEOUT);
+ int flags = msg.arg1;
+
+ ParcelFileDescriptor parcelFileDescriptor = (ParcelFileDescriptor) msg.obj;
+
+ if (parcelFileDescriptor != null) {
+ //New USB constructor with PFD
+ service.usbTransport = new MultiplexUsbTransport(parcelFileDescriptor, service.usbHandler, msg.getData());
+
+
+ usbCableDisconnectRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (provider.get() != null && AndroidTools.isUSBCableConnected(provider.get().getApplicationContext())) {
+ provider.get().usbTransport.start();
+ }
+ }
+ };
+ postDelayed(usbCableDisconnectRunnable, 4000);
+
+
+ // Register a BroadcastReceiver to stop USB transport if USB cable got disconnected
+ if (provider.get() != null) {
+ usbCableDisconnectBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
+ if (provider.get() != null && plugged != BatteryManager.BATTERY_PLUGGED_AC && plugged != BatteryManager.BATTERY_PLUGGED_USB) {
+ try {
+ provider.get().getApplicationContext().unregisterReceiver(usbCableDisconnectBroadcastReceiver);
+ } catch (Exception e) {
+ }
+ removeCallbacks(usbCableDisconnectRunnable);
+ if (provider.get().usbTransport != null) {
+ provider.get().usbTransport.stop();
+ }
}
- }
- };
- if(service.packetExecutor !=null){
- service.packetExecutor.execute(packetRun);
- }
- }
- break;
- case TransportConstants.ROUTER_REQUEST_NEW_SESSION:
- String appIdRequesting = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(appIdRequesting == null){
- appIdRequesting = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
- Message extraSessionResponse = Message.obtain();
- extraSessionResponse.what = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE;
- if(appIdRequesting.length()>0){
- synchronized(service.REGISTERED_APPS_LOCK){
- if(registeredApps!=null){
- RegisteredApp appRequesting = registeredApps.get(appIdRequesting);
- if(appRequesting!=null){
- //Retrieve the transport the app is requesting a new session
- String transport = receivedBundle.getString(TransportConstants.TRANSPORT_TYPE);
- TransportType requestingTransport = null;
- if(transport != null){
- try{
- requestingTransport = TransportType.valueOf(transport);
- }catch (IllegalArgumentException e){}
- }
- if(requestingTransport == null){
- /* We check bluetooth first because we assume if this value
- * isn't included it is an older version of the proxy and
- * therefore will be expecting this to be bluetooth.
- */
- if(service.bluetoothTransport != null && service.bluetoothTransport.isConnected()){
- requestingTransport = TransportType.BLUETOOTH;
- }else if(service.usbTransport!= null && service.usbTransport.isConnected()){
- requestingTransport = TransportType.USB;
- }else if(service.tcpTransport != null && service.tcpTransport.isConnected()){
- requestingTransport = TransportType.TCP;
- }
- }
- appRequesting.getSessionIds().add((long)-1); //Adding an extra session
- appRequesting.getAwaitingSession().add(requestingTransport);
- extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS;
- }else{
- extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
- }
- }
- }
- }else{
- extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
- }
- try {
- msg.replyTo.send(extraSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
- } catch (RemoteException e) {
- e.printStackTrace();
- }catch(NullPointerException e2){
- DebugTool.logError(TAG, "No reply address included, can't send a reply");
- }
- break;
- case TransportConstants.ROUTER_REMOVE_SESSION:
- String appIdWithSession = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(appIdWithSession == null){
- appIdWithSession = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
- long sessionId = receivedBundle.getLong(TransportConstants.SESSION_ID_EXTRA, -1);
-
- Message removeSessionResponse = Message.obtain();
- removeSessionResponse.what = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE;
- if(appIdWithSession.length()>0){
- if(sessionId>=0){
- synchronized(service.REGISTERED_APPS_LOCK){
- if(registeredApps!=null){
- RegisteredApp appRequesting = registeredApps.get(appIdWithSession);
- if(appRequesting!=null){
- //Might need to check which session is on which transport
- service.removeSessionFromMap((int)sessionId, appRequesting.getTransportsForSession((int)sessionId));
- if(appRequesting.removeSession(sessionId)){
- removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_SUCESS;
- }else{
- removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND;
- }
- }else{
- removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
- }
- }
- }
- }else{
- removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL;
- }
- }else{
- removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
- }
- try {
- msg.replyTo.send(removeSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
- } catch (RemoteException e) {
- e.printStackTrace();
- }catch(NullPointerException e2){
- DebugTool.logError(TAG, "No reply address included, can't send a reply");
- }
- break;
- case TransportConstants.ROUTER_REQUEST_SECONDARY_TRANSPORT_CONNECTION:
- // Currently this only handles one TCP connection
-
- String ipAddress = receivedBundle.getString(ControlFrameTags.RPC.TransportEventUpdate.TCP_IP_ADDRESS);
- int port = receivedBundle.getInt(ControlFrameTags.RPC.TransportEventUpdate.TCP_PORT);
-
- if(ipAddress != null){
- if(service.tcpTransport != null){
- switch (service.tcpTransport.getState()){
- case MultiplexBaseTransport.STATE_CONNECTED:
- case MultiplexBaseTransport.STATE_CONNECTING:
- // A TCP connection is currently active. This version of the
- // router service can't handle multiple TCP transports so just
- // return a connected message to requester.
- if(msg.replyTo != null){
- // Send a transport connect message to the app that requested
- // the tcp transport
- try {
- msg.replyTo.send(service.createHardwareConnectedMessage(service.tcpTransport.transportRecord));
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- //Nothing else to do, so return out of this method
- return;
-
- case MultiplexBaseTransport.STATE_NONE:
- case MultiplexBaseTransport.STATE_LISTEN:
- case MultiplexBaseTransport.STATE_ERROR:
- //Clear out tcp transport
- service.tcpTransport.stop(MultiplexBaseTransport.STATE_NONE);
- service.tcpTransport = null;
- //Do not return, need to create a new TCP connection
- }
-
- }//else { TCP transport does not exists.}
-
- //TCP transport either doesn't exist or is not connected. Start one up.
- service.tcpTransport = new MultiplexTcpTransport(port, ipAddress, true, service.tcpHandler, service);
- service.tcpTransport.start();
-
- }
- break;
- default:
- super.handleMessage(msg);
- }
- }
- }
-
-
- /**
- * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
- */
- final Messenger altTransportMessenger = new Messenger(new AltTransportHandler(this));
-
- /**
- * Handler of incoming messages from an alternative transport (USB).
- */
- @SuppressWarnings("Convert2Diamond")
- static class AltTransportHandler extends Handler {
- final ClassLoader loader;
- final WeakReference<SdlRouterService> provider;
-
- public AltTransportHandler(SdlRouterService provider){
- this.provider = new WeakReference<SdlRouterService>(provider);
- loader = getClass().getClassLoader();
- }
-
- @Override
- public void handleMessage(Message msg) {
- if(this.provider.get() == null){
- return;
- }
- SdlRouterService service = this.provider.get();
- Bundle receivedBundle = msg.getData();
- switch(msg.what){
- case TransportConstants.HARDWARE_CONNECTION_EVENT:
- if(receivedBundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)){
- //We should shut down, so call
- if(altTransportService != null
- && altTransportService.equals(msg.replyTo)){
- //The same transport that was connected to the router service is now telling us it's disconnected. Let's inform clients and clear our saved messenger
- altTransportService = null;
- service.onTransportDisconnected(new TransportRecord(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_DISCONNECTED)),null));
- service.shouldServiceRemainOpen(null); //this will close the service if bluetooth is not available
- }
- }else if(receivedBundle.containsKey(TransportConstants.HARDWARE_CONNECTED)){
- Message retMsg = Message.obtain();
- retMsg.what = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE;
- if(altTransportService == null){ //Ok no other transport is connected, this is good
- DebugTool.logInfo(TAG, "Alt transport connected.");
- if(msg.replyTo == null){
- break;
- }
- altTransportService = msg.replyTo;
- //Clear out the timer to make sure the service knows we're good to go
- if(service.altTransportTimerHandler!=null && service.altTransportTimerRunnable!=null){
- service.altTransportTimerHandler.removeCallbacks(service.altTransportTimerRunnable);
- }
- service.altTransportTimerHandler = null;
- service.altTransportTimerRunnable = null;
-
- //Let the alt transport know they are good to go
- retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS;
- service.onTransportConnected(new TransportRecord(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_CONNECTED)),null));
-
- }else{ //There seems to be some other transport connected
- //Error
- retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED;
- }
- if(msg.replyTo!=null){
- try {msg.replyTo.send(retMsg);} catch (RemoteException e) {e.printStackTrace();}
- }
- }
- break;
- case TransportConstants.ROUTER_RECEIVED_PACKET:
- if(receivedBundle!=null){
- receivedBundle.setClassLoader(loader);//We do this because loading a custom parcelable object isn't possible without it
- if(receivedBundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)){
- SdlPacket packet = receivedBundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
- if(packet!=null){
- service.onPacketRead(packet);
- }else{
- DebugTool.logWarning(TAG, "Received null packet from alt transport service");
- }
- }else{
- DebugTool.logWarning(TAG, "False positive packet reception");
- }
- }else{
- DebugTool.logError(TAG, "Bundle was null while sending packet to router service from alt transport");
- }
- break;
- default:
- super.handleMessage(msg);
- }
-
- }
- }
-
- /**
- * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
- */
- final Messenger routerStatusMessenger = new Messenger(new RouterStatusHandler(this));
-
- /**
- * Handler of incoming messages from an alternative transport (USB).
- */
- @SuppressWarnings("Convert2Diamond")
- static class RouterStatusHandler extends Handler {
- final WeakReference<SdlRouterService> provider;
-
- public RouterStatusHandler(SdlRouterService provider){
- this.provider = new WeakReference<SdlRouterService>(provider);
- }
-
- @Override
- public void handleMessage(Message msg) {
- if(this.provider.get() == null){
- return;
- }
- SdlRouterService service = this.provider.get();
- switch(msg.what){
- case TransportConstants.ROUTER_STATUS_CONNECTED_STATE_REQUEST:
- int flags = msg.arg1;
- if(msg.replyTo!=null){
- Message message = Message.obtain();
- message.what = TransportConstants.ROUTER_STATUS_CONNECTED_STATE_RESPONSE;
- message.arg1 = (service.isPrimaryTransportConnected()) ? 1 : 0;
- try {
- msg.replyTo.send(message);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- if(service.isPrimaryTransportConnected() && ((TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING & flags) == TransportConstants.ROUTER_STATUS_FLAG_TRIGGER_PING)){
- if(service.pingIntent == null){
- service.initPingIntent();
- }
- AndroidTools.sendExplicitBroadcast(service.getApplicationContext(),service.pingIntent, null);
- }
- break;
- default:
- DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
- break;
- }
- }
- }
-
-
- /**
- * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
- */
- final Messenger usbTransferMessenger = new Messenger(new UsbTransferHandler(this));
-
- /**
- * Handler of incoming messages from an alternative transport (USB).
- */
- @SuppressWarnings("Convert2Diamond")
- static class UsbTransferHandler extends Handler {
- final WeakReference<SdlRouterService> provider;
- Runnable usbCableDisconnectRunnable;
- BroadcastReceiver usbCableDisconnectBroadcastReceiver;
-
- public UsbTransferHandler(SdlRouterService provider){
- this.provider = new WeakReference<SdlRouterService>(provider);
- }
-
- @Override
- public void handleMessage(Message msg) {
- if(this.provider.get() == null){
- return;
- }
- SdlRouterService service = this.provider.get();
- switch(msg.what){
- case TransportConstants.USB_CONNECTED_WITH_DEVICE:
- service.enterForeground("Opening USB connection",FOREGROUND_TIMEOUT,false);
- service.resetForegroundTimeOut(FOREGROUND_TIMEOUT);
- int flags = msg.arg1;
-
- ParcelFileDescriptor parcelFileDescriptor = (ParcelFileDescriptor)msg.obj;
-
- if(parcelFileDescriptor != null) {
- //New USB constructor with PFD
- service.usbTransport = new MultiplexUsbTransport(parcelFileDescriptor, service.usbHandler, msg.getData());
-
-
- usbCableDisconnectRunnable = new Runnable() {
- @Override
- public void run() {
- if(provider.get() != null && AndroidTools.isUSBCableConnected(provider.get().getApplicationContext())) {
- provider.get().usbTransport.start();
- }
- }
- };
- postDelayed(usbCableDisconnectRunnable, 4000);
-
-
- // Register a BroadcastReceiver to stop USB transport if USB cable got disconnected
- if (provider.get() != null) {
- usbCableDisconnectBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
- if (provider.get()!= null && plugged != BatteryManager.BATTERY_PLUGGED_AC && plugged != BatteryManager.BATTERY_PLUGGED_USB) {
- try {
- provider.get().getApplicationContext().unregisterReceiver(usbCableDisconnectBroadcastReceiver);
- } catch (Exception e){ }
- removeCallbacks(usbCableDisconnectRunnable);
- if (provider.get().usbTransport != null) {
- provider.get().usbTransport.stop();
- }
- }
- }
- };
- provider.get().getApplicationContext().registerReceiver(usbCableDisconnectBroadcastReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
- }
-
-
- }
-
- if(msg.replyTo!=null){
- Message message = Message.obtain();
- message.what = TransportConstants.ROUTER_USB_ACC_RECEIVED;
- try {
- msg.replyTo.send(message);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- break;
- case TransportConstants.ALT_TRANSPORT_CONNECTED:
- break;
- default:
- DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
- break;
- }
- }
- }
-
-/* **************************************************************************************************************************************
-*********************************************** Life Cycle **************************************************************
-****************************************************************************************************************************************/
-
- @Override
- public IBinder onBind(Intent intent) {
- //Check intent to send back the correct binder (client binding vs alt transport)
- if(intent!=null){
- if(closing){
- DebugTool.logWarning(TAG, "Denying bind request due to service shutting down.");
- return null;
- }
- String requestType = intent.getAction();//intent.getIntExtra(TransportConstants.ROUTER_BIND_REQUEST_TYPE_EXTRA, TransportConstants.BIND_REQUEST_TYPE_CLIENT);
- if(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(requestType)){
- if(0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)){ //Only allow alt transport in debug mode
- return this.altTransportMessenger.getBinder();
- }
- }else if(TransportConstants.BIND_REQUEST_TYPE_CLIENT.equals(requestType)){
- return this.routerMessenger.getBinder();
- }else if(TransportConstants.BIND_REQUEST_TYPE_STATUS.equals(requestType)){
- return this.routerStatusMessenger.getBinder();
- }else if(TransportConstants.BIND_REQUEST_TYPE_USB_PROVIDER.equals(requestType)){
- return this.usbTransferMessenger.getBinder();
- }else{
- DebugTool.logWarning(TAG, "Unknown bind request type");
- }
-
- }
- return null;
- }
-
-
-
- @Override
- public boolean onUnbind(Intent intent) {
- DebugTool.logInfo(TAG, "Unbind being called.");
- return super.onUnbind(intent);
- }
-
-
- private void notifyClients(final Message message){
- if(message==null){
- DebugTool.logWarning(TAG, "Can't notify clients, message was null");
- return;
- }
- DebugTool.logInfo(TAG, "Notifying "+ registeredApps.size()+ " clients");
- int result;
- synchronized(REGISTERED_APPS_LOCK){
- Collection<RegisteredApp> apps = registeredApps.values();
- Iterator<RegisteredApp> it = apps.iterator();
- Message formattedMessage = new Message();
- while(it.hasNext()){
- RegisteredApp app = it.next();
- formattedMessage.copyFrom(message);
- //Format the message for the receiving app and appropriate messaging version
- if(formatMessage(app, formattedMessage)) {
- result = app.sendMessage(formattedMessage);
- if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) {
- app.close();
- it.remove();
- }
- }
- }
-
- }
- }
-
- /**
- * Formats the message for the app that is to receive it
- * @param app
- * @param message
- * @return if the message should be sent or not
- */
- protected boolean formatMessage(RegisteredApp app, Message message){
- if( app.routerMessagingVersion <= 1){
- Bundle bundle = message.getData();
- if (bundle != null){
- if(message.what == TransportConstants.HARDWARE_CONNECTION_EVENT) {
-
- switch (message.arg1){
- case TransportConstants.HARDWARE_CONNECTION_EVENT_CONNECTED:
- if(app.isRegisteredOnTransport(-1, null)){
- //App is already registered on a transport and does not need this update
- return false;
- }
- break;
- case TransportConstants.HARDWARE_CONNECTION_EVENT_DISCONNECTED:
- if(bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)){
- TransportType transportType = TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_DISCONNECTED));
- if(!app.isRegisteredOnTransport(-1, transportType)){
- //App is not registered on this transport, not sending
- return false;
- }
- }
- if (bundle.containsKey(TransportConstants.TRANSPORT_DISCONNECTED)) {
- //Unable to handle new parcel TransportRecord
- bundle.remove(TransportConstants.TRANSPORT_DISCONNECTED);
- }
- break;
- }
-
- //All connection event messages should have this as part of the bundle
- if (bundle.containsKey(TransportConstants.CURRENT_HARDWARE_CONNECTED)) {
- //Unable to handle new parcel TransportRecord
- bundle.remove(TransportConstants.CURRENT_HARDWARE_CONNECTED);
- }
-
-
- }
- }
- }
- return true;
- }
-
- private void pingClients(){
- Message message = Message.obtain();
- DebugTool.logInfo(TAG, "Pinging "+ registeredApps.size()+ " clients");
- int result;
- synchronized(REGISTERED_APPS_LOCK){
- Collection<RegisteredApp> apps = registeredApps.values();
- Iterator<RegisteredApp> it = apps.iterator();
- while(it.hasNext()){
- RegisteredApp app = it.next();
- result = app.sendMessage(message);
- if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
- app.close();
- Vector<Long> sessions = app.getSessionIds();
- for(Long session:sessions){
- if(session !=null && session != -1){
- List<TransportType> transportTypes = app.getTransportsForSession(session.intValue());
- if(transportTypes != null && transportTypes.size() > 0){
- attemptToCleanUpModule(session.intValue(), cachedModuleVersion, transportTypes.get(0) );
- }
- }
- }
- it.remove();
- }
- }
- }
- }
-
- /**
- * We want to make sure we are in the right process here. If there is some sort of developer error
- * we want to just close out right away.
- * @return if this service is executing in the correct process
- */
- private boolean processCheck(){
- int myPid = android.os.Process.myPid();
- ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
- if(am == null || am.getRunningAppProcesses() == null)
- return false; // No RunningAppProcesses, let's close out
- for (RunningAppProcessInfo processInfo : am.getRunningAppProcesses())
- {
- if (processInfo != null && processInfo.pid == myPid)
- {
- return ROUTER_SERVICE_PROCESS.equals(processInfo.processName);
- }
- }
- return false;
-
- }
-
- @SuppressWarnings("SameParameterValue")
- private boolean permissionCheck(String permissionToCheck){
- if(permissionToCheck == null){
- throw new IllegalArgumentException("permission is null");
- }
- return PackageManager.PERMISSION_GRANTED == getBaseContext().checkPermission(permissionToCheck, android.os.Process.myPid(), android.os.Process.myUid());
- }
-
- /**
- * Runs several checks to ensure this router service has the correct conditions to run properly
- * @return true if this service is set up correctly
- */
- private boolean initCheck(){
- if(!processCheck()){
- DebugTool.logError(TAG, "Not using correct process. Shutting down");
- wrongProcess = true;
- return false;
- }
- if(!permissionCheck(Manifest.permission.BLUETOOTH)){
- DebugTool.logError(TAG, "Bluetooth Permission is not granted. Shutting down");
- return false;
- }
- if(!AndroidTools.isServiceExported(this, new ComponentName(this, this.getClass()))){ //We want to check to see if our service is actually exported
- DebugTool.logError(TAG, "Service isn't exported. Shutting down");
- return false;
- }
- return true;
- }
-
-
- @Override
- public void onCreate() {
- super.onCreate();
- if (AndroidTools.isDebugMode(getApplicationContext())) {
- IntegrationValidator.ValidationResult result = IntegrationValidator.validate(getApplicationContext(), this.getClass(), 0);
- if(!result.isSuccessful()) {
- throw new RuntimeException(result.getResultText());
- }
- }
- //Add this first to avoid the runtime exceptions for the entire lifecycle of the service
- setRouterServiceExceptionHandler();
- //This must be done regardless of if this service shuts down or not
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- hasCalledStartForeground = false;
- enterForeground("Waiting for connection...", FOREGROUND_TIMEOUT/1000, false);
- hasCalledStartForeground = true;
- resetForegroundTimeOut(FOREGROUND_TIMEOUT/1000);
- }
-
-
- if(!initCheck()){ // Run checks on process and permissions
- deployNextRouterService();
- closeSelf();
- return;
- }
- initPassed = true;
-
-
- synchronized(REGISTERED_APPS_LOCK){
- registeredApps = new HashMap<String,RegisteredApp>();
- }
- closing = false;
-
- synchronized(SESSION_LOCK){
- this.bluetoothSessionMap = new SparseArray<String>();
- this.sessionHashIdMap = new SparseIntArray();
- this.cleanedSessionMap = new SparseIntArray();
- }
-
- packetExecutor = Executors.newSingleThreadExecutor();
-
- startUpSequence();
- }
-
- /**
- * The method will attempt to start up the next router service in line based on the sorting criteria of best router service.
- */
- protected void deployNextRouterService(){
- List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(getApplicationContext(), new SdlAppInfo.BestRouterComparator());
- if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
- ComponentName name = new ComponentName(this, this.getClass());
- SdlAppInfo info;
- int listSize = sdlAppInfoList.size();
- for(int i = 0; i < listSize; i++) {
- info = sdlAppInfoList.get(i);
- if(info.getRouterServiceComponentName().equals(name) && listSize > i + 1){
- SdlAppInfo nextUp = sdlAppInfoList.get(i+1);
- Intent serviceIntent = new Intent();
- serviceIntent.setComponent(nextUp.getRouterServiceComponentName());
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- startService(serviceIntent);
- }else{
- try{
- startForegroundService(serviceIntent);
- }catch (Exception e){
- DebugTool.logError(TAG, "Unable to start next SDL router service. " + e.getMessage());
- }
- }
- break;
-
- }
- }
- } else{
- DebugTool.logInfo(TAG, "No sdl apps found");
- return;
- }
- closing = true;
- closeBluetoothSerialServer();
- notifyAltTransportOfClose(TransportConstants.ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE);
- }
-
- public void startUpSequence(){
- IntentFilter disconnectFilter = new IntentFilter();
- disconnectFilter.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
- disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
- disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
- disconnectFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
- registerReceiver(mListenForDisconnect,disconnectFilter );
-
- IntentFilter filter = new IntentFilter();
- filter.addAction(REGISTER_WITH_ROUTER_ACTION);
- registerReceiver(mainServiceReceiver,filter);
-
- if(!connectAsClient){
- if(bluetoothAvailable()){
- initBluetoothSerialService();
- }
- }
-
- if(altTransportTimerHandler!=null){
- //There's an alt transport waiting for this service to be started
- Intent intent = new Intent(TransportConstants.ALT_TRANSPORT_RECEIVER);
- sendBroadcast(intent);
- }
-
- startSequenceComplete= true;
- }
-
- /**
- * This method will set a new UncaughtExceptionHandler for the current thread. The only
- * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
- * a specific mobile device/OS can't properly handle the deletion and creation of the foreground
- * notification channel that is necessary for foreground services after Android Oreo.
- * The new UncaughtExceptionHandler will catch that specific exception and tell the
- * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
- * an ANR to the app that makes the startForegroundService call. It will set a flag that will
- * prevent the channel from being deleted in the future and therefore avoiding this exception.
- */
- protected void setRouterServiceExceptionHandler() {
- final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
- if (defaultUncaughtExceptionHandler != routerServiceExceptionHandler) {
- routerServiceExceptionHandler = new Thread.UncaughtExceptionHandler() {
- @Override
- public void uncaughtException(Thread t, Throwable e) {
- if (e != null
- && e instanceof AndroidRuntimeException
- && "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
- && e.getMessage() != null
- && e.getMessage().contains("invalid channel for service notification")) { //This is the message received in the exception for notification channel issues
-
- // Set the flag to not delete the notification channel to avoid this exception in the future
- try{
- SdlRouterService.this.setSdlRouterServicePrefs(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE, true);
- }catch (Exception exception){
- //Unable to save flag for KEY_AVOID_NOTIFICATION_CHANNEL_DELETE
- }
- Looper.loop();
- } else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
- defaultUncaughtExceptionHandler.uncaughtException(t, e);
- }
- }
- };
- Thread.setDefaultUncaughtExceptionHandler(routerServiceExceptionHandler);
- }
- }
-
-
- @SuppressLint({"NewApi", "MissingPermission"})
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- if(intent != null ){
- if(intent.getBooleanExtra(FOREGROUND_EXTRA, false)){
- hasCalledStartForeground = false;
-
- if (!this.isPrimaryTransportConnected()) { //If there is no transport connected we need to ensure the service is moved to the foreground
- String address = null;
- if(intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)){
- BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
- if(device != null){
- address = device.getAddress();
- }
- }
- boolean confirmedDevice = intent.getBooleanExtra(TransportConstants.CONFIRMED_SDL_DEVICE, false);
- int timeout = getNotificationTimeout(address, confirmedDevice);
-
- enterForeground("Waiting for connection...", timeout, false);
- resetForegroundTimeOut(timeout);
- } else {
- enterForeground(createConnectedNotificationText(),0,true);
- }
-
- hasCalledStartForeground = true;
- }
-
- if(intent.hasExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA)){
- //Make sure we are listening on RFCOMM
- if(startSequenceComplete){ //We only check if we are sure we are already through the start up process
- DebugTool.logInfo(TAG, "Received ping, making sure we are listening to bluetooth rfcomm");
- initBluetoothSerialService();
- }
- }
- }
-
- if(!shouldServiceRemainOpen(intent)){
- closeSelf();
- }
-
- if(registeredApps == null){
- synchronized(REGISTERED_APPS_LOCK){
- registeredApps = new HashMap<String,RegisteredApp>();
- }
- }
- return START_REDELIVER_INTENT;
- }
-
- @SuppressWarnings("ConstantConditions")
- @Override
- public void onDestroy(){
- stopClientPings();
-
- if(altTransportTimerHandler!=null){
- altTransportTimerHandler.removeCallbacks(altTransportTimerRunnable);
- altTransportTimerHandler = null;
- }
-
- DebugTool.logWarning(TAG, "Sdl Router Service Destroyed");
- closing = true;
- //No need for this Broadcast Receiver anymore
- unregisterAllReceivers();
- closeBluetoothSerialServer();
- if(registeredApps!=null){
- synchronized(REGISTERED_APPS_LOCK){
- registeredApps.clear();
- registeredApps = null;
- }
- }
- synchronized(SESSION_LOCK){
- if(this.bluetoothSessionMap !=null){
- this.bluetoothSessionMap.clear();
- this.bluetoothSessionMap = null;
- }
- if(this.sessionHashIdMap!=null){
- this.sessionHashIdMap.clear();
- this.sessionHashIdMap = null;
- }
- }
-
- //SESSION_LOCK = null;
-
- startSequenceComplete=false;
- if(packetExecutor !=null){
- packetExecutor.shutdownNow();
- packetExecutor = null;
- }
-
- exitForeground();
- if(packetWriteTaskMasterMap != null && packetWriteTaskMasterMap.values() != null) {
- Collection<PacketWriteTaskMaster> tasks = packetWriteTaskMasterMap.values();
- for (PacketWriteTaskMaster packetWriteTaskMaster : tasks) {
- if (packetWriteTaskMaster != null) {
- packetWriteTaskMaster.close();
- }
- }
- }
- if(packetWriteTaskMasterMap != null){
- packetWriteTaskMasterMap.clear();
- }
- packetWriteTaskMasterMap = null;
-
-
- super.onDestroy();
- System.gc(); //Lower end phones need this hint
- if(!wrongProcess){
- //noinspection EmptyCatchBlock
- try{
- android.os.Process.killProcess(android.os.Process.myPid());
- }catch(Exception e){}
- }
- }
-
- private void unregisterAllReceivers(){
- //noinspection EmptyCatchBlock
- try{
- unregisterReceiver(mListenForDisconnect);
- unregisterReceiver(mainServiceReceiver);
- }catch(Exception e){}
- }
-
- @SuppressWarnings("SameParameterValue")
- private void notifyAltTransportOfClose(int reason){
- if(altTransportService!=null){
- Message msg = Message.obtain();
- msg.what = TransportConstants.ROUTER_SHUTTING_DOWN_NOTIFICATION;
- msg.arg1 = reason;
- try {
- altTransportService.send(msg);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Gets the correct timeout for the foreground notification.
- * @param address the address of the device that is currently connected
- * @return the amount of time for a timeout handler to remove the notification.
- */
- @SuppressLint("MissingPermission")
- private int getNotificationTimeout(String address, boolean confirmedDevice){
- if(address != null){
- if(confirmedDevice || hasSDLConnected(address)){
- return FOREGROUND_TIMEOUT * 2;
- }else if(this.isFirstStatusCheck(address)) {
- // If this is the first time the service has ever connected to this device we want
- // to ensure we have a record of it
- setSDLConnectedStatus(address, false);
- return FOREGROUND_TIMEOUT;
- }
- }
- // If this is a new device or hasn't connected through SDL we want to limit the exposure
- // of the SDL service in the foreground
- return FOREGROUND_TIMEOUT/1000;
- }
-
- public void resetForegroundTimeOut(long delay){
- synchronized (FOREGROUND_NOTIFICATION_LOCK) {
- if (foregroundTimeoutHandler == null) {
- foregroundTimeoutHandler = new Handler();
- }
- if (foregroundTimeoutRunnable == null) {
- foregroundTimeoutRunnable = new Runnable() {
- @Override
- public void run() {
- if(!getConnectedTransports().isEmpty()){
- // Updates notification to one of still connected transport
- enterForeground(createConnectedNotificationText(),0,true);
- return;
- }else{
- exitForeground();//Leave our foreground state as we don't have a connection
-
- }
- }
- };
- } else {
- //This instance likely means there is a callback in the queue so we should remove it
- foregroundTimeoutHandler.removeCallbacks(foregroundTimeoutRunnable);
- }
- foregroundTimeoutHandler.postDelayed(foregroundTimeoutRunnable, delay);
- }
- }
-
- public void cancelForegroundTimeOut(){
- synchronized (FOREGROUND_NOTIFICATION_LOCK) {
- if (foregroundTimeoutHandler != null && foregroundTimeoutRunnable != null) {
- foregroundTimeoutHandler.removeCallbacks(foregroundTimeoutRunnable);
- }
- }
-
- }
-
- @SuppressLint("NewApi")
- private void enterForeground(String content, long chronometerLength, boolean ongoing) {
- DebugTool.logInfo(TAG, "Attempting to enter the foreground - " + System.currentTimeMillis());
-
- Bitmap icon;
- int resourcesIncluded = getResources().getIdentifier("ic_sdl", "drawable", getPackageName());
-
- if ( resourcesIncluded != 0 ) { //No additional pylons required
- icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_sdl);
- }
- else {
- icon = BitmapFactory.decodeResource(getResources(), android.R.drawable.stat_sys_data_bluetooth);
- }
- // Bitmap icon = BitmapFactory.decodeByteArray(SdlLogo.SDL_LOGO_STRING, 0, SdlLogo.SDL_LOGO_STRING.length);
+ }
+ };
+ provider.get().getApplicationContext().registerReceiver(usbCableDisconnectBroadcastReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ }
+
+
+ }
+
+ if (msg.replyTo != null) {
+ Message message = Message.obtain();
+ message.what = TransportConstants.ROUTER_USB_ACC_RECEIVED;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+
+ break;
+ case TransportConstants.ALT_TRANSPORT_CONNECTED:
+ break;
+ default:
+ DebugTool.logWarning(TAG, "Unsupported request: " + msg.what);
+ break;
+ }
+ }
+ }
+
+ /* **************************************************************************************************************************************
+ *********************************************** Life Cycle **************************************************************
+ ****************************************************************************************************************************************/
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ //Check intent to send back the correct binder (client binding vs alt transport)
+ if (intent != null) {
+ if (closing) {
+ DebugTool.logWarning(TAG, "Denying bind request due to service shutting down.");
+ return null;
+ }
+ String requestType = intent.getAction();//intent.getIntExtra(TransportConstants.ROUTER_BIND_REQUEST_TYPE_EXTRA, TransportConstants.BIND_REQUEST_TYPE_CLIENT);
+ if (TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(requestType)) {
+ if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) { //Only allow alt transport in debug mode
+ return this.altTransportMessenger.getBinder();
+ }
+ } else if (TransportConstants.BIND_REQUEST_TYPE_CLIENT.equals(requestType)) {
+ return this.routerMessenger.getBinder();
+ } else if (TransportConstants.BIND_REQUEST_TYPE_STATUS.equals(requestType)) {
+ return this.routerStatusMessenger.getBinder();
+ } else if (TransportConstants.BIND_REQUEST_TYPE_USB_PROVIDER.equals(requestType)) {
+ return this.usbTransferMessenger.getBinder();
+ } else {
+ DebugTool.logWarning(TAG, "Unknown bind request type");
+ }
+
+ }
+ return null;
+ }
+
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ DebugTool.logInfo(TAG, "Unbind being called.");
+ return super.onUnbind(intent);
+ }
+
+
+ private void notifyClients(final Message message) {
+ if (message == null) {
+ DebugTool.logWarning(TAG, "Can't notify clients, message was null");
+ return;
+ }
+ DebugTool.logInfo(TAG, "Notifying " + registeredApps.size() + " clients");
+ int result;
+ synchronized (REGISTERED_APPS_LOCK) {
+ Collection<RegisteredApp> apps = registeredApps.values();
+ Iterator<RegisteredApp> it = apps.iterator();
+ Message formattedMessage = new Message();
+ while (it.hasNext()) {
+ RegisteredApp app = it.next();
+ formattedMessage.copyFrom(message);
+ //Format the message for the receiving app and appropriate messaging version
+ if (formatMessage(app, formattedMessage)) {
+ result = app.sendMessage(formattedMessage);
+ if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) {
+ app.close();
+ it.remove();
+ }
+ }
+ }
+
+ }
+ }
+
+ /**
+ * Formats the message for the app that is to receive it
+ *
+ * @param app
+ * @param message
+ * @return if the message should be sent or not
+ */
+ protected boolean formatMessage(RegisteredApp app, Message message) {
+ if (app.routerMessagingVersion <= 1) {
+ Bundle bundle = message.getData();
+ if (bundle != null) {
+ if (message.what == TransportConstants.HARDWARE_CONNECTION_EVENT) {
+
+ switch (message.arg1) {
+ case TransportConstants.HARDWARE_CONNECTION_EVENT_CONNECTED:
+ if (app.isRegisteredOnTransport(-1, null)) {
+ //App is already registered on a transport and does not need this update
+ return false;
+ }
+ break;
+ case TransportConstants.HARDWARE_CONNECTION_EVENT_DISCONNECTED:
+ if (bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
+ TransportType transportType = TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_DISCONNECTED));
+ if (!app.isRegisteredOnTransport(-1, transportType)) {
+ //App is not registered on this transport, not sending
+ return false;
+ }
+ }
+ if (bundle.containsKey(TransportConstants.TRANSPORT_DISCONNECTED)) {
+ //Unable to handle new parcel TransportRecord
+ bundle.remove(TransportConstants.TRANSPORT_DISCONNECTED);
+ }
+ break;
+ }
+
+ //All connection event messages should have this as part of the bundle
+ if (bundle.containsKey(TransportConstants.CURRENT_HARDWARE_CONNECTED)) {
+ //Unable to handle new parcel TransportRecord
+ bundle.remove(TransportConstants.CURRENT_HARDWARE_CONNECTED);
+ }
+
+
+ }
+ }
+ }
+ return true;
+ }
+
+ private void pingClients() {
+ Message message = Message.obtain();
+ DebugTool.logInfo(TAG, "Pinging " + registeredApps.size() + " clients");
+ int result;
+ synchronized (REGISTERED_APPS_LOCK) {
+ Collection<RegisteredApp> apps = registeredApps.values();
+ Iterator<RegisteredApp> it = apps.iterator();
+ while (it.hasNext()) {
+ RegisteredApp app = it.next();
+ result = app.sendMessage(message);
+ if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) {
+ app.close();
+ Vector<Long> sessions = app.getSessionIds();
+ for (Long session : sessions) {
+ if (session != null && session != -1) {
+ List<TransportType> transportTypes = app.getTransportsForSession(session.intValue());
+ if (transportTypes != null && transportTypes.size() > 0) {
+ attemptToCleanUpModule(session.intValue(), cachedModuleVersion, transportTypes.get(0));
+ }
+ }
+ }
+ it.remove();
+ }
+ }
+ }
+ }
+
+ /**
+ * We want to make sure we are in the right process here. If there is some sort of developer error
+ * we want to just close out right away.
+ *
+ * @return if this service is executing in the correct process
+ */
+ private boolean processCheck() {
+ int myPid = android.os.Process.myPid();
+ ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
+ if (am == null || am.getRunningAppProcesses() == null)
+ return false; // No RunningAppProcesses, let's close out
+ for (RunningAppProcessInfo processInfo : am.getRunningAppProcesses()) {
+ if (processInfo != null && processInfo.pid == myPid) {
+ return ROUTER_SERVICE_PROCESS.equals(processInfo.processName);
+ }
+ }
+ return false;
+
+ }
+
+ @SuppressWarnings("SameParameterValue")
+ private boolean permissionCheck(String permissionToCheck) {
+ if (permissionToCheck == null) {
+ throw new IllegalArgumentException("permission is null");
+ }
+ return PackageManager.PERMISSION_GRANTED == getBaseContext().checkPermission(permissionToCheck, android.os.Process.myPid(), android.os.Process.myUid());
+ }
+
+ /**
+ * Runs several checks to ensure this router service has the correct conditions to run properly
+ *
+ * @return true if this service is set up correctly
+ */
+ private boolean initCheck() {
+ if (!processCheck()) {
+ DebugTool.logError(TAG, "Not using correct process. Shutting down");
+ wrongProcess = true;
+ return false;
+ }
+ if (!permissionCheck(Manifest.permission.BLUETOOTH)) {
+ DebugTool.logError(TAG, "Bluetooth Permission is not granted. Shutting down");
+ return false;
+ }
+ if (!AndroidTools.isServiceExported(this, new ComponentName(this, this.getClass()))) { //We want to check to see if our service is actually exported
+ DebugTool.logError(TAG, "Service isn't exported. Shutting down");
+ return false;
+ }
+ return true;
+ }
+
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ if (AndroidTools.isDebugMode(getApplicationContext())) {
+ IntegrationValidator.ValidationResult result = IntegrationValidator.validate(getApplicationContext(), this.getClass(), 0);
+ if (!result.isSuccessful()) {
+ throw new RuntimeException(result.getResultText());
+ }
+ }
+ //Add this first to avoid the runtime exceptions for the entire lifecycle of the service
+ setRouterServiceExceptionHandler();
+ //This must be done regardless of if this service shuts down or not
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ hasCalledStartForeground = false;
+ enterForeground("Waiting for connection...", FOREGROUND_TIMEOUT / 1000, false);
+ hasCalledStartForeground = true;
+ resetForegroundTimeOut(FOREGROUND_TIMEOUT / 1000);
+ }
+
+
+ if (!initCheck()) { // Run checks on process and permissions
+ deployNextRouterService();
+ closeSelf();
+ return;
+ }
+ initPassed = true;
+
+
+ synchronized (REGISTERED_APPS_LOCK) {
+ registeredApps = new HashMap<String, RegisteredApp>();
+ }
+ closing = false;
+
+ synchronized (SESSION_LOCK) {
+ this.bluetoothSessionMap = new SparseArray<String>();
+ this.sessionHashIdMap = new SparseIntArray();
+ this.cleanedSessionMap = new SparseIntArray();
+ }
+
+ packetExecutor = Executors.newSingleThreadExecutor();
+
+ startUpSequence();
+ }
+
+ /**
+ * The method will attempt to start up the next router service in line based on the sorting criteria of best router service.
+ */
+ protected void deployNextRouterService() {
+ List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(getApplicationContext(), new SdlAppInfo.BestRouterComparator());
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
+ ComponentName name = new ComponentName(this, this.getClass());
+ SdlAppInfo info;
+ int listSize = sdlAppInfoList.size();
+ for (int i = 0; i < listSize; i++) {
+ info = sdlAppInfoList.get(i);
+ if (info.getRouterServiceComponentName().equals(name) && listSize > i + 1) {
+ SdlAppInfo nextUp = sdlAppInfoList.get(i + 1);
+ Intent serviceIntent = new Intent();
+ serviceIntent.setComponent(nextUp.getRouterServiceComponentName());
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ startService(serviceIntent);
+ } else {
+ try {
+ startForegroundService(serviceIntent);
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Unable to start next SDL router service. " + e.getMessage());
+ }
+ }
+ break;
+
+ }
+ }
+ } else {
+ DebugTool.logInfo(TAG, "No sdl apps found");
+ return;
+ }
+ closing = true;
+ closeBluetoothSerialServer();
+ notifyAltTransportOfClose(TransportConstants.ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE);
+ }
+
+ public void startUpSequence() {
+ IntentFilter disconnectFilter = new IntentFilter();
+ disconnectFilter.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
+ disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
+ disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
+ disconnectFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ registerReceiver(mListenForDisconnect, disconnectFilter);
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(REGISTER_WITH_ROUTER_ACTION);
+ registerReceiver(mainServiceReceiver, filter);
+
+ if (!connectAsClient) {
+ if (bluetoothAvailable()) {
+ initBluetoothSerialService();
+ }
+ }
+
+ if (altTransportTimerHandler != null) {
+ //There's an alt transport waiting for this service to be started
+ Intent intent = new Intent(TransportConstants.ALT_TRANSPORT_RECEIVER);
+ sendBroadcast(intent);
+ }
+
+ startSequenceComplete = true;
+ }
+
+ /**
+ * This method will set a new UncaughtExceptionHandler for the current thread. The only
+ * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
+ * a specific mobile device/OS can't properly handle the deletion and creation of the foreground
+ * notification channel that is necessary for foreground services after Android Oreo.
+ * The new UncaughtExceptionHandler will catch that specific exception and tell the
+ * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
+ * an ANR to the app that makes the startForegroundService call. It will set a flag that will
+ * prevent the channel from being deleted in the future and therefore avoiding this exception.
+ */
+ protected void setRouterServiceExceptionHandler() {
+ final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+ if (defaultUncaughtExceptionHandler != routerServiceExceptionHandler) {
+ routerServiceExceptionHandler = new Thread.UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ if (e != null
+ && e instanceof AndroidRuntimeException
+ && "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
+ && e.getMessage() != null
+ && e.getMessage().contains("invalid channel for service notification")) { //This is the message received in the exception for notification channel issues
+
+ // Set the flag to not delete the notification channel to avoid this exception in the future
+ try {
+ SdlRouterService.this.setSdlRouterServicePrefs(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE, true);
+ } catch (Exception exception) {
+ //Unable to save flag for KEY_AVOID_NOTIFICATION_CHANNEL_DELETE
+ }
+ Looper.loop();
+ } else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
+ defaultUncaughtExceptionHandler.uncaughtException(t, e);
+ }
+ }
+ };
+ Thread.setDefaultUncaughtExceptionHandler(routerServiceExceptionHandler);
+ }
+ }
+
+
+ @SuppressLint({"NewApi", "MissingPermission"})
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if (intent != null) {
+ if (intent.getBooleanExtra(FOREGROUND_EXTRA, false)) {
+ hasCalledStartForeground = false;
+
+ if (!this.isPrimaryTransportConnected()) { //If there is no transport connected we need to ensure the service is moved to the foreground
+ String address = null;
+ if (intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)) {
+ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ if (device != null) {
+ address = device.getAddress();
+ }
+ }
+ boolean confirmedDevice = intent.getBooleanExtra(TransportConstants.CONFIRMED_SDL_DEVICE, false);
+ int timeout = getNotificationTimeout(address, confirmedDevice);
+
+ enterForeground("Waiting for connection...", timeout, false);
+ resetForegroundTimeOut(timeout);
+ } else {
+ enterForeground(createConnectedNotificationText(), 0, true);
+ }
+
+ hasCalledStartForeground = true;
+ }
+
+ if (intent.hasExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA)) {
+ //Make sure we are listening on RFCOMM
+ if (startSequenceComplete) { //We only check if we are sure we are already through the start up process
+ DebugTool.logInfo(TAG, "Received ping, making sure we are listening to bluetooth rfcomm");
+ initBluetoothSerialService();
+ }
+ }
+ }
+
+ if (!shouldServiceRemainOpen(intent)) {
+ closeSelf();
+ }
+
+ if (registeredApps == null) {
+ synchronized (REGISTERED_APPS_LOCK) {
+ registeredApps = new HashMap<String, RegisteredApp>();
+ }
+ }
+ return START_REDELIVER_INTENT;
+ }
+
+ @SuppressWarnings("ConstantConditions")
+ @Override
+ public void onDestroy() {
+ stopClientPings();
+
+ if (altTransportTimerHandler != null) {
+ altTransportTimerHandler.removeCallbacks(altTransportTimerRunnable);
+ altTransportTimerHandler = null;
+ }
+
+ DebugTool.logWarning(TAG, "Sdl Router Service Destroyed");
+ closing = true;
+ //No need for this Broadcast Receiver anymore
+ unregisterAllReceivers();
+ closeBluetoothSerialServer();
+ if (registeredApps != null) {
+ synchronized (REGISTERED_APPS_LOCK) {
+ registeredApps.clear();
+ registeredApps = null;
+ }
+ }
+ synchronized (SESSION_LOCK) {
+ if (this.bluetoothSessionMap != null) {
+ this.bluetoothSessionMap.clear();
+ this.bluetoothSessionMap = null;
+ }
+ if (this.sessionHashIdMap != null) {
+ this.sessionHashIdMap.clear();
+ this.sessionHashIdMap = null;
+ }
+ }
+
+ //SESSION_LOCK = null;
+
+ startSequenceComplete = false;
+ if (packetExecutor != null) {
+ packetExecutor.shutdownNow();
+ packetExecutor = null;
+ }
+
+ exitForeground();
+ if (packetWriteTaskMasterMap != null && packetWriteTaskMasterMap.values() != null) {
+ Collection<PacketWriteTaskMaster> tasks = packetWriteTaskMasterMap.values();
+ for (PacketWriteTaskMaster packetWriteTaskMaster : tasks) {
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.close();
+ }
+ }
+ }
+ if (packetWriteTaskMasterMap != null) {
+ packetWriteTaskMasterMap.clear();
+ }
+ packetWriteTaskMasterMap = null;
+
+
+ super.onDestroy();
+ System.gc(); //Lower end phones need this hint
+ if (!wrongProcess) {
+ //noinspection EmptyCatchBlock
+ try {
+ android.os.Process.killProcess(android.os.Process.myPid());
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ private void unregisterAllReceivers() {
+ //noinspection EmptyCatchBlock
+ try {
+ unregisterReceiver(mListenForDisconnect);
+ unregisterReceiver(mainServiceReceiver);
+ } catch (Exception e) {
+ }
+ }
+
+ @SuppressWarnings("SameParameterValue")
+ private void notifyAltTransportOfClose(int reason) {
+ if (altTransportService != null) {
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SHUTTING_DOWN_NOTIFICATION;
+ msg.arg1 = reason;
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Gets the correct timeout for the foreground notification.
+ *
+ * @param address the address of the device that is currently connected
+ * @return the amount of time for a timeout handler to remove the notification.
+ */
+ @SuppressLint("MissingPermission")
+ private int getNotificationTimeout(String address, boolean confirmedDevice) {
+ if (address != null) {
+ if (confirmedDevice || hasSDLConnected(address)) {
+ return FOREGROUND_TIMEOUT * 2;
+ } else if (this.isFirstStatusCheck(address)) {
+ // If this is the first time the service has ever connected to this device we want
+ // to ensure we have a record of it
+ setSDLConnectedStatus(address, false);
+ return FOREGROUND_TIMEOUT;
+ }
+ }
+ // If this is a new device or hasn't connected through SDL we want to limit the exposure
+ // of the SDL service in the foreground
+ return FOREGROUND_TIMEOUT / 1000;
+ }
+
+ public void resetForegroundTimeOut(long delay) {
+ synchronized (FOREGROUND_NOTIFICATION_LOCK) {
+ if (foregroundTimeoutHandler == null) {
+ foregroundTimeoutHandler = new Handler();
+ }
+ if (foregroundTimeoutRunnable == null) {
+ foregroundTimeoutRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (!getConnectedTransports().isEmpty()) {
+ // Updates notification to one of still connected transport
+ enterForeground(createConnectedNotificationText(), 0, true);
+ return;
+ } else {
+ exitForeground();//Leave our foreground state as we don't have a connection
+
+ }
+ }
+ };
+ } else {
+ //This instance likely means there is a callback in the queue so we should remove it
+ foregroundTimeoutHandler.removeCallbacks(foregroundTimeoutRunnable);
+ }
+ foregroundTimeoutHandler.postDelayed(foregroundTimeoutRunnable, delay);
+ }
+ }
+
+ public void cancelForegroundTimeOut() {
+ synchronized (FOREGROUND_NOTIFICATION_LOCK) {
+ if (foregroundTimeoutHandler != null && foregroundTimeoutRunnable != null) {
+ foregroundTimeoutHandler.removeCallbacks(foregroundTimeoutRunnable);
+ }
+ }
+
+ }
+
+ @SuppressLint("NewApi")
+ private void enterForeground(String content, long chronometerLength, boolean ongoing) {
+ DebugTool.logInfo(TAG, "Attempting to enter the foreground - " + System.currentTimeMillis());
+
+ Bitmap icon;
+ int resourcesIncluded = getResources().getIdentifier("ic_sdl", "drawable", getPackageName());
+
+ if (resourcesIncluded != 0) { //No additional pylons required
+ icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_sdl);
+ } else {
+ icon = BitmapFactory.decodeResource(getResources(), android.R.drawable.stat_sys_data_bluetooth);
+ }
+ // Bitmap icon = BitmapFactory.decodeByteArray(SdlLogo.SDL_LOGO_STRING, 0, SdlLogo.SDL_LOGO_STRING.length);
Notification.Builder builder;
- if(android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O){
- builder = new Notification.Builder(this);
- } else {
- builder = new Notification.Builder(this, SDL_NOTIFICATION_CHANNEL_ID);
- }
-
- if(0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)){ //If we are in debug mode, include what app has the router service open
- ComponentName name = new ComponentName(this, this.getClass());
- builder.setContentTitle("SDL: " + name.getPackageName());
- }else{
- builder.setContentTitle("SmartDeviceLink");
+ if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ builder = new Notification.Builder(this);
+ } else {
+ builder = new Notification.Builder(this, SDL_NOTIFICATION_CHANNEL_ID);
+ }
+
+ if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) { //If we are in debug mode, include what app has the router service open
+ ComponentName name = new ComponentName(this, this.getClass());
+ builder.setContentTitle("SDL: " + name.getPackageName());
+ } else {
+ builder.setContentTitle("SmartDeviceLink");
}
builder.setTicker("SmartDeviceLink");
builder.setContentText(content);
- //We should use icon from library resources if available
+ //We should use icon from library resources if available
int trayId = getResources().getIdentifier("sdl_tray_icon", "drawable", getPackageName());
- if ( resourcesIncluded != 0 ) { //No additional pylons required
- builder.setSmallIcon(trayId);
- }
- else {
- builder.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth);
- }
+ if (resourcesIncluded != 0) { //No additional pylons required
+ builder.setSmallIcon(trayId);
+ } else {
+ builder.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth);
+ }
builder.setLargeIcon(icon);
builder.setOngoing(ongoing);
- // Create an intent that will be fired when the user clicks the notification.
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SDL_NOTIFICATION_FAQS_PAGE));
- PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
- builder.setContentIntent(pendingIntent);
+ // Create an intent that will be fired when the user clicks the notification.
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SDL_NOTIFICATION_FAQS_PAGE));
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ builder.setContentIntent(pendingIntent);
+
+ if (chronometerLength > (FOREGROUND_TIMEOUT / 1000) && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ //The countdown method is only available in SDKs >= 24
+ // Only add countdown if it is over the min timeout
+ builder.setWhen(chronometerLength + System.currentTimeMillis());
+ builder.setUsesChronometer(true);
+ builder.setChronometerCountDown(true);
+ }
+ synchronized (FOREGROUND_NOTIFICATION_LOCK) {
+ Notification notification;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ //Now we need to add a notification channel
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager != null) {
+ NotificationChannel notificationChannel = new NotificationChannel(SDL_NOTIFICATION_CHANNEL_ID, SDL_NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
+ notificationChannel.enableLights(false);
+ notificationChannel.enableVibration(false);
+ notificationManager.createNotificationChannel(notificationChannel);
+ } else {
+ DebugTool.logError(TAG, "Unable to retrieve notification Manager service");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
+ safeStartForeground(FOREGROUND_SERVICE_ID, builder.build());
+ stopSelf(); //A valid notification channel must be supplied for SDK 27+
+ }
+ }
+
+ }
+ notification = builder.build();
+ safeStartForeground(FOREGROUND_SERVICE_ID, notification);
+ isForeground = true;
+
+ }
- if(chronometerLength > (FOREGROUND_TIMEOUT/1000) && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- //The countdown method is only available in SDKs >= 24
- // Only add countdown if it is over the min timeout
- builder.setWhen(chronometerLength + System.currentTimeMillis());
- builder.setUsesChronometer(true);
- builder.setChronometerCountDown(true);
+ }
+
+ /**
+ * This is a simple wrapper around the startForeground method. In the case that the notification
+ * is null, or a notification was unable to be created we will still attempt to call the
+ * startForeground method in hopes that Android will not throw the System Exception.
+ *
+ * @param id notification channel id
+ * @param notification the notification to display when in the foreground
+ */
+ private void safeStartForeground(int id, Notification notification) {
+ try {
+ if (notification == null) {
+ //Try the NotificationCompat this time in case there was a previous error
+ NotificationCompat.Builder builder =
+ new NotificationCompat.Builder(this, SDL_NOTIFICATION_CHANNEL_ID)
+ .setContentTitle("SmartDeviceLink")
+ .setContentText("Service Running");
+ notification = builder.build();
+ }
+ startForeground(id, notification);
+ DebugTool.logInfo(TAG, "Entered the foreground - " + System.currentTimeMillis());
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Unable to start service in foreground", e);
}
+ }
+
+ private void exitForeground() {
synchronized (FOREGROUND_NOTIFICATION_LOCK) {
- Notification notification;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- //Now we need to add a notification channel
- NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- if (notificationManager != null) {
- NotificationChannel notificationChannel = new NotificationChannel(SDL_NOTIFICATION_CHANNEL_ID, SDL_NOTIFICATION_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
- notificationChannel.enableLights(false);
- notificationChannel.enableVibration(false);
- notificationManager.createNotificationChannel(notificationChannel);
- } else {
- DebugTool.logError(TAG, "Unable to retrieve notification Manager service");
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
- safeStartForeground(FOREGROUND_SERVICE_ID, builder.build());
- stopSelf(); //A valid notification channel must be supplied for SDK 27+
- }
- }
-
- }
- notification = builder.build();
- safeStartForeground(FOREGROUND_SERVICE_ID, notification);
- isForeground = true;
-
- }
-
- }
-
- /**
- * This is a simple wrapper around the startForeground method. In the case that the notification
- * is null, or a notification was unable to be created we will still attempt to call the
- * startForeground method in hopes that Android will not throw the System Exception.
- * @param id notification channel id
- * @param notification the notification to display when in the foreground
- */
- private void safeStartForeground(int id, Notification notification){
- try{
- if(notification == null){
- //Try the NotificationCompat this time in case there was a previous error
- NotificationCompat.Builder builder =
- new NotificationCompat.Builder(this, SDL_NOTIFICATION_CHANNEL_ID)
- .setContentTitle("SmartDeviceLink")
- .setContentText("Service Running");
- notification = builder.build();
- }
- startForeground(id, notification);
- DebugTool.logInfo(TAG, "Entered the foreground - " + System.currentTimeMillis());
- }catch (Exception e){
- DebugTool.logError(TAG, "Unable to start service in foreground", e);
- }
- }
-
- private void exitForeground(){
- synchronized (FOREGROUND_NOTIFICATION_LOCK) {
- if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
- DebugTool.logInfo(TAG, "SdlRouterService to exit foreground");
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- this.stopForeground(Service.STOP_FOREGROUND_DETACH);
- }else{
- stopForeground(false);
- }
- NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
- if (notificationManager!= null){
- try {
- notificationManager.cancel(FOREGROUND_SERVICE_ID);
- if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !getBooleanPref(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE,false)) {
- notificationManager.deleteNotificationChannel(SDL_NOTIFICATION_CHANNEL_ID);
- }
- } catch (Exception e) {
- DebugTool.logError(TAG, "Issue when removing notification and channel", e);
- }
- }
- isForeground = false;
- }
- }
- }
-
-
- /**
- * Creates a notification message to attach to the foreground service notification.
- *
- * @return string to be used as the message
- */
- private String createConnectedNotificationText(){
- StringBuilder builder = new StringBuilder();
- builder.append("Connected to ");
-
- if(bluetoothTransport!= null && bluetoothTransport.isConnected()){
- if(bluetoothTransport.getDeviceName() != null){
- builder.append(bluetoothTransport.getDeviceName());
- if(0 == (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
- //If this is production, just the device name is fine
- return builder.toString();
- }
- }else{
- builder.append(TransportType.BLUETOOTH.name().toLowerCase());
- }
- }
-
- if(usbTransport != null && usbTransport.isConnected()){
- if(builder.length() > 13){ //13 characters for initial Connected to string
- builder.append(" & ");
- }
- builder.append(TransportType.USB.name());
- }
-
- return builder.toString();
- }
-
-
- /* **************************************************************************************************************************************
- *********************************************** Helper Methods **************************************************************
- ****************************************************************************************************************************************/
-
- private ArrayList<TransportRecord> getConnectedTransports(){
- ArrayList<TransportRecord> connected = new ArrayList<>();
- if(bluetoothTransport != null && bluetoothTransport.isConnected()){
+ if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
+ DebugTool.logInfo(TAG, "SdlRouterService to exit foreground");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ this.stopForeground(Service.STOP_FOREGROUND_DETACH);
+ } else {
+ stopForeground(false);
+ }
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager != null) {
+ try {
+ notificationManager.cancel(FOREGROUND_SERVICE_ID);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !getBooleanPref(KEY_AVOID_NOTIFICATION_CHANNEL_DELETE, false)) {
+ notificationManager.deleteNotificationChannel(SDL_NOTIFICATION_CHANNEL_ID);
+ }
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Issue when removing notification and channel", e);
+ }
+ }
+ isForeground = false;
+ }
+ }
+ }
+
+
+ /**
+ * Creates a notification message to attach to the foreground service notification.
+ *
+ * @return string to be used as the message
+ */
+ private String createConnectedNotificationText() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("Connected to ");
+
+ if (bluetoothTransport != null && bluetoothTransport.isConnected()) {
+ if (bluetoothTransport.getDeviceName() != null) {
+ builder.append(bluetoothTransport.getDeviceName());
+ if (0 == (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) {
+ //If this is production, just the device name is fine
+ return builder.toString();
+ }
+ } else {
+ builder.append(TransportType.BLUETOOTH.name().toLowerCase());
+ }
+ }
+
+ if (usbTransport != null && usbTransport.isConnected()) {
+ if (builder.length() > 13) { //13 characters for initial Connected to string
+ builder.append(" & ");
+ }
+ builder.append(TransportType.USB.name());
+ }
+
+ return builder.toString();
+ }
+
+
+ /* **************************************************************************************************************************************
+ *********************************************** Helper Methods **************************************************************
+ ****************************************************************************************************************************************/
+
+ private ArrayList<TransportRecord> getConnectedTransports() {
+ ArrayList<TransportRecord> connected = new ArrayList<>();
+ if (bluetoothTransport != null && bluetoothTransport.isConnected()) {
connected.add(bluetoothTransport.getTransportRecord());
}
- if(tcpTransport != null && tcpTransport.isConnected()){
+ if (tcpTransport != null && tcpTransport.isConnected()) {
connected.add(tcpTransport.getTransportRecord());
}
- if(usbTransport != null && usbTransport.isConnected()){
+ if (usbTransport != null && usbTransport.isConnected()) {
connected.add(usbTransport.getTransportRecord());
}
- return connected;
- }
-
- private boolean isPrimaryTransportConnected(){
- return isTransportConnected(TransportType.BLUETOOTH) || isTransportConnected(TransportType.USB);
- }
-
- private boolean isTransportConnected(TransportType transportType){
- if(bluetoothTransport != null && transportType.equals(TransportType.BLUETOOTH)){
- return bluetoothTransport.isConnected();
- }else if(tcpTransport != null && transportType.equals(TransportType.TCP)){
- return tcpTransport.isConnected();
- }else if(usbTransport != null && transportType.equals(TransportType.USB)){
- return usbTransport.isConnected();
- }
- return false;
- }
-
- /**
- * Checks to make sure bluetooth adapter is available and on
- * @return if the bluetooth adapter is available and is enabled
- */
- @SuppressWarnings("MissingPermission")
- private boolean bluetoothAvailable(){
- try {
- return (!(BluetoothAdapter.getDefaultAdapter() == null) && BluetoothAdapter.getDefaultAdapter().isEnabled());
- }catch(NullPointerException e){ // only for BluetoothAdapter.getDefaultAdapter().isEnabled() call
- return false;
- }
- }
-
- /**
- *
- * 1. If the app has SDL shut off, shut down
- * 2. if The app has an Alt Transport address or was started by one, stay open
- * 3. If Bluetooth is off/NA shut down
- * 4. Anything else
- */
- public boolean shouldServiceRemainOpen(Intent intent){
- ArrayList<TransportRecord> connectedTransports = getConnectedTransports();
-
- if(connectedTransports != null && !connectedTransports.isEmpty()){ // stay open if we have any transports connected
- DebugTool.logInfo(TAG, "1 or more transports connected, remaining open");
- return true;
- }else if(altTransportService!=null || altTransportTimerHandler !=null){
- //We have been started by an alt transport, we must remain open. "My life for Auir...."
- DebugTool.logInfo(TAG, "Alt Transport connected, remaining open");
- return true;
-
- }else if(intent!=null && TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(intent.getAction())){
- DebugTool.logInfo(TAG, "Received start intent with alt transport request.");
- startAltTransportTimer();
- return true;
- }else if(!bluetoothAvailable()){//If bluetooth isn't on...there's nothing to see here
- //Bluetooth is off, we should shut down
- DebugTool.logInfo(TAG, "Bluetooth not available, shutting down service");
-
- return connectedTransports != null && connectedTransports.size() > 0; //If a transport is connected the list will be >0
- }else{
- DebugTool.logInfo(TAG, "Service to remain open");
- return true;
- }
- }
- /**
- * This method is needed so that apps that choose not to implement this as a service as defined by Android, but rather
- * just a simple class we have to know how to shut down.
- */
- public void closeSelf(){
- closing = true;
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !hasCalledStartForeground ){
- //This must be called before stopping self
- safeStartForeground(FOREGROUND_SERVICE_ID, null);
- exitForeground();
- }
-
- if(getBaseContext()!= null){
- stopSelf();
- }
-
- //For good measure.
- onDestroy();
-
- }
- private synchronized void initBluetoothSerialService(){
- if(legacyModeEnabled){
- DebugTool.logInfo(TAG, "Not starting own bluetooth during legacy mode");
- return;
- }
- //init serial service
- if(bluetoothTransport == null || bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_ERROR){
- bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
- }
- if (bluetoothTransport != null) {
+ return connected;
+ }
+
+ private boolean isPrimaryTransportConnected() {
+ return isTransportConnected(TransportType.BLUETOOTH) || isTransportConnected(TransportType.USB);
+ }
+
+ private boolean isTransportConnected(TransportType transportType) {
+ if (bluetoothTransport != null && transportType.equals(TransportType.BLUETOOTH)) {
+ return bluetoothTransport.isConnected();
+ } else if (tcpTransport != null && transportType.equals(TransportType.TCP)) {
+ return tcpTransport.isConnected();
+ } else if (usbTransport != null && transportType.equals(TransportType.USB)) {
+ return usbTransport.isConnected();
+ }
+ return false;
+ }
+
+ /**
+ * Checks to make sure bluetooth adapter is available and on
+ *
+ * @return if the bluetooth adapter is available and is enabled
+ */
+ @SuppressWarnings("MissingPermission")
+ private boolean bluetoothAvailable() {
+ try {
+ return (!(BluetoothAdapter.getDefaultAdapter() == null) && BluetoothAdapter.getDefaultAdapter().isEnabled());
+ } catch (NullPointerException e) { // only for BluetoothAdapter.getDefaultAdapter().isEnabled() call
+ return false;
+ }
+ }
+
+ /**
+ * 1. If the app has SDL shut off, shut down
+ * 2. if The app has an Alt Transport address or was started by one, stay open
+ * 3. If Bluetooth is off/NA shut down
+ * 4. Anything else
+ */
+ public boolean shouldServiceRemainOpen(Intent intent) {
+ ArrayList<TransportRecord> connectedTransports = getConnectedTransports();
+
+ if (connectedTransports != null && !connectedTransports.isEmpty()) { // stay open if we have any transports connected
+ DebugTool.logInfo(TAG, "1 or more transports connected, remaining open");
+ return true;
+ } else if (altTransportService != null || altTransportTimerHandler != null) {
+ //We have been started by an alt transport, we must remain open. "My life for Auir...."
+ DebugTool.logInfo(TAG, "Alt Transport connected, remaining open");
+ return true;
+
+ } else if (intent != null && TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(intent.getAction())) {
+ DebugTool.logInfo(TAG, "Received start intent with alt transport request.");
+ startAltTransportTimer();
+ return true;
+ } else if (!bluetoothAvailable()) {//If bluetooth isn't on...there's nothing to see here
+ //Bluetooth is off, we should shut down
+ DebugTool.logInfo(TAG, "Bluetooth not available, shutting down service");
+
+ return connectedTransports != null && connectedTransports.size() > 0; //If a transport is connected the list will be >0
+ } else {
+ DebugTool.logInfo(TAG, "Service to remain open");
+ return true;
+ }
+ }
+
+ /**
+ * This method is needed so that apps that choose not to implement this as a service as defined by Android, but rather
+ * just a simple class we have to know how to shut down.
+ */
+ public void closeSelf() {
+ closing = true;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !hasCalledStartForeground) {
+ //This must be called before stopping self
+ safeStartForeground(FOREGROUND_SERVICE_ID, null);
+ exitForeground();
+ }
+
+ if (getBaseContext() != null) {
+ stopSelf();
+ }
+
+ //For good measure.
+ onDestroy();
+
+ }
+
+ private synchronized void initBluetoothSerialService() {
+ if (legacyModeEnabled) {
+ DebugTool.logInfo(TAG, "Not starting own bluetooth during legacy mode");
+ return;
+ }
+ //init serial service
+ if (bluetoothTransport == null || bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_ERROR) {
+ bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
+ }
+ if (bluetoothTransport != null) {
// Only if the state is STATE_NONE, do we know that we haven't started already
if (bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_NONE) {
- // Start the Bluetooth services
- DebugTool.logInfo(TAG, "Starting bluetooth transport");
- bluetoothTransport.start();
- }
-
- }
- }
-
- public void onTransportConnected(final TransportRecord record){
- cancelForegroundTimeOut();
- enterForeground(createConnectedNotificationText(),0,true);
-
- if(packetWriteTaskMasterMap == null){
- packetWriteTaskMasterMap = new ConcurrentHashMap<>();
- }
-
- TransportType type = record.getType();
- PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(type);
-
- if(packetWriteTaskMaster!=null){
- packetWriteTaskMaster.close();
- packetWriteTaskMaster.alert();
- }
- packetWriteTaskMaster = new PacketWriteTaskMaster();
- packetWriteTaskMaster.setTransportType(type);
- packetWriteTaskMaster.start();
- packetWriteTaskMasterMap.put(type,packetWriteTaskMaster);
-
- Intent startService = new Intent();
- startService.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
-
- startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, true);
- startService.putExtra(TransportConstants.FORCE_TRANSPORT_CONNECTED, true);
- startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE, getBaseContext().getPackageName());
- startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME, new ComponentName(this, this.getClass()));
-
- if(record!= null && record.getType() != null){
- startService.putExtra(TransportConstants.START_ROUTER_SERVICE_TRANSPORT_CONNECTED, record.getType().toString());
- }
-
- startService.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
-
- AndroidTools.sendExplicitBroadcast(getApplicationContext(),startService, null);
-
- //HARDWARE_CONNECTED
- if(!(registeredApps== null || registeredApps.isEmpty())){
- //If we have clients
- notifyClients(createHardwareConnectedMessage(record));
- }
- }
-
- private Message createHardwareConnectedMessage(final TransportRecord record){
- Message message = Message.obtain();
- message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
- message.arg1 = TransportConstants.HARDWARE_CONNECTION_EVENT_CONNECTED;
- Bundle bundle = new Bundle();
- bundle.putString(TransportConstants.HARDWARE_CONNECTED, record.getType().name());
- bundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED, getConnectedTransports());
-
- if(bluetoothTransport != null){
- bundle.putString(CONNECTED_DEVICE_STRING_EXTRA_NAME, bluetoothTransport.getDeviceName());
- }
-
- message.setData(bundle);
- return message;
-
- }
-
- public void onTransportDisconnected(TransportRecord record){
- cachedModuleVersion = -1; //Reset our cached version
- //Stop any current pings being sent before the proper state can be determined.
- stopClientPings();
-
- if(registeredApps != null && !registeredApps.isEmpty()){
- Message message = Message.obtain();
- message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
- message.arg1 = TransportConstants.HARDWARE_CONNECTION_EVENT_DISCONNECTED;
-
- Bundle bundle = new Bundle();
+ // Start the Bluetooth services
+ DebugTool.logInfo(TAG, "Starting bluetooth transport");
+ bluetoothTransport.start();
+ }
+
+ }
+ }
+
+ public void onTransportConnected(final TransportRecord record) {
+ cancelForegroundTimeOut();
+ enterForeground(createConnectedNotificationText(), 0, true);
+
+ if (packetWriteTaskMasterMap == null) {
+ packetWriteTaskMasterMap = new ConcurrentHashMap<>();
+ }
+
+ TransportType type = record.getType();
+ PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(type);
+
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.close();
+ packetWriteTaskMaster.alert();
+ }
+ packetWriteTaskMaster = new PacketWriteTaskMaster();
+ packetWriteTaskMaster.setTransportType(type);
+ packetWriteTaskMaster.start();
+ packetWriteTaskMasterMap.put(type, packetWriteTaskMaster);
+
+ Intent startService = new Intent();
+ startService.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
+
+ startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, true);
+ startService.putExtra(TransportConstants.FORCE_TRANSPORT_CONNECTED, true);
+ startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE, getBaseContext().getPackageName());
+ startService.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME, new ComponentName(this, this.getClass()));
+
+ if (record != null && record.getType() != null) {
+ startService.putExtra(TransportConstants.START_ROUTER_SERVICE_TRANSPORT_CONNECTED, record.getType().toString());
+ }
+
+ startService.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(), startService, null);
+
+ //HARDWARE_CONNECTED
+ if (!(registeredApps == null || registeredApps.isEmpty())) {
+ //If we have clients
+ notifyClients(createHardwareConnectedMessage(record));
+ }
+ }
+
+ private Message createHardwareConnectedMessage(final TransportRecord record) {
+ Message message = Message.obtain();
+ message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
+ message.arg1 = TransportConstants.HARDWARE_CONNECTION_EVENT_CONNECTED;
+ Bundle bundle = new Bundle();
+ bundle.putString(TransportConstants.HARDWARE_CONNECTED, record.getType().name());
+ bundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED, getConnectedTransports());
+
+ if (bluetoothTransport != null) {
+ bundle.putString(CONNECTED_DEVICE_STRING_EXTRA_NAME, bluetoothTransport.getDeviceName());
+ }
+
+ message.setData(bundle);
+ return message;
+
+ }
+
+ public void onTransportDisconnected(TransportRecord record) {
+ cachedModuleVersion = -1; //Reset our cached version
+ //Stop any current pings being sent before the proper state can be determined.
+ stopClientPings();
+
+ if (registeredApps != null && !registeredApps.isEmpty()) {
+ Message message = Message.obtain();
+ message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
+ message.arg1 = TransportConstants.HARDWARE_CONNECTION_EVENT_DISCONNECTED;
+
+ Bundle bundle = new Bundle();
bundle.putParcelable(TRANSPORT_DISCONNECTED, record);
//For legacy
bundle.putString(HARDWARE_DISCONNECTED, record.getType().name());
- bundle.putBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA, legacyModeEnabled);
-
- //Still connected transports
- bundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED,getConnectedTransports());
-
- message.setData(bundle);
- notifyClients(message);
-
- synchronized (REGISTERED_APPS_LOCK) {
- Collection<RegisteredApp> apps = registeredApps.values();
- for (RegisteredApp app : apps) {
- app.unregisterTransport(-1,record.getType());
-
- }
- }
- }
- //Remove and close the packet task master assigned to this transport
- if(packetWriteTaskMasterMap != null
- && record != null
- && packetWriteTaskMasterMap.containsKey(record.getType())){
- PacketWriteTaskMaster master = packetWriteTaskMasterMap.remove(record.getType());
- if(master != null){
- master.close();
- master.alert();
- }
- }
- if(record != null) {
- //Ensure the associated transport is dealt with
- switch (record.getType()) {
- case BLUETOOTH:
- synchronized (SESSION_LOCK) {
- if (bluetoothSessionMap != null) {
- bluetoothSessionMap.clear();
- }
- }
- if (!connectAsClient) {
- if (!legacyModeEnabled && !closing) {
- initBluetoothSerialService();
- }
- }
- break;
- case USB:
- if (usbTransport != null) {
- usbTransport = null;
- }
- synchronized (SESSION_LOCK) {
- if (usbSessionMap != null) {
- usbSessionMap.clear();
- }
- }
- break;
- case TCP:
- if (tcpTransport != null) {
- tcpTransport = null;
- }
- synchronized (SESSION_LOCK) {
- if (tcpSessionMap != null) {
- tcpSessionMap.clear();
- }
- }
- break;
- }
- }
-
- if(!getConnectedTransports().isEmpty()){
- // Updates notification to one of still connected transport
- enterForeground(createConnectedNotificationText(),0,true);
- return;
- }else{
- exitForeground();//Leave our foreground state as we don't have a connection anymore
- if(!shouldServiceRemainOpen(null)){
- closeSelf();
- }
- }
-
- if(altTransportService!=null){ //If we still have an alt transport open, then we don't need to tell the clients to close
- return;
- }
-
- DebugTool.logError(TAG, "Notifying client service of hardware disconnect.");
-
-
- //We've notified our clients, less clean up the mess now.
- synchronized(SESSION_LOCK){
- this.sessionHashIdMap.clear();
- }
- synchronized(REGISTERED_APPS_LOCK){
- if(registeredApps==null){
- return;
- }
- registeredApps.clear();
- }
- }
-
- public void onTransportError(TransportRecord transport, Bundle errorBundle){
- switch (transport.getType()){
+ bundle.putBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA, legacyModeEnabled);
+
+ //Still connected transports
+ bundle.putParcelableArrayList(TransportConstants.CURRENT_HARDWARE_CONNECTED, getConnectedTransports());
+
+ message.setData(bundle);
+ notifyClients(message);
+
+ synchronized (REGISTERED_APPS_LOCK) {
+ Collection<RegisteredApp> apps = registeredApps.values();
+ for (RegisteredApp app : apps) {
+ app.unregisterTransport(-1, record.getType());
+
+ }
+ }
+ }
+ //Remove and close the packet task master assigned to this transport
+ if (packetWriteTaskMasterMap != null
+ && record != null
+ && packetWriteTaskMasterMap.containsKey(record.getType())) {
+ PacketWriteTaskMaster master = packetWriteTaskMasterMap.remove(record.getType());
+ if (master != null) {
+ master.close();
+ master.alert();
+ }
+ }
+ if (record != null) {
+ //Ensure the associated transport is dealt with
+ switch (record.getType()) {
+ case BLUETOOTH:
+ synchronized (SESSION_LOCK) {
+ if (bluetoothSessionMap != null) {
+ bluetoothSessionMap.clear();
+ }
+ }
+ if (!connectAsClient) {
+ if (!legacyModeEnabled && !closing) {
+ initBluetoothSerialService();
+ }
+ }
+ break;
+ case USB:
+ if (usbTransport != null) {
+ usbTransport = null;
+ }
+ synchronized (SESSION_LOCK) {
+ if (usbSessionMap != null) {
+ usbSessionMap.clear();
+ }
+ }
+ break;
+ case TCP:
+ if (tcpTransport != null) {
+ tcpTransport = null;
+ }
+ synchronized (SESSION_LOCK) {
+ if (tcpSessionMap != null) {
+ tcpSessionMap.clear();
+ }
+ }
+ break;
+ }
+ }
+
+ if (!getConnectedTransports().isEmpty()) {
+ // Updates notification to one of still connected transport
+ enterForeground(createConnectedNotificationText(), 0, true);
+ return;
+ } else {
+ exitForeground();//Leave our foreground state as we don't have a connection anymore
+ if (!shouldServiceRemainOpen(null)) {
+ closeSelf();
+ }
+ }
+
+ if (altTransportService != null) { //If we still have an alt transport open, then we don't need to tell the clients to close
+ return;
+ }
+
+ DebugTool.logError(TAG, "Notifying client service of hardware disconnect.");
+
+
+ //We've notified our clients, less clean up the mess now.
+ synchronized (SESSION_LOCK) {
+ this.sessionHashIdMap.clear();
+ }
+ synchronized (REGISTERED_APPS_LOCK) {
+ if (registeredApps == null) {
+ return;
+ }
+ registeredApps.clear();
+ }
+ }
+
+ public void onTransportError(TransportRecord transport, Bundle errorBundle) {
+ switch (transport.getType()) {
case BLUETOOTH:
- if(bluetoothTransport !=null){
+ if (bluetoothTransport != null) {
bluetoothTransport.setStateManually(MultiplexBluetoothTransport.STATE_NONE);
bluetoothTransport = null;
}
- if (errorBundle != null && errorBundle.getByte(MultiplexBaseTransport.ERROR_REASON_KEY) == MultiplexBaseTransport.REASON_SPP_ERROR) {
- notifySppError();
- }
+ if (errorBundle != null && errorBundle.getByte(MultiplexBaseTransport.ERROR_REASON_KEY) == MultiplexBaseTransport.REASON_SPP_ERROR) {
+ notifySppError();
+ }
break;
case USB:
break;
@@ -1908,1831 +1916,1872 @@ public class SdlRouterService extends Service{
}
- public void onPacketRead(SdlPacket packet){
+ public void onPacketRead(SdlPacket packet) {
try {
- //Log.i(TAG, "******** Read packet with header: " +(packet).toString());
- if(packet.getVersion() == 1){
- if( packet.getFrameType() == FrameType.Control && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK){
- //We received a v1 packet from the head unit, this means we can't use the router service.
- //Enable legacy mode
- enableLegacyMode(true);
- return;
- }
- }else if(cachedModuleVersion == -1){
- cachedModuleVersion = packet.getVersion();
- }
- //Send the received packet to the registered app
- sendPacketToRegisteredApp(packet);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Handler for all Multiplex Based transports.
- * It will ensure messages are properly queued back to the router service.
- */
- private static class TransportHandler extends Handler{
-
- final WeakReference<SdlRouterService> provider;
-
- public TransportHandler(SdlRouterService provider){
- this.provider = new WeakReference<SdlRouterService>(provider);
- }
- @Override
- public void handleMessage(Message msg) {
- if(this.provider.get() == null){
- return;
- }
- SdlRouterService service = this.provider.get();
- switch (msg.what) {
- case MESSAGE_DEVICE_NAME:
- Bundle bundle = msg.getData();
- if(bundle !=null) {
- service.setSDLConnectedStatus(bundle.getString(MultiplexBaseTransport.DEVICE_ADDRESS),true);
- }
- break;
- case MESSAGE_STATE_CHANGE:
- TransportRecord transportRecord = (TransportRecord) msg.obj;
- switch (msg.arg1) {
- case MultiplexBaseTransport.STATE_CONNECTED:
- service.onTransportConnected(transportRecord);
- break;
- case MultiplexBaseTransport.STATE_CONNECTING:
- // Currently attempting to connect - update UI?
- break;
- case MultiplexBaseTransport.STATE_LISTEN:
- break;
- case MultiplexBaseTransport.STATE_NONE:
- // We've just lost the connection
+ //Log.i(TAG, "******** Read packet with header: " +(packet).toString());
+ if (packet.getVersion() == 1) {
+ if (packet.getFrameType() == FrameType.Control && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK) {
+ //We received a v1 packet from the head unit, this means we can't use the router service.
+ //Enable legacy mode
+ enableLegacyMode(true);
+ return;
+ }
+ } else if (cachedModuleVersion == -1) {
+ cachedModuleVersion = packet.getVersion();
+ }
+ //Send the received packet to the registered app
+ sendPacketToRegisteredApp(packet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Handler for all Multiplex Based transports.
+ * It will ensure messages are properly queued back to the router service.
+ */
+ private static class TransportHandler extends Handler {
+
+ final WeakReference<SdlRouterService> provider;
+
+ public TransportHandler(SdlRouterService provider) {
+ this.provider = new WeakReference<SdlRouterService>(provider);
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ if (this.provider.get() == null) {
+ return;
+ }
+ SdlRouterService service = this.provider.get();
+ switch (msg.what) {
+ case MESSAGE_DEVICE_NAME:
+ Bundle bundle = msg.getData();
+ if (bundle != null) {
+ service.setSDLConnectedStatus(bundle.getString(MultiplexBaseTransport.DEVICE_ADDRESS), true);
+ }
+ break;
+ case MESSAGE_STATE_CHANGE:
+ TransportRecord transportRecord = (TransportRecord) msg.obj;
+ switch (msg.arg1) {
+ case MultiplexBaseTransport.STATE_CONNECTED:
+ service.onTransportConnected(transportRecord);
+ break;
+ case MultiplexBaseTransport.STATE_CONNECTING:
+ // Currently attempting to connect - update UI?
+ break;
+ case MultiplexBaseTransport.STATE_LISTEN:
+ break;
+ case MultiplexBaseTransport.STATE_NONE:
+ // We've just lost the connection
service.onTransportDisconnected(transportRecord);
- break;
- case MultiplexBaseTransport.STATE_ERROR:
- service.onTransportError(transportRecord, msg.getData());
- break;
- }
- break;
-
- case MESSAGE_READ:
- service.onPacketRead((SdlPacket) msg.obj);
- break;
- }
- }
- }
-
- //The return false after the packet null check is not dead code. Read the getByteArray method from bundle
- public boolean writeBytesToTransport(Bundle bundle){
- if(bundle == null){
- return false;
- }
- byte[] packet = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
- if(packet==null) {
- DebugTool.logWarning(TAG, "Ignoring null packet");
- return false;
- }
- int offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
- int count = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, packet.length); //In case there isn't anything just send the whole packet.
- TransportType transportType = TransportType.valueForString(bundle.getString(TransportConstants.TRANSPORT_TYPE));
- if(transportType != null) {
- switch ((transportType)) {
- case BLUETOOTH:
- if (bluetoothTransport != null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
- bluetoothTransport.write(packet, offset, count);
- return true;
- }
- case USB:
- if (usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- usbTransport.write(packet, offset, count);
- return true;
- }
- case TCP:
- if (tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- tcpTransport.write(packet, offset, count);
- return true;
- }
- default:
- if (sendThroughAltTransport(bundle)) {
- return true;
- }
- }
- }
- DebugTool.logError(TAG, "Can't send data, no transport of specified type connected");
- return false;
- }
-
- private boolean manuallyWriteBytes(TransportType transportType, byte[] packet, int offset, int count){
- switch ((transportType)){
- case BLUETOOTH:
- if(bluetoothTransport !=null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
- bluetoothTransport.write(packet, offset, count);
- return true;
- }
- case USB:
- if(usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- usbTransport.write(packet, offset, count);
- return true;
- }
- case TCP:
- if(tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- tcpTransport.write(packet, offset, count);
- return true;
- }
- default:
- return sendThroughAltTransport(packet, offset, count);
- }
- }
-
-
- /**
- * This Method will send the packets through the alt transport that is connected
- * @param bundle This bundle will have its what changed and sent off to the alt transport
- * @return If it was possible to send the packet off.
- * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
- */
- private boolean sendThroughAltTransport(Bundle bundle){
- if(altTransportService!=null){
- Message msg = Message.obtain();
- msg.what = TransportConstants.ROUTER_SEND_PACKET;
- msg.setData(bundle);
- try {
- altTransportService.send(msg);
- } catch (RemoteException e) {
- DebugTool.logError(TAG, "Unable to send through alt transport!");
- e.printStackTrace();
- }
- return true;
- }else{
- DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
- }
- return false;
- }
-
- /** This Method will send the packets through the alt transport that is connected
- * @param bytes The byte array of data to be wrote out
- * @return If it was possible to send the packet off.
- * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
- */
- private boolean sendThroughAltTransport(byte[] bytes, int offset, int count){
- if(altTransportService!=null){
- Message msg = Message.obtain();
- msg.what = TransportConstants.ROUTER_SEND_PACKET;
- Bundle bundle = new Bundle();
- bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME,bytes);
- bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, offset);
- bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, count);
- msg.setData(bundle);
- try {
- altTransportService.send(msg);
- } catch (RemoteException e) {
- DebugTool.logError(TAG, "Unable to send through alt transport!");
- e.printStackTrace();
- }
- return true;
- }else{
- DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
- }
- return false;
- }
- /**
- * This will send the received packet to the registered service. It will default to the single registered "foreground" app.
- * This can be overridden to provide more specific functionality.
- * @param packet the packet that is received
- * @return whether or not the sending was successful
- */
- public boolean sendPacketToRegisteredApp(SdlPacket packet) {
- if(registeredApps != null && registeredApps.size() > 0 ){
- final int session = packet.getSessionId();
- boolean isNewSessionRequest = false, isNewTransportRequest = false;
-
- final int frameInfo = packet.getFrameInfo();
- if(packet.getFrameType() == FrameType.Control){
- isNewSessionRequest = (frameInfo == SdlPacket.FRAME_INFO_START_SERVICE_ACK ||frameInfo == SdlPacket.FRAME_INFO_START_SERVICE_NAK)
- && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC;
- isNewTransportRequest = (frameInfo == SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_ACK
- || frameInfo == SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_NAK); // && packet.getServiceType() != SdlPacket.SERVICE_TYPE_RPC;
- }
-
- //Find where this packet should go
- String appid = getAppIDForSession(session, isNewSessionRequest, isNewTransportRequest, packet.getTransportRecord().getType());
-
- if(appid != null && appid.length() > 0){
-
- RegisteredApp app;
- synchronized(REGISTERED_APPS_LOCK){
- app = registeredApps.get(appid);
- }
-
- if(app == null){
- DebugTool.logError(TAG, "No app found for app id " + appid + " Removing session mapping and sending unregisterAI to head unit.");
-
- //We have no app to match the app id tied to this session
- removeSessionFromMap(session, Collections.singletonList(packet.getTransportRecord().getType()));
-
- final int serviceType = packet.getServiceType();
- if(serviceType == SdlPacket.SERVICE_TYPE_RPC || serviceType == SdlPacket.SERVICE_TYPE_BULK_DATA) {
- //This is a primary transport packet as it is an RPC packet
- //Create an unregister app interface to remove the app as it doesn't appear to exist anymore
- byte[] uai = createForceUnregisterApp((byte) session, (byte) packet.getVersion());
- manuallyWriteBytes(packet.getTransportRecord().getType(),uai, 0, uai.length);
-
- int hashId = 0;
- synchronized(this.SESSION_LOCK){
- if(this.sessionHashIdMap.indexOfKey(session)>=0){
- hashId = this.sessionHashIdMap.get(session);
- this.sessionHashIdMap.delete(session);
- }
- }
-
- //TODO stop other services on that transport for the session with no app
- byte[] stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)packet.getVersion(), hashId).constructPacket();
- manuallyWriteBytes(packet.getTransportRecord().getType(), stopService,0,stopService.length);
- }else{
- DebugTool.logWarning(TAG, "No where to send a packet from what appears to be a non primary transport");
- }
-
- return false;
- }
-
- //There is an app id and can continue to normal flow
- byte version = (byte)packet.getVersion();
-
- if(isNewSessionRequest && version > 1 && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK){ //we know this was a start session response
- if (version >= 5) {
- Integer hashId = (Integer) packet.getTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID);
- if (hashId != null) {
- synchronized(SESSION_LOCK) {
- this.sessionHashIdMap.put(session, hashId);
- }
- } else {
- DebugTool.logWarning(TAG, "Hash ID not found in V5 start service ACK frame for session " + session);
- }
- } else {
- if (packet.getPayload() != null && packet.getDataSize() == 4){ //hashid will be 4 bytes in length
- synchronized(SESSION_LOCK){
- this.sessionHashIdMap.put(session, (BitConverter.intFromByteArray(packet.getPayload(), 0)));
- }
- }
- }
- }
-
- // check and prevent a UAI from being passed to an app that is using a recycled session id
- if (cleanedSessionMap != null && cleanedSessionMap.size() > 0 ) {
- if(packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC) {
- BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
- if (binFrameHeader != null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()) {
- DebugTool.logInfo(TAG, "Received an unregister app interface. Checking session hash before sending");
- // make sure that we don't try to unregister a recently added app that might have a
- // session ID of a removed app whose UAI was delayed
- int hashOfRemoved = this.cleanedSessionMap.get(session, -1);
- int currentHash = this.sessionHashIdMap.get(session, -1);
- if (hashOfRemoved != -1) {
- // Current session contains key that was held before
- if (hashOfRemoved != currentHash) {
- // App assigned same session id but is a different app. Keep this from being killed
- DebugTool.logInfo(TAG, "same session id for different apps found, dropping packet");
- this.cleanedSessionMap.delete(session);
- return false;
- }
- }
- }
- }
- }
-
- int packetSize = (int) (packet.getDataSize() + SdlPacket.HEADER_SIZE);
- //Log.i(TAG, "Checking packet size: " + packetSize);
- Message message = Message.obtain();
- Bundle bundle = new Bundle();
-
- if(packetSize < ByteArrayMessageSpliter.MAX_BINDER_SIZE){ //This is a small enough packet just send on through
- //Log.w(TAG, " Packet size is just right " + packetSize + " is smaller than " + ByteArrayMessageSpliter.MAX_BINDER_SIZE + " = " + (packetSize<ByteArrayMessageSpliter.MAX_BINDER_SIZE));
- message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
-
- // !!!! ADD ADDITIONAL ITEMS TO BUNDLE HERE !!!
-
- packet.setMessagingVersion(app.routerMessagingVersion);
- bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, packet);
- /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
- bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
- /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
-
- message.setData(bundle);
- return sendPacketMessageToClient(app,message, version);
- }else{
- //Log.w(TAG, "Packet too big for IPC buffer. Breaking apart and then sending to client.");
- //We need to churn through the packet payload and send it in chunks
- byte[] bytes = packet.getPayload();
- SdlPacket copyPacket = new SdlPacket(packet.getVersion(),packet.isEncrypted(),
- (int)packet.getFrameType().getValue(),
- packet.getServiceType(),packet.getFrameInfo(), session,
- (int)packet.getDataSize(),packet.getMessageId(),null);
- message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
- // !!!! ADD ADDITIONAL ITEMS TO BUNDLE HERE !!!
-
- bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, copyPacket);
- /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
- bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED);
- /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
-
- message.setData(bundle);
- //Log.d(TAG, "First packet before sending: " + message.getData().toString());
- if(!sendPacketMessageToClient(app, message, version)){
- DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
- return false;
- }
- //Log.w(TAG, "Message too big for single IPC transaction. Breaking apart. Size - " + packet.getDataSize());
- ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appid,TransportConstants.ROUTER_RECEIVED_PACKET,bytes,0);
- while(splitter.isActive()){
- if(!sendPacketMessageToClient(app,splitter.nextMessage(),version)){
- DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
- splitter.close();
- return false;
- }
- }
- //Log.i(TAG, "Large packet finished being sent");
- }
-
- }else{ //If we can't find a session for this packet we just drop the packet
- DebugTool.logError(TAG, "App Id was NULL for session! " + session);
- TransportType transportType = packet.getTransportRecord().getType();
- if(removeSessionFromMap(session, Collections.singletonList(transportType))){ //If we found the session id still tied to an app in our map we need to remove it and send the proper shutdown sequence.
- DebugTool.logInfo(TAG, "Removed session from map. Sending unregister request to module.");
- attemptToCleanUpModule(session, packet.getVersion(), transportType);
- }else{ //There was no mapping so let's try to resolve this
-
- if(packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC){
- BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
- if(binFrameHeader!=null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()){
- DebugTool.logInfo(TAG, "Received an unregister app interface with no where to send it, dropping the packet.");
- }else{
- attemptToCleanUpModule(session, packet.getVersion(),transportType);
- }
- }else if((packet.getFrameType() == FrameType.Control
- && (packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_NAK))){
- //We want to ignore this
- DebugTool.logInfo(TAG, "Received a stop service ack/nak with no where to send it, dropping the packet.");
- }else{
- attemptToCleanUpModule(session, packet.getVersion(),transportType);
- }
- }
- }
- }
- return false;
- }
-
- /**
- * This method is an all else fails situation. If the head unit is out of sync with the apps on the phone
- * this method will clear out an unwanted or out of date session.
- * @param session the session id that is to be cleaned up
- * @param version the last known version that this session was operating with
- */
- private void attemptToCleanUpModule(int session, int version, TransportType primaryTransport){
- DebugTool.logInfo(TAG, "Attempting to stop session " + session);
- byte[] uai = createForceUnregisterApp((byte)session, (byte)version);
- manuallyWriteBytes(primaryTransport,uai,0,uai.length);
- int hashId = 0;
- synchronized(this.SESSION_LOCK){
- if(this.sessionHashIdMap.indexOfKey(session)>=0){
- hashId = this.sessionHashIdMap.get(session);
- this.sessionHashIdMap.delete(session);
- this.cleanedSessionMap.put(session,hashId);
- }
- }
- byte[] stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)version, hashId).constructPacket();
- manuallyWriteBytes(primaryTransport,stopService,0,stopService.length);
- }
-
- private boolean sendPacketMessageToClient(RegisteredApp app, Message message, byte version){
- int result = app.sendMessage(message);
- if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
- DebugTool.logInfo(TAG, "Dead object, removing app and sessions");
- //Get all their sessions and send out unregister info
- //Use the version in this packet as a best guess
- app.close();
- Vector<Long> sessions = app.getSessionIds();
- byte[] unregister,stopService;
- int size = sessions.size(), sessionId;
- for(int i=0; i<size;i++){
- sessionId = sessions.get(i).intValue();
- unregister = createForceUnregisterApp((byte)sessionId,version);
- List<TransportType> transportTypes = app.getTransportsForSession(sessionId);
- if(transportTypes != null && !transportTypes.isEmpty()) {
- manuallyWriteBytes(transportTypes.get(0),unregister, 0, unregister.length);
- int hashId = 0;
- synchronized (this.SESSION_LOCK) {
- if (this.sessionHashIdMap.indexOfKey(sessionId) >= 0) {
- hashId = this.sessionHashIdMap.get(sessionId);
- }
- }
- stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte) sessionId, 0, version, hashId).constructPacket();
-
- manuallyWriteBytes(transportTypes.get(0),stopService, 0, stopService.length);
- synchronized (SESSION_LOCK) {
- this.bluetoothSessionMap.remove(sessionId);
- this.sessionHashIdMap.delete(sessionId);
- }
- }
- }
- synchronized(REGISTERED_APPS_LOCK){
- registeredApps.remove(app.appId);
- }
- return false;//We did our best to correct errors
- }
- return true;//We should have sent our packet, so we can return true now
- }
-
- private synchronized void closeBluetoothSerialServer(){
- if(bluetoothTransport != null){
- bluetoothTransport.stop();
- bluetoothTransport = null;
- }
- }
-
- /**
- * This function looks through the phones currently paired bluetooth devices
- * If one of the devices' names contain "sync", or livio it will attempt to connect the RFCOMM
- * And start SDL
- * @return a boolean if a connection was attempted
- */
- @SuppressWarnings({"MissingPermission"})
- public synchronized boolean bluetoothQuerryAndConnect(){
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if(adapter != null && adapter.isEnabled()){
- Set<BluetoothDevice> pairedBT= adapter.getBondedDevices();
- DebugTool.logInfo(TAG, "Query Bluetooth paired devices");
- if (pairedBT.size() > 0) {
- for (BluetoothDevice device : pairedBT) {
- String name = device.getName().toLowerCase(Locale.US);
- if(name.contains("sync") || name.contains("livio")){
- bluetoothConnect(device);
- return true;
- }
- }
- }
- }else{
- DebugTool.logError(TAG, "There was an issue with connecting as client");
- }
- return false;
- }
-
- @SuppressWarnings("MissingPermission")
- private synchronized boolean bluetoothConnect(BluetoothDevice device){
- DebugTool.logInfo(TAG,"Connecting to device: " + device.getName());
- if(bluetoothTransport == null || !bluetoothTransport.isConnected())
- { // Set up the Bluetooth serial object
- bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
- }
- // We've been given a device - let's connect to it
- if(bluetoothTransport.getState()!=MultiplexBluetoothTransport.STATE_CONNECTING){
- bluetoothTransport.connect(device);
- if(bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTING){
- return true;
- }
- }
-
- DebugTool.logInfo(TAG, "Bluetooth SPP Connect Attempt Completed");
- return false;
- }
-
-
- //**************************************************************************************************************************************
- //********************************************************* PREFERENCES ****************************************************************
- //**************************************************************************************************************************************
-
- /**
- * Set the connection establishment status of the particular device
- * @param address address of the device in quesiton
- * @param hasSDLConnected true if a connection has been established, false if not
- */
- protected void setSDLConnectedStatus(String address, boolean hasSDLConnected){
- SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putBoolean(address,hasSDLConnected);
- editor.commit();
- }
-
- /**
- * Checks to see if a device address has connected to SDL before.
- * @param address the mac address of the device in quesiton
- * @return if this is the first status check of this device
- */
- protected boolean isFirstStatusCheck(String address){
- SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
- return !preferences.contains(address) ;
- }
- /**
- * Checks to see if a device address has connected to SDL before.
- * @param address the mac address of the device in quesiton
- * @return if an SDL connection has ever been established with this device
- */
- protected boolean hasSDLConnected(String address){
- SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
- return preferences.contains(address) && preferences.getBoolean(address,false);
- }
-
- /**
- * Set specific settings through key/value to the SDL_ROUTER_SERVICE_PREFS
- * @param key the key of the pair to set in the preferences
- * @param value boolean to attach to key in the preferences
- */
- protected void setSdlRouterServicePrefs(String key, boolean value){
- SharedPreferences preferences = this.getSharedPreferences(SDL_ROUTER_SERVICE_PREFS, Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putBoolean(key,value);
- editor.commit();
- DebugTool.logInfo(TAG, "Preference set: " + key + " : " + value);
- }
-
- /**
- * Retrieves a boolean value for the given key in the SDL_ROUTER_SERVICE_PREFS
- * @param key the string key that will be used to retrieve the boolean value
- * @param defaultValue if they key does not exist or there is no value to be found, this is the
- * value that will be returned
- * @return the value associated with the supplied key or defaultValue if one does not exist
- */
- protected boolean getBooleanPref(String key, boolean defaultValue){
- SharedPreferences preferences = this.getSharedPreferences(SDL_ROUTER_SERVICE_PREFS, Context.MODE_PRIVATE);
- if(preferences != null){
- return preferences.getBoolean(key, defaultValue);
- }
- return false;
- }
-
-
- /* ***********************************************************************************************************************************************************************
- * ***************************************************************** CUSTOM ADDITIONS ************************************************************************************
- *************************************************************************************************************************************************************************/
-
- @SuppressWarnings("DeprecatedIsStillUsed")
- @Deprecated
- protected static LocalRouterService getLocalRouterService(Intent launchIntent, ComponentName name){
- if(launchIntent == null){
- DebugTool.logWarning(TAG, "Supplied intent was null, local router service will not contain intent");
- }
- if(name == null){
- DebugTool.logError(TAG, "Unable to create local router service object because component name was null");
- return null;
- }
- //noinspection deprecation
- return new LocalRouterService(launchIntent,ROUTER_SERVICE_VERSION_NUMBER, System.currentTimeMillis(), name);
- }
-
- /**
- * This method is used to check for the newest version of this class to make sure the latest and greatest is up and running.
- */
- private void startAltTransportTimer(){
- altTransportTimerHandler = new Handler();
- altTransportTimerRunnable = new Runnable() {
+ break;
+ case MultiplexBaseTransport.STATE_ERROR:
+ service.onTransportError(transportRecord, msg.getData());
+ break;
+ }
+ break;
+
+ case MESSAGE_READ:
+ service.onPacketRead((SdlPacket) msg.obj);
+ break;
+ }
+ }
+ }
+
+ //The return false after the packet null check is not dead code. Read the getByteArray method from bundle
+ public boolean writeBytesToTransport(Bundle bundle) {
+ if (bundle == null) {
+ return false;
+ }
+ byte[] packet = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
+ if (packet == null) {
+ DebugTool.logWarning(TAG, "Ignoring null packet");
+ return false;
+ }
+ int offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
+ int count = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, packet.length); //In case there isn't anything just send the whole packet.
+ TransportType transportType = TransportType.valueForString(bundle.getString(TransportConstants.TRANSPORT_TYPE));
+ if (transportType != null) {
+ switch ((transportType)) {
+ case BLUETOOTH:
+ if (bluetoothTransport != null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
+ bluetoothTransport.write(packet, offset, count);
+ return true;
+ }
+ case USB:
+ if (usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ usbTransport.write(packet, offset, count);
+ return true;
+ }
+ case TCP:
+ if (tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ tcpTransport.write(packet, offset, count);
+ return true;
+ }
+ default:
+ if (sendThroughAltTransport(bundle)) {
+ return true;
+ }
+ }
+ }
+ DebugTool.logError(TAG, "Can't send data, no transport of specified type connected");
+ return false;
+ }
+
+ private boolean manuallyWriteBytes(TransportType transportType, byte[] packet, int offset, int count) {
+ switch ((transportType)) {
+ case BLUETOOTH:
+ if (bluetoothTransport != null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
+ bluetoothTransport.write(packet, offset, count);
+ return true;
+ }
+ case USB:
+ if (usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ usbTransport.write(packet, offset, count);
+ return true;
+ }
+ case TCP:
+ if (tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ tcpTransport.write(packet, offset, count);
+ return true;
+ }
+ default:
+ return sendThroughAltTransport(packet, offset, count);
+ }
+ }
+
+
+ /**
+ * This Method will send the packets through the alt transport that is connected
+ *
+ * @param bundle This bundle will have its what changed and sent off to the alt transport
+ * @return If it was possible to send the packet off.
+ * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
+ */
+ private boolean sendThroughAltTransport(Bundle bundle) {
+ if (altTransportService != null) {
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SEND_PACKET;
+ msg.setData(bundle);
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ DebugTool.logError(TAG, "Unable to send through alt transport!");
+ e.printStackTrace();
+ }
+ return true;
+ } else {
+ DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
+ }
+ return false;
+ }
+
+ /**
+ * This Method will send the packets through the alt transport that is connected
+ *
+ * @param bytes The byte array of data to be wrote out
+ * @return If it was possible to send the packet off.
+ * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
+ */
+ private boolean sendThroughAltTransport(byte[] bytes, int offset, int count) {
+ if (altTransportService != null) {
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SEND_PACKET;
+ Bundle bundle = new Bundle();
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, bytes);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, offset);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, count);
+ msg.setData(bundle);
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ DebugTool.logError(TAG, "Unable to send through alt transport!");
+ e.printStackTrace();
+ }
+ return true;
+ } else {
+ DebugTool.logWarning(TAG, "Unable to send packet through alt transport, it was null");
+ }
+ return false;
+ }
+
+ /**
+ * This will send the received packet to the registered service. It will default to the single registered "foreground" app.
+ * This can be overridden to provide more specific functionality.
+ *
+ * @param packet the packet that is received
+ * @return whether or not the sending was successful
+ */
+ public boolean sendPacketToRegisteredApp(SdlPacket packet) {
+ if (registeredApps != null && registeredApps.size() > 0) {
+ final int session = packet.getSessionId();
+ boolean isNewSessionRequest = false, isNewTransportRequest = false;
+
+ final int frameInfo = packet.getFrameInfo();
+ if (packet.getFrameType() == FrameType.Control) {
+ isNewSessionRequest = (frameInfo == SdlPacket.FRAME_INFO_START_SERVICE_ACK || frameInfo == SdlPacket.FRAME_INFO_START_SERVICE_NAK)
+ && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC;
+ isNewTransportRequest = (frameInfo == SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_ACK
+ || frameInfo == SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_NAK); // && packet.getServiceType() != SdlPacket.SERVICE_TYPE_RPC;
+ }
+
+ //Find where this packet should go
+ String appid = getAppIDForSession(session, isNewSessionRequest, isNewTransportRequest, packet.getTransportRecord().getType());
+
+ if (appid != null && appid.length() > 0) {
+
+ RegisteredApp app;
+ synchronized (REGISTERED_APPS_LOCK) {
+ app = registeredApps.get(appid);
+ }
+
+ if (app == null) {
+ DebugTool.logError(TAG, "No app found for app id " + appid + " Removing session mapping and sending unregisterAI to head unit.");
+
+ //We have no app to match the app id tied to this session
+ removeSessionFromMap(session, Collections.singletonList(packet.getTransportRecord().getType()));
+
+ final int serviceType = packet.getServiceType();
+ if (serviceType == SdlPacket.SERVICE_TYPE_RPC || serviceType == SdlPacket.SERVICE_TYPE_BULK_DATA) {
+ //This is a primary transport packet as it is an RPC packet
+ //Create an unregister app interface to remove the app as it doesn't appear to exist anymore
+ byte[] uai = createForceUnregisterApp((byte) session, (byte) packet.getVersion());
+ manuallyWriteBytes(packet.getTransportRecord().getType(), uai, 0, uai.length);
+
+ int hashId = 0;
+ synchronized (this.SESSION_LOCK) {
+ if (this.sessionHashIdMap.indexOfKey(session) >= 0) {
+ hashId = this.sessionHashIdMap.get(session);
+ this.sessionHashIdMap.delete(session);
+ }
+ }
+
+ //TODO stop other services on that transport for the session with no app
+ byte[] stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte) session, 0, (byte) packet.getVersion(), hashId).constructPacket();
+ manuallyWriteBytes(packet.getTransportRecord().getType(), stopService, 0, stopService.length);
+ } else {
+ DebugTool.logWarning(TAG, "No where to send a packet from what appears to be a non primary transport");
+ }
+
+ return false;
+ }
+
+ //There is an app id and can continue to normal flow
+ byte version = (byte) packet.getVersion();
+
+ if (isNewSessionRequest && version > 1 && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK) { //we know this was a start session response
+ if (version >= 5) {
+ Integer hashId = (Integer) packet.getTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID);
+ if (hashId != null) {
+ synchronized (SESSION_LOCK) {
+ this.sessionHashIdMap.put(session, hashId);
+ }
+ } else {
+ DebugTool.logWarning(TAG, "Hash ID not found in V5 start service ACK frame for session " + session);
+ }
+ } else {
+ if (packet.getPayload() != null && packet.getDataSize() == 4) { //hashid will be 4 bytes in length
+ synchronized (SESSION_LOCK) {
+ this.sessionHashIdMap.put(session, (BitConverter.intFromByteArray(packet.getPayload(), 0)));
+ }
+ }
+ }
+ }
+
+ // check and prevent a UAI from being passed to an app that is using a recycled session id
+ if (cleanedSessionMap != null && cleanedSessionMap.size() > 0) {
+ if (packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC) {
+ BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
+ if (binFrameHeader != null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()) {
+ DebugTool.logInfo(TAG, "Received an unregister app interface. Checking session hash before sending");
+ // make sure that we don't try to unregister a recently added app that might have a
+ // session ID of a removed app whose UAI was delayed
+ int hashOfRemoved = this.cleanedSessionMap.get(session, -1);
+ int currentHash = this.sessionHashIdMap.get(session, -1);
+ if (hashOfRemoved != -1) {
+ // Current session contains key that was held before
+ if (hashOfRemoved != currentHash) {
+ // App assigned same session id but is a different app. Keep this from being killed
+ DebugTool.logInfo(TAG, "same session id for different apps found, dropping packet");
+ this.cleanedSessionMap.delete(session);
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+ int packetSize = (int) (packet.getDataSize() + SdlPacket.HEADER_SIZE);
+ //Log.i(TAG, "Checking packet size: " + packetSize);
+ Message message = Message.obtain();
+ Bundle bundle = new Bundle();
+
+ if (packetSize < ByteArrayMessageSpliter.MAX_BINDER_SIZE) { //This is a small enough packet just send on through
+ //Log.w(TAG, " Packet size is just right " + packetSize + " is smaller than " + ByteArrayMessageSpliter.MAX_BINDER_SIZE + " = " + (packetSize<ByteArrayMessageSpliter.MAX_BINDER_SIZE));
+ message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
+
+ // !!!! ADD ADDITIONAL ITEMS TO BUNDLE HERE !!!
+
+ packet.setMessagingVersion(app.routerMessagingVersion);
+ bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, packet);
+ /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
+ /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
+
+ message.setData(bundle);
+ return sendPacketMessageToClient(app, message, version);
+ } else {
+ //Log.w(TAG, "Packet too big for IPC buffer. Breaking apart and then sending to client.");
+ //We need to churn through the packet payload and send it in chunks
+ byte[] bytes = packet.getPayload();
+ SdlPacket copyPacket = new SdlPacket(packet.getVersion(), packet.isEncrypted(),
+ (int) packet.getFrameType().getValue(),
+ packet.getServiceType(), packet.getFrameInfo(), session,
+ (int) packet.getDataSize(), packet.getMessageId(), null);
+ message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
+ // !!!! ADD ADDITIONAL ITEMS TO BUNDLE HERE !!!
+
+ bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, copyPacket);
+ /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED);
+ /* !!!!!! DO NOT ADD ANY ADDITIONAL ITEMS TO THE BUNDLE AFTER PACKET. ONLY BYTES_TO_SEND_FLAG !!!!!!!*/
+
+ message.setData(bundle);
+ //Log.d(TAG, "First packet before sending: " + message.getData().toString());
+ if (!sendPacketMessageToClient(app, message, version)) {
+ DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
+ return false;
+ }
+ //Log.w(TAG, "Message too big for single IPC transaction. Breaking apart. Size - " + packet.getDataSize());
+ ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appid, TransportConstants.ROUTER_RECEIVED_PACKET, bytes, 0);
+ while (splitter.isActive()) {
+ if (!sendPacketMessageToClient(app, splitter.nextMessage(), version)) {
+ DebugTool.logWarning(TAG, "Error sending first message of split packet to client " + app.appId);
+ splitter.close();
+ return false;
+ }
+ }
+ //Log.i(TAG, "Large packet finished being sent");
+ }
+
+ } else { //If we can't find a session for this packet we just drop the packet
+ DebugTool.logError(TAG, "App Id was NULL for session! " + session);
+ TransportType transportType = packet.getTransportRecord().getType();
+ if (removeSessionFromMap(session, Collections.singletonList(transportType))) { //If we found the session id still tied to an app in our map we need to remove it and send the proper shutdown sequence.
+ DebugTool.logInfo(TAG, "Removed session from map. Sending unregister request to module.");
+ attemptToCleanUpModule(session, packet.getVersion(), transportType);
+ } else { //There was no mapping so let's try to resolve this
+
+ if (packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC) {
+ BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
+ if (binFrameHeader != null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()) {
+ DebugTool.logInfo(TAG, "Received an unregister app interface with no where to send it, dropping the packet.");
+ } else {
+ attemptToCleanUpModule(session, packet.getVersion(), transportType);
+ }
+ } else if ((packet.getFrameType() == FrameType.Control
+ && (packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_NAK))) {
+ //We want to ignore this
+ DebugTool.logInfo(TAG, "Received a stop service ack/nak with no where to send it, dropping the packet.");
+ } else {
+ attemptToCleanUpModule(session, packet.getVersion(), transportType);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method is an all else fails situation. If the head unit is out of sync with the apps on the phone
+ * this method will clear out an unwanted or out of date session.
+ *
+ * @param session the session id that is to be cleaned up
+ * @param version the last known version that this session was operating with
+ */
+ private void attemptToCleanUpModule(int session, int version, TransportType primaryTransport) {
+ DebugTool.logInfo(TAG, "Attempting to stop session " + session);
+ byte[] uai = createForceUnregisterApp((byte) session, (byte) version);
+ manuallyWriteBytes(primaryTransport, uai, 0, uai.length);
+ int hashId = 0;
+ synchronized (this.SESSION_LOCK) {
+ if (this.sessionHashIdMap.indexOfKey(session) >= 0) {
+ hashId = this.sessionHashIdMap.get(session);
+ this.sessionHashIdMap.delete(session);
+ this.cleanedSessionMap.put(session, hashId);
+ }
+ }
+ byte[] stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte) session, 0, (byte) version, hashId).constructPacket();
+ manuallyWriteBytes(primaryTransport, stopService, 0, stopService.length);
+ }
+
+ private boolean sendPacketMessageToClient(RegisteredApp app, Message message, byte version) {
+ int result = app.sendMessage(message);
+ if (result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT) {
+ DebugTool.logInfo(TAG, "Dead object, removing app and sessions");
+ //Get all their sessions and send out unregister info
+ //Use the version in this packet as a best guess
+ app.close();
+ Vector<Long> sessions = app.getSessionIds();
+ byte[] unregister, stopService;
+ int size = sessions.size(), sessionId;
+ for (int i = 0; i < size; i++) {
+ sessionId = sessions.get(i).intValue();
+ unregister = createForceUnregisterApp((byte) sessionId, version);
+ List<TransportType> transportTypes = app.getTransportsForSession(sessionId);
+ if (transportTypes != null && !transportTypes.isEmpty()) {
+ manuallyWriteBytes(transportTypes.get(0), unregister, 0, unregister.length);
+ int hashId = 0;
+ synchronized (this.SESSION_LOCK) {
+ if (this.sessionHashIdMap.indexOfKey(sessionId) >= 0) {
+ hashId = this.sessionHashIdMap.get(sessionId);
+ }
+ }
+ stopService = SdlPacketFactory.createEndSession(SessionType.RPC, (byte) sessionId, 0, version, hashId).constructPacket();
+
+ manuallyWriteBytes(transportTypes.get(0), stopService, 0, stopService.length);
+ synchronized (SESSION_LOCK) {
+ this.bluetoothSessionMap.remove(sessionId);
+ this.sessionHashIdMap.delete(sessionId);
+ }
+ }
+ }
+ synchronized (REGISTERED_APPS_LOCK) {
+ registeredApps.remove(app.appId);
+ }
+ return false;//We did our best to correct errors
+ }
+ return true;//We should have sent our packet, so we can return true now
+ }
+
+ private synchronized void closeBluetoothSerialServer() {
+ if (bluetoothTransport != null) {
+ bluetoothTransport.stop();
+ bluetoothTransport = null;
+ }
+ }
+
+ /**
+ * This function looks through the phones currently paired bluetooth devices
+ * If one of the devices' names contain "sync", or livio it will attempt to connect the RFCOMM
+ * And start SDL
+ *
+ * @return a boolean if a connection was attempted
+ */
+ @SuppressWarnings({"MissingPermission"})
+ public synchronized boolean bluetoothQuerryAndConnect() {
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if (adapter != null && adapter.isEnabled()) {
+ Set<BluetoothDevice> pairedBT = adapter.getBondedDevices();
+ DebugTool.logInfo(TAG, "Query Bluetooth paired devices");
+ if (pairedBT.size() > 0) {
+ for (BluetoothDevice device : pairedBT) {
+ String name = device.getName().toLowerCase(Locale.US);
+ if (name.contains("sync") || name.contains("livio")) {
+ bluetoothConnect(device);
+ return true;
+ }
+ }
+ }
+ } else {
+ DebugTool.logError(TAG, "There was an issue with connecting as client");
+ }
+ return false;
+ }
+
+ @SuppressWarnings("MissingPermission")
+ private synchronized boolean bluetoothConnect(BluetoothDevice device) {
+ DebugTool.logInfo(TAG, "Connecting to device: " + device.getName());
+ if (bluetoothTransport == null || !bluetoothTransport.isConnected()) { // Set up the Bluetooth serial object
+ bluetoothTransport = new MultiplexBluetoothTransport(bluetoothHandler);
+ }
+ // We've been given a device - let's connect to it
+ if (bluetoothTransport.getState() != MultiplexBluetoothTransport.STATE_CONNECTING) {
+ bluetoothTransport.connect(device);
+ if (bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTING) {
+ return true;
+ }
+ }
+
+ DebugTool.logInfo(TAG, "Bluetooth SPP Connect Attempt Completed");
+ return false;
+ }
+
+
+ //**************************************************************************************************************************************
+ //********************************************************* PREFERENCES ****************************************************************
+ //**************************************************************************************************************************************
+
+ /**
+ * Set the connection establishment status of the particular device
+ *
+ * @param address address of the device in quesiton
+ * @param hasSDLConnected true if a connection has been established, false if not
+ */
+ protected void setSDLConnectedStatus(String address, boolean hasSDLConnected) {
+ SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean(address, hasSDLConnected);
+ editor.commit();
+ }
+
+ /**
+ * Checks to see if a device address has connected to SDL before.
+ *
+ * @param address the mac address of the device in quesiton
+ * @return if this is the first status check of this device
+ */
+ protected boolean isFirstStatusCheck(String address) {
+ SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ return !preferences.contains(address);
+ }
+
+ /**
+ * Checks to see if a device address has connected to SDL before.
+ *
+ * @param address the mac address of the device in quesiton
+ * @return if an SDL connection has ever been established with this device
+ */
+ protected boolean hasSDLConnected(String address) {
+ SharedPreferences preferences = this.getSharedPreferences(SDL_DEVICE_STATUS_SHARED_PREFS, Context.MODE_PRIVATE);
+ return preferences.contains(address) && preferences.getBoolean(address, false);
+ }
+
+ /**
+ * Set specific settings through key/value to the SDL_ROUTER_SERVICE_PREFS
+ *
+ * @param key the key of the pair to set in the preferences
+ * @param value boolean to attach to key in the preferences
+ */
+ protected void setSdlRouterServicePrefs(String key, boolean value) {
+ SharedPreferences preferences = this.getSharedPreferences(SDL_ROUTER_SERVICE_PREFS, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean(key, value);
+ editor.commit();
+ DebugTool.logInfo(TAG, "Preference set: " + key + " : " + value);
+ }
+
+ /**
+ * Retrieves a boolean value for the given key in the SDL_ROUTER_SERVICE_PREFS
+ *
+ * @param key the string key that will be used to retrieve the boolean value
+ * @param defaultValue if they key does not exist or there is no value to be found, this is the
+ * value that will be returned
+ * @return the value associated with the supplied key or defaultValue if one does not exist
+ */
+ protected boolean getBooleanPref(String key, boolean defaultValue) {
+ SharedPreferences preferences = this.getSharedPreferences(SDL_ROUTER_SERVICE_PREFS, Context.MODE_PRIVATE);
+ if (preferences != null) {
+ return preferences.getBoolean(key, defaultValue);
+ }
+ return false;
+ }
+
+
+ /* ***********************************************************************************************************************************************************************
+ * ***************************************************************** CUSTOM ADDITIONS ************************************************************************************
+ *************************************************************************************************************************************************************************/
+
+ @SuppressWarnings("DeprecatedIsStillUsed")
+ @Deprecated
+ protected static LocalRouterService getLocalRouterService(Intent launchIntent, ComponentName name) {
+ if (launchIntent == null) {
+ DebugTool.logWarning(TAG, "Supplied intent was null, local router service will not contain intent");
+ }
+ if (name == null) {
+ DebugTool.logError(TAG, "Unable to create local router service object because component name was null");
+ return null;
+ }
+ //noinspection deprecation
+ return new LocalRouterService(launchIntent, ROUTER_SERVICE_VERSION_NUMBER, System.currentTimeMillis(), name);
+ }
+
+ /**
+ * This method is used to check for the newest version of this class to make sure the latest and greatest is up and running.
+ */
+ private void startAltTransportTimer() {
+ altTransportTimerHandler = new Handler();
+ altTransportTimerRunnable = new Runnable() {
public void run() {
- altTransportTimerHandler = null;
- altTransportTimerRunnable = null;
- if(!shouldServiceRemainOpen(null)){
- closeSelf();
- }
+ altTransportTimerHandler = null;
+ altTransportTimerRunnable = null;
+ if (!shouldServiceRemainOpen(null)) {
+ closeSelf();
+ }
}
};
- altTransportTimerHandler.postDelayed(altTransportTimerRunnable, ALT_TRANSPORT_TIMEOUT_RUNNABLE);
- }
-
- /**
- * Removes session from map if the key is found.
- * @param sessionId the session id that is to be removed from our current mapping
- * @return if the key was found
- */
- private boolean removeSessionFromMap(int sessionId, List<TransportType> transportTypes){
- synchronized(SESSION_LOCK){
- boolean retVal = false;
- if(transportTypes != null) { //FIXME I don't believe this should be null
- if (transportTypes.contains(TransportType.BLUETOOTH) && bluetoothSessionMap != null) {
- if (bluetoothSessionMap.indexOfKey(sessionId) >= 0) {
- bluetoothSessionMap.remove(sessionId);
- retVal = true;
- }
- } else if (transportTypes.contains(TransportType.USB) && usbSessionMap != null) {
- if (usbSessionMap.indexOfKey(sessionId) >= 0) {
- usbSessionMap.remove(sessionId);
- retVal = true;
- }
- } else if (transportTypes.contains(TransportType.TCP) && tcpSessionMap != null) {
- if (tcpSessionMap.indexOfKey(sessionId) >= 0) {
- tcpSessionMap.remove(sessionId);
- retVal = true;
- }
- }
- }
- return retVal;
- }
- }
-
-
- private boolean removeAllSessionsWithAppId(String appId){
- synchronized(SESSION_LOCK){
- if(bluetoothSessionMap !=null){
- SparseArray<String> iter = bluetoothSessionMap.clone();
- int size = iter.size();
- for(int i = 0; i<size; i++){
- if(iter.valueAt(i).compareTo(appId) == 0){
- sessionHashIdMap.delete(iter.keyAt(i));
- bluetoothSessionMap.removeAt(i);
- }
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * Removes all sessions from the sessions map for this given app id
- * @param app the RegisteredApp object that should have all its sessions removed
- * @param cleanModule a flag if this service should attempt to clear off the sessions tied to the app off the module
- */
- private void removeAllSessionsForApp(RegisteredApp app, boolean cleanModule){
- Vector<Long> sessions = app.getSessionIds();
- int size = sessions.size(), sessionId;
- for(int i=0; i<size;i++){
- //Log.d(TAG, "Investigating session " +sessions.get(i).intValue());
- //Log.d(TAG, "App id is: " + bluetoothSessionMap.get(sessions.get(i).intValue()));
- sessionId = sessions.get(i).intValue();
- List<TransportType> transportTypes = app.getTransportsForSession(sessionId);
- removeSessionFromMap(sessionId, transportTypes);
- if(cleanModule){
- if(transportTypes != null && transportTypes.size() > 0){
- attemptToCleanUpModule(sessionId, cachedModuleVersion, transportTypes.get(0));
- }
- }
- }
- }
-
- private boolean removeAppFromMap(RegisteredApp app){
- synchronized(REGISTERED_APPS_LOCK){
- //noinspection SuspiciousMethodCalls
- RegisteredApp old = registeredApps.remove(app);
- if(old!=null){
- old.close();
- return true;
- }
- }
- return false;
- }
-
- private String getAppIDForSession(int sessionId, boolean newSession, boolean newTransport, TransportType transportType){
- synchronized(SESSION_LOCK){
- //Log.d(TAG, "Looking for session: " + sessionId);
- //First get the session map for the correct transport
- SparseArray<String> sessionMap;
- switch(transportType){
- case BLUETOOTH:
- if(bluetoothSessionMap == null){
- bluetoothSessionMap = new SparseArray<String>();
- }
- sessionMap = bluetoothSessionMap;
- break;
- case USB:
- if(usbSessionMap == null){
- usbSessionMap = new SparseArray<String>();
- }
- sessionMap = usbSessionMap;
- break;
- case TCP:
- if(tcpSessionMap == null){
- tcpSessionMap = new SparseArray<String>();
- }
- sessionMap = tcpSessionMap;
- break;
- default:
- return null;
- }
-
- String appId = sessionMap.get(sessionId);
- if(appId==null){
- // If service type is RPC then we know we need to just skip ahead and see if there
- // is a registered app awaiting a session.
- if(newSession) {
- int pos;
- synchronized (REGISTERED_APPS_LOCK) {
- for (RegisteredApp app : registeredApps.values()) {
- if(app.getAwaitingSession().contains(transportType)) {
- pos = app.containsSessionId(-1);
- if (pos != -1) {
- app.setSessionId(pos, sessionId);
- app.registerTransport(sessionId, transportType);
- app.getAwaitingSession().remove(transportType);
- appId = app.getAppId();
- sessionMap.put(sessionId, appId);
- break;
- }
- }
- }
- }
- }else if(newTransport){
-
- // If this is anything other than RPC with a start service response we can assume
- // the app wants to use a new transport as secondary.
-
- // We would only receive a start service response for RPC service when an app is
- // attempting to register for the first time. Other services can be ran on
- //secondary transports.
- switch (transportType){
- case BLUETOOTH: //Check for BT as a secondary transport
- //USB is potential primary
- appId = usbSessionMap.get(sessionId);
- // No other suitable transport for primary transport
- break;
- case USB: //Check for USB as a secondary transport
- //BT potential primary transport
- appId = bluetoothSessionMap.get(sessionId);
- // No other suitable transport for primary transport
- break;
- case TCP: //Check for TCP as a secondary transport
- //BT potential primary transport
- appId = bluetoothSessionMap.get(sessionId);
- if(appId == null){
- //USB is potential primary transport
- appId = usbSessionMap.get(sessionId);
- }
- break;
- default:
- return null;
- }
-
- if(appId != null){
- //This means that there is a session id of the same id on another transport
- synchronized(REGISTERED_APPS_LOCK){
- RegisteredApp app = registeredApps.get(appId);
- //Ensure a registered app actually exists and is not null
- if(app != null){
- //Register this new transport for the app and add the entry to the
- //session map associated with this transport
- app.registerTransport(sessionId, transportType);
- sessionMap.put(sessionId,appId);
- }else{
- DebugTool.logWarning(TAG, "No registered app found when register secondary transport");
- }
- }
- }
- }
-
- }
- //Log.d(TAG, sessionId + " session returning App Id: " + appId);
- return appId;
- }
- }
-
- /* ****************************************************************************************************************************************
+ altTransportTimerHandler.postDelayed(altTransportTimerRunnable, ALT_TRANSPORT_TIMEOUT_RUNNABLE);
+ }
+
+ /**
+ * Removes session from map if the key is found.
+ *
+ * @param sessionId the session id that is to be removed from our current mapping
+ * @return if the key was found
+ */
+ private boolean removeSessionFromMap(int sessionId, List<TransportType> transportTypes) {
+ synchronized (SESSION_LOCK) {
+ boolean retVal = false;
+ if (transportTypes != null) { //FIXME I don't believe this should be null
+ if (transportTypes.contains(TransportType.BLUETOOTH) && bluetoothSessionMap != null) {
+ if (bluetoothSessionMap.indexOfKey(sessionId) >= 0) {
+ bluetoothSessionMap.remove(sessionId);
+ retVal = true;
+ }
+ } else if (transportTypes.contains(TransportType.USB) && usbSessionMap != null) {
+ if (usbSessionMap.indexOfKey(sessionId) >= 0) {
+ usbSessionMap.remove(sessionId);
+ retVal = true;
+ }
+ } else if (transportTypes.contains(TransportType.TCP) && tcpSessionMap != null) {
+ if (tcpSessionMap.indexOfKey(sessionId) >= 0) {
+ tcpSessionMap.remove(sessionId);
+ retVal = true;
+ }
+ }
+ }
+ return retVal;
+ }
+ }
+
+
+ private boolean removeAllSessionsWithAppId(String appId) {
+ synchronized (SESSION_LOCK) {
+ if (bluetoothSessionMap != null) {
+ SparseArray<String> iter = bluetoothSessionMap.clone();
+ int size = iter.size();
+ for (int i = 0; i < size; i++) {
+ if (iter.valueAt(i).compareTo(appId) == 0) {
+ sessionHashIdMap.delete(iter.keyAt(i));
+ bluetoothSessionMap.removeAt(i);
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Removes all sessions from the sessions map for this given app id
+ *
+ * @param app the RegisteredApp object that should have all its sessions removed
+ * @param cleanModule a flag if this service should attempt to clear off the sessions tied to the app off the module
+ */
+ private void removeAllSessionsForApp(RegisteredApp app, boolean cleanModule) {
+ Vector<Long> sessions = app.getSessionIds();
+ int size = sessions.size(), sessionId;
+ for (int i = 0; i < size; i++) {
+ //Log.d(TAG, "Investigating session " +sessions.get(i).intValue());
+ //Log.d(TAG, "App id is: " + bluetoothSessionMap.get(sessions.get(i).intValue()));
+ sessionId = sessions.get(i).intValue();
+ List<TransportType> transportTypes = app.getTransportsForSession(sessionId);
+ removeSessionFromMap(sessionId, transportTypes);
+ if (cleanModule) {
+ if (transportTypes != null && transportTypes.size() > 0) {
+ attemptToCleanUpModule(sessionId, cachedModuleVersion, transportTypes.get(0));
+ }
+ }
+ }
+ }
+
+ private boolean removeAppFromMap(RegisteredApp app) {
+ synchronized (REGISTERED_APPS_LOCK) {
+ //noinspection SuspiciousMethodCalls
+ RegisteredApp old = registeredApps.remove(app);
+ if (old != null) {
+ old.close();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String getAppIDForSession(int sessionId, boolean newSession, boolean newTransport, TransportType transportType) {
+ synchronized (SESSION_LOCK) {
+ //Log.d(TAG, "Looking for session: " + sessionId);
+ //First get the session map for the correct transport
+ SparseArray<String> sessionMap;
+ switch (transportType) {
+ case BLUETOOTH:
+ if (bluetoothSessionMap == null) {
+ bluetoothSessionMap = new SparseArray<String>();
+ }
+ sessionMap = bluetoothSessionMap;
+ break;
+ case USB:
+ if (usbSessionMap == null) {
+ usbSessionMap = new SparseArray<String>();
+ }
+ sessionMap = usbSessionMap;
+ break;
+ case TCP:
+ if (tcpSessionMap == null) {
+ tcpSessionMap = new SparseArray<String>();
+ }
+ sessionMap = tcpSessionMap;
+ break;
+ default:
+ return null;
+ }
+
+ String appId = sessionMap.get(sessionId);
+ if (appId == null) {
+ // If service type is RPC then we know we need to just skip ahead and see if there
+ // is a registered app awaiting a session.
+ if (newSession) {
+ int pos;
+ synchronized (REGISTERED_APPS_LOCK) {
+ for (RegisteredApp app : registeredApps.values()) {
+ if (app.getAwaitingSession().contains(transportType)) {
+ pos = app.containsSessionId(-1);
+ if (pos != -1) {
+ app.setSessionId(pos, sessionId);
+ app.registerTransport(sessionId, transportType);
+ app.getAwaitingSession().remove(transportType);
+ appId = app.getAppId();
+ sessionMap.put(sessionId, appId);
+ break;
+ }
+ }
+ }
+ }
+ } else if (newTransport) {
+
+ // If this is anything other than RPC with a start service response we can assume
+ // the app wants to use a new transport as secondary.
+
+ // We would only receive a start service response for RPC service when an app is
+ // attempting to register for the first time. Other services can be ran on
+ //secondary transports.
+ switch (transportType) {
+ case BLUETOOTH: //Check for BT as a secondary transport
+ //USB is potential primary
+ appId = usbSessionMap.get(sessionId);
+ // No other suitable transport for primary transport
+ break;
+ case USB: //Check for USB as a secondary transport
+ //BT potential primary transport
+ appId = bluetoothSessionMap.get(sessionId);
+ // No other suitable transport for primary transport
+ break;
+ case TCP: //Check for TCP as a secondary transport
+ //BT potential primary transport
+ appId = bluetoothSessionMap.get(sessionId);
+ if (appId == null) {
+ //USB is potential primary transport
+ appId = usbSessionMap.get(sessionId);
+ }
+ break;
+ default:
+ return null;
+ }
+
+ if (appId != null) {
+ //This means that there is a session id of the same id on another transport
+ synchronized (REGISTERED_APPS_LOCK) {
+ RegisteredApp app = registeredApps.get(appId);
+ //Ensure a registered app actually exists and is not null
+ if (app != null) {
+ //Register this new transport for the app and add the entry to the
+ //session map associated with this transport
+ app.registerTransport(sessionId, transportType);
+ sessionMap.put(sessionId, appId);
+ } else {
+ DebugTool.logWarning(TAG, "No registered app found when register secondary transport");
+ }
+ }
+ }
+ }
+
+ }
+ //Log.d(TAG, sessionId + " session returning App Id: " + appId);
+ return appId;
+ }
+ }
+
+ /* ****************************************************************************************************************************************
// *********************************************************** LEGACY ****************************************************************
//*****************************************************************************************************************************************/
- private boolean legacyModeEnabled = false;
-
- private void enableLegacyMode(boolean enable){
- DebugTool.logInfo(TAG, "Enable legacy mode: " + enable);
- legacyModeEnabled = enable; //We put this at the end to avoid a race condition between the bluetooth d/c and notify of legacy mode enabled
-
- if(legacyModeEnabled){
- //So we need to let the clients know they need to host their own bluetooth sessions because the currently connected head unit only supports a very old version of SDL/Applink
- //Start by closing our own bluetooth connection. The following calls will handle actually notifying the clients of legacy mode
- closeBluetoothSerialServer();
- //Now wait until we get a d/c, then the apps should shut their bluetooth down and go back to normal
-
- }//else{}
-
- }
-
+ private boolean legacyModeEnabled = false;
+
+ private void enableLegacyMode(boolean enable) {
+ DebugTool.logInfo(TAG, "Enable legacy mode: " + enable);
+ legacyModeEnabled = enable; //We put this at the end to avoid a race condition between the bluetooth d/c and notify of legacy mode enabled
+
+ if (legacyModeEnabled) {
+ //So we need to let the clients know they need to host their own bluetooth sessions because the currently connected head unit only supports a very old version of SDL/Applink
+ //Start by closing our own bluetooth connection. The following calls will handle actually notifying the clients of legacy mode
+ closeBluetoothSerialServer();
+ //Now wait until we get a d/c, then the apps should shut their bluetooth down and go back to normal
+
+ }//else{}
+
+ }
+
/* ****************************************************************************************************************************************
// *********************************************************** UTILITY ****************************************************************
//*****************************************************************************************************************************************/
-
- private void debugPacket(byte[] bytes){
- //DEBUG
-
- if(bytes[0] != 0x00){
- DebugTool.logInfo(TAG, "Writing packet with header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
- }else{
-
- //Log.d(TAG, "Writing packet with binary header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
- //int length = bytes.length-12;
- if(bytes.length<=8){
- DebugTool.logWarning(TAG, "No payload to debug or too small");
- return;
- }
- //Check first byte if 0, make to json
- char[] buffer = new char[bytes.length];
- for(int i = 12;i<bytes.length;i++){
- buffer[i-12] = (char)(bytes[i] & 0xFF);
- }
- try {
-
- JSONObject object = new JSONObject(new String(buffer));
- DebugTool.logInfo(TAG, "JSON: " + object.toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- }
-
- /**
- * If an app crashes the only way we can handle it being on the head unit is to send an unregister app interface rpc.
- * This method should only be called when the router service recognizes the client is no longer valid
- * @param sessionId session id that is currently being cleared from the module. It will be used to form the packet.
- * @param version the last known version this session was operating with
- * @return a byte array that contains the full packet for an UnregisterAppInterface that can be written out to the transport
- */
- private byte[] createForceUnregisterApp(byte sessionId,byte version){
- UnregisterAppInterface request = new UnregisterAppInterface();
- request.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
- request.format(null,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, version);
- ProtocolMessage pm = new ProtocolMessage();
- pm.setData(msgBytes);
- pm.setSessionID(sessionId);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
- pm.setCorrID(request.getCorrelationID());
- if (request.getBulkData() != null)
- pm.setBulkData(request.getBulkData());
- byte[] data;
- if(version > 1) { //If greater than v1 we need to include a binary frame header in the data before all the JSON starts
- data = new byte[12 + pm.getJsonSize()];
- BinaryFrameHeader binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
- System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
- System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
- }else {
- data = pm.getData();
- }
-
- SdlPacket packet = new SdlPacket(version,false,SdlPacket.FRAME_TYPE_SINGLE,SdlPacket.SERVICE_TYPE_RPC,0,sessionId,data.length,data.length+100,data);
- return packet.constructPacket();
- }
-
-
+
+ private void debugPacket(byte[] bytes) {
+ //DEBUG
+
+ if (bytes[0] != 0x00) {
+ DebugTool.logInfo(TAG, "Writing packet with header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
+ } else {
+
+ //Log.d(TAG, "Writing packet with binary header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
+ //int length = bytes.length-12;
+ if (bytes.length <= 8) {
+ DebugTool.logWarning(TAG, "No payload to debug or too small");
+ return;
+ }
+ //Check first byte if 0, make to json
+ char[] buffer = new char[bytes.length];
+ for (int i = 12; i < bytes.length; i++) {
+ buffer[i - 12] = (char) (bytes[i] & 0xFF);
+ }
+ try {
+
+ JSONObject object = new JSONObject(new String(buffer));
+ DebugTool.logInfo(TAG, "JSON: " + object.toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ /**
+ * If an app crashes the only way we can handle it being on the head unit is to send an unregister app interface rpc.
+ * This method should only be called when the router service recognizes the client is no longer valid
+ *
+ * @param sessionId session id that is currently being cleared from the module. It will be used to form the packet.
+ * @param version the last known version this session was operating with
+ * @return a byte array that contains the full packet for an UnregisterAppInterface that can be written out to the transport
+ */
+ private byte[] createForceUnregisterApp(byte sessionId, byte version) {
+ UnregisterAppInterface request = new UnregisterAppInterface();
+ request.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
+ request.format(null, true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, version);
+ ProtocolMessage pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ pm.setSessionID(sessionId);
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
+ pm.setCorrID(request.getCorrelationID());
+ if (request.getBulkData() != null)
+ pm.setBulkData(request.getBulkData());
+ byte[] data;
+ if (version > 1) { //If greater than v1 we need to include a binary frame header in the data before all the JSON starts
+ data = new byte[12 + pm.getJsonSize()];
+ BinaryFrameHeader binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), pm.getJsonSize());
+ System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
+ System.arraycopy(pm.getData(), 0, data, 12, pm.getJsonSize());
+ } else {
+ data = pm.getData();
+ }
+
+ SdlPacket packet = new SdlPacket(version, false, SdlPacket.FRAME_TYPE_SINGLE, SdlPacket.SERVICE_TYPE_RPC, 0, sessionId, data.length, data.length + 100, data);
+ return packet.constructPacket();
+ }
+
+
/**
* Method for finding the next, highest priority write task from all connected apps.
+ *
* @return the next task for writing out packets if one exists
*/
- protected PacketWriteTask getNextTask(TransportType transportType){
- final long currentTime = System.currentTimeMillis();
- RegisteredApp priorityApp = null;
- long currentPriority = -Long.MAX_VALUE, peekWeight;
- synchronized(REGISTERED_APPS_LOCK){
- PacketWriteTask peekTask;
- for (RegisteredApp app : registeredApps.values()) {
- peekTask = app.peekNextTask(transportType);
- if(peekTask!=null){
- peekWeight = peekTask.getWeight(currentTime);
- //Log.v(TAG, "App " + app.appId +" has a task with weight "+ peekWeight);
- if(peekWeight>currentPriority){
- if(app.queuePaused){
- app.notIt(transportType);//Reset the timer
- continue;
- }
- if(priorityApp!=null){
- priorityApp.notIt(transportType);
- }
- currentPriority = peekWeight;
- priorityApp = app;
- }
- }
- }
- if(priorityApp!=null){
- return priorityApp.getNextTask(transportType);
- }
- }
- return null;
- }
-
- private void initPingIntent(){
- pingIntent = new Intent();
- pingIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
- pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, true);
- pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE, getBaseContext().getPackageName());
- pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME, new ComponentName(SdlRouterService.this, SdlRouterService.this.getClass()));
- pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_PING, true);
- }
-
- private void startClientPings(){
- synchronized(this){
- if(!isPrimaryTransportConnected()){ //If we aren't connected, bail
- return;
- }
- if(isPingingClients){
- DebugTool.logWarning(TAG, "Already pinging clients. Resting count");
- synchronized(PING_COUNT_LOCK){
- pingCount = 0;
- }
- return;
- }
- if(clientPingExecutor == null){
- clientPingExecutor = Executors.newSingleThreadScheduledExecutor();
- }
- isPingingClients = true;
- synchronized(PING_COUNT_LOCK){
- pingCount = 0;
- }
-
- clientPingExecutor.scheduleAtFixedRate(new Runnable(){
- List<ResolveInfo> sdlApps;
- @Override
- public void run() {
- if(getPingCount()>=10){
- DebugTool.logInfo(TAG, "Hit ping limit");
- stopClientPings();
- return;
- }
- if(pingIntent == null){
- initPingIntent();
- }
-
- if(sdlApps == null){
- sdlApps = getPackageManager().queryBroadcastReceivers(pingIntent, 0);
- }
-
- AndroidTools.sendExplicitBroadcast(getApplicationContext(), pingIntent, sdlApps);
- synchronized(PING_COUNT_LOCK){
- pingCount++;
- }
-
- }
- }, CLIENT_PING_DELAY, CLIENT_PING_DELAY, TimeUnit.MILLISECONDS); //Give a little delay for first call
- }
- }
-
- private int getPingCount(){
- synchronized(PING_COUNT_LOCK){
- return pingCount;
- }
- }
-
- private void stopClientPings(){
- if(clientPingExecutor!=null && !clientPingExecutor.isShutdown()){
- clientPingExecutor.shutdownNow();
- clientPingExecutor = null;
- isPingingClients = false;
- }
- pingIntent = null;
- }
+ protected PacketWriteTask getNextTask(TransportType transportType) {
+ final long currentTime = System.currentTimeMillis();
+ RegisteredApp priorityApp = null;
+ long currentPriority = -Long.MAX_VALUE, peekWeight;
+ synchronized (REGISTERED_APPS_LOCK) {
+ PacketWriteTask peekTask;
+ for (RegisteredApp app : registeredApps.values()) {
+ peekTask = app.peekNextTask(transportType);
+ if (peekTask != null) {
+ peekWeight = peekTask.getWeight(currentTime);
+ //Log.v(TAG, "App " + app.appId +" has a task with weight "+ peekWeight);
+ if (peekWeight > currentPriority) {
+ if (app.queuePaused) {
+ app.notIt(transportType);//Reset the timer
+ continue;
+ }
+ if (priorityApp != null) {
+ priorityApp.notIt(transportType);
+ }
+ currentPriority = peekWeight;
+ priorityApp = app;
+ }
+ }
+ }
+ if (priorityApp != null) {
+ return priorityApp.getNextTask(transportType);
+ }
+ }
+ return null;
+ }
+
+ private void initPingIntent() {
+ pingIntent = new Intent();
+ pingIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, true);
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE, getBaseContext().getPackageName());
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME, new ComponentName(SdlRouterService.this, SdlRouterService.this.getClass()));
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_PING, true);
+ }
+
+ private void startClientPings() {
+ synchronized (this) {
+ if (!isPrimaryTransportConnected()) { //If we aren't connected, bail
+ return;
+ }
+ if (isPingingClients) {
+ DebugTool.logWarning(TAG, "Already pinging clients. Resting count");
+ synchronized (PING_COUNT_LOCK) {
+ pingCount = 0;
+ }
+ return;
+ }
+ if (clientPingExecutor == null) {
+ clientPingExecutor = Executors.newSingleThreadScheduledExecutor();
+ }
+ isPingingClients = true;
+ synchronized (PING_COUNT_LOCK) {
+ pingCount = 0;
+ }
+
+ clientPingExecutor.scheduleAtFixedRate(new Runnable() {
+ List<ResolveInfo> sdlApps;
+
+ @Override
+ public void run() {
+ if (getPingCount() >= 10) {
+ DebugTool.logInfo(TAG, "Hit ping limit");
+ stopClientPings();
+ return;
+ }
+ if (pingIntent == null) {
+ initPingIntent();
+ }
+
+ if (sdlApps == null) {
+ sdlApps = getPackageManager().queryBroadcastReceivers(pingIntent, 0);
+ }
+
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(), pingIntent, sdlApps);
+ synchronized (PING_COUNT_LOCK) {
+ pingCount++;
+ }
+
+ }
+ }, CLIENT_PING_DELAY, CLIENT_PING_DELAY, TimeUnit.MILLISECONDS); //Give a little delay for first call
+ }
+ }
+
+ private int getPingCount() {
+ synchronized (PING_COUNT_LOCK) {
+ return pingCount;
+ }
+ }
+
+ private void stopClientPings() {
+ if (clientPingExecutor != null && !clientPingExecutor.isShutdown()) {
+ clientPingExecutor.shutdownNow();
+ clientPingExecutor = null;
+ isPingingClients = false;
+ }
+ pingIntent = null;
+ }
/* ****************************************************************************************************************************************
// ********************************************************** TINY CLASSES ************************************************************
//*****************************************************************************************************************************************/
- /**
- *This class enables us to compare two router services
- * from different apps and determine which is the newest
- * and therefore which one should be the one spun up.
- * @author Joey Grover
- * @deprecated Move to the new version checking system with meta-data
- *
- */
- @SuppressWarnings({"DeprecatedIsStillUsed"})
- @Deprecated
- static class LocalRouterService implements Parcelable{
- Intent launchIntent = null;
- int version ;
- final long timestamp;
- ComponentName name;
-
- @SuppressWarnings("SameParameterValue")
- private LocalRouterService(Intent intent, int version, long timeStamp, ComponentName name ){
- this.launchIntent = intent;
- this.version = version;
- this.timestamp = timeStamp;
- this.name = name;
- }
- /**
- * Check if input is newer than this version
- * @param service a reference to another possible router service that is in quesiton
- * @return if the supplied service is newer than this one
- */
- public boolean isNewer(@SuppressWarnings("deprecation") LocalRouterService service){
- if(service.version>this.version){
- return true;
- }else if(service.version == this.version){ //If we have the same version, we will use a timestamp
- return service.timestamp<this.timestamp;
- }
- return false;
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean isEqual(@SuppressWarnings("deprecation") LocalRouterService service) {
- return service != null && service.name != null && this.name != null && this.name.equals(service.name);
- }
-
- @Override
- public String toString() {
- StringBuilder build = new StringBuilder();
- build.append("Intent action: ");
- if(launchIntent!=null && launchIntent.getComponent() != null){
- build.append(launchIntent.getComponent().getClassName());
- }else if(name!=null){
- build.append(name.getClassName());
- }
-
- build.append(" Version: ");
- build.append(version);
- build.append(" Timestamp: ");
- build.append(timestamp);
-
- return build.toString();
- }
- public LocalRouterService(Parcel p) {
- this.version = p.readInt();
- this.timestamp = p.readLong();
- try {
- this.launchIntent = p.readParcelable(Intent.class.getClassLoader());
- this.name = p.readParcelable(ComponentName.class.getClassLoader());
- }catch (Exception e){
- // catch DexException
- }
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(version);
- dest.writeLong(timestamp);
- dest.writeParcelable(launchIntent, 0);
- dest.writeParcelable(name, 0);
-
- }
-
- @SuppressWarnings("deprecation")
- public static final Parcelable.Creator<LocalRouterService> CREATOR = new Parcelable.Creator<LocalRouterService>() {
- @SuppressWarnings("deprecation")
- public LocalRouterService createFromParcel(Parcel in) {
- //noinspection deprecation
- return new LocalRouterService(in);
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public LocalRouterService[] newArray(int size) {
- //noinspection deprecation
- return new LocalRouterService[size];
- }
-
- };
-
- }
-
-
- /**
- * This class helps keep track of all the different sessions established with the head unit
- * and to which app they belong to.
- * @author Joey Grover
- *
- */
- @SuppressWarnings("Convert2Diamond")
- class RegisteredApp {
- protected static final int SEND_MESSAGE_SUCCESS = 0x00;
- protected static final int SEND_MESSAGE_ERROR_MESSAGE_NULL = 0x01;
- protected static final int SEND_MESSAGE_ERROR_MESSENGER_NULL = 0x02;
- protected static final int SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION = 0x03;
- protected static final int SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT = 0x04;
-
- protected static final int PAUSE_TIME_FOR_QUEUE = 1500;
-
- private final Object TRANSPORT_LOCK = new Object();
-
- final String appId;
- final Messenger messenger;
- final Vector<Long> sessionIds;
- final Vector<TransportType> awaitingSession;
- final int routerMessagingVersion;
-
- ByteAraryMessageAssembler buffer;
- int priorityForBuffingMessage;
- DeathRecipient deathNote = null;
- //Packet queue vars
- final ConcurrentHashMap<TransportType, PacketWriteTaskBlockingQueue> queues;
- Handler queueWaitHandler;
- Runnable queueWaitRunnable = null;
- boolean queuePaused = false;
-
- //Primary will always be first
- final SparseArray<ArrayList<TransportType>> registeredTransports;
-
- /**
- * This is a simple class to hold onto a reference of a registered app.
- * @param appId the supplied id for this app that is attempting to register
- * @param routerMessagingVersion
- * @param messenger the specific messenger that is tied to this app
- */
- public RegisteredApp(String appId, int routerMessagingVersion, Messenger messenger){
- this.appId = appId;
- this.messenger = messenger;
- this.sessionIds = new Vector<Long>();
- this.queues = new ConcurrentHashMap<>();
- queueWaitHandler = new Handler();
- registeredTransports = new SparseArray<ArrayList<TransportType>>();
- awaitingSession = new Vector<>();
- setDeathNote(); //messaging Version
- this.routerMessagingVersion = routerMessagingVersion;
- }
-
-
- /**
- * Closes this app properly.
- */
- public void close(){
- clearDeathNote();
- clearBuffer();
- Collection<PacketWriteTaskBlockingQueue> queueCollection = queues.values();
- for(PacketWriteTaskBlockingQueue queue : queueCollection) {
- if (queue != null) {
- queue.clear();
- }
- }
- queueCollection.clear();
-
- if(queueWaitHandler!=null){
- if(queueWaitRunnable!=null){
- queueWaitHandler.removeCallbacks(queueWaitRunnable);
- }
- queueWaitHandler = null;
- }
- }
-
- public String getAppId() {
- return appId;
- }
+ /**
+ * This class enables us to compare two router services
+ * from different apps and determine which is the newest
+ * and therefore which one should be the one spun up.
+ *
+ * @author Joey Grover
+ * @deprecated Move to the new version checking system with meta-data
+ */
+ @SuppressWarnings({"DeprecatedIsStillUsed"})
+ @Deprecated
+ static class LocalRouterService implements Parcelable {
+ Intent launchIntent = null;
+ int version;
+ final long timestamp;
+ ComponentName name;
+
+ @SuppressWarnings("SameParameterValue")
+ private LocalRouterService(Intent intent, int version, long timeStamp, ComponentName name) {
+ this.launchIntent = intent;
+ this.version = version;
+ this.timestamp = timeStamp;
+ this.name = name;
+ }
+
+ /**
+ * Check if input is newer than this version
+ *
+ * @param service a reference to another possible router service that is in quesiton
+ * @return if the supplied service is newer than this one
+ */
+ public boolean isNewer(@SuppressWarnings("deprecation") LocalRouterService service) {
+ if (service.version > this.version) {
+ return true;
+ } else if (service.version == this.version) { //If we have the same version, we will use a timestamp
+ return service.timestamp < this.timestamp;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
+ public boolean isEqual(@SuppressWarnings("deprecation") LocalRouterService service) {
+ return service != null && service.name != null && this.name != null && this.name.equals(service.name);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder build = new StringBuilder();
+ build.append("Intent action: ");
+ if (launchIntent != null && launchIntent.getComponent() != null) {
+ build.append(launchIntent.getComponent().getClassName());
+ } else if (name != null) {
+ build.append(name.getClassName());
+ }
+
+ build.append(" Version: ");
+ build.append(version);
+ build.append(" Timestamp: ");
+ build.append(timestamp);
+
+ return build.toString();
+ }
+
+ public LocalRouterService(Parcel p) {
+ this.version = p.readInt();
+ this.timestamp = p.readLong();
+ try {
+ this.launchIntent = p.readParcelable(Intent.class.getClassLoader());
+ this.name = p.readParcelable(ComponentName.class.getClassLoader());
+ } catch (Exception e) {
+ // catch DexException
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(version);
+ dest.writeLong(timestamp);
+ dest.writeParcelable(launchIntent, 0);
+ dest.writeParcelable(name, 0);
+
+ }
+
+ @SuppressWarnings("deprecation")
+ public static final Parcelable.Creator<LocalRouterService> CREATOR = new Parcelable.Creator<LocalRouterService>() {
+ @SuppressWarnings("deprecation")
+ public LocalRouterService createFromParcel(Parcel in) {
+ //noinspection deprecation
+ return new LocalRouterService(in);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public LocalRouterService[] newArray(int size) {
+ //noinspection deprecation
+ return new LocalRouterService[size];
+ }
+
+ };
+
+ }
+
+
+ /**
+ * This class helps keep track of all the different sessions established with the head unit
+ * and to which app they belong to.
+ *
+ * @author Joey Grover
+ */
+ @SuppressWarnings("Convert2Diamond")
+ class RegisteredApp {
+ protected static final int SEND_MESSAGE_SUCCESS = 0x00;
+ protected static final int SEND_MESSAGE_ERROR_MESSAGE_NULL = 0x01;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_NULL = 0x02;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION = 0x03;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT = 0x04;
+
+ protected static final int PAUSE_TIME_FOR_QUEUE = 1500;
+
+ private final Object TRANSPORT_LOCK = new Object();
+
+ final String appId;
+ final Messenger messenger;
+ final Vector<Long> sessionIds;
+ final Vector<TransportType> awaitingSession;
+ final int routerMessagingVersion;
+
+ ByteAraryMessageAssembler buffer;
+ int priorityForBuffingMessage;
+ DeathRecipient deathNote = null;
+ //Packet queue vars
+ final ConcurrentHashMap<TransportType, PacketWriteTaskBlockingQueue> queues;
+ Handler queueWaitHandler;
+ Runnable queueWaitRunnable = null;
+ boolean queuePaused = false;
+
+ //Primary will always be first
+ final SparseArray<ArrayList<TransportType>> registeredTransports;
+
+ /**
+ * This is a simple class to hold onto a reference of a registered app.
+ *
+ * @param appId the supplied id for this app that is attempting to register
+ * @param routerMessagingVersion
+ * @param messenger the specific messenger that is tied to this app
+ */
+ public RegisteredApp(String appId, int routerMessagingVersion, Messenger messenger) {
+ this.appId = appId;
+ this.messenger = messenger;
+ this.sessionIds = new Vector<Long>();
+ this.queues = new ConcurrentHashMap<>();
+ queueWaitHandler = new Handler();
+ registeredTransports = new SparseArray<ArrayList<TransportType>>();
+ awaitingSession = new Vector<>();
+ setDeathNote(); //messaging Version
+ this.routerMessagingVersion = routerMessagingVersion;
+ }
+
+
+ /**
+ * Closes this app properly.
+ */
+ public void close() {
+ clearDeathNote();
+ clearBuffer();
+ Collection<PacketWriteTaskBlockingQueue> queueCollection = queues.values();
+ for (PacketWriteTaskBlockingQueue queue : queueCollection) {
+ if (queue != null) {
+ queue.clear();
+ }
+ }
+ queueCollection.clear();
+
+ if (queueWaitHandler != null) {
+ if (queueWaitRunnable != null) {
+ queueWaitHandler.removeCallbacks(queueWaitRunnable);
+ }
+ queueWaitHandler = null;
+ }
+ }
+
+ public String getAppId() {
+ return appId;
+ }
/*public long getAppId() {
return appId;
}*/
- /**
- * This is a convenience variable and may not be used or useful in different protocols
- * @return a vector of all the session ids associated with this app
- */
- public Vector<Long> getSessionIds() {
- return sessionIds;
- }
-
- /**
- * Returns the position of the desired object if it is contained in the vector. If not it will return -1.
- * @param id a session id value that is in question to be associated with this app
- * @return the index of the supplied session id or -1 if it is not associated with this app
- */
- public int containsSessionId(long id){
- return sessionIds.indexOf(id);
- }
- /**
- * This will remove a session from the session id list
- * @param sessionId the id of the session that should be removed
- * @return if the session was successfully removed, or false if the session id wasn't associated with this app.
- */
- public boolean removeSession(Long sessionId){
- int location = sessionIds.indexOf(sessionId);
- if(location>=0){
- Long removedSessionId = sessionIds.remove(location);
- registeredTransports.remove(sessionId.intValue());
- return removedSessionId != null;
- }else{
- return false;
- }
- }
-
- /**
- * This method is to manually put a session id into the mapping. This method should be used with extreme caution and
- * only in certain cases when the sesion id needs to exist at a specific position in the mapping (overwriting a value)
- * @param position the position at which the session id should be placed
- * @param sessionId the session id that will be put into the specific position in the mapping
- * @throws ArrayIndexOutOfBoundsException if the position is outside of the current size of the sessionIds vector
- */
- public void setSessionId(int position,long sessionId) throws ArrayIndexOutOfBoundsException {
- this.sessionIds.set(position, sessionId);
- synchronized (TRANSPORT_LOCK){
- this.registeredTransports.put((int)sessionId, new ArrayList<TransportType>());
- }
- }
-
- public void clearSessionIds(){
- this.sessionIds.clear();
- }
-
- public Vector<TransportType> getAwaitingSession() {
- return awaitingSession;
- }
-
- protected void registerTransport(int sessionId, TransportType transportType){
- synchronized (TRANSPORT_LOCK){
- ArrayList<TransportType> transportTypes = this.registeredTransports.get(sessionId);
- if(transportTypes!= null){
- if(queues.get(transportType) == null){
- queues.put(transportType, new PacketWriteTaskBlockingQueue());
- }
- transportTypes.add(transportType);
- this.registeredTransports.put(sessionId,transportTypes);
- }
-
- }
- }
-
- /**
- *
- * @param sessionId the session id to find if a transport is registered. -1 for sessionId will
- * trigger a search through all sessions.
- * @param transportType the transport type to find if a transport is registered. If null is
- * passed, will return true for any transport being registered on
- * @return
- */
- protected boolean isRegisteredOnTransport(int sessionId, TransportType transportType){
- synchronized (TRANSPORT_LOCK){
- if(this.registeredTransports.indexOfKey(sessionId) >= 0){
- if(transportType == null){
- return this.registeredTransports.get(sessionId).size() > 0;
- }
- return this.registeredTransports.get(sessionId).indexOf(transportType) >= 0;
- }else if(sessionId < 0 ){
-
- //Check if any session is registered on this transport
- int numberOfSessions = registeredTransports.size();
- ArrayList<TransportType> transportTypes;
- for(int i = 0; i < numberOfSessions; i++){
- transportTypes = registeredTransports.valueAt(i);
- if(transportTypes != null) {
- if(transportType == null && transportTypes.size() > 0){
- return true;
- }
- for (TransportType type : transportTypes) {
- if (type.equals(transportType)) {
- return true;
- }
- }
- }
- }
- return false;
-
- }else{
- return false;
- }
- }
- }
-
- protected List<TransportType> getTransportsForSession(int sessionId){
- synchronized (TRANSPORT_LOCK){
- if(this.registeredTransports.indexOfKey(sessionId) >= 0){
- return this.registeredTransports.get(sessionId);
- }else{
- return null;
- }
- }
- }
-
- protected boolean unregisterTransport(int sessionId, @NonNull TransportType transportType){
- if(queues != null && queues.containsKey(transportType)){
- PacketWriteTaskBlockingQueue queue = queues.remove(transportType);
- if(queue != null){
- queue.clear();
- }
- }
- synchronized (TRANSPORT_LOCK){
- if(sessionId == -1){
- int size = this.registeredTransports.size();
- for(int i = 0; i <size; i++){
- this.registeredTransports.valueAt(i).remove(transportType);
- }
- return true;
- }else if(this.registeredTransports.indexOfKey(sessionId) >= 0){
- return this.registeredTransports.get(sessionId).remove(transportType);
- }else{
- return false;
- }
- }
-
- }
-
- protected void unregisterAllTransports(int sessionId){
- synchronized (TRANSPORT_LOCK){
- if(this.registeredTransports.indexOfKey(sessionId) >= 0){
- this.registeredTransports.get(sessionId).clear();
- }else if(sessionId == -1){
- int size = this.registeredTransports.size();
- for(int i = 0; i <size; i++){
- this.registeredTransports.valueAt(i).clear();
- }
- }
- }
- }
-
-
- /**
- * This method will attempt to return a transport type that can be associated to this
- * registered app
- * @return
- */
- private TransportType getCompatPrimaryTransport(){
- if(this.registeredTransports != null && this.registeredTransports.size() > 0) {
- List<TransportType> transportTypes = this.registeredTransports.valueAt(0);
- if (transportTypes != null) {
- if (transportTypes.get(0) != null) {
- return transportTypes.get(0);
- }
- }
- }
-
- //No transport stored
- if(bluetoothTransport != null && bluetoothTransport.isConnected()){
- return TransportType.BLUETOOTH;
- } else if(usbTransport!= null && usbTransport.isConnected()){
- return TransportType.USB;
- } else if(tcpTransport != null && tcpTransport.isConnected()){
- return TransportType.TCP;
- }
-
- return TransportType.BLUETOOTH;
- }
-
- @SuppressWarnings("SameReturnValue")
- public boolean handleIncommingClientMessage(final Bundle receivedBundle){
- 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){
- synchronized (TRANSPORT_LOCK){
- transportType = getCompatPrimaryTransport();
- }
- receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
- }
-
- if(flags!=TransportConstants.BYTES_TO_SEND_FLAG_NONE){
- byte[] packet = receivedBundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
- if(flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START){
- this.priorityForBuffingMessage = receivedBundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT,0);
- }
- handleMessage(flags, packet, transportType);
- }else{
- //Add the write task on the stack
- PacketWriteTaskBlockingQueue queue = queues.get(transportType);
- if(queue == null){ //TODO check to see if there is any better place to put this
- queue = new PacketWriteTaskBlockingQueue();
- queues.put(transportType,queue);
- }
- queue.add(new PacketWriteTask(receivedBundle));
- if(packetWriteTaskMasterMap != null) {
- PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
- if (packetWriteTaskMaster != null) {
- packetWriteTaskMaster.alert();
- }
- } //If this is null, it is likely the service is closing
- }
- return true;
- }
-
- public int sendMessage(Message message){
- if(this.messenger == null){return SEND_MESSAGE_ERROR_MESSENGER_NULL;}
- if(message == null){return SEND_MESSAGE_ERROR_MESSAGE_NULL;}
- try {
- this.messenger.send(message);
- return SEND_MESSAGE_SUCCESS;
- } catch (RemoteException e) {
- e.printStackTrace();
- if(e instanceof DeadObjectException){
- return SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT;
- }else{
- return SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION;
- }
- }
- }
-
- public void handleMessage(int flags, byte[] packet, TransportType transportType){
- if(flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START){
- clearBuffer();
- buffer = new ByteAraryMessageAssembler();
- buffer.init();
- buffer.setTransportType(transportType);
- }
- if(buffer != null){
- if (!buffer.handleMessage(flags, packet)) { //If this returns false
- DebugTool.logError(TAG, "Error handling bytes");
- }
- if (buffer.isFinished()) { //We are finished building the buffer so we should write the bytes out
- byte[] bytes = buffer.getBytes();
- PacketWriteTaskBlockingQueue queue = queues.get(transportType);
- if (queue != null) {
- queue.add(new PacketWriteTask(bytes, 0, bytes.length, this.priorityForBuffingMessage,transportType));
- if(packetWriteTaskMasterMap != null) {
- PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
- if (packetWriteTaskMaster != null) {
- packetWriteTaskMaster.alert();
- }
- }
- }
- buffer.close();
- }
- }
- }
-
- protected PacketWriteTask peekNextTask(TransportType transportType){
- PacketWriteTaskBlockingQueue queue = queues.get(transportType);
- if(queue !=null){
- return queue.peek();
- }
- return null;
- }
-
- protected PacketWriteTask getNextTask(TransportType transportType){
- PacketWriteTaskBlockingQueue queue = queues.get(transportType);
- if(queue !=null){
- return queue.poll();
- }
- return null;
- }
-
- /**
- * This will inform the local app object that it was not picked to have the highest priority. This will allow the user to continue to perform interactions
- * with the module and not be bogged down by large packet requests.
- */
- protected void notIt(final TransportType transportType){
- PacketWriteTaskBlockingQueue queue = queues.get(transportType);
- if(queue!=null && queue.peek().priorityCoefficient>0){ //If this has any sort of priority coefficient we want to make it wait.
- //Flag to wait
- if(queueWaitHandler == null){
- DebugTool.logError(TAG, "Unable to pause queue, handler was null");
- }
- if(queueWaitRunnable == null){
- queueWaitRunnable = new Runnable(){
-
- @Override
- public void run() {
- pauseQueue(false);
- PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
- if(packetWriteTaskMaster!=null){
- packetWriteTaskMaster.alert();
- }
- }
- };
- }
- if(queuePaused){
- queueWaitHandler.removeCallbacks(queueWaitRunnable);
- }
- pauseQueue(queueWaitHandler.postDelayed(queueWaitRunnable, PAUSE_TIME_FOR_QUEUE));
- }
- }
- private void pauseQueue(boolean paused){
- this.queuePaused = paused;
- }
- protected void clearBuffer(){
- if(buffer!=null){
- buffer.close();
- buffer = null;
- }
- }
-
- protected boolean setDeathNote(){
- if(messenger!=null){
- if(deathNote == null){
- deathNote = new DeathRecipient(){
- final Object deathLock = new Object();
- @Override
- public void binderDied() {
- synchronized(deathLock){
- DebugTool.logWarning(TAG, "Binder died for app " + RegisteredApp.this.appId);
- if(messenger.getBinder()!=null){
- messenger.getBinder().unlinkToDeath(this, 0);
- }
- removeAllSessionsForApp(RegisteredApp.this,true);
- removeAppFromMap(RegisteredApp.this);
- startClientPings();
- }
- }
- };
- }
- try {
- messenger.getBinder().linkToDeath(deathNote, 0);
- return true;
- } catch (RemoteException e) {
- e.printStackTrace();
- return false;
- }
- }
- return false;
- }
-
- protected boolean clearDeathNote() {
- return messenger != null && messenger.getBinder() != null && deathNote != null && messenger.getBinder().unlinkToDeath(deathNote, 0);
- }
- }
-
- /**
- * A runnable task for writing out packets.
- * @author Joey Grover
- *
- */
- public class PacketWriteTask implements Runnable{
- private static final long DELAY_CONSTANT = 500; //250ms
- private static final long SIZE_CONSTANT = 1000; //1kb
- private static final long PRIORITY_COEF_CONSTANT = 500;
- private static final int DELAY_COEF = 1;
- private static final int SIZE_COEF = 1;
-
- private byte[] bytesToWrite;
- private final int offset, size, priorityCoefficient;
- private final long timestamp;
- final Bundle receivedBundle;
- TransportType transportType;
-
- public PacketWriteTask(byte[] bytes, int offset, int size, int priorityCoefficient, TransportType transportType){
- timestamp = System.currentTimeMillis();
- bytesToWrite = bytes;
- this.offset = offset;
- this.size = size;
- this.priorityCoefficient = priorityCoefficient;
- receivedBundle = null;
- this.transportType = transportType;
- }
-
- public PacketWriteTask(Bundle bundle){
- this.receivedBundle = bundle;
- timestamp = System.currentTimeMillis();
- bytesToWrite = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
- offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
- size = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytesToWrite.length); //In case there isn't anything just send the whole packet.
- this.priorityCoefficient = bundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT,0);
- this.transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
-
- }
-
- protected void setTransportType(TransportType transportType){
- this.transportType = transportType;
- }
-
- @Override
- public void run() {
- if(receivedBundle != null){
- writeBytesToTransport(receivedBundle);
- }else if(bytesToWrite !=null){
- manuallyWriteBytes(this.transportType, bytesToWrite, offset, size);
- }
- }
-
- private long getWeight(long currentTime){ //Time waiting - size - priority_coef
- return ((((currentTime-timestamp) + DELAY_CONSTANT) * DELAY_COEF ) - ((size -SIZE_CONSTANT) * SIZE_COEF) - (priorityCoefficient * PRIORITY_COEF_CONSTANT));
- }
- }
-
- /**
- * Extends thread to consume PacketWriteTasks in a priority queue fashion. It will attempt to look
- * at all apps serial queue of tasks and compare them
- * @author Joey Grover
- *
- */
- private class PacketWriteTaskMaster extends Thread{
- protected final Object QUEUE_LOCK = new Object();
- private boolean isHalted = false, isWaiting = false;
- private TransportType transportType;
-
- public PacketWriteTaskMaster(){
- this.setName("PacketWriteTaskMaster");
- this.setDaemon(true);
- }
- protected void setTransportType(TransportType transportType){
- this.transportType = transportType;
- }
-
- @Override
- public void run() {
- while(!isHalted){
- try{
- PacketWriteTask task;
- synchronized(QUEUE_LOCK){
- task = getNextTask(transportType);
- if(task != null){
- task.run();
- }else{
- isWaiting = true;
- QUEUE_LOCK.wait();
- isWaiting = false;
- }
- }
- }catch(InterruptedException e){
- break;
- }
- }
- }
-
- private void alert(){
- if(isWaiting){
- synchronized(QUEUE_LOCK){
- QUEUE_LOCK.notify();
- }
- }
- }
-
- private void close(){
- this.isHalted = true;
- }
- }
-
- /**
- * Custom queue to prioritize packet write tasks based on their priority coefficient.<br> The queue is a doubly linked list.<br><br>
- * When a tasks is added to the queue, it will be evaluated using it's priority coefficient. If the coefficient is greater than 0, it will simply
- * be placed at the end of the queue. If the coefficient is equal to 0, the queue will begin to iterate at the head and work it's way back. Once it is found that the current
- * tasks has a priority coefficient greater than 0, it will be placed right before that task. The idea is to keep a semi-serial queue but creates a priority that allows urgent
- * tasks such as UI related to skip near the front. However, it is assumed those tasks of higher priority should also be handled in a serial fashion.
- *
- * @author Joey Grover
- *
- */
- @SuppressWarnings("Convert2Diamond")
- private class PacketWriteTaskBlockingQueue{
- final class Node<E> {
- final E item;
- Node<E> prev;
- Node<E> next;
- Node(E item, Node<E> previous, Node<E> next) {
- this.item = item;
- this.prev = previous;
- this.next = next;
- }
- }
-
- private Node<PacketWriteTask> head;
- private Node<PacketWriteTask> tail;
-
- /**
- * This will take the given task and insert it at the tail of the queue
- * @param task the task to be inserted at the tail of the queue
- */
- private void insertAtTail(PacketWriteTask task){
- if (task == null){
- throw new NullPointerException();
- }
- Node<PacketWriteTask> oldTail = tail;
- Node<PacketWriteTask> newTail = new Node<PacketWriteTask>(task, oldTail, null);
- tail = newTail;
- if (head == null){
- head = newTail;
- }else{
- oldTail.next = newTail;
- }
-
- }
-
- /**
- * This will take the given task and insert it at the head of the queue
- * @param task the task to be inserted at the head of the queue
- */
- private void insertAtHead(PacketWriteTask task){
- if (task == null){
- throw new NullPointerException();
- }
- Node<PacketWriteTask> oldHead = head;
- Node<PacketWriteTask> newHead = new Node<PacketWriteTask>(task, null, oldHead);
- head = newHead;
- if (tail == null){
- tail = newHead;
- }else{
- if(oldHead!=null){
- oldHead.prev = newHead;
- }
- }
- }
-
- /**
- * Insert the task in the queue where it belongs
- * @param task the new PacketWriteTask that needs to be added to the queue to be handled
- */
- public void add(PacketWriteTask task){
- synchronized(this){
- if (task == null){
- throw new NullPointerException();
- }
-
- //If we currently don't have anything in our queue
- if(head == null || tail == null){
- Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, head, tail);
- head = taskNode;
- tail = taskNode;
- }else if(task.priorityCoefficient>0){ //If the task is already a not high priority task, we just need to insert it at the tail
- insertAtTail(task);
- }else if(head.item.priorityCoefficient>0){ //If the head task is already a not high priority task, we just need to insert at head
- insertAtHead(task);
- }else{
- if(tail.item.priorityCoefficient==0){ //Saves us from going through the entire list if all of these tasks are priority coef == 0
- insertAtTail(task);
- return;
- }
- Node<PacketWriteTask> currentPlace = head;
- while(true){
- if(currentPlace.item.priorityCoefficient==0){
- if(currentPlace.next==null){
- //We've reached the end of the list
- insertAtTail(task);
- return;
- }else{
- currentPlace = currentPlace.next;
- }
- }else{
- //We've found where this task should be inserted
- Node<PacketWriteTask> previous = currentPlace.prev;
- Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, previous, currentPlace);
- previous.next = taskNode;
- currentPlace.prev = taskNode;
- return;
-
- }
- }
- }
- }
- }
-
- /**
- * Peek at the current head of the queue
- * @return the task at the head of the queue but does not remove it from the queue
- */
- public PacketWriteTask peek(){
- synchronized(this){
- if(head == null){
- return null;
- }else{
- return head.item;
- }
- }
- }
-
- /**
- * Remove the head of the queue
- * @return the old head of the queue
- */
- public PacketWriteTask poll(){
- synchronized(this){
- if(head == null){
- return null;
- }else{
- Node<PacketWriteTask> retValNode = head;
- Node<PacketWriteTask> newHead = head.next;
- if(newHead == null){
- tail = null;
- }
- head = newHead;
-
- return retValNode.item;
- }
- }
- }
-
- /**
- * Currently only clears the head and the tail of the queue.
- */
- public void clear(){
- //Should probably go through the linked list and clear elements, but gc should clear them out automatically.
- head = null;
- tail = null;
- }
- }
-
- /**
- * notifySppError: utilize notification channel to notify the SPP out-of-resource error.
- */
- @TargetApi(11)
- @SuppressLint("NewApi")
- private void notifySppError() {
- Notification.Builder builder;
- if(android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O){
- builder = new Notification.Builder(getApplicationContext());
- } else {
- builder = new Notification.Builder(getApplicationContext(), TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID);
- }
- ComponentName name = new ComponentName(this, this.getClass());
- if(0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) { //If we are in debug mode, include what app has the router service open
- builder.setContentTitle("SDL: " + name.getPackageName());
- } else {
- builder.setContentTitle(getString(R.string.notification_title));
- }
- builder.setTicker(getString(R.string.sdl_error_notification_channel_name));
- builder.setContentText(getString(R.string.spp_out_of_resource));
-
- //We should use icon from library resources if available
- int trayId = getResources().getIdentifier("sdl_tray_icon", "drawable", getPackageName());
-
- builder.setSmallIcon(trayId);
- Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.spp_error);
- builder.setLargeIcon(icon);
-
- builder.setOngoing(false);
-
- DebugTool.logError(TAG, "Notification: notifySppError entering");
- final String tag = "SDL";
- //Now we need to add a notification channel
- final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
- if (notificationManager != null) {
- notificationManager.cancel(tag, TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel notificationChannel = new NotificationChannel(TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID, getString(R.string.sdl_error_notification_channel_name), NotificationManager.IMPORTANCE_HIGH);
- notificationChannel.enableLights(true);
- notificationChannel.enableVibration(true);
- notificationChannel.setShowBadge(false);
- notificationManager.createNotificationChannel(notificationChannel);
- builder.setChannelId(notificationChannel.getId());
- }
- Notification notification = builder.build();
- notificationManager.notify(tag, TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT, notification);
- } else {
- DebugTool.logError(TAG, "notifySppError: Unable to retrieve notification Manager service");
- }
- }
+
+ /**
+ * This is a convenience variable and may not be used or useful in different protocols
+ *
+ * @return a vector of all the session ids associated with this app
+ */
+ public Vector<Long> getSessionIds() {
+ return sessionIds;
+ }
+
+ /**
+ * Returns the position of the desired object if it is contained in the vector. If not it will return -1.
+ *
+ * @param id a session id value that is in question to be associated with this app
+ * @return the index of the supplied session id or -1 if it is not associated with this app
+ */
+ public int containsSessionId(long id) {
+ return sessionIds.indexOf(id);
+ }
+
+ /**
+ * This will remove a session from the session id list
+ *
+ * @param sessionId the id of the session that should be removed
+ * @return if the session was successfully removed, or false if the session id wasn't associated with this app.
+ */
+ public boolean removeSession(Long sessionId) {
+ int location = sessionIds.indexOf(sessionId);
+ if (location >= 0) {
+ Long removedSessionId = sessionIds.remove(location);
+ registeredTransports.remove(sessionId.intValue());
+ return removedSessionId != null;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * This method is to manually put a session id into the mapping. This method should be used with extreme caution and
+ * only in certain cases when the sesion id needs to exist at a specific position in the mapping (overwriting a value)
+ *
+ * @param position the position at which the session id should be placed
+ * @param sessionId the session id that will be put into the specific position in the mapping
+ * @throws ArrayIndexOutOfBoundsException if the position is outside of the current size of the sessionIds vector
+ */
+ public void setSessionId(int position, long sessionId) throws ArrayIndexOutOfBoundsException {
+ this.sessionIds.set(position, sessionId);
+ synchronized (TRANSPORT_LOCK) {
+ this.registeredTransports.put((int) sessionId, new ArrayList<TransportType>());
+ }
+ }
+
+ public void clearSessionIds() {
+ this.sessionIds.clear();
+ }
+
+ public Vector<TransportType> getAwaitingSession() {
+ return awaitingSession;
+ }
+
+ protected void registerTransport(int sessionId, TransportType transportType) {
+ synchronized (TRANSPORT_LOCK) {
+ ArrayList<TransportType> transportTypes = this.registeredTransports.get(sessionId);
+ if (transportTypes != null) {
+ if (queues.get(transportType) == null) {
+ queues.put(transportType, new PacketWriteTaskBlockingQueue());
+ }
+ transportTypes.add(transportType);
+ this.registeredTransports.put(sessionId, transportTypes);
+ }
+
+ }
+ }
+
+ /**
+ * @param sessionId the session id to find if a transport is registered. -1 for sessionId will
+ * trigger a search through all sessions.
+ * @param transportType the transport type to find if a transport is registered. If null is
+ * passed, will return true for any transport being registered on
+ * @return
+ */
+ protected boolean isRegisteredOnTransport(int sessionId, TransportType transportType) {
+ synchronized (TRANSPORT_LOCK) {
+ if (this.registeredTransports.indexOfKey(sessionId) >= 0) {
+ if (transportType == null) {
+ return this.registeredTransports.get(sessionId).size() > 0;
+ }
+ return this.registeredTransports.get(sessionId).indexOf(transportType) >= 0;
+ } else if (sessionId < 0) {
+
+ //Check if any session is registered on this transport
+ int numberOfSessions = registeredTransports.size();
+ ArrayList<TransportType> transportTypes;
+ for (int i = 0; i < numberOfSessions; i++) {
+ transportTypes = registeredTransports.valueAt(i);
+ if (transportTypes != null) {
+ if (transportType == null && transportTypes.size() > 0) {
+ return true;
+ }
+ for (TransportType type : transportTypes) {
+ if (type.equals(transportType)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+
+ } else {
+ return false;
+ }
+ }
+ }
+
+ protected List<TransportType> getTransportsForSession(int sessionId) {
+ synchronized (TRANSPORT_LOCK) {
+ if (this.registeredTransports.indexOfKey(sessionId) >= 0) {
+ return this.registeredTransports.get(sessionId);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ protected boolean unregisterTransport(int sessionId, @NonNull TransportType transportType) {
+ if (queues != null && queues.containsKey(transportType)) {
+ PacketWriteTaskBlockingQueue queue = queues.remove(transportType);
+ if (queue != null) {
+ queue.clear();
+ }
+ }
+ synchronized (TRANSPORT_LOCK) {
+ if (sessionId == -1) {
+ int size = this.registeredTransports.size();
+ for (int i = 0; i < size; i++) {
+ this.registeredTransports.valueAt(i).remove(transportType);
+ }
+ return true;
+ } else if (this.registeredTransports.indexOfKey(sessionId) >= 0) {
+ return this.registeredTransports.get(sessionId).remove(transportType);
+ } else {
+ return false;
+ }
+ }
+
+ }
+
+ protected void unregisterAllTransports(int sessionId) {
+ synchronized (TRANSPORT_LOCK) {
+ if (this.registeredTransports.indexOfKey(sessionId) >= 0) {
+ this.registeredTransports.get(sessionId).clear();
+ } else if (sessionId == -1) {
+ int size = this.registeredTransports.size();
+ for (int i = 0; i < size; i++) {
+ this.registeredTransports.valueAt(i).clear();
+ }
+ }
+ }
+ }
+
+
+ /**
+ * This method will attempt to return a transport type that can be associated to this
+ * registered app
+ *
+ * @return
+ */
+ private TransportType getCompatPrimaryTransport() {
+ if (this.registeredTransports != null && this.registeredTransports.size() > 0) {
+ List<TransportType> transportTypes = this.registeredTransports.valueAt(0);
+ if (transportTypes != null) {
+ if (transportTypes.get(0) != null) {
+ return transportTypes.get(0);
+ }
+ }
+ }
+
+ //No transport stored
+ if (bluetoothTransport != null && bluetoothTransport.isConnected()) {
+ return TransportType.BLUETOOTH;
+ } else if (usbTransport != null && usbTransport.isConnected()) {
+ return TransportType.USB;
+ } else if (tcpTransport != null && tcpTransport.isConnected()) {
+ return TransportType.TCP;
+ }
+
+ return TransportType.BLUETOOTH;
+ }
+
+ @SuppressWarnings("SameReturnValue")
+ public boolean handleIncommingClientMessage(final Bundle receivedBundle) {
+ 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) {
+ synchronized (TRANSPORT_LOCK) {
+ transportType = getCompatPrimaryTransport();
+ }
+ receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
+ }
+
+ if (flags != TransportConstants.BYTES_TO_SEND_FLAG_NONE) {
+ byte[] packet = receivedBundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
+ if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
+ this.priorityForBuffingMessage = receivedBundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, 0);
+ }
+ handleMessage(flags, packet, transportType);
+ } else {
+ //Add the write task on the stack
+ PacketWriteTaskBlockingQueue queue = queues.get(transportType);
+ if (queue == null) { //TODO check to see if there is any better place to put this
+ queue = new PacketWriteTaskBlockingQueue();
+ queues.put(transportType, queue);
+ }
+ queue.add(new PacketWriteTask(receivedBundle));
+ if (packetWriteTaskMasterMap != null) {
+ PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.alert();
+ }
+ } //If this is null, it is likely the service is closing
+ }
+ return true;
+ }
+
+ public int sendMessage(Message message) {
+ if (this.messenger == null) {
+ return SEND_MESSAGE_ERROR_MESSENGER_NULL;
+ }
+ if (message == null) {
+ return SEND_MESSAGE_ERROR_MESSAGE_NULL;
+ }
+ try {
+ this.messenger.send(message);
+ return SEND_MESSAGE_SUCCESS;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ if (e instanceof DeadObjectException) {
+ return SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT;
+ } else {
+ return SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION;
+ }
+ }
+ }
+
+ public void handleMessage(int flags, byte[] packet, TransportType transportType) {
+ if (flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START) {
+ clearBuffer();
+ buffer = new ByteAraryMessageAssembler();
+ buffer.init();
+ buffer.setTransportType(transportType);
+ }
+ if (buffer != null) {
+ if (!buffer.handleMessage(flags, packet)) { //If this returns false
+ DebugTool.logError(TAG, "Error handling bytes");
+ }
+ if (buffer.isFinished()) { //We are finished building the buffer so we should write the bytes out
+ byte[] bytes = buffer.getBytes();
+ PacketWriteTaskBlockingQueue queue = queues.get(transportType);
+ if (queue != null) {
+ queue.add(new PacketWriteTask(bytes, 0, bytes.length, this.priorityForBuffingMessage, transportType));
+ if (packetWriteTaskMasterMap != null) {
+ PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.alert();
+ }
+ }
+ }
+ buffer.close();
+ }
+ }
+ }
+
+ protected PacketWriteTask peekNextTask(TransportType transportType) {
+ PacketWriteTaskBlockingQueue queue = queues.get(transportType);
+ if (queue != null) {
+ return queue.peek();
+ }
+ return null;
+ }
+
+ protected PacketWriteTask getNextTask(TransportType transportType) {
+ PacketWriteTaskBlockingQueue queue = queues.get(transportType);
+ if (queue != null) {
+ return queue.poll();
+ }
+ return null;
+ }
+
+ /**
+ * This will inform the local app object that it was not picked to have the highest priority. This will allow the user to continue to perform interactions
+ * with the module and not be bogged down by large packet requests.
+ */
+ protected void notIt(final TransportType transportType) {
+ PacketWriteTaskBlockingQueue queue = queues.get(transportType);
+ if (queue != null && queue.peek().priorityCoefficient > 0) { //If this has any sort of priority coefficient we want to make it wait.
+ //Flag to wait
+ if (queueWaitHandler == null) {
+ DebugTool.logError(TAG, "Unable to pause queue, handler was null");
+ }
+ if (queueWaitRunnable == null) {
+ queueWaitRunnable = new Runnable() {
+
+ @Override
+ public void run() {
+ pauseQueue(false);
+ PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.alert();
+ }
+ }
+ };
+ }
+ if (queuePaused) {
+ queueWaitHandler.removeCallbacks(queueWaitRunnable);
+ }
+ pauseQueue(queueWaitHandler.postDelayed(queueWaitRunnable, PAUSE_TIME_FOR_QUEUE));
+ }
+ }
+
+ private void pauseQueue(boolean paused) {
+ this.queuePaused = paused;
+ }
+
+ protected void clearBuffer() {
+ if (buffer != null) {
+ buffer.close();
+ buffer = null;
+ }
+ }
+
+ protected boolean setDeathNote() {
+ if (messenger != null) {
+ if (deathNote == null) {
+ deathNote = new DeathRecipient() {
+ final Object deathLock = new Object();
+
+ @Override
+ public void binderDied() {
+ synchronized (deathLock) {
+ DebugTool.logWarning(TAG, "Binder died for app " + RegisteredApp.this.appId);
+ if (messenger.getBinder() != null) {
+ messenger.getBinder().unlinkToDeath(this, 0);
+ }
+ removeAllSessionsForApp(RegisteredApp.this, true);
+ removeAppFromMap(RegisteredApp.this);
+ startClientPings();
+ }
+ }
+ };
+ }
+ try {
+ messenger.getBinder().linkToDeath(deathNote, 0);
+ return true;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return false;
+ }
+
+ protected boolean clearDeathNote() {
+ return messenger != null && messenger.getBinder() != null && deathNote != null && messenger.getBinder().unlinkToDeath(deathNote, 0);
+ }
+ }
+
+ /**
+ * A runnable task for writing out packets.
+ *
+ * @author Joey Grover
+ */
+ public class PacketWriteTask implements Runnable {
+ private static final long DELAY_CONSTANT = 500; //250ms
+ private static final long SIZE_CONSTANT = 1000; //1kb
+ private static final long PRIORITY_COEF_CONSTANT = 500;
+ private static final int DELAY_COEF = 1;
+ private static final int SIZE_COEF = 1;
+
+ private byte[] bytesToWrite;
+ private final int offset, size, priorityCoefficient;
+ private final long timestamp;
+ final Bundle receivedBundle;
+ TransportType transportType;
+
+ public PacketWriteTask(byte[] bytes, int offset, int size, int priorityCoefficient, TransportType transportType) {
+ timestamp = System.currentTimeMillis();
+ bytesToWrite = bytes;
+ this.offset = offset;
+ this.size = size;
+ this.priorityCoefficient = priorityCoefficient;
+ receivedBundle = null;
+ this.transportType = transportType;
+ }
+
+ public PacketWriteTask(Bundle bundle) {
+ this.receivedBundle = bundle;
+ timestamp = System.currentTimeMillis();
+ bytesToWrite = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
+ offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
+ size = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytesToWrite.length); //In case there isn't anything just send the whole packet.
+ this.priorityCoefficient = bundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, 0);
+ this.transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
+
+ }
+
+ protected void setTransportType(TransportType transportType) {
+ this.transportType = transportType;
+ }
+
+ @Override
+ public void run() {
+ if (receivedBundle != null) {
+ writeBytesToTransport(receivedBundle);
+ } else if (bytesToWrite != null) {
+ manuallyWriteBytes(this.transportType, bytesToWrite, offset, size);
+ }
+ }
+
+ private long getWeight(long currentTime) { //Time waiting - size - priority_coef
+ return ((((currentTime - timestamp) + DELAY_CONSTANT) * DELAY_COEF) - ((size - SIZE_CONSTANT) * SIZE_COEF) - (priorityCoefficient * PRIORITY_COEF_CONSTANT));
+ }
+ }
+
+ /**
+ * Extends thread to consume PacketWriteTasks in a priority queue fashion. It will attempt to look
+ * at all apps serial queue of tasks and compare them
+ *
+ * @author Joey Grover
+ */
+ private class PacketWriteTaskMaster extends Thread {
+ protected final Object QUEUE_LOCK = new Object();
+ private boolean isHalted = false, isWaiting = false;
+ private TransportType transportType;
+
+ public PacketWriteTaskMaster() {
+ this.setName("PacketWriteTaskMaster");
+ this.setDaemon(true);
+ }
+
+ protected void setTransportType(TransportType transportType) {
+ this.transportType = transportType;
+ }
+
+ @Override
+ public void run() {
+ while (!isHalted) {
+ try {
+ PacketWriteTask task;
+ synchronized (QUEUE_LOCK) {
+ task = getNextTask(transportType);
+ if (task != null) {
+ task.run();
+ } else {
+ isWaiting = true;
+ QUEUE_LOCK.wait();
+ isWaiting = false;
+ }
+ }
+ } catch (InterruptedException e) {
+ break;
+ }
+ }
+ }
+
+ private void alert() {
+ if (isWaiting) {
+ synchronized (QUEUE_LOCK) {
+ QUEUE_LOCK.notify();
+ }
+ }
+ }
+
+ private void close() {
+ this.isHalted = true;
+ }
+ }
+
+ /**
+ * Custom queue to prioritize packet write tasks based on their priority coefficient.<br> The queue is a doubly linked list.<br><br>
+ * When a tasks is added to the queue, it will be evaluated using it's priority coefficient. If the coefficient is greater than 0, it will simply
+ * be placed at the end of the queue. If the coefficient is equal to 0, the queue will begin to iterate at the head and work it's way back. Once it is found that the current
+ * tasks has a priority coefficient greater than 0, it will be placed right before that task. The idea is to keep a semi-serial queue but creates a priority that allows urgent
+ * tasks such as UI related to skip near the front. However, it is assumed those tasks of higher priority should also be handled in a serial fashion.
+ *
+ * @author Joey Grover
+ */
+ @SuppressWarnings("Convert2Diamond")
+ private class PacketWriteTaskBlockingQueue {
+ final class Node<E> {
+ final E item;
+ Node<E> prev;
+ Node<E> next;
+
+ Node(E item, Node<E> previous, Node<E> next) {
+ this.item = item;
+ this.prev = previous;
+ this.next = next;
+ }
+ }
+
+ private Node<PacketWriteTask> head;
+ private Node<PacketWriteTask> tail;
+
+ /**
+ * This will take the given task and insert it at the tail of the queue
+ *
+ * @param task the task to be inserted at the tail of the queue
+ */
+ private void insertAtTail(PacketWriteTask task) {
+ if (task == null) {
+ throw new NullPointerException();
+ }
+ Node<PacketWriteTask> oldTail = tail;
+ Node<PacketWriteTask> newTail = new Node<PacketWriteTask>(task, oldTail, null);
+ tail = newTail;
+ if (head == null) {
+ head = newTail;
+ } else {
+ oldTail.next = newTail;
+ }
+
+ }
+
+ /**
+ * This will take the given task and insert it at the head of the queue
+ *
+ * @param task the task to be inserted at the head of the queue
+ */
+ private void insertAtHead(PacketWriteTask task) {
+ if (task == null) {
+ throw new NullPointerException();
+ }
+ Node<PacketWriteTask> oldHead = head;
+ Node<PacketWriteTask> newHead = new Node<PacketWriteTask>(task, null, oldHead);
+ head = newHead;
+ if (tail == null) {
+ tail = newHead;
+ } else {
+ if (oldHead != null) {
+ oldHead.prev = newHead;
+ }
+ }
+ }
+
+ /**
+ * Insert the task in the queue where it belongs
+ *
+ * @param task the new PacketWriteTask that needs to be added to the queue to be handled
+ */
+ public void add(PacketWriteTask task) {
+ synchronized (this) {
+ if (task == null) {
+ throw new NullPointerException();
+ }
+
+ //If we currently don't have anything in our queue
+ if (head == null || tail == null) {
+ Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, head, tail);
+ head = taskNode;
+ tail = taskNode;
+ } else if (task.priorityCoefficient > 0) { //If the task is already a not high priority task, we just need to insert it at the tail
+ insertAtTail(task);
+ } else if (head.item.priorityCoefficient > 0) { //If the head task is already a not high priority task, we just need to insert at head
+ insertAtHead(task);
+ } else {
+ if (tail.item.priorityCoefficient == 0) { //Saves us from going through the entire list if all of these tasks are priority coef == 0
+ insertAtTail(task);
+ return;
+ }
+ Node<PacketWriteTask> currentPlace = head;
+ while (true) {
+ if (currentPlace.item.priorityCoefficient == 0) {
+ if (currentPlace.next == null) {
+ //We've reached the end of the list
+ insertAtTail(task);
+ return;
+ } else {
+ currentPlace = currentPlace.next;
+ }
+ } else {
+ //We've found where this task should be inserted
+ Node<PacketWriteTask> previous = currentPlace.prev;
+ Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, previous, currentPlace);
+ previous.next = taskNode;
+ currentPlace.prev = taskNode;
+ return;
+
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Peek at the current head of the queue
+ *
+ * @return the task at the head of the queue but does not remove it from the queue
+ */
+ public PacketWriteTask peek() {
+ synchronized (this) {
+ if (head == null) {
+ return null;
+ } else {
+ return head.item;
+ }
+ }
+ }
+
+ /**
+ * Remove the head of the queue
+ *
+ * @return the old head of the queue
+ */
+ public PacketWriteTask poll() {
+ synchronized (this) {
+ if (head == null) {
+ return null;
+ } else {
+ Node<PacketWriteTask> retValNode = head;
+ Node<PacketWriteTask> newHead = head.next;
+ if (newHead == null) {
+ tail = null;
+ }
+ head = newHead;
+
+ return retValNode.item;
+ }
+ }
+ }
+
+ /**
+ * Currently only clears the head and the tail of the queue.
+ */
+ public void clear() {
+ //Should probably go through the linked list and clear elements, but gc should clear them out automatically.
+ head = null;
+ tail = null;
+ }
+ }
+
+ /**
+ * notifySppError: utilize notification channel to notify the SPP out-of-resource error.
+ */
+ @TargetApi(11)
+ @SuppressLint("NewApi")
+ private void notifySppError() {
+ Notification.Builder builder;
+ if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ builder = new Notification.Builder(getApplicationContext());
+ } else {
+ builder = new Notification.Builder(getApplicationContext(), TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID);
+ }
+ ComponentName name = new ComponentName(this, this.getClass());
+ if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) { //If we are in debug mode, include what app has the router service open
+ builder.setContentTitle("SDL: " + name.getPackageName());
+ } else {
+ builder.setContentTitle(getString(R.string.notification_title));
+ }
+ builder.setTicker(getString(R.string.sdl_error_notification_channel_name));
+ builder.setContentText(getString(R.string.spp_out_of_resource));
+
+ //We should use icon from library resources if available
+ int trayId = getResources().getIdentifier("sdl_tray_icon", "drawable", getPackageName());
+
+ builder.setSmallIcon(trayId);
+ Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.spp_error);
+ builder.setLargeIcon(icon);
+
+ builder.setOngoing(false);
+
+ DebugTool.logError(TAG, "Notification: notifySppError entering");
+ final String tag = "SDL";
+ //Now we need to add a notification channel
+ final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager != null) {
+ notificationManager.cancel(tag, TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ NotificationChannel notificationChannel = new NotificationChannel(TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID, getString(R.string.sdl_error_notification_channel_name), NotificationManager.IMPORTANCE_HIGH);
+ notificationChannel.enableLights(true);
+ notificationChannel.enableVibration(true);
+ notificationChannel.setShowBadge(false);
+ notificationManager.createNotificationChannel(notificationChannel);
+ builder.setChannelId(notificationChannel.getId());
+ }
+ Notification notification = builder.build();
+ notificationManager.notify(tag, TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT, notification);
+ } else {
+ DebugTool.logError(TAG, "notifySppError: Unable to retrieve notification Manager service");
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
index 0640017d5..b90a55684 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
@@ -52,141 +52,143 @@ import static com.smartdevicelink.transport.TransportConstants.FOREGROUND_EXTRA;
public class SdlRouterStatusProvider {
- private static final String TAG = "SdlRouterStateProvider";
-
- private Context context;
- private boolean isBound = false;
- ConnectedStatusCallback cb;
- Messenger routerServiceMessenger = null;
- private ComponentName routerService;
- private int flags = 0;
-
- final Messenger clientMessenger;
-
- private final ServiceConnection routerConnection= new ServiceConnection() {
-
- public void onServiceConnected(ComponentName className, IBinder service) {
- DebugTool.logInfo(TAG, "Bound to service " + className.toString());
- routerServiceMessenger = new Messenger(service);
- isBound = true;
- //So we just established our connection
- //Register with router service
- Message msg = Message.obtain();
- msg.what = TransportConstants.ROUTER_STATUS_CONNECTED_STATE_REQUEST;
- msg.arg1 = flags;
- msg.replyTo = clientMessenger;
- try {
- routerServiceMessenger.send(msg);
- } catch (RemoteException e) {
- e.printStackTrace();
- if(cb!=null){
- cb.onConnectionStatusUpdate(false, routerService, context);
- }
- }
- }
-
- public void onServiceDisconnected(ComponentName className) {
- DebugTool.logInfo(TAG, "UN-Bound from service " + className.getClassName());
- routerServiceMessenger = null;
- isBound = false;
- }
- };
-
- public SdlRouterStatusProvider(Context context, ComponentName service, ConnectedStatusCallback callback){
- if(context == null || service == null || callback == null){
- throw new IllegalStateException("Supplied params are not correct. Context == null? "+ (context==null) + " ComponentName == null? " + (service == null) + " ConnectedStatusListener == null? " + callback);
- }
- this.context = context;
- this.routerService = service;
- this.cb = callback;
- this.clientMessenger = new Messenger(new ClientHandler(this));
-
- }
- public void setFlags(int flags){
- this.flags = flags;
- }
- public void checkIsConnected(){
- if(!AndroidTools.isServiceExported(context,routerService) || !bindToService()){
- //We are unable to bind to service
- cb.onConnectionStatusUpdate(false, routerService, context);
- unBindFromService();
- }
- }
-
- public void cancel(){
- if(isBound){
- unBindFromService();
- }
- }
-
- private boolean bindToService(){
- if(isBound){
- return true;
- }
- if(clientMessenger == null){
- return false;
- }
- Intent bindingIntent = new Intent();
- bindingIntent.setClassName(this.routerService.getPackageName(), this.routerService.getClassName());//This sets an explicit intent
- //Quickly make sure it's just up and running
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- context.startService(bindingIntent);
- }else {
- bindingIntent.putExtra(FOREGROUND_EXTRA, true);
- SdlBroadcastReceiver.setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
- context.startForegroundService(bindingIntent);
-
- }
- bindingIntent.setAction( TransportConstants.BIND_REQUEST_TYPE_STATUS);
- return context.bindService(bindingIntent, routerConnection, Context.BIND_AUTO_CREATE);
- }
-
- private void unBindFromService(){
- try{
- if(context!=null && routerConnection!=null){
- context.unbindService(routerConnection);
- }else{
- DebugTool.logWarning(TAG, "Unable to unbind from router service, context was null");
- }
-
- }catch(IllegalArgumentException e){
- //This is ok
- }
- }
-
- private void handleRouterStatusConnectedResponse(int connectedStatus){
- if(cb!=null){
- cb.onConnectionStatusUpdate(connectedStatus == 1, routerService,context);
- }
- unBindFromService();
- routerServiceMessenger =null;
- }
-
- static class ClientHandler extends Handler {
- final WeakReference<SdlRouterStatusProvider> provider;
-
- public ClientHandler(SdlRouterStatusProvider provider){
- super(Looper.getMainLooper());
- this.provider = new WeakReference<>(provider);
- }
-
- @Override
+ private static final String TAG = "SdlRouterStateProvider";
+
+ private Context context;
+ private boolean isBound = false;
+ ConnectedStatusCallback cb;
+ Messenger routerServiceMessenger = null;
+ private ComponentName routerService;
+ private int flags = 0;
+
+ final Messenger clientMessenger;
+
+ private final ServiceConnection routerConnection = new ServiceConnection() {
+
+ public void onServiceConnected(ComponentName className, IBinder service) {
+ DebugTool.logInfo(TAG, "Bound to service " + className.toString());
+ routerServiceMessenger = new Messenger(service);
+ isBound = true;
+ //So we just established our connection
+ //Register with router service
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_STATUS_CONNECTED_STATE_REQUEST;
+ msg.arg1 = flags;
+ msg.replyTo = clientMessenger;
+ try {
+ routerServiceMessenger.send(msg);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ if (cb != null) {
+ cb.onConnectionStatusUpdate(false, routerService, context);
+ }
+ }
+ }
+
+ public void onServiceDisconnected(ComponentName className) {
+ DebugTool.logInfo(TAG, "UN-Bound from service " + className.getClassName());
+ routerServiceMessenger = null;
+ isBound = false;
+ }
+ };
+
+ public SdlRouterStatusProvider(Context context, ComponentName service, ConnectedStatusCallback callback) {
+ if (context == null || service == null || callback == null) {
+ throw new IllegalStateException("Supplied params are not correct. Context == null? " + (context == null) + " ComponentName == null? " + (service == null) + " ConnectedStatusListener == null? " + callback);
+ }
+ this.context = context;
+ this.routerService = service;
+ this.cb = callback;
+ this.clientMessenger = new Messenger(new ClientHandler(this));
+
+ }
+
+ public void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ public void checkIsConnected() {
+ if (!AndroidTools.isServiceExported(context, routerService) || !bindToService()) {
+ //We are unable to bind to service
+ cb.onConnectionStatusUpdate(false, routerService, context);
+ unBindFromService();
+ }
+ }
+
+ public void cancel() {
+ if (isBound) {
+ unBindFromService();
+ }
+ }
+
+ private boolean bindToService() {
+ if (isBound) {
+ return true;
+ }
+ if (clientMessenger == null) {
+ return false;
+ }
+ Intent bindingIntent = new Intent();
+ bindingIntent.setClassName(this.routerService.getPackageName(), this.routerService.getClassName());//This sets an explicit intent
+ //Quickly make sure it's just up and running
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ context.startService(bindingIntent);
+ } else {
+ bindingIntent.putExtra(FOREGROUND_EXTRA, true);
+ SdlBroadcastReceiver.setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
+ context.startForegroundService(bindingIntent);
+
+ }
+ bindingIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_STATUS);
+ return context.bindService(bindingIntent, routerConnection, Context.BIND_AUTO_CREATE);
+ }
+
+ private void unBindFromService() {
+ try {
+ if (context != null && routerConnection != null) {
+ context.unbindService(routerConnection);
+ } else {
+ DebugTool.logWarning(TAG, "Unable to unbind from router service, context was null");
+ }
+
+ } catch (IllegalArgumentException e) {
+ //This is ok
+ }
+ }
+
+ private void handleRouterStatusConnectedResponse(int connectedStatus) {
+ if (cb != null) {
+ cb.onConnectionStatusUpdate(connectedStatus == 1, routerService, context);
+ }
+ unBindFromService();
+ routerServiceMessenger = null;
+ }
+
+ static class ClientHandler extends Handler {
+ final WeakReference<SdlRouterStatusProvider> provider;
+
+ public ClientHandler(SdlRouterStatusProvider provider) {
+ super(Looper.getMainLooper());
+ this.provider = new WeakReference<>(provider);
+ }
+
+ @Override
public void handleMessage(Message msg) {
- if(provider.get()==null){
- return;
- }
- switch (msg.what) {
- case TransportConstants.ROUTER_STATUS_CONNECTED_STATE_RESPONSE:
- provider.get().handleRouterStatusConnectedResponse(msg.arg1);
- break;
- default:
- break;
- }
- }
- }
-
- public interface ConnectedStatusCallback{
- void onConnectionStatusUpdate(boolean connected, ComponentName service, Context context);
- }
-
+ if (provider.get() == null) {
+ return;
+ }
+ switch (msg.what) {
+ case TransportConstants.ROUTER_STATUS_CONNECTED_STATE_RESPONSE:
+ provider.get().handleRouterStatusConnectedResponse(msg.arg1);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ public interface ConnectedStatusCallback {
+ void onConnectionStatusUpdate(boolean connected, ComponentName service, Context context);
+ }
+
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportConfig.java
index 790aa0935..9043bfa22 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportConfig.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportConfig.java
@@ -1,52 +1,52 @@
-/*
- * 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.transport;
import com.smartdevicelink.transport.enums.TransportType;
/**
- * Container of TCP transport specific configuration.
+ * Container of TCP transport specific configuration.
*/
public final class TCPTransportConfig extends BaseTransportConfig {
-
- /**
- * Value of port to use in TCP connection.
- */
- private final int mPort;
-
- /**
- * Value of IP address to use in TCP connection.
- */
- private final String mIpAddress;
+
+ /**
+ * Value of port to use in TCP connection.
+ */
+ private final int mPort;
+
+ /**
+ * Value of IP address to use in TCP connection.
+ */
+ private final String mIpAddress;
/**
* Value of flag which is set to true if tcp connection must be automatically reestablished in case of disconnection
@@ -54,39 +54,40 @@ public final class TCPTransportConfig extends BaseTransportConfig {
private final boolean mAutoReconnect;
/**
- * Constructor. Objects of this class must be created for known port and IP address value.
- *
- * @param port Port for TCP connection.
- * @param ipAddress IP address for TCP connection.
+ * Constructor. Objects of this class must be created for known port and IP address value.
+ *
+ * @param port Port for TCP connection.
+ * @param ipAddress IP address for TCP connection.
* @param autoReconnect Flag which must be set to true if tcp connection must be automatically reestablished in
* case of disconnection
- */
+ */
public TCPTransportConfig(int port, String ipAddress, boolean autoReconnect) {
- mPort = port;
- mIpAddress = ipAddress;
+ mPort = port;
+ mIpAddress = ipAddress;
mAutoReconnect = autoReconnect;
}
-
- /**
- * Gets value of Port.
- *
- * @return Port for TCP connection.
- */
- public int getPort() {
- return mPort;
- }
-
- /**
- * Gets value of IP address.
- *
- * @return IP address for TCP connection.
- */
- public String getIPAddress() {
- return mIpAddress;
- }
+
+ /**
+ * Gets value of Port.
+ *
+ * @return Port for TCP connection.
+ */
+ public int getPort() {
+ return mPort;
+ }
+
+ /**
+ * Gets value of IP address.
+ *
+ * @return IP address for TCP connection.
+ */
+ public String getIPAddress() {
+ return mIpAddress;
+ }
/**
* Gets value of AutoReconnect
+ *
* @return Flag that determines automatic reconnection
*/
public boolean getAutoReconnect() {
@@ -94,15 +95,14 @@ public final class TCPTransportConfig extends BaseTransportConfig {
}
/**
- * Overridden abstract method which returns specific type of this transport configuration.
- *
- * @return Constant value TransportType.TCP.
- *
- * @see TransportType
- */
- public TransportType getTransportType() {
- return TransportType.TCP;
- }
+ * Overridden abstract method which returns specific type of this transport configuration.
+ *
+ * @return Constant value TransportType.TCP.
+ * @see TransportType
+ */
+ public TransportType getTransportType() {
+ return TransportType.TCP;
+ }
@Override
public String toString() {
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
index 4381b97c6..bad7392eb 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
-public class TCPTransportManager extends TransportManagerBase{
+public class TCPTransportManager extends TransportManagerBase {
private static final String TAG = "TCPTransportManager";
@@ -18,12 +18,12 @@ public class TCPTransportManager extends TransportManagerBase{
private MultiplexTcpTransport transport;
private final TCPTransportConfig config;
- public TCPTransportManager(TCPTransportConfig config, TransportEventListener transportEventListener){
- super(config,transportEventListener);
+ public TCPTransportManager(TCPTransportConfig config, TransportEventListener transportEventListener) {
+ super(config, transportEventListener);
DebugTool.logInfo(TAG, "USING THE TCP TRANSPORT MANAGER");
this.config = config;
tcpHandler = new TCPHandler(this);
- transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(),tcpHandler, null);
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(), config.getAutoReconnect(), tcpHandler, null);
}
@Override
@@ -39,11 +39,11 @@ public class TCPTransportManager extends TransportManagerBase{
@Deprecated
public void resetSession() {
- if(transport != null){
+ if (transport != null) {
transport.stop();
}
//TODO make sure this makes sense
- transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(), tcpHandler, null);
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(), config.getAutoReconnect(), tcpHandler, null);
}
@@ -54,18 +54,18 @@ public class TCPTransportManager extends TransportManagerBase{
@Override
public TransportRecord getTransportRecord(TransportType transportType, String address) {
- if(transport != null){
+ if (transport != null) {
return transport.getTransportRecord();
- }else{
+ } else {
return null;
}
}
@Override
public void sendPacket(SdlPacket packet) {
- if(packet != null){
+ if (packet != null) {
byte[] rawBytes = packet.constructPacket();
- if(rawBytes != null && rawBytes.length >0){
+ if (rawBytes != null && rawBytes.length > 0) {
transport.write(rawBytes, 0, rawBytes.length);
}
}
@@ -77,23 +77,24 @@ public class TCPTransportManager extends TransportManagerBase{
final WeakReference<TCPTransportManager> provider;
- public TCPHandler(TCPTransportManager provider){
+ public TCPHandler(TCPTransportManager provider) {
this.provider = new WeakReference<>(provider);
}
+
@Override
public void handleMessage(Message msg) {
- if(this.provider.get() == null){
+ if (this.provider.get() == null) {
return;
}
TCPTransportManager service = this.provider.get();
- if(service.transportListener == null){
+ 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){
+ synchronized (service.TRANSPORT_STATUS_LOCK) {
service.transportStatus.clear();
service.transportStatus.add(service.transport.getTransportRecord());
}
@@ -104,23 +105,23 @@ public class TCPTransportManager extends TransportManagerBase{
// Currently attempting to connect - update UI?
break;
case MultiplexBaseTransport.STATE_LISTEN:
- if(service.transport != null){
+ 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){
+ if (service.transport != null) {
service.transportListener.onTransportDisconnected("TCP transport disconnected", service.transport.transportRecord, null);
- }else{
+ } else {
service.transportListener.onTransportDisconnected("TCP transport disconnected", null, null);
}
break;
case MultiplexBaseTransport.STATE_ERROR:
DebugTool.logInfo(TAG, "TCP transport encountered an error");
- service.transportListener.onError("TCP transport encountered an error" );
+ service.transportListener.onError("TCP transport encountered an error");
break;
}
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 dd887b6d4..52f718230 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
@@ -75,9 +75,11 @@ public class TransportBroker {
private static final int MAX_MESSAGING_VERSION = 2;
private static final int MIN_MESSAGING_VERSION = 1;
- /** Version of the router service that supports the new additional transports (USB and TCP) */
+ /**
+ * Version of the router service that supports the new additional transports (USB and TCP)
+ */
private static final int RS_MULTI_TRANSPORT_SUPPORT = 8;
- private static final TransportRecord LEGACY_TRANSPORT_RECORD = new TransportRecord(TransportType.BLUETOOTH,null);
+ private static final TransportRecord LEGACY_TRANSPORT_RECORD = new TransportRecord(TransportType.BLUETOOTH, null);
private final String WHERE_TO_REPLY_PREFIX = "com.sdl.android.";
private final String appId;
@@ -244,7 +246,6 @@ public class TransportBroker {
}
-
break;
case TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE:
if (msg.arg1 == TransportConstants.UNREGISTRATION_RESPONSE_SUCESS) {
@@ -257,7 +258,7 @@ public class TransportBroker {
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
- if(bundle == null){
+ if (bundle == null) {
DebugTool.logWarning(TAG, "Received packet message from router service with no bundle");
return;
}
@@ -270,7 +271,7 @@ public class TransportBroker {
if (flags == TransportConstants.BYTES_TO_SEND_FLAG_NONE) {
if (packet != null) { //Log.i(TAG, "received packet to process "+ packet.toString());
- if(packet.getTransportRecord() == null){
+ if (packet.getTransportRecord() == null) {
// If the transport record is null, one must be added
// This is likely due to an older router service being used
// in which only a bluetooth transport is available
@@ -313,7 +314,7 @@ public class TransportBroker {
}
break;
case TransportConstants.HARDWARE_CONNECTION_EVENT:
- if(bundle == null){
+ if (bundle == null) {
DebugTool.logWarning(TAG, "Received hardware connection message from router service with no bundle");
return;
}
@@ -341,7 +342,7 @@ public class TransportBroker {
if (bundle.containsKey(TransportConstants.HARDWARE_CONNECTED) || bundle.containsKey(TransportConstants.CURRENT_HARDWARE_CONNECTED)) {
//This is a connection event
- handleConnectionEvent(bundle,broker);
+ handleConnectionEvent(bundle, broker);
break;
}
break;
@@ -354,11 +355,12 @@ public class TransportBroker {
/**
* Handle a potential connection event. This will adapt legacy router service implementations
* into the new multiple transport scheme.
+ *
* @param bundle the received bundle from the router service
* @param broker reference to the transport broker that this handler exists
* @return if a connection event was triggered in the supplied broker
*/
- private boolean handleConnectionEvent(Bundle bundle, TransportBroker broker){
+ private boolean handleConnectionEvent(Bundle bundle, TransportBroker broker) {
if (broker.routerServiceVersion < RS_MULTI_TRANSPORT_SUPPORT) {
//Previous versions of the router service only supports a single
//transport, so this will be the only extra received
@@ -368,7 +370,7 @@ public class TransportBroker {
broker.onHardwareConnected(Collections.singletonList(LEGACY_TRANSPORT_RECORD));
return true;
}
- } else{
+ } else {
//Router service supports multiple transport
if (bundle.containsKey(TransportConstants.CURRENT_HARDWARE_CONNECTED)) {
@@ -455,8 +457,8 @@ public class TransportBroker {
} catch (Exception e) {
//This is ok
- DebugTool.logWarning(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
- }finally {
+ DebugTool.logWarning(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext() != null) + " router connection?" + (routerConnection != null));
+ } finally {
isBound = false;
}
}
@@ -491,7 +493,7 @@ public class TransportBroker {
}
- protected int getRouterServiceVersion(){
+ protected int getRouterServiceVersion() {
return routerServiceVersion;
}
@@ -505,7 +507,7 @@ public class TransportBroker {
if (packet == null
//|| offset<0
//|| count<0
- ) {//|| count>(bytes.length-offset)){
+ ) {//|| count>(bytes.length-offset)){
DebugTool.logWarning(TAG, whereToReply + "incorrect params supplied");
return false;
}
@@ -582,7 +584,7 @@ public class TransportBroker {
@SuppressLint("InlinedApi")
private boolean sendBindingIntent() {
- if(this.isBound){
+ if (this.isBound) {
DebugTool.logError(TAG, "Already bound");
return false;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
index 13edfb5f1..8dbbe1eef 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -55,7 +55,7 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.List;
-public class TransportManager extends TransportManagerBase{
+public class TransportManager extends TransportManagerBase {
private static final String TAG = "TransportManager";
TransportBrokerImpl transport;
@@ -74,12 +74,12 @@ public class TransportManager extends TransportManagerBase{
* If transport is not connected. Request Router service connect to it. Get connected message
*/
- public TransportManager(MultiplexTransportConfig config, TransportEventListener listener){
- super(config,listener);
+ public TransportManager(MultiplexTransportConfig config, TransportEventListener listener) {
+ super(config, listener);
this.mConfig = config;
- if(config.service == null) {
+ if (config.service == null) {
config.service = SdlBroadcastReceiver.consumeQueuedRouterService();
}
@@ -95,17 +95,17 @@ public class TransportManager extends TransportManagerBase{
validator.validateAsync(new RouterServiceValidator.ValidationStatusCallback() {
@Override
public void onFinishedValidation(boolean valid, ComponentName name) {
- DebugTool.logInfo(TAG, "onFinishedValidation valid=" + valid + "; name=" + ((name == null)? "null" : name.getPackageName()));
+ DebugTool.logInfo(TAG, "onFinishedValidation valid=" + valid + "; name=" + ((name == null) ? "null" : name.getPackageName()));
if (valid && name != null) {
mConfig.service = name;
transport = new TransportBrokerImpl(contextWeakReference.get(), mConfig.appId, mConfig.service);
DebugTool.logInfo(TAG, "TransportManager start was called; transport=" + transport);
- if(transport != null){
+ if (transport != null) {
transport.start();
}
} else {
enterLegacyMode("Router service is not trusted. Entering legacy mode");
- if(legacyBluetoothTransport != null){
+ if (legacyBluetoothTransport != null) {
legacyBluetoothTransport.start();
}
}
@@ -114,11 +114,11 @@ public class TransportManager extends TransportManagerBase{
}
@Override
- public void close(long sessionId){
- if(transport != null) {
+ public void close(long sessionId) {
+ if (transport != null) {
transport.removeSession(sessionId);
transport.stop();
- }else if(legacyBluetoothTransport != null){
+ } else if (legacyBluetoothTransport != null) {
legacyBluetoothTransport.stop();
legacyBluetoothTransport = null;
}
@@ -126,15 +126,16 @@ public class TransportManager extends TransportManagerBase{
/**
* Check to see if a transport is connected.
+ *
* @param transportType the transport to have its connection status returned. If `null` is
* passed in, all transports will be checked and if any are connected a
* true value will be returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be used to return if connected.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be used to return if connected.
* @return if a transport is connected based on included variables
*/
@Override
- public boolean isConnected(TransportType transportType, String address){
+ public boolean isConnected(TransportType transportType, String address) {
synchronized (TRANSPORT_STATUS_LOCK) {
if (transportType == null) {
return !transportStatus.isEmpty();
@@ -154,15 +155,17 @@ public class TransportManager extends TransportManagerBase{
return false;
}
}
+
/**
* Retrieve a transport record with the supplied params
+ *
* @param transportType the transport to have its connection status returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be returned.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be returned.
* @return the transport record for the transport type and address if supplied
*/
@Override
- public TransportRecord getTransportRecord(TransportType transportType, String address){
+ public TransportRecord getTransportRecord(TransportType transportType, String address) {
synchronized (TRANSPORT_STATUS_LOCK) {
if (transportType == null) {
return null;
@@ -185,15 +188,16 @@ public class TransportManager extends TransportManagerBase{
/**
* Retrieves the currently connected transports
+ *
* @return the currently connected transports
*/
@Override
- public List<TransportRecord> getConnectedTransports(){
+ public List<TransportRecord> getConnectedTransports() {
return this.transportStatus;
}
@Override
- public boolean isHighBandwidthAvailable(){
+ public boolean isHighBandwidthAvailable() {
synchronized (TRANSPORT_STATUS_LOCK) {
for (TransportRecord record : transportStatus) {
if (record.getType().equals(TransportType.USB)
@@ -206,46 +210,46 @@ public class TransportManager extends TransportManagerBase{
}
@Override
- public BaseTransportConfig updateTransportConfig(BaseTransportConfig config){
- if(transport != null && TransportType.MULTIPLEX.equals(config.getTransportType())){
- ((MultiplexTransportConfig)config).setService(transport.getRouterService());
+ public BaseTransportConfig updateTransportConfig(BaseTransportConfig config) {
+ if (transport != null && TransportType.MULTIPLEX.equals(config.getTransportType())) {
+ ((MultiplexTransportConfig) config).setService(transport.getRouterService());
}
return config;
}
@Override
- public void sendPacket(SdlPacket packet){
- if(transport !=null){
+ public void sendPacket(SdlPacket packet) {
+ if (transport != null) {
transport.sendPacketToRouterService(packet);
- }else if(legacyBluetoothTransport != null){
+ } else if (legacyBluetoothTransport != null) {
byte[] data = packet.constructPacket();
legacyBluetoothTransport.write(data, 0, data.length);
}
}
@Override
- public void requestNewSession(TransportRecord transportRecord){
- if(transport != null){
+ public void requestNewSession(TransportRecord transportRecord) {
+ if (transport != null) {
transport.requestNewSession(transportRecord);
- }else if(legacyBluetoothTransport != null){
+ } else if (legacyBluetoothTransport != null) {
DebugTool.logWarning(TAG, "Session requested for non-bluetooth transport while in legacy mode");
}
}
@Override
- public void requestSecondaryTransportConnection(byte sessionId, TransportRecord transportRecord){
- if(transportRecord != null){
+ public void requestSecondaryTransportConnection(byte sessionId, TransportRecord transportRecord) {
+ if (transportRecord != null) {
Bundle bundle = new Bundle();
bundle.putString(TransportConstants.TRANSPORT_TYPE, transportRecord.getType().name());
- if(transportRecord.getType().equals(TransportType.TCP)) {
- String address = transportRecord.getAddress();
- if(address.contains(":")){
+ if (transportRecord.getType().equals(TransportType.TCP)) {
+ String address = transportRecord.getAddress();
+ if (address.contains(":")) {
String[] split = address.split(":");
- if(split.length == 2) {
+ if (split.length == 2) {
bundle.putString(ControlFrameTags.RPC.TransportEventUpdate.TCP_IP_ADDRESS, split[0]);
bundle.putInt(ControlFrameTags.RPC.TransportEventUpdate.TCP_PORT, Integer.parseInt(split[1]));
} //else {something went wrong;}
- }else{
+ } else {
bundle.putString(ControlFrameTags.RPC.TransportEventUpdate.TCP_IP_ADDRESS, address);
}
@@ -255,30 +259,31 @@ public class TransportManager extends TransportManagerBase{
}
}
- protected class TransportBrokerImpl extends TransportBroker{
+ protected class TransportBrokerImpl extends TransportBroker {
boolean shuttingDown = false;
- public TransportBrokerImpl(Context context, String appId, ComponentName routerService){
- super(context,appId,routerService);
+
+ public TransportBrokerImpl(Context context, String appId, ComponentName routerService) {
+ super(context, appId, routerService);
}
@Override
public synchronized boolean onHardwareConnected(List<TransportRecord> transports) {
super.onHardwareConnected(transports);
DebugTool.logInfo(TAG, "OnHardwareConnected");
- if(shuttingDown){
+ if (shuttingDown) {
return false;
}
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
transportStatus.clear();
transportStatus.addAll(transports);
}
//If a bluetooth device has connected, make sure to save the mac address in the case
//this app is asked to host the router service, the app knows to do so immediately on connection.
- if(transports != null && transports.size() > 0) {
+ if (transports != null && transports.size() > 0) {
for (TransportRecord record : transports) {
- if(record != null && TransportType.BLUETOOTH.equals(record.getType())) {
- SdlDeviceListener.setSDLConnectedStatus(contextWeakReference.get(), record.getAddress(),true);
+ if (record != null && TransportType.BLUETOOTH.equals(record.getType())) {
+ SdlDeviceListener.setSDLConnectedStatus(contextWeakReference.get(), record.getAddress(), true);
}
}
}
@@ -290,21 +295,21 @@ public class TransportManager extends TransportManagerBase{
@Override
public synchronized void onHardwareDisconnected(TransportRecord record, List<TransportRecord> connectedTransports) {
- if(record != null){
+ if (record != null) {
DebugTool.logInfo(TAG, "Transport disconnected - " + record);
- }else{
+ } else {
DebugTool.logInfo(TAG, "Transport disconnected");
}
- if(shuttingDown){
+ if (shuttingDown) {
return;
}
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
boolean wasRemoved = TransportManager.this.transportStatus.remove(record);
//Might check connectedTransports vs transportStatus to ensure they are equal
//If the transport wasn't removed, check RS version for corner case
- if(!wasRemoved && record != null &&getRouterServiceVersion() == 8){
+ if (!wasRemoved && record != null && getRouterServiceVersion() == 8) {
boolean foundMatch = false;
//There is an issue in the first gen of multi transport router services that
//will remove certain extras from messages to the TransportBroker if older apps
@@ -312,7 +317,7 @@ public class TransportManager extends TransportManagerBase{
//that, we check the records we have and if the transport matches we assume it
//was the original transport that was received regardless of the address.
TransportType disconnectedTransportType = record.getType();
- if(disconnectedTransportType != null) {
+ if (disconnectedTransportType != null) {
for (TransportRecord transportRecord : TransportManager.this.transportStatus) {
if (disconnectedTransportType.equals(transportRecord.getType())) {
//The record stored in the TM will contain the actual record the
@@ -331,15 +336,15 @@ public class TransportManager extends TransportManagerBase{
}
}
- if(isLegacyModeEnabled()
+ if (isLegacyModeEnabled()
&& record != null
- && TransportType.BLUETOOTH.equals(record.getType())){ //Make sure it's bluetooth that has be d/c
- //&& legacyBluetoothTransport == null){ //Make sure we aren't already in legacy mode
- if(legacyBluetoothTransport == null) {
+ && TransportType.BLUETOOTH.equals(record.getType())) { //Make sure it's bluetooth that has be d/c
+ //&& legacyBluetoothTransport == null){ //Make sure we aren't already in legacy mode
+ if (legacyBluetoothTransport == null) {
//Legacy mode has been enabled so we need to cycle
enterLegacyModeAndStart("Router service has enabled legacy mode");
}
- }else{
+ } else {
//Inform the transport listener that a transport has disconnected
transportListener.onTransportDisconnected("", record, connectedTransports);
}
@@ -347,10 +352,10 @@ public class TransportManager extends TransportManagerBase{
@Override
public synchronized void onLegacyModeEnabled() {
- if(shuttingDown){
+ if (shuttingDown) {
return;
}
- if( legacyBluetoothTransport == null){
+ if (legacyBluetoothTransport == null) {
//First remove the connected bluetooth transport if one exists
TransportRecord toBeRemoved = null;
for (TransportRecord transportRecord : TransportManager.this.transportStatus) {
@@ -361,7 +366,7 @@ public class TransportManager extends TransportManagerBase{
}
}
- if(toBeRemoved != null){ //Remove item after the loop to avoid concurrent modifications
+ if (toBeRemoved != null) { //Remove item after the loop to avoid concurrent modifications
TransportManager.this.transportStatus.remove(toBeRemoved);
}
@@ -371,8 +376,8 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onPacketReceived(Parcelable packet) {
- if(packet!=null){
- transportListener.onPacketReceived((SdlPacket)packet);
+ if (packet != null) {
+ transportListener.onPacketReceived((SdlPacket) packet);
}
}
@@ -383,75 +388,76 @@ public class TransportManager extends TransportManagerBase{
}
}
- void enterLegacyModeAndStart(final String info){
+ void enterLegacyModeAndStart(final String info) {
enterLegacyMode(info);
- if(legacyBluetoothTransport != null
- && legacyBluetoothTransport.getState() == MultiplexBaseTransport.STATE_NONE){
+ if (legacyBluetoothTransport != null
+ && legacyBluetoothTransport.getState() == MultiplexBaseTransport.STATE_NONE) {
legacyBluetoothTransport.start();
}
}
@Override
- synchronized void enterLegacyMode(final String info){
- if(legacyBluetoothTransport != null && legacyBluetoothHandler != null){
+ synchronized void enterLegacyMode(final String info) {
+ if (legacyBluetoothTransport != null && legacyBluetoothHandler != null) {
return; //Already in legacy mode
}
- if(transportListener.onLegacyModeEnabled(info)) {
- if(Looper.myLooper() == null){
+ if (transportListener.onLegacyModeEnabled(info)) {
+ if (Looper.myLooper() == null) {
Looper.prepare();
}
legacyBluetoothHandler = new LegacyBluetoothHandler(this);
legacyBluetoothTransport = new MultiplexBluetoothTransport(legacyBluetoothHandler);
- if(contextWeakReference.get() != null){
+ if (contextWeakReference.get() != null) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
- contextWeakReference.get().registerReceiver(legacyDisconnectReceiver, intentFilter );
+ contextWeakReference.get().registerReceiver(legacyDisconnectReceiver, intentFilter);
}
- }else{
+ } else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
transportListener.onError(info + " - Legacy mode unacceptable; shutting down.");
}
- },500);
+ }, 500);
}
}
@Override
- synchronized void exitLegacyMode(String info ){
+ synchronized void exitLegacyMode(String info) {
TransportRecord legacyTransportRecord = null;
- if(legacyBluetoothTransport != null){
+ if (legacyBluetoothTransport != null) {
legacyTransportRecord = legacyBluetoothTransport.getTransportRecord();
legacyBluetoothTransport.stop();
legacyBluetoothTransport = null;
}
legacyBluetoothHandler = null;
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
TransportManager.this.transportStatus.clear();
}
- if(contextWeakReference !=null){
- try{
+ if (contextWeakReference != null) {
+ try {
contextWeakReference.get().unregisterReceiver(legacyDisconnectReceiver);
- }catch (Exception e){}
+ } catch (Exception e) {
+ }
}
- transportListener.onTransportDisconnected(info, legacyTransportRecord,null);
+ transportListener.onTransportDisconnected(info, legacyTransportRecord, null);
}
private BroadcastReceiver legacyDisconnectReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if(intent != null){
+ if (intent != null) {
String action = intent.getAction();
- if(BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)){
+ if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
exitLegacyMode("Bluetooth disconnected");
- }else if(action != null && action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
+ } else if (action != null && action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)) {
int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
- if(bluetoothState == BluetoothAdapter.STATE_TURNING_OFF || bluetoothState == BluetoothAdapter.STATE_OFF){
+ if (bluetoothState == BluetoothAdapter.STATE_TURNING_OFF || bluetoothState == BluetoothAdapter.STATE_OFF) {
DebugTool.logInfo(TAG, "Bluetooth is shutting off, exiting legacy mode.");
exitLegacyMode("Bluetooth adapter shutting off");
}
@@ -460,27 +466,28 @@ public class TransportManager extends TransportManagerBase{
}
};
- protected static class LegacyBluetoothHandler extends Handler{
+ protected static class LegacyBluetoothHandler extends Handler {
final WeakReference<TransportManager> provider;
- public LegacyBluetoothHandler(TransportManager provider){
+ public LegacyBluetoothHandler(TransportManager provider) {
this.provider = new WeakReference<>(provider);
}
+
@Override
public void handleMessage(Message msg) {
- if(this.provider.get() == null){
+ if (this.provider.get() == null) {
return;
}
TransportManager service = this.provider.get();
- if(service.transportListener == null){
+ 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){
+ synchronized (service.TRANSPORT_STATUS_LOCK) {
service.transportStatus.clear();
service.transportStatus.add(service.legacyBluetoothTransport.getTransportRecord());
}
@@ -490,7 +497,7 @@ public class TransportManager extends TransportManagerBase{
// Currently attempting to connect - update UI?
break;
case MultiplexBaseTransport.STATE_LISTEN:
- if(service.transport != null){
+ if (service.transport != null) {
service.transport.stop();
service.transport = null;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
index dbe7898ef..604e3b435 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
@@ -83,10 +83,10 @@ import static com.smartdevicelink.transport.TransportConstants.FOREGROUND_EXTRA;
* }</pre>
*/
public class USBAccessoryAttachmentActivity extends Activity {
-
+
private static final String TAG = USBAccessoryAttachmentActivity.class.getSimpleName();
private static final int USB_SUPPORTED_ROUTER_SERVICE_VERSION = 8;
-
+
UsbAccessory usbAccessory;
Parcelable permissionGranted;
@@ -108,7 +108,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
}
private synchronized void checkUsbAccessoryIntent() {
- if(usbAccessory != null){
+ if (usbAccessory != null) {
return;
}
final Intent intent = getIntent();
@@ -121,7 +121,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
wakeUpRouterService(getApplicationContext());
- }else{
+ } else {
finish();
}
}
@@ -134,7 +134,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
}
@SuppressWarnings("deprecation")
- private void wakeUpRouterService(final Context context){
+ private void wakeUpRouterService(final Context context) {
new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
@Override
public void onComplete(Vector<ComponentName> routerServices) {
@@ -147,18 +147,18 @@ public class USBAccessoryAttachmentActivity extends Activity {
if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
SdlAppInfo optimalRouterService = sdlAppInfoList.get(0);
-
- if(optimalRouterService.getRouterServiceVersion() < USB_SUPPORTED_ROUTER_SERVICE_VERSION){
+
+ if (optimalRouterService.getRouterServiceVersion() < USB_SUPPORTED_ROUTER_SERVICE_VERSION) {
// The most optimal router service doesn't support the USB connection
// At this point to ensure that USB connection is still possible it might be
// worth trying to use the legacy USB transport scheme
attemptLegacyUsbConnection(usbAccessory);
return;
}
-
+
serviceIntent = new Intent();
serviceIntent.setComponent(optimalRouterService.getRouterServiceComponentName());
- } else{
+ } else {
DebugTool.logInfo(TAG, "No SDL Router Services found");
DebugTool.logInfo(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
// At this point to ensure that USB connection is still possible it might be
@@ -170,14 +170,14 @@ public class USBAccessoryAttachmentActivity extends Activity {
ComponentName startedService;
try {
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
startedService = context.startService(serviceIntent);
- }else {
+ } else {
serviceIntent.putExtra(FOREGROUND_EXTRA, true);
startedService = context.startForegroundService(serviceIntent);
}
- if(startedService == null){
+ if (startedService == null) {
// A router service was not started or is not running.
DebugTool.logError(TAG, " - Error starting router service. Attempting legacy connection ");
attemptLegacyUsbConnection(usbAccessory);
@@ -191,7 +191,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
restart.putExtra(SdlBroadcastReceiver.LOCAL_ROUTER_SERVICE_DID_START_OWN, true);
context.sendBroadcast(restart);
- if (usbAccessory!=null) {
+ if (usbAccessory != null) {
new UsbTransferProvider(context, serviceIntent.getComponent(), usbAccessory, new UsbTransferProvider.UsbTransferCallback() {
@Override
public void onUsbTransferUpdate(boolean success) {
@@ -205,8 +205,8 @@ public class USBAccessoryAttachmentActivity extends Activity {
DebugTool.logError(TAG, "Security exception, process is bad");
}
} else {
- if (usbAccessory!=null) {
- new UsbTransferProvider(context,runningBluetoothServicePackage.get(0),usbAccessory, new UsbTransferProvider.UsbTransferCallback(){
+ if (usbAccessory != null) {
+ new UsbTransferProvider(context, runningBluetoothServicePackage.get(0), usbAccessory, new UsbTransferProvider.UsbTransferCallback() {
@Override
public void onUsbTransferUpdate(boolean success) {
finish();
@@ -218,15 +218,15 @@ public class USBAccessoryAttachmentActivity extends Activity {
}
});
}
-
- private void attemptLegacyUsbConnection(UsbAccessory usbAccessory){
- if(usbAccessory != null) {
+
+ private void attemptLegacyUsbConnection(UsbAccessory usbAccessory) {
+ if (usbAccessory != null) {
DebugTool.logInfo(TAG, "Attempting to send USB connection intent using legacy method");
Intent usbAccessoryAttachedIntent = new Intent(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_ACCESSORY, usbAccessory);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, permissionGranted);
AndroidTools.sendExplicitBroadcast(getApplicationContext(), usbAccessoryAttachedIntent, null);
- }else{
+ } else {
DebugTool.logError(TAG, "Unable to start legacy USB mode as the accessory was null");
}
finish();
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
index 0b0c9b88d..b588f1512 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/UsbTransferProvider.java
@@ -59,7 +59,7 @@ import java.lang.ref.WeakReference;
public class UsbTransferProvider {
private static final String TAG = "UsbTransferProvider";
- private Context context ;
+ private Context context;
private boolean isBound = false;
private ComponentName routerService;
private int flags = 0;
@@ -71,7 +71,7 @@ public class UsbTransferProvider {
ParcelFileDescriptor usbPfd;
Bundle usbInfoBundle;
- private final ServiceConnection routerConnection= new ServiceConnection() {
+ private final ServiceConnection routerConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
DebugTool.logInfo(TAG, "Bound to service " + className.toString());
@@ -84,7 +84,7 @@ public class UsbTransferProvider {
msg.arg1 = flags;
msg.replyTo = clientMessenger;
msg.obj = usbPfd;
- if(usbInfoBundle != null){
+ if (usbInfoBundle != null) {
msg.setData(usbInfoBundle);
}
try {
@@ -101,12 +101,12 @@ public class UsbTransferProvider {
}
};
- public UsbTransferProvider(Context context, ComponentName service, UsbAccessory usbAccessory, UsbTransferCallback callback){
- if(context == null || service == null || usbAccessory == null){
- throw new IllegalStateException("Supplied params are not correct. Context == null? "+ (context==null) + " ComponentName == null? " + (service == null) + " Usb Accessory == null? " + usbAccessory);
+ public UsbTransferProvider(Context context, ComponentName service, UsbAccessory usbAccessory, UsbTransferCallback callback) {
+ if (context == null || service == null || usbAccessory == null) {
+ throw new IllegalStateException("Supplied params are not correct. Context == null? " + (context == null) + " ComponentName == null? " + (service == null) + " Usb Accessory == null? " + usbAccessory);
}
usbPfd = getFileDescriptor(usbAccessory, context);
- if(usbPfd != null && usbPfd.getFileDescriptor() != null && usbPfd.getFileDescriptor().valid()){
+ if (usbPfd != null && usbPfd.getFileDescriptor() != null && usbPfd.getFileDescriptor().valid()) {
this.context = context;
this.routerService = service;
this.callback = callback;
@@ -120,10 +120,10 @@ public class UsbTransferProvider {
usbInfoBundle.putString(MultiplexUsbTransport.SERIAL, usbAccessory.getSerial());
usbInfoBundle.putString(MultiplexUsbTransport.DESCRIPTION, usbAccessory.getDescription());
checkIsConnected();
- }else{
+ } else {
DebugTool.logError(TAG, "Unable to open accessory");
clientMessenger = null;
- if(callback != null){
+ if (callback != null) {
callback.onUsbTransferUpdate(false);
}
}
@@ -142,67 +142,67 @@ public class UsbTransferProvider {
} catch (Exception e) {
}
}
- return null;
+ return null;
}
- public void setFlags(int flags){
+ public void setFlags(int flags) {
this.flags = flags;
}
- public void checkIsConnected(){
- if(!AndroidTools.isServiceExported(context,routerService) || !bindToService()){
+ public void checkIsConnected() {
+ if (!AndroidTools.isServiceExported(context, routerService) || !bindToService()) {
//We are unable to bind to service
DebugTool.logError(TAG, "Unable to bind to service");
unBindFromService();
}
}
- public void cancel(){
- if(isBound){
+ public void cancel() {
+ if (isBound) {
unBindFromService();
}
}
- private boolean bindToService(){
- if(isBound){
+ private boolean bindToService() {
+ if (isBound) {
return true;
}
- if(clientMessenger == null){
+ if (clientMessenger == null) {
return false;
}
Intent bindingIntent = new Intent();
bindingIntent.setClassName(this.routerService.getPackageName(), this.routerService.getClassName());//This sets an explicit intent
//Quickly make sure it's just up and running
context.startService(bindingIntent);
- bindingIntent.setAction( TransportConstants.BIND_REQUEST_TYPE_USB_PROVIDER);
+ bindingIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_USB_PROVIDER);
return context.bindService(bindingIntent, routerConnection, Context.BIND_AUTO_CREATE);
}
- private void unBindFromService(){
- try{
- if(context!=null && routerConnection!=null){
+ private void unBindFromService() {
+ try {
+ if (context != null && routerConnection != null) {
context.unbindService(routerConnection);
- }else{
+ } else {
DebugTool.logWarning(TAG, "Unable to unbind from router service, context was null");
}
- }catch(IllegalArgumentException e){
+ } catch (IllegalArgumentException e) {
//This is ok
}
}
- private void finish(){
- try {
+ private void finish() {
+ try {
usbPfd.close();
} catch (IOException e) {
e.printStackTrace();
}
usbPfd = null;
unBindFromService();
- routerServiceMessenger =null;
+ routerServiceMessenger = null;
context = null;
System.gc();
- if(callback != null){
+ if (callback != null) {
callback.onUsbTransferUpdate(true);
}
}
@@ -210,14 +210,14 @@ public class UsbTransferProvider {
static class ClientHandler extends Handler {
final WeakReference<UsbTransferProvider> provider;
- public ClientHandler(UsbTransferProvider provider){
+ public ClientHandler(UsbTransferProvider provider) {
super(Looper.getMainLooper());
this.provider = new WeakReference<>(provider);
}
@Override
public void handleMessage(Message msg) {
- if(provider.get()==null){
+ if (provider.get() == null) {
return;
}
switch (msg.what) {
@@ -231,7 +231,7 @@ public class UsbTransferProvider {
}
}
- public interface UsbTransferCallback{
+ public interface UsbTransferCallback {
void onUsbTransferUpdate(boolean success);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
index 163b2268b..2f2e286f4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
@@ -39,74 +39,74 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class ByteAraryMessageAssembler {
- private static final String TAG = "ByteAraryMsgAssembler";
- ByteArrayOutputStream buffer;
- boolean isFinished;
- TransportType transportType;
+ private static final String TAG = "ByteAraryMsgAssembler";
+ ByteArrayOutputStream buffer;
+ boolean isFinished;
+ TransportType transportType;
- public void init(){
- close();
- this.isFinished = false;
- buffer = new ByteArrayOutputStream();
- }
+ public void init() {
+ close();
+ this.isFinished = false;
+ buffer = new ByteArrayOutputStream();
+ }
- public void setTransportType(TransportType transportType){
- this.transportType = transportType;
- }
+ public void setTransportType(TransportType transportType) {
+ this.transportType = transportType;
+ }
- public TransportType getTransportType() {
- return transportType;
- }
+ public TransportType getTransportType() {
+ return transportType;
+ }
- public boolean close(){
- if(buffer!=null){
- try {
- buffer.close();
- buffer = null;
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- }
- return false;
- }
-
- public void append(byte[] bytes){
- try {
- buffer.write(bytes);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public synchronized boolean handleMessage(int flags, byte[] packet){
- switch(flags){
- case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START: //Fall through to write the bytes after they buffer was init'ed
- case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT:
- append(packet);
- break;
- case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END:
- append(packet);
- this.isFinished = true;
- break;
- default:
- DebugTool.logError(TAG, "Error handling message");
- return false;
- }
-
- return true;
- }
+ public boolean close() {
+ if (buffer != null) {
+ try {
+ buffer.close();
+ buffer = null;
+ return true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return false;
+ }
- public byte[] getBytes(){
- if(buffer == null){
- return null;
- }
- return this.buffer.toByteArray();
- }
-
- public boolean isFinished(){
- return this.isFinished;
- }
+ public void append(byte[] bytes) {
+ try {
+ buffer.write(bytes);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public synchronized boolean handleMessage(int flags, byte[] packet) {
+ switch (flags) {
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START: //Fall through to write the bytes after they buffer was init'ed
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT:
+ append(packet);
+ break;
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END:
+ append(packet);
+ this.isFinished = true;
+ break;
+ default:
+ DebugTool.logError(TAG, "Error handling message");
+ return false;
+ }
+
+ return true;
+ }
+
+ public byte[] getBytes() {
+ if (buffer == null) {
+ return null;
+ }
+ return this.buffer.toByteArray();
+ }
+
+ public boolean isFinished() {
+ return this.isFinished;
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
index 670711709..8f33c76e6 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
@@ -42,105 +42,105 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
public class ByteArrayMessageSpliter {
- private static final String TAG = "ByteArrayMessageSpliter";
-
- //To test set this value to something very small (eg, 50)
- public static final int MAX_BINDER_SIZE = 1000000/4; //~1MB/4 We do this as a safety measure. IPC only allows 1MB for everything. We should never fill more than 25% of the buffer so here we make sure we stay under that
-
- boolean firstPacket;
- ByteArrayInputStream stream;
- int bytesRead;
- final int what;
- final String appId;
- byte[] buffer;
- final int orginalSize;
- final int priorityCoef;
- int routerServiceVersion = 1;
- TransportRecord transportRecord;
-
- public ByteArrayMessageSpliter(String appId,int what, byte[] bytes, int priorityCoef){
- this.appId = appId;
- this.what = what;
- stream = new ByteArrayInputStream(bytes);
- orginalSize = stream.available();
- bytesRead = 0;
- firstPacket = true;
- this.priorityCoef = priorityCoef;
- }
-
- public void setRouterServiceVersion(int version){
- this.routerServiceVersion = version;
- }
-
- public void setTransportRecord(TransportRecord transportRecord){
- this.transportRecord = transportRecord;
- }
-
- public boolean isActive(){
- if(stream!=null){
- return stream.available()>0;
- }
- return false;
- }
-
- public boolean close(){
- if(stream == null){
- return false;
- }
- try {
- stream.close();
- stream = null;
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
-
- }
-
- public Message nextMessage(){
- if(stream == null || stream.available()<=0){
- return null;
- }
-
- Message message = Message.obtain(); //Do we need to always obtain new? or can we just swap bundles?
- message.what = this.what;// TransportConstants.ROUTER_SEND_PACKET;
- Bundle bundle = new Bundle();
-
-
- if(stream.available()>=MAX_BINDER_SIZE){
- buffer = new byte[MAX_BINDER_SIZE];
- bytesRead = stream.read(buffer, 0, MAX_BINDER_SIZE);
- }else{
- buffer = new byte[stream.available()];
- bytesRead = stream.read(buffer, 0, stream.available());
- }
-
- bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, buffer); //Do we just change this to the args and objs
- bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0);
- bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytesRead);
- if(transportRecord != null){
- bundle.putString(TransportConstants.TRANSPORT_TYPE, transportRecord.getType().name());
- bundle.putString(TransportConstants.TRANSPORT_ADDRESS, transportRecord.getAddress());
- }
-
- //Determine which flag should be sent for this division of the packet
- if(firstPacket){
- bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START);
- bundle.putInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, this.priorityCoef);
- firstPacket = false;
- }else if(stream.available()<=0){ //We are at the end of the stream so let the flag reflect that
- bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END);
- }else{
- bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT);
- }
-
- if(routerServiceVersion< TransportConstants.RouterServiceVersions.APPID_STRING){
- bundle.putLong(TransportConstants.APP_ID_EXTRA,TransportBroker.convertAppId(appId));
- }
- bundle.putString(TransportConstants.APP_ID_EXTRA_STRING, appId);
- message.setData(bundle);
- DebugTool.logInfo(TAG, ((100 - ((stream.available()*100)/orginalSize) ))+ " percent complete.");
- return message;
- }
+ private static final String TAG = "ByteArrayMessageSpliter";
+
+ //To test set this value to something very small (eg, 50)
+ public static final int MAX_BINDER_SIZE = 1000000 / 4; //~1MB/4 We do this as a safety measure. IPC only allows 1MB for everything. We should never fill more than 25% of the buffer so here we make sure we stay under that
+
+ boolean firstPacket;
+ ByteArrayInputStream stream;
+ int bytesRead;
+ final int what;
+ final String appId;
+ byte[] buffer;
+ final int orginalSize;
+ final int priorityCoef;
+ int routerServiceVersion = 1;
+ TransportRecord transportRecord;
+
+ public ByteArrayMessageSpliter(String appId, int what, byte[] bytes, int priorityCoef) {
+ this.appId = appId;
+ this.what = what;
+ stream = new ByteArrayInputStream(bytes);
+ orginalSize = stream.available();
+ bytesRead = 0;
+ firstPacket = true;
+ this.priorityCoef = priorityCoef;
+ }
+
+ public void setRouterServiceVersion(int version) {
+ this.routerServiceVersion = version;
+ }
+
+ public void setTransportRecord(TransportRecord transportRecord) {
+ this.transportRecord = transportRecord;
+ }
+
+ public boolean isActive() {
+ if (stream != null) {
+ return stream.available() > 0;
+ }
+ return false;
+ }
+
+ public boolean close() {
+ if (stream == null) {
+ return false;
+ }
+ try {
+ stream.close();
+ stream = null;
+ return true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ }
+
+ public Message nextMessage() {
+ if (stream == null || stream.available() <= 0) {
+ return null;
+ }
+
+ Message message = Message.obtain(); //Do we need to always obtain new? or can we just swap bundles?
+ message.what = this.what;// TransportConstants.ROUTER_SEND_PACKET;
+ Bundle bundle = new Bundle();
+
+
+ if (stream.available() >= MAX_BINDER_SIZE) {
+ buffer = new byte[MAX_BINDER_SIZE];
+ bytesRead = stream.read(buffer, 0, MAX_BINDER_SIZE);
+ } else {
+ buffer = new byte[stream.available()];
+ bytesRead = stream.read(buffer, 0, stream.available());
+ }
+
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, buffer); //Do we just change this to the args and objs
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytesRead);
+ if (transportRecord != null) {
+ bundle.putString(TransportConstants.TRANSPORT_TYPE, transportRecord.getType().name());
+ bundle.putString(TransportConstants.TRANSPORT_ADDRESS, transportRecord.getAddress());
+ }
+
+ //Determine which flag should be sent for this division of the packet
+ if (firstPacket) {
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START);
+ bundle.putInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, this.priorityCoef);
+ firstPacket = false;
+ } else if (stream.available() <= 0) { //We are at the end of the stream so let the flag reflect that
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END);
+ } else {
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT);
+ }
+
+ if (routerServiceVersion < TransportConstants.RouterServiceVersions.APPID_STRING) {
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, TransportBroker.convertAppId(appId));
+ }
+ bundle.putString(TransportConstants.APP_ID_EXTRA_STRING, appId);
+ message.setData(bundle);
+ DebugTool.logInfo(TAG, ((100 - ((stream.available() * 100) / orginalSize))) + " percent complete.");
+ return message;
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java
index 1ca1f8d97..251eb130f 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/SdlDeviceListener.java
@@ -85,9 +85,9 @@ public class SdlDeviceListener {
* will listen for 30 seconds, if it is not, this will listen for 15 seconds instead.
*/
public void start() {
- if(connectedDevice == null) {
+ if (connectedDevice == null) {
DebugTool.logInfo(TAG, ": No supplied bluetooth device");
- if(callback != null){
+ if (callback != null) {
callback.onTransportError(null);
}
return;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
index bd31e746e..f8dc2828b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java
@@ -14,7 +14,7 @@ public class TransportRecord extends BaseTransportRecord implements Parcelable {
public TransportRecord(Parcel p) {
if (p.readInt() == 1) { //We should have a transport type attached
String transportName = p.readString();
- if(transportName != null){
+ if (transportName != null) {
this.type = TransportType.valueOf(transportName);
}
}
@@ -31,13 +31,13 @@ public class TransportRecord extends BaseTransportRecord implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(type!=null? 1 : 0);
- if(type != null){
+ dest.writeInt(type != null ? 1 : 0);
+ if (type != null) {
dest.writeString(type.name());
}
- dest.writeInt(address !=null? 1 : 0);
- if(address != null){
+ dest.writeInt(address != null ? 1 : 0);
+ if (address != null) {
dest.writeString(address);
}
}
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 d33f4c374..eda694d95 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
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -50,7 +50,7 @@ import static com.smartdevicelink.util.NativeLogTool.logInfo;
public class WiFiSocketFactory {
/**
* Try to create a TCP socket which is bound to Wi-Fi network (for Android 5+)
- *
+ * <p>
* On Android 5 and later, this method tries to create a Socket instance which is bound to a
* Wi-Fi network. If the phone is not connected to a Wi-Fi network, or the app lacks
* required permission (ACCESS_NETWORK_STATE), then this method simply creates a Socket instance
@@ -72,7 +72,7 @@ public class WiFiSocketFactory {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Socket createWiFiSocket(Context context) {
- if(context == null){
+ if (context == null) {
logInfo("Context supplied was null");
return null;
}
@@ -87,7 +87,7 @@ public class WiFiSocketFactory {
return null;
}
- ConnectivityManager connMan = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ ConnectivityManager connMan = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connMan == null) {
logInfo("ConnectivityManager isn't available.");
return null;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
index ea2bf709f..9109dc3ad 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
@@ -59,144 +59,149 @@ import java.util.HashMap;
import java.util.List;
public class AndroidTools {
- /**
- * Check to see if a component is exported
- * @param context object used to retrieve the package manager
- * @param name of the component in question
- * @return true if this component is tagged as exported
- */
- public static boolean isServiceExported(Context context, ComponentName name) {
- try {
- ServiceInfo serviceInfo = context.getPackageManager().getServiceInfo(name, PackageManager.GET_META_DATA);
- return serviceInfo.exported;
- } catch (NameNotFoundException e) {
- e.printStackTrace();
- }
- return false;
- }
- /**
- * Get all SDL enabled apps. If the package name is null, it will return all apps. However, if the package name is included, the
- * resulting hash map will not include the app with that package name.
- * @param context a context object used to get an instance of the package manager
- * @param myPackageName the package of the requesting app. This should only be included if the app wants to exclude itself from the map
- * @return a hash map of SDL apps with the package name as the key, and the ResolveInfo as the value
- */
- public static HashMap<String,ResolveInfo> getSdlEnabledApps(Context context, String myPackageName){
- Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
- List<ResolveInfo> infos = context.getPackageManager().queryBroadcastReceivers(intent, 0);
- HashMap<String,ResolveInfo> sdlMultiList = new HashMap<>();
- for(ResolveInfo info: infos){
- if(info.activityInfo.applicationInfo.packageName.equals(myPackageName)){
- continue; //Ignoring my own package
- }
- sdlMultiList.put(info.activityInfo.packageName, info);
- }
- return sdlMultiList;
- }
-
-
- /**
- * Finds all SDL apps via their SdlRouterService manifest entry. It will return the metadata associated with that router service.
- * @param context a context instance to obtain the package manager
- * @param comparator the Comparator to sort the resulting list. If null is supplied, they will be returned as they are from the system
- * @return the sorted list of SdlAppInfo objects that represent SDL apps
- */
- public static List<SdlAppInfo> querySdlAppInfo(Context context, Comparator<SdlAppInfo> comparator){
- List<SdlAppInfo> sdlAppInfoList = new ArrayList<>();
- Intent intent = new Intent(TransportConstants.ROUTER_SERVICE_ACTION);
- List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentServices(intent, PackageManager.GET_META_DATA);
-
- if(resolveInfoList != null && resolveInfoList.size() > 0) {
- PackageManager packageManager = context.getPackageManager();
- if(packageManager != null) {
-
- for (ResolveInfo info : resolveInfoList) {
- PackageInfo packageInfo;
- try {
- packageInfo = packageManager.getPackageInfo(info.serviceInfo.packageName, 0);
- sdlAppInfoList.add(new SdlAppInfo(info, packageInfo));
- } catch (NameNotFoundException e) {
- //Package was not found, likely a sign the resolve info can't be trusted.
- }
-
- }
- }
-
- if (comparator != null) {
- Collections.sort(sdlAppInfoList, comparator);
- }
- }
-
- return sdlAppInfoList;
- }
-
-
- /**
- * Sends the provided intent to the specified destinations making it an explicit intent, rather
- * than an implicit intent. A direct replacement of sendBroadcast(Intent). As of Android 8.0
- * (API 26+) implicit broadcasts are no longer sent to broadcast receivers that are declared via
- * the AndroidManifest. If no apps are found to receive the intent, this method will send the
- * broadcast implicitly if no list of apps is provided.
- *
- * @param intent - the intent to send explicitly
- * @param apps - the list of apps that this broadcast will be sent to. If null is passed in
- * the intent will be sent to all apps that match the provided intent via a query
- * to the package manager; it will also be sent implicitly to mimic
- * sendBroadcast()'s original functionality.
- */
- public static void sendExplicitBroadcast(Context context, Intent intent, List<ResolveInfo> apps) {
-
- if(context == null || intent == null){
- return;
- }
-
- if (apps == null) {
- apps = context.getPackageManager().queryBroadcastReceivers(intent, 0);
- }
-
- if (apps != null && apps.size()>0) {
- for(ResolveInfo app: apps){
- try {
- intent.setClassName(app.activityInfo.applicationInfo.packageName, app.activityInfo.name);
- context.sendBroadcast(intent);
- }catch(Exception e){
- //In case there is missing info in the app reference we want to keep moving
- }
- }
- } else {
- // fallback to implicit broadcast if we cannot resolve apps info.
- context.sendBroadcast(intent);
- }
- }
-
- /**
- * Checks if the usb cable is physically connected or not
- * Note: the intent here is a sticky intent so registerReceiver is actually a synchronous call and doesn't register a receiver on each call
- * @param context a context instance
- * @return boolean value that represents whether the usb cable is physically connected or not
- */
- public static boolean isUSBCableConnected(Context context) {
- Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
- if (intent == null ) {
- return false;
- }
- int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
- return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB;
- }
-
- public static Bitmap downloadImage(String urlStr) throws IOException {
- URL url = new URL(urlStr);
- URLConnection connection = url.openConnection();
- BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
- Bitmap result = BitmapFactory.decodeStream(bis);
- bis.close();
- return result;
- }
-
- public static boolean isDebugMode(Context context){
- if(context != null && context.getApplicationInfo() != null){
- return 0 != ( context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE );
- }
- return false;
- }
+ /**
+ * Check to see if a component is exported
+ *
+ * @param context object used to retrieve the package manager
+ * @param name of the component in question
+ * @return true if this component is tagged as exported
+ */
+ public static boolean isServiceExported(Context context, ComponentName name) {
+ try {
+ ServiceInfo serviceInfo = context.getPackageManager().getServiceInfo(name, PackageManager.GET_META_DATA);
+ return serviceInfo.exported;
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * Get all SDL enabled apps. If the package name is null, it will return all apps. However, if the package name is included, the
+ * resulting hash map will not include the app with that package name.
+ *
+ * @param context a context object used to get an instance of the package manager
+ * @param myPackageName the package of the requesting app. This should only be included if the app wants to exclude itself from the map
+ * @return a hash map of SDL apps with the package name as the key, and the ResolveInfo as the value
+ */
+ public static HashMap<String, ResolveInfo> getSdlEnabledApps(Context context, String myPackageName) {
+ Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ List<ResolveInfo> infos = context.getPackageManager().queryBroadcastReceivers(intent, 0);
+ HashMap<String, ResolveInfo> sdlMultiList = new HashMap<>();
+ for (ResolveInfo info : infos) {
+ if (info.activityInfo.applicationInfo.packageName.equals(myPackageName)) {
+ continue; //Ignoring my own package
+ }
+ sdlMultiList.put(info.activityInfo.packageName, info);
+ }
+ return sdlMultiList;
+ }
+
+
+ /**
+ * Finds all SDL apps via their SdlRouterService manifest entry. It will return the metadata associated with that router service.
+ *
+ * @param context a context instance to obtain the package manager
+ * @param comparator the Comparator to sort the resulting list. If null is supplied, they will be returned as they are from the system
+ * @return the sorted list of SdlAppInfo objects that represent SDL apps
+ */
+ public static List<SdlAppInfo> querySdlAppInfo(Context context, Comparator<SdlAppInfo> comparator) {
+ List<SdlAppInfo> sdlAppInfoList = new ArrayList<>();
+ Intent intent = new Intent(TransportConstants.ROUTER_SERVICE_ACTION);
+ List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentServices(intent, PackageManager.GET_META_DATA);
+
+ if (resolveInfoList != null && resolveInfoList.size() > 0) {
+ PackageManager packageManager = context.getPackageManager();
+ if (packageManager != null) {
+
+ for (ResolveInfo info : resolveInfoList) {
+ PackageInfo packageInfo;
+ try {
+ packageInfo = packageManager.getPackageInfo(info.serviceInfo.packageName, 0);
+ sdlAppInfoList.add(new SdlAppInfo(info, packageInfo));
+ } catch (NameNotFoundException e) {
+ //Package was not found, likely a sign the resolve info can't be trusted.
+ }
+
+ }
+ }
+
+ if (comparator != null) {
+ Collections.sort(sdlAppInfoList, comparator);
+ }
+ }
+
+ return sdlAppInfoList;
+ }
+
+
+ /**
+ * Sends the provided intent to the specified destinations making it an explicit intent, rather
+ * than an implicit intent. A direct replacement of sendBroadcast(Intent). As of Android 8.0
+ * (API 26+) implicit broadcasts are no longer sent to broadcast receivers that are declared via
+ * the AndroidManifest. If no apps are found to receive the intent, this method will send the
+ * broadcast implicitly if no list of apps is provided.
+ *
+ * @param intent - the intent to send explicitly
+ * @param apps - the list of apps that this broadcast will be sent to. If null is passed in
+ * the intent will be sent to all apps that match the provided intent via a query
+ * to the package manager; it will also be sent implicitly to mimic
+ * sendBroadcast()'s original functionality.
+ */
+ public static void sendExplicitBroadcast(Context context, Intent intent, List<ResolveInfo> apps) {
+
+ if (context == null || intent == null) {
+ return;
+ }
+
+ if (apps == null) {
+ apps = context.getPackageManager().queryBroadcastReceivers(intent, 0);
+ }
+
+ if (apps != null && apps.size() > 0) {
+ for (ResolveInfo app : apps) {
+ try {
+ intent.setClassName(app.activityInfo.applicationInfo.packageName, app.activityInfo.name);
+ context.sendBroadcast(intent);
+ } catch (Exception e) {
+ //In case there is missing info in the app reference we want to keep moving
+ }
+ }
+ } else {
+ // fallback to implicit broadcast if we cannot resolve apps info.
+ context.sendBroadcast(intent);
+ }
+ }
+
+ /**
+ * Checks if the usb cable is physically connected or not
+ * Note: the intent here is a sticky intent so registerReceiver is actually a synchronous call and doesn't register a receiver on each call
+ *
+ * @param context a context instance
+ * @return boolean value that represents whether the usb cable is physically connected or not
+ */
+ public static boolean isUSBCableConnected(Context context) {
+ Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ if (intent == null) {
+ return false;
+ }
+ int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
+ return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB;
+ }
+
+ public static Bitmap downloadImage(String urlStr) throws IOException {
+ URL url = new URL(urlStr);
+ URLConnection connection = url.openConnection();
+ BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
+ Bitmap result = BitmapFactory.decodeStream(bis);
+ bis.close();
+ return result;
+ }
+
+ public static boolean isDebugMode(Context context) {
+ if (context != null && context.getApplicationInfo() != null) {
+ return 0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE);
+ }
+ return false;
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
index 1cc0b514c..295a06935 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,167 +44,168 @@ import java.net.HttpURLConnection;
import java.net.URL;
public class HttpRequestTask extends AsyncTask<String, String, String> {
- private static final String TAG = "Http Request Task";
-
- public static final String REQUEST_TYPE_POST = "POST";
- public static final String REQUEST_TYPE_GET = "GET";
- public static final String REQUEST_TYPE_DELETE = "DELETE";
-
- HttpRequestTaskCallback cb;
-
- /**
- * @param hcb callback for when this task finishes
- * <br><br><b> - When calling execute, params as followed: </b><br>
- * 1. Url String<br>
- * 2. Request type (Defined in this class) REQUEST_TYPE_POST, REQUEST_TYPE_GET, REQUEST_TYPE_DELETE<br>
- * 3. (Optional) Data to be sent. <br>
- * 4. (Optional) Content Type Default will be application/json<br>
- * 5. (Optional) Accept Type default will be application/json
- *
- */
- public HttpRequestTask( HttpRequestTaskCallback hcb){
- this.cb = hcb;
- }
-
- @Override
- protected String doInBackground(String... params) {
- int length = params.length;
- String urlString = params[0];
- String request_type = params[1];
-
- //Grab and set data to be written if included
- String data;
- if(length>2){
- data = params[2];
- }else{
- data = null;
- }
-
- //Grab and set content type for the header if included
- String contentType;
- if(length>3){
- contentType = params[3];
- }else{
- contentType = "application/json";
- }
- //Grab and set accept type for the header if included
- String acceptType;
- if(length>4){
- acceptType = params[4];
- }else{
- acceptType = "application/json";
- }
-
- if(urlString == null || request_type == null){
- DebugTool.logError(TAG, "Can't process request, param error");
- if(cb!=null){
- cb.httpFailure(-1);
- cb = null;
- }
- return "Error";
- }
-
- HttpURLConnection urlConnection = null;
- BufferedReader reader = null;
- try {
- URL url = new URL(urlString);
- urlConnection = (HttpURLConnection) url.openConnection();
- urlConnection.setDoOutput(true);
- urlConnection.setRequestMethod(request_type);
- urlConnection.setRequestProperty("Content-Type", contentType);
- urlConnection.setRequestProperty("Accept", acceptType);
- //If we have data, we should write it out
- if(data !=null){
- Writer writer = new BufferedWriter(new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8"));
- writer.write(data);
- writer.close();
- }
- InputStream inputStream = urlConnection.getInputStream();
-
- int responseCode = urlConnection.getResponseCode();
- if (responseCode == 200) { //Success
- //input stream
- StringBuffer buffer = new StringBuffer();
- if (inputStream == null) {
- // Nothing to do.
- if(cb!=null){
- cb.httpCallComplete(null);
- cb = null;
- }
- return null;
- }
- reader = new BufferedReader(new InputStreamReader(inputStream));
-
- String inputLine;
- while ((inputLine = reader.readLine()) != null)
- buffer.append(inputLine).append("\n");
- if (buffer.length() == 0) {
- // Stream was empty. No point in parsing.
- if(cb!=null){
- cb.httpCallComplete(null);
- cb = null;
- }
- return null;
- }
- String response;
-
- response = buffer.toString();
- //send to post execute
- if(cb!=null){
- cb.httpCallComplete(response);
- cb = null;
- }
- return response;
- }else{
- if(cb!=null){
- cb.httpFailure(responseCode);
- cb = null;
- }
- DebugTool.logError(TAG, "Failed to download file - " + responseCode);
- return null;
- }
-
-
- } catch (IOException e) {
- e.printStackTrace();
- } catch (NullPointerException e){ // Only to catch error in urlConnection.getOutputStream() - when servers are down
- e.printStackTrace();
- urlConnection = null;
- }
- finally {
- if (urlConnection != null) {
- urlConnection.disconnect();
- }
- if (reader != null) {
- try {
- reader.close();
- } catch (final IOException e) {
- DebugTool.logError(TAG, "Error closing stream", e);
- }
- }
- if(cb!=null){
- cb.httpFailure(-1);
- }
- }
- return null;
- }
-
- /**
- * Callback interface for HTTP requests.
- * @author Joey Grover
- *
- */
- public interface HttpRequestTaskCallback{
- /**
- * Called when HTTP request is successfully completed.
- * @param response The response to the HTTP request.
- */
- void httpCallComplete(String response);
- /**
- * Called when HTTP request failed.
- * @param statusCode The HTTP failure code.
- */
- void httpFailure(int statusCode);
- }
+ private static final String TAG = "Http Request Task";
+
+ public static final String REQUEST_TYPE_POST = "POST";
+ public static final String REQUEST_TYPE_GET = "GET";
+ public static final String REQUEST_TYPE_DELETE = "DELETE";
+
+ HttpRequestTaskCallback cb;
+
+ /**
+ * @param hcb callback for when this task finishes
+ * <br><br><b> - When calling execute, params as followed: </b><br>
+ * 1. Url String<br>
+ * 2. Request type (Defined in this class) REQUEST_TYPE_POST, REQUEST_TYPE_GET, REQUEST_TYPE_DELETE<br>
+ * 3. (Optional) Data to be sent. <br>
+ * 4. (Optional) Content Type Default will be application/json<br>
+ * 5. (Optional) Accept Type default will be application/json
+ */
+ public HttpRequestTask(HttpRequestTaskCallback hcb) {
+ this.cb = hcb;
+ }
+
+ @Override
+ protected String doInBackground(String... params) {
+ int length = params.length;
+ String urlString = params[0];
+ String request_type = params[1];
+
+ //Grab and set data to be written if included
+ String data;
+ if (length > 2) {
+ data = params[2];
+ } else {
+ data = null;
+ }
+
+ //Grab and set content type for the header if included
+ String contentType;
+ if (length > 3) {
+ contentType = params[3];
+ } else {
+ contentType = "application/json";
+ }
+ //Grab and set accept type for the header if included
+ String acceptType;
+ if (length > 4) {
+ acceptType = params[4];
+ } else {
+ acceptType = "application/json";
+ }
+
+ if (urlString == null || request_type == null) {
+ DebugTool.logError(TAG, "Can't process request, param error");
+ if (cb != null) {
+ cb.httpFailure(-1);
+ cb = null;
+ }
+ return "Error";
+ }
+
+ HttpURLConnection urlConnection = null;
+ BufferedReader reader = null;
+ try {
+ URL url = new URL(urlString);
+ urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setDoOutput(true);
+ urlConnection.setRequestMethod(request_type);
+ urlConnection.setRequestProperty("Content-Type", contentType);
+ urlConnection.setRequestProperty("Accept", acceptType);
+ //If we have data, we should write it out
+ if (data != null) {
+ Writer writer = new BufferedWriter(new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8"));
+ writer.write(data);
+ writer.close();
+ }
+ InputStream inputStream = urlConnection.getInputStream();
+
+ int responseCode = urlConnection.getResponseCode();
+ if (responseCode == 200) { //Success
+ //input stream
+ StringBuffer buffer = new StringBuffer();
+ if (inputStream == null) {
+ // Nothing to do.
+ if (cb != null) {
+ cb.httpCallComplete(null);
+ cb = null;
+ }
+ return null;
+ }
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String inputLine;
+ while ((inputLine = reader.readLine()) != null)
+ buffer.append(inputLine).append("\n");
+ if (buffer.length() == 0) {
+ // Stream was empty. No point in parsing.
+ if (cb != null) {
+ cb.httpCallComplete(null);
+ cb = null;
+ }
+ return null;
+ }
+ String response;
+
+ response = buffer.toString();
+ //send to post execute
+ if (cb != null) {
+ cb.httpCallComplete(response);
+ cb = null;
+ }
+ return response;
+ } else {
+ if (cb != null) {
+ cb.httpFailure(responseCode);
+ cb = null;
+ }
+ DebugTool.logError(TAG, "Failed to download file - " + responseCode);
+ return null;
+ }
+
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e) { // Only to catch error in urlConnection.getOutputStream() - when servers are down
+ e.printStackTrace();
+ urlConnection = null;
+ } finally {
+ if (urlConnection != null) {
+ urlConnection.disconnect();
+ }
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (final IOException e) {
+ DebugTool.logError(TAG, "Error closing stream", e);
+ }
+ }
+ if (cb != null) {
+ cb.httpFailure(-1);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Callback interface for HTTP requests.
+ *
+ * @author Joey Grover
+ */
+ public interface HttpRequestTaskCallback {
+ /**
+ * Called when HTTP request is successfully completed.
+ *
+ * @param response The response to the HTTP request.
+ */
+ void httpCallComplete(String response);
+
+ /**
+ * Called when HTTP request failed.
+ *
+ * @param statusCode The HTTP failure code.
+ */
+ void httpFailure(int statusCode);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
index e7a4b69d6..dc0bde5ed 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
@@ -53,7 +53,7 @@ import java.util.List;
/**
* Possible improvements
- *
+ * <p>
* - Narrow down list of acceptable audio devices
* - Add ability to listen for when audio devices become available, and then connect
* - Improve redundant calls to create String arrays for action arrays
@@ -68,7 +68,7 @@ public class MediaStreamingStatus {
private Callback callback;
private final List<String> intentList;
- public MediaStreamingStatus(@NonNull Context context, @NonNull Callback callback){
+ public MediaStreamingStatus(@NonNull Context context, @NonNull Callback callback) {
contextWeakReference = new WeakReference<>(context);
this.callback = callback;
intentList = new ArrayList<>();
@@ -76,7 +76,7 @@ public class MediaStreamingStatus {
intentList.add(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
}
- public void clear(){
+ public void clear() {
callback = null;
unregisterBroadcastReceiver();
contextWeakReference.clear();
@@ -109,13 +109,15 @@ public class MediaStreamingStatus {
@SuppressLint("MissingPermission")
public synchronized boolean isAudioOutputAvailable() {
Context context = contextWeakReference.get();
- if(context == null){ return false;}
+ if (context == null) {
+ return false;
+ }
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
// If API level 23+ audio manager can iterate over all current devices to see if a supported
// device is present.
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (audioManager != null) {
AudioDeviceInfo[] deviceInfos = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
if (deviceInfos != null) {
@@ -141,23 +143,24 @@ public class MediaStreamingStatus {
* This method will check to ensure that the device is supported. If possible, it will also
* check against known variables and flags to ensure that that device is connected. This is
* required as the AudioManager tends to be untrustworthy.
+ *
* @param audioDevice
* @return
*/
- boolean isSupportedAudioDevice(int audioDevice){
+ boolean isSupportedAudioDevice(int audioDevice) {
DebugTool.logInfo(TAG, "Audio device connected: " + audioDevice);
- switch (audioDevice){
+ switch (audioDevice) {
case AudioDeviceInfo.TYPE_BLUETOOTH_A2DP:
- if(isBluetoothActuallyAvailable()) {
- setupBluetoothBroadcastReceiver();
- return true; //Make sure this doesn't fall to any other logic after this point
- }
- return false;
+ if (isBluetoothActuallyAvailable()) {
+ setupBluetoothBroadcastReceiver();
+ return true; //Make sure this doesn't fall to any other logic after this point
+ }
+ return false;
case AudioDeviceInfo.TYPE_DOCK:
case AudioDeviceInfo.TYPE_USB_ACCESSORY:
case AudioDeviceInfo.TYPE_USB_DEVICE:
case AudioDeviceInfo.TYPE_USB_HEADSET:
- if(isUsbActuallyConnected()) {
+ if (isUsbActuallyConnected()) {
setupUSBBroadcastReceiver();
return true;
}
@@ -174,15 +177,15 @@ public class MediaStreamingStatus {
}
@SuppressLint("MissingPermission")
- boolean isBluetoothActuallyAvailable(){
+ boolean isBluetoothActuallyAvailable() {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if(adapter == null || !adapter.isEnabled() ){
+ if (adapter == null || !adapter.isEnabled()) {
//False positive
return false;
}
int state = adapter.getProfileConnectionState(BluetoothProfile.A2DP);
- if(state != BluetoothAdapter.STATE_CONNECTING && state != BluetoothAdapter.STATE_CONNECTED){
+ if (state != BluetoothAdapter.STATE_CONNECTING && state != BluetoothAdapter.STATE_CONNECTED) {
//False positive
return false;
}
@@ -190,17 +193,17 @@ public class MediaStreamingStatus {
return true;
}
- boolean isUsbActuallyConnected(){
+ boolean isUsbActuallyConnected() {
Context context = contextWeakReference.get();
- if(context != null){
- return AndroidTools.isUSBCableConnected(context);
+ if (context != null) {
+ return AndroidTools.isUSBCableConnected(context);
}
//default to true
return true;
}
- private void setupBluetoothBroadcastReceiver(){
+ private void setupBluetoothBroadcastReceiver() {
String[] actions = new String[4];
actions[0] = BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED;
actions[1] = BluetoothAdapter.ACTION_STATE_CHANGED;
@@ -210,37 +213,37 @@ public class MediaStreamingStatus {
listenForIntents(actions);
}
- private void setupHeadsetBroadcastReceiver(){
+ private void setupHeadsetBroadcastReceiver() {
String[] actions = new String[1];
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
actions[0] = AudioManager.ACTION_HEADSET_PLUG;
- }else{
- actions[0] = "android.intent.action.HEADSET_PLUG";
+ } else {
+ actions[0] = "android.intent.action.HEADSET_PLUG";
}
listenForIntents(actions);
}
- private void setupUSBBroadcastReceiver(){
+ private void setupUSBBroadcastReceiver() {
String[] actions = new String[1];
actions[0] = Intent.ACTION_BATTERY_CHANGED;
listenForIntents(actions);
}
- private void listenForIntents(@NonNull String[] actions){
- if(intentList != null){
+ private void listenForIntents(@NonNull String[] actions) {
+ if (intentList != null) {
//Add each intent
int preAddSize = intentList.size();
- for(String action : actions){
- if(action != null && action.length() > 0 && !intentList.contains(action)){
+ for (String action : actions) {
+ if (action != null && action.length() > 0 && !intentList.contains(action)) {
intentList.add(action);
}
}
- if(preAddSize != intentList.size()){
- synchronized (BROADCAST_RECEIVER_LOCK){
+ if (preAddSize != intentList.size()) {
+ synchronized (BROADCAST_RECEIVER_LOCK) {
broadcastReceiverValid = true;
}
updateBroadcastReceiver();
@@ -264,12 +267,12 @@ public class MediaStreamingStatus {
}
- private void unregisterBroadcastReceiver(){
+ private void unregisterBroadcastReceiver() {
Context context = contextWeakReference.get();
- if(context != null) {
- try{
+ if (context != null) {
+ try {
context.unregisterReceiver(broadcastReceiver);
- }catch (Exception e){
+ } catch (Exception e) {
//Ignore the exception
}
}
@@ -296,7 +299,7 @@ public class MediaStreamingStatus {
};
- public interface Callback{
+ public interface Callback {
void onAudioNoLongerAvailable();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
index 35c852c09..d49e63575 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
@@ -58,16 +58,16 @@ public class SdlAppInfo {
long lastUpdateTime;
- public SdlAppInfo(ResolveInfo resolveInfo, PackageInfo packageInfo){
- if(resolveInfo.serviceInfo != null){
+ public SdlAppInfo(ResolveInfo resolveInfo, PackageInfo packageInfo) {
+ if (resolveInfo.serviceInfo != null) {
this.packageName = resolveInfo.serviceInfo.packageName;
this.routerServiceComponentName = new ComponentName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name);
Bundle metadata = resolveInfo.serviceInfo.metaData;
- if(metadata != null) {
+ if (metadata != null) {
- if (metadata.containsKey(SDL_ROUTER_VERSION_METADATA)){
+ if (metadata.containsKey(SDL_ROUTER_VERSION_METADATA)) {
this.routerServiceVersion = metadata.getInt(SDL_ROUTER_VERSION_METADATA);
}
@@ -79,12 +79,12 @@ public class SdlAppInfo {
}
}
- if(packageInfo != null){
+ if (packageInfo != null) {
this.lastUpdateTime = packageInfo.lastUpdateTime;
- if(this.lastUpdateTime <= 0){
+ if (this.lastUpdateTime <= 0) {
this.lastUpdateTime = packageInfo.firstInstallTime;
}
- }else{
+ } else {
this.lastUpdateTime = 0;
}
}
@@ -129,44 +129,43 @@ public class SdlAppInfo {
/**
* This comparator will sort a list to find the best router service to start out of the known SDL enabled apps
- *
*/
- public static class BestRouterComparator implements Comparator<SdlAppInfo>{
+ public static class BestRouterComparator implements Comparator<SdlAppInfo> {
@Override
public int compare(SdlAppInfo one, SdlAppInfo two) {
- if(one != null){
- if(two != null){
- if(one.isCustomRouterService){
- if(two.isCustomRouterService){
+ if (one != null) {
+ if (two != null) {
+ if (one.isCustomRouterService) {
+ if (two.isCustomRouterService) {
return 0;
- }else{
+ } else {
return 1;
}
- }else if(two.isCustomRouterService){
+ } else if (two.isCustomRouterService) {
return -1;
}//else, do nothing. Move to version check
- int versionCompare = two.routerServiceVersion - one.routerServiceVersion;
+ int versionCompare = two.routerServiceVersion - one.routerServiceVersion;
- if(versionCompare == 0){ //Versions are equal so lets use the one that has been updated most recently
- long updateTime = two.lastUpdateTime - one.lastUpdateTime;
- if(updateTime == 0){
+ if (versionCompare == 0) { //Versions are equal so lets use the one that has been updated most recently
+ long updateTime = two.lastUpdateTime - one.lastUpdateTime;
+ if (updateTime == 0) {
//This is arbitrary, but we want to ensure all lists are sorted in the same order
- return one.routerServiceComponentName.getPackageName().compareTo(two.routerServiceComponentName.getPackageName());
- }else{
+ return one.routerServiceComponentName.getPackageName().compareTo(two.routerServiceComponentName.getPackageName());
+ } else {
return (updateTime < 0 ? -1 : 1);
}
- }else{
+ } else {
return (versionCompare < 0 ? -1 : 1);
}
- }else{
+ } else {
return -1;
}
- }else{
- if(two != null){
+ } else {
+ if (two != null) {
return 1;
}
}
diff --git a/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml b/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
index ce287ed04..405558455 100644
--- a/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
+++ b/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
@@ -1,7 +1,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/lockscreen_relative_layout"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:id="@+id/lockscreen_relative_layout"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/lockscreen_linear_layout"
@@ -26,7 +26,7 @@
android:scaleType="fitXY"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/lockscreen_image_description"
- android:visibility="gone"/>
+ android:visibility="gone" />
<ImageView
android:id="@+id/device_image"
@@ -35,7 +35,7 @@
android:layout_marginTop="30dp"
android:scaleType="fitXY"
android:layout_gravity="center_horizontal"
- android:contentDescription="@string/lockscreen_device_image_description"/>
+ android:contentDescription="@string/lockscreen_device_image_description" />
</LinearLayout>
@@ -47,6 +47,6 @@
android:textSize="18sp"
android:gravity="center|bottom"
android:textColor="#FFFFFF"
- android:paddingBottom="10dp"/>
+ android:paddingBottom="10dp" />
</RelativeLayout> \ No newline at end of file
diff --git a/android/sdl_android/src/main/res/xml/accessory_filter.xml b/android/sdl_android/src/main/res/xml/accessory_filter.xml
index 4b0ab7c83..6a6e1ea97 100644
--- a/android/sdl_android/src/main/res/xml/accessory_filter.xml
+++ b/android/sdl_android/src/main/res/xml/accessory_filter.xml
@@ -3,5 +3,5 @@
<usb-accessory
manufacturer="SDL"
model="Core"
- version="1.0"/>
+ version="1.0" />
</resource> \ No newline at end of file
diff --git a/android/sdl_android/src/test/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java b/android/sdl_android/src/test/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java
index 1e147a728..69693101b 100644
--- a/android/sdl_android/src/test/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java
+++ b/android/sdl_android/src/test/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java
@@ -158,7 +158,6 @@ public class HapticInterfaceManagerTest extends TestCase {
}
-
@Test
public void testRefreshHapticData_NullCapability() {
final int buttonX = 60;
@@ -261,7 +260,7 @@ public class HapticInterfaceManagerTest extends TestCase {
doAnswer(new Answer() {
@Override
public int[] answer(InvocationOnMock invocation) throws Throwable {
- int[] args = (int[])(invocation.getArguments()[0]);
+ int[] args = (int[]) (invocation.getArguments()[0]);
args[0] = x;
args[1] = y;
return args;
diff --git a/base/src/main/java/com/smartdevicelink/exception/SdlException.java b/base/src/main/java/com/smartdevicelink/exception/SdlException.java
index 3bea33575..e55c80334 100644
--- a/base/src/main/java/com/smartdevicelink/exception/SdlException.java
+++ b/base/src/main/java/com/smartdevicelink/exception/SdlException.java
@@ -1,78 +1,78 @@
-/*
- * 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.exception;
public class SdlException extends Exception {
-
- private static final long serialVersionUID = 5922492291870772815L;
-
- protected Throwable detail = null;
- private SdlExceptionCause _sdlExceptionCause = null;
-
- public SdlException(String msg, SdlExceptionCause exceptionCause) {
- super(msg);
- _sdlExceptionCause = exceptionCause;
- }
-
- public SdlException(String msg, Throwable ex, SdlExceptionCause exceptionCause) {
- super(msg + " --- Check inner exception for diagnostic details");
- detail = ex;
- _sdlExceptionCause = exceptionCause;
- }
-
- public SdlException(Throwable ex) {
- super(ex.getMessage());
- detail = ex;
- }
-
- public SdlExceptionCause getSdlExceptionCause() {
- return _sdlExceptionCause;
- }
-
- public Throwable getInnerException() {
- return detail;
- }
-
- public String toString() {
- String ret = this.getClass().getName();
- ret += ": " + this.getMessage();
- if(this.getSdlExceptionCause() != null){
- ret += "\nSdlExceptionCause: " + this.getSdlExceptionCause().name();
- }
- if (detail != null) {
- ret += "\nnested: " + detail.toString();
- detail.printStackTrace();
- }
- return ret;
- }
+
+ private static final long serialVersionUID = 5922492291870772815L;
+
+ protected Throwable detail = null;
+ private SdlExceptionCause _sdlExceptionCause = null;
+
+ public SdlException(String msg, SdlExceptionCause exceptionCause) {
+ super(msg);
+ _sdlExceptionCause = exceptionCause;
+ }
+
+ public SdlException(String msg, Throwable ex, SdlExceptionCause exceptionCause) {
+ super(msg + " --- Check inner exception for diagnostic details");
+ detail = ex;
+ _sdlExceptionCause = exceptionCause;
+ }
+
+ public SdlException(Throwable ex) {
+ super(ex.getMessage());
+ detail = ex;
+ }
+
+ public SdlExceptionCause getSdlExceptionCause() {
+ return _sdlExceptionCause;
+ }
+
+ public Throwable getInnerException() {
+ return detail;
+ }
+
+ public String toString() {
+ String ret = this.getClass().getName();
+ ret += ": " + this.getMessage();
+ if (this.getSdlExceptionCause() != null) {
+ ret += "\nSdlExceptionCause: " + this.getSdlExceptionCause().name();
+ }
+ if (detail != null) {
+ ret += "\nnested: " + detail.toString();
+ detail.printStackTrace();
+ }
+ return ret;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/exception/SdlExceptionCause.java b/base/src/main/java/com/smartdevicelink/exception/SdlExceptionCause.java
index 0d8351d54..828887e47 100644
--- a/base/src/main/java/com/smartdevicelink/exception/SdlExceptionCause.java
+++ b/base/src/main/java/com/smartdevicelink/exception/SdlExceptionCause.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,28 +29,28 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.exception;
-
-public enum SdlExceptionCause {
- BLUETOOTH_ADAPTER_NULL,
- BLUETOOTH_DISABLED,
- BLUETOOTH_SOCKET_UNAVAILABLE,
- HEARTBEAT_PAST_DUE,
- INCORRECT_LIFECYCLE_MODEL,
- INVALID_ARGUMENT,
- INVALID_RPC_PARAMETER,
- PERMISSION_DENIED,
- RESERVED_CORRELATION_ID,
- SDL_CONNECTION_FAILED,
- SDL_PROXY_CYCLED,
- SDL_PROXY_DISPOSED,
- SDL_PROXY_OBSOLETE,
- SDL_REGISTRATION_ERROR,
- SDL_UNAVAILABLE,
- INVALID_HEADER,
- DATA_BUFFER_NULL,
- SDL_USB_DETACHED,
- SDL_USB_PERMISSION_DENIED,
- LOCK_SCREEN_ICON_NOT_SUPPORTED,
- ;
-}
+package com.smartdevicelink.exception;
+
+public enum SdlExceptionCause {
+ BLUETOOTH_ADAPTER_NULL,
+ BLUETOOTH_DISABLED,
+ BLUETOOTH_SOCKET_UNAVAILABLE,
+ HEARTBEAT_PAST_DUE,
+ INCORRECT_LIFECYCLE_MODEL,
+ INVALID_ARGUMENT,
+ INVALID_RPC_PARAMETER,
+ PERMISSION_DENIED,
+ RESERVED_CORRELATION_ID,
+ SDL_CONNECTION_FAILED,
+ SDL_PROXY_CYCLED,
+ SDL_PROXY_DISPOSED,
+ SDL_PROXY_OBSOLETE,
+ SDL_REGISTRATION_ERROR,
+ SDL_UNAVAILABLE,
+ INVALID_HEADER,
+ DATA_BUFFER_NULL,
+ SDL_USB_DETACHED,
+ SDL_USB_PERMISSION_DENIED,
+ LOCK_SCREEN_ICON_NOT_SUPPORTED,
+ ;
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
index dce30db8e..0348cc1e7 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
@@ -245,8 +245,8 @@ abstract class BaseSdlManager {
}
}
- void checkSdlManagerState(){
- if (getState() != BaseSubManager.READY && getState() != BaseSubManager.LIMITED){
+ void checkSdlManagerState() {
+ if (getState() != BaseSubManager.READY && getState() != BaseSubManager.LIMITED) {
DebugTool.logError(TAG, "SdlManager is not ready for use, be sure to initialize with start() method, implement callback, and use SubManagers in the SdlManager's callback");
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSubManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSubManager.java
index 11de4359b..0c8a98495 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSubManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSubManager.java
@@ -41,78 +41,81 @@ import java.util.List;
/**
* <strong>BaseSubManager</strong> <br>
- *
+ * <p>
* Note: This class is extended by SubManagers <br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. <br>
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public abstract class BaseSubManager {
- // states - if this gets more complicated we can move elsewhere
- private int state;
- private final Object STATE_LOCK = new Object();
- public static final int SETTING_UP = 0x00, READY = 0x30, LIMITED = 0x50, SHUTDOWN = 0x80, ERROR = 0xC0;
- protected final ISdl internalInterface;
- private CompletionListener completionListener;
+ // states - if this gets more complicated we can move elsewhere
+ private int state;
+ private final Object STATE_LOCK = new Object();
+ public static final int SETTING_UP = 0x00, READY = 0x30, LIMITED = 0x50, SHUTDOWN = 0x80, ERROR = 0xC0;
+ protected final ISdl internalInterface;
+ private CompletionListener completionListener;
- public BaseSubManager(@NonNull ISdl internalInterface){
- this.internalInterface = internalInterface;
- transitionToState(SETTING_UP);
- }
+ public BaseSubManager(@NonNull ISdl internalInterface) {
+ this.internalInterface = internalInterface;
+ transitionToState(SETTING_UP);
+ }
- /**
- * Starts up a BaseSubManager, and calls provided callback once BaseSubManager is done setting up or failed setup.
- * @param listener CompletionListener that is called once the BaseSubManager's state is READY, LIMITED, or ERROR
- */
- @CallSuper
- public void start(CompletionListener listener){
- this.completionListener = listener;
- int state = getState();
- if((state == READY || state == LIMITED || state == ERROR) && completionListener != null){
- completionListener.onComplete(state == READY || state == LIMITED);
- completionListener = null;
- }
- }
+ /**
+ * Starts up a BaseSubManager, and calls provided callback once BaseSubManager is done setting up or failed setup.
+ *
+ * @param listener CompletionListener that is called once the BaseSubManager's state is READY, LIMITED, or ERROR
+ */
+ @CallSuper
+ public void start(CompletionListener listener) {
+ this.completionListener = listener;
+ int state = getState();
+ if ((state == READY || state == LIMITED || state == ERROR) && completionListener != null) {
+ completionListener.onComplete(state == READY || state == LIMITED);
+ completionListener = null;
+ }
+ }
- /**
- * <p>Called when manager is being torn down</p>
- */
- @CallSuper
- public void dispose(){
- transitionToState(SHUTDOWN);
- }
+ /**
+ * <p>Called when manager is being torn down</p>
+ */
+ @CallSuper
+ public void dispose() {
+ transitionToState(SHUTDOWN);
+ }
- protected void transitionToState(int state) {
- synchronized (STATE_LOCK) {
- this.state = state;
- }
- if((state == READY || state == LIMITED || state == ERROR) && completionListener != null ){
- completionListener.onComplete(state == READY || state == LIMITED);
- completionListener = null;
- }
- }
+ protected void transitionToState(int state) {
+ synchronized (STATE_LOCK) {
+ this.state = state;
+ }
+ if ((state == READY || state == LIMITED || state == ERROR) && completionListener != null) {
+ completionListener.onComplete(state == READY || state == LIMITED);
+ completionListener = null;
+ }
+ }
- public int getState() {
- synchronized (STATE_LOCK) {
- return state;
- }
- }
+ public int getState() {
+ synchronized (STATE_LOCK) {
+ return state;
+ }
+ }
- //This allows the method to not be exposed to developers
- protected void handleTransportUpdated(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail){
- this.onTransportUpdate(connectedTransports,audioStreamTransportAvail,videoStreamTransportAvail);
- }
+ //This allows the method to not be exposed to developers
+ protected void handleTransportUpdated(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
+ this.onTransportUpdate(connectedTransports, audioStreamTransportAvail, videoStreamTransportAvail);
+ }
- /**
- * Transport status has been updated
- * @param connectedTransports currently connected transports
- * @param audioStreamTransportAvail if there is a transport that could be used to carry the
- * audio service
- * @param videoStreamTransportAvail if there is a transport that could be used to carry the
- * video service
- */
- protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail){}
+ /**
+ * Transport status has been updated
+ *
+ * @param connectedTransports currently connected transports
+ * @param audioStreamTransportAvail if there is a transport that could be used to carry the
+ * audio service
+ * @param videoStreamTransportAvail if there is a transport that could be used to carry the
+ * video service
+ */
+ protected void onTransportUpdate(List<TransportRecord> connectedTransports, boolean audioStreamTransportAvail, boolean videoStreamTransportAvail) {
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/CompletionListener.java b/base/src/main/java/com/smartdevicelink/managers/CompletionListener.java
index 2a9c5b16c..1974062d1 100644
--- a/base/src/main/java/com/smartdevicelink/managers/CompletionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/CompletionListener.java
@@ -33,9 +33,10 @@ package com.smartdevicelink.managers;
public interface CompletionListener {
- /**
- * Returns whether a specific operation was successful or not
- * @param success - success or fail
- */
- void onComplete(boolean success);
+ /**
+ * Returns whether a specific operation was successful or not
+ *
+ * @param success - success or fail
+ */
+ void onComplete(boolean success);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/ISdl.java b/base/src/main/java/com/smartdevicelink/managers/ISdl.java
index 5885f4dc4..6d9a3c50f 100644
--- a/base/src/main/java/com/smartdevicelink/managers/ISdl.java
+++ b/base/src/main/java/com/smartdevicelink/managers/ISdl.java
@@ -64,46 +64,53 @@ public interface ISdl {
/**
* Method to check if the session is connected
+ *
* @return if there is a connected session
*/
boolean isConnected();
/**
* Add a service listener for a specific service type
- * @param serviceType service type that the listener will be attached to
+ *
+ * @param serviceType service type that the listener will be attached to
* @param sdlServiceListener listener for events that happen to the service
*/
void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener);
/**
* Remote a service listener for a specific service type
- * @param serviceType service type that the listener was attached to
+ *
+ * @param serviceType service type that the listener was attached to
* @param sdlServiceListener service listener that was previously added for the service type
*/
void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener);
/**
* Starts the video streaming service
+ *
* @param parameters desired video streaming params for this service to be started with
- * @param encrypted flag to start this service with encryption or not
+ * @param encrypted flag to start this service with encryption or not
*/
void startVideoService(VideoStreamingParameters parameters, boolean encrypted);
/**
* Starts the Audio streaming service
+ *
* @param encrypted flag to start this service with encryption or not
*/
void startAudioService(boolean encrypted);
/**
* Pass an RPC message through the proxy to be sent to the connected module
+ *
* @param message RPCMessage that should be sent to the module
*/
void sendRPC(RPCMessage message);
/**
* Pass a list of RPC messages through the proxy to be sent to core
- * @param rpcs List of RPC messages
+ *
+ * @param rpcs List of RPC messages
* @param listener OnMultipleRequestListener that is called between requests and after all are processed
*/
void sendRPCs(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener);
@@ -116,82 +123,94 @@ public interface ISdl {
*
* <strong>ADDITIONAL NOTE: This only takes the type of RPCRequest for now, notifications and responses will be thrown out</strong>
*
- * @param rpcs is the list of RPCMessages being sent
+ * @param rpcs is the list of RPCMessages being sent
* @param listener listener for updates and completions
*/
void sendSequentialRPCs(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener);
- /**
- * Add an OnRPCNotificationListener for specified notification
- * @param notificationId FunctionID of the notification that is to be listened for
- * @param listener listener that should be added for the notification ID
- */
+ /**
+ * Add an OnRPCNotificationListener for specified notification
+ *
+ * @param notificationId FunctionID of the notification that is to be listened for
+ * @param listener listener that should be added for the notification ID
+ */
void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener);
/**
* Removes an OnRPCNotificationListener for specified notification
+ *
* @param notificationId FunctionID of the notification that was to be listened for
- * @param listener listener that was previously added for the notification ID
+ * @param listener listener that was previously added for the notification ID
*/
boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener);
/**
* Add an OnRPCRequestListener for specified request
+ *
* @param functionID FunctionID of the request that is to be listened for
- * @param listener listener that should be added for the request ID
+ * @param listener listener that should be added for the request ID
*/
void addOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener);
/**
* Removes an OnRPCRequestListener for specified request
+ *
* @param functionID FunctionID of the request that was to be listened for
- * @param listener listener that was previously added for the request ID
+ * @param listener listener that was previously added for the request ID
*/
boolean removeOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener);
/**
* Add an OnRPCResponseListener for specified response
+ *
* @param responseId FunctionID of the response that is to be listened for
- * @param listener listener that should be added for the response ID
+ * @param listener listener that should be added for the response ID
*/
void addOnRPCListener(FunctionID responseId, OnRPCListener listener);
/**
* Removes an OnRPCResponseListener for specified response
+ *
* @param responseId FunctionID of the response that was to be listened for
- * @param listener listener that was previously added for the response ID
+ * @param listener listener that was previously added for the response ID
*/
boolean removeOnRPCListener(FunctionID responseId, OnRPCListener listener);
/**
* Get RegisterAppInterfaceResponse
+ *
* @return the RegisterAppInterfaceResponse if available, null if not
*/
RegisterAppInterfaceResponse getRegisterAppInterfaceResponse();
/**
* Check to see if a transport is available to start/use the supplied service.
+ *
* @param serviceType the session that should be checked for transport availability
* @return true if there is either a supported
- * transport currently connected or a transport is
- * available to connect with for the supplied service type.
- * <br>false if there is no
- * transport connected to support the service type in question and
- * no possibility in the foreseeable future.
+ * transport currently connected or a transport is
+ * available to connect with for the supplied service type.
+ * <br>false if there is no
+ * transport connected to support the service type in question and
+ * no possibility in the foreseeable future.
*/
boolean isTransportForServiceAvailable(SessionType serviceType);
/**
* Get the RPC specification version currently being used for the SDL messages
+ *
* @return SdlMsgVersion the current RPC specification version
*/
- @NonNull SdlMsgVersion getSdlMsgVersion();
+ @NonNull
+ SdlMsgVersion getSdlMsgVersion();
/**
* Get the protocol version of this session
+ *
* @return byte value representing WiPro version
*/
- @NonNull Version getProtocolVersion();
+ @NonNull
+ Version getProtocolVersion();
/**
* Start encrypted RPC service
diff --git a/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
index b788bab1c..b5ad249bb 100644
--- a/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
+++ b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
@@ -25,7 +25,7 @@ public class ManagerUtility {
* Check to see if WindowCapability has an ImageFieldName of a given name.
*
* @param windowCapability WindowCapability representing the capabilities of the desired window
- * @param name ImageFieldName representing a name of a given Image field that would be stored in WindowCapability
+ * @param name ImageFieldName representing a name of a given Image field that would be stored in WindowCapability
* @return true if name exist in WindowCapability else false
*/
public static boolean hasImageFieldOfName(final WindowCapability windowCapability, final ImageFieldName name) {
@@ -34,7 +34,7 @@ public class ManagerUtility {
}
if (windowCapability.getImageFields() != null) {
List<ImageField> imageFields = windowCapability.getImageFields();
- if(imageFields != null && imageFields.size() > 0) {
+ if (imageFields != null && imageFields.size() > 0) {
for (ImageField field : imageFields) {
if (field != null && name.equals(field.getName())) {
return true;
@@ -49,7 +49,7 @@ public class ManagerUtility {
* Check to see if WindowCapability has a textField of a given name.
*
* @param windowCapability WindowCapability representing the capabilities of the desired window
- * @param name TextFieldName representing a name of a given text field that would be stored in WindowCapability
+ * @param name TextFieldName representing a name of a given text field that would be stored in WindowCapability
* @return true if name exist in WindowCapability else false
*/
public static boolean hasTextFieldOfName(final WindowCapability windowCapability, final TextFieldName name) {
@@ -80,7 +80,7 @@ public class ManagerUtility {
if (windowCapability != null && windowCapability.getTextFields() != null) {
for (TextField field : windowCapability.getTextFields()) {
int fieldNumber = 0;
- if(field != null && field.getName() != null) {
+ if (field != null && field.getName() != null) {
switch (field.getName()) {
case mainField1:
fieldNumber = 1;
diff --git a/base/src/main/java/com/smartdevicelink/managers/StreamingStateMachine.java b/base/src/main/java/com/smartdevicelink/managers/StreamingStateMachine.java
index f828ff58e..67929d4dd 100644
--- a/base/src/main/java/com/smartdevicelink/managers/StreamingStateMachine.java
+++ b/base/src/main/java/com/smartdevicelink/managers/StreamingStateMachine.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,67 +37,72 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
public class StreamingStateMachine {
- @IntDef({NONE, READY, STARTED, STOPPED, ERROR})
- @Retention(RetentionPolicy.SOURCE)
- public @interface StreamingState {}
- public static final int NONE = 0x00, READY = 0x30, STARTED = 0x60, STOPPED = 0x90, ERROR = 0xC0;
+ @IntDef({NONE, READY, STARTED, STOPPED, ERROR})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface StreamingState {
+ }
- private @StreamingState int state = NONE;
- private final Object STATE_LOCK = new Object();
+ public static final int NONE = 0x00, READY = 0x30, STARTED = 0x60, STOPPED = 0x90, ERROR = 0xC0;
- public StreamingStateMachine(){}
+ private @StreamingState
+ int state = NONE;
+ private final Object STATE_LOCK = new Object();
- public void transitionToState(int state) {
- if(state != NONE && state != READY && state != STARTED
- && state != STOPPED && state != ERROR) {
- return;
- }
- synchronized (STATE_LOCK) {
- if(isValidTransition(this.state, state)){
- this.state = state;
- }
- }
- }
+ public StreamingStateMachine() {
+ }
- public @StreamingState int getState() {
- synchronized (STATE_LOCK) {
- return state;
- }
- }
+ public void transitionToState(int state) {
+ if (state != NONE && state != READY && state != STARTED
+ && state != STOPPED && state != ERROR) {
+ return;
+ }
+ synchronized (STATE_LOCK) {
+ if (isValidTransition(this.state, state)) {
+ this.state = state;
+ }
+ }
+ }
- private boolean isValidTransition(int prev_state, int next_state){
- if(prev_state == next_state){
- return false;
- }
- switch (prev_state){
- case NONE:
- if((next_state == READY) || (next_state == ERROR)){
- return true;
- }
- break;
- case READY:
- if((next_state == STARTED) || (next_state == ERROR)){
- return true;
- }
- break;
- case STARTED:
- if((next_state == STOPPED) || (next_state == ERROR)){
- return true;
- }
- break;
- case STOPPED:
- if((next_state == STARTED) || (next_state == NONE)){
- return true;
- }
- break;
- case ERROR:
- if(next_state == NONE){
- return true;
- }
- break;
- default:
- break;
- }
- return false;
- }
+ public @StreamingState
+ int getState() {
+ synchronized (STATE_LOCK) {
+ return state;
+ }
+ }
+
+ private boolean isValidTransition(int prev_state, int next_state) {
+ if (prev_state == next_state) {
+ return false;
+ }
+ switch (prev_state) {
+ case NONE:
+ if ((next_state == READY) || (next_state == ERROR)) {
+ return true;
+ }
+ break;
+ case READY:
+ if ((next_state == STARTED) || (next_state == ERROR)) {
+ return true;
+ }
+ break;
+ case STARTED:
+ if ((next_state == STOPPED) || (next_state == ERROR)) {
+ return true;
+ }
+ break;
+ case STOPPED:
+ if ((next_state == STARTED) || (next_state == NONE)) {
+ return true;
+ }
+ break;
+ case ERROR:
+ if (next_state == NONE) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/audio/BaseAudioStreamManager.java b/base/src/main/java/com/smartdevicelink/managers/audio/BaseAudioStreamManager.java
index 65bf6e3e1..a72b76a53 100644
--- a/base/src/main/java/com/smartdevicelink/managers/audio/BaseAudioStreamManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/audio/BaseAudioStreamManager.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
diff --git a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
index e6c67d2b8..77ba2ef1e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
@@ -65,409 +65,423 @@ import java.util.Map;
/**
* <strong>FileManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The SDLFileManager uploads files and keeps track of all the uploaded files names during a session. <br>
- *
+ * <p>
* We need to add the following struct: SDLFile<br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. Getters <br>
* 2. Deletion methods <br>
* 3. Uploading Files / Artwork
*/
abstract class BaseFileManager extends BaseSubManager {
- final static String TAG = "FileManager";
- final static int SPACE_AVAILABLE_MAX_VALUE = 2000000000;
- private List<String> remoteFiles;
- private final List<String> uploadedEphemeralFileNames;
- private int bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
- private final FileManagerConfig fileManagerConfig;
- private final HashMap<String, Integer> failedFileUploadsIndex;
-
- /**
- * Constructor for BaseFileManager
- * @param internalInterface ISDL
- * @param fileManagerConfig FileManagerConfig
- */
- BaseFileManager(ISdl internalInterface, FileManagerConfig fileManagerConfig) {
-
- // setup
- super(internalInterface);
- uploadedEphemeralFileNames = new ArrayList<>();
- this.fileManagerConfig = fileManagerConfig;
- failedFileUploadsIndex = new HashMap<>();
- }
-
- @Override
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public void start(CompletionListener listener) {
- // prepare manager - don't set state to ready until we have list of files
- retrieveRemoteFiles();
- super.start(listener);
- }
-
- // GETTERS
-
- /**
- * Returns a list of file names currently residing on core
- * @return List<String> of remote file names
- */
- public List<String> getRemoteFileNames() {
- if (getState() != BaseSubManager.READY){
- // error and don't return list
- throw new IllegalArgumentException("FileManager is not READY");
- }
- // return list (this is synchronous at this point)
- return remoteFiles;
- }
-
- /**
- * Get the number of bytes still available for files for this app.
- * @return int value representing The number of bytes still available
- */
- public int getBytesAvailable(){
- return bytesAvailable;
- }
-
- private void retrieveRemoteFiles(){
- remoteFiles = new ArrayList<>();
- // hold list in remoteFiles class var
- ListFiles listFiles = new ListFiles();
- listFiles.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- ListFilesResponse listFilesResponse = (ListFilesResponse) response;
- if (listFilesResponse.getSuccess()) {
- bytesAvailable = listFilesResponse.getSpaceAvailable() != null ? listFilesResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
-
- if (listFilesResponse.getFilenames() != null) {
- remoteFiles.addAll(listFilesResponse.getFilenames());
- }
- // on callback set manager to ready state
- transitionToState(BaseSubManager.READY);
- } else {
- // file list could not be received. assume that setting can work and allow SDLManager to start
- DebugTool.logError(TAG, "File Manager could not list files");
- bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
- transitionToState(BaseSubManager.READY);
- }
- }
- });
- internalInterface.sendRPC(listFiles);
- }
-
- // DELETION
-
- /**
- * Attempts to delete the desired file from core, calls listener with indication of success/failure
- * @param fileName name of file to be deleted
- * @param listener callback that is called on response from core
- */
- public void deleteRemoteFileWithName(@NonNull final String fileName, final CompletionListener listener){
- DeleteFile deleteFile = new DeleteFile();
- deleteFile.setSdlFileName(fileName);
- deleteFile.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- DeleteFileResponse deleteFileResponse = (DeleteFileResponse) response;
- if(deleteFileResponse.getSuccess()){
- bytesAvailable = deleteFileResponse.getSpaceAvailable() != null ? deleteFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
-
- remoteFiles.remove(fileName);
- uploadedEphemeralFileNames.remove(fileName);
- }
- if(listener != null){
- listener.onComplete(deleteFileResponse.getSuccess());
- }
- }
- });
- internalInterface.sendRPC(deleteFile);
- }
-
- /**
- * Attempts to delete a list of files from core, calls listener with indication of success/failure
- * @param fileNames list of file names to be deleted
- * @param listener callback that is called once core responds to all deletion requests
- */
- public void deleteRemoteFilesWithNames(@NonNull List<String> fileNames, final MultipleFileCompletionListener listener){
- if(fileNames.isEmpty()){
- return;
- }
- final List<DeleteFile> deleteFileRequests = new ArrayList<>();
- for(String fileName : fileNames){
- DeleteFile deleteFile = new DeleteFile();
- deleteFile.setSdlFileName(fileName);
- deleteFileRequests.add(deleteFile);
- }
- final Map<String, String> errors = new HashMap<>();
- sendMultipleFileOperations(deleteFileRequests, listener, errors);
- }
-
- // UPLOAD FILES / ARTWORK
-
- /**
- * Creates and returns a PutFile request that would upload a given SdlFile
- * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
- * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
- */
- abstract PutFile createPutFile(@NonNull final SdlFile file);
-
- /**
- * Sends list of provided requests (strictly PutFile or DeleteFile) asynchronously through internalInterface,
- * calls listener on conclusion of sending requests.
- *
- * @param requests Non-empty list of PutFile or DeleteFile requests
- * @param listener MultipleFileCompletionListener that is called upon conclusion of sending requests
- * @param errors a hashMap that keeps track of RPCRequest that have failed to upload and returns to developer if listener is not null
- */
- private void sendMultipleFileOperations(final List<? extends RPCRequest> requests, final MultipleFileCompletionListener listener, final Map<String, String> errors) {
- final HashMap<Integer, RPCRequest> requestMap = new HashMap<>();
- final List<RPCRequest> requestsToResend = new ArrayList<>();
- final boolean deletionOperation;
- if (requests.get(0) instanceof PutFile) {
- deletionOperation = false;
- } else if (requests.get(0) instanceof DeleteFile) {
- deletionOperation = true;
- } else {
- return;
- }
-
- OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
- int fileNum = 0;
-
- @Override
- public void addCorrelationId(int correlationId) {
- super.addCorrelationId(correlationId);
- requestMap.put(correlationId, requests.get(fileNum++));
- }
-
- @Override
- public void onUpdate(int remainingRequests) {
- }
-
- @Override
- public void onFinished() {
- if (!deletionOperation) {
- if (!requestsToResend.isEmpty()) {
- sendMultipleFileOperations(requestsToResend, listener, errors);
- } else if (listener != null) {
- listener.onComplete(errors.isEmpty() ? null : errors);
- }
- } else {
- if (listener != null) {
- listener.onComplete(errors.isEmpty() ? null : errors);
- }
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- if (response instanceof PutFileResponse) {
- PutFileResponse putFileResponse = (PutFileResponse) response;
- bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
-
- PutFile putFile = ((PutFile) requestMap.get(correlationId));
- if (putFile != null) {
- remoteFiles.add(putFile.getSdlFileName());
- uploadedEphemeralFileNames.add(putFile.getSdlFileName());
- }
-
- } else if (response instanceof DeleteFileResponse) {
- DeleteFileResponse deleteFileResponse = (DeleteFileResponse) response;
- bytesAvailable = deleteFileResponse.getSpaceAvailable() != null ? deleteFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
-
- DeleteFile deleteFile = (DeleteFile) requestMap.get(correlationId);
- if (deleteFile != null) {
- remoteFiles.remove(deleteFile.getSdlFileName());
- uploadedEphemeralFileNames.remove(deleteFile.getSdlFileName());
- }
- }
- } else {
- final RPCRequest request = requestMap.get(correlationId);
- if (request != null) {
- if (!deletionOperation) {
- if (shouldReUploadFile(((PutFile) request).getSdlFileName(), ((PutFile) request).getFileType())) {
- request.setOnRPCResponseListener(null);
- requestsToResend.add(request);
- } else {
- errors.put(((PutFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
- }
- } else {
- errors.put(((DeleteFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
- }
- }
- }
- }
- };
- internalInterface.sendRPCs(requests, onMultipleRequestListener);
- }
-
- /**
- * Attempts to upload a SdlFile to core
- * @param file SdlFile with file name and one of A) fileData, B) Uri, or C) resourceID set
- * @param listener called when core responds to the attempt to upload the file
- */
- public void uploadFile(@NonNull final SdlFile file, final CompletionListener listener) {
- if (file.isStaticIcon()) {
- DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
- listener.onComplete(true);
- return;
- }
- if (!file.getOverwrite() && hasUploadedFile(file)) {
- DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
- listener.onComplete(true);
- return;
- }
- PutFile putFile = createPutFile(file);
- putFile.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- PutFileResponse putFileResponse = (PutFileResponse) response;
- if (putFileResponse.getSuccess()) {
- bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
- remoteFiles.add(file.getName());
- uploadedEphemeralFileNames.add(file.getName());
- if (listener != null) {
- listener.onComplete(true);
- }
- } else {
- if (shouldReUploadFile(file.getName(), file.getType())) {
- uploadFile(file, listener);
- } else if (listener != null) {
- listener.onComplete(false);
- }
- }
- }
- });
- internalInterface.sendRPC(putFile);
- }
-
- /**
- * Check to see if file can be re-uploaded
- * @param fileName a String that represents an SdlFile's name
- * @param fileType an instances of FileType that represents a type of File
- * @return true or false depending on if file with given type and name can be re-uploaded
- */
- private boolean shouldReUploadFile(String fileName, FileType fileType) {
- if (!failedFileUploadsIndex.containsKey(fileName)) {
- if (FileType.GRAPHIC_JPEG.equals(fileType) ||
- FileType.GRAPHIC_BMP.equals(fileType) ||
- FileType.GRAPHIC_PNG.equals(fileType)) {
- failedFileUploadsIndex.put(fileName, fileManagerConfig.getArtworkRetryCount());
- } else {
- failedFileUploadsIndex.put(fileName, fileManagerConfig.getFileRetryCount());
- }
- }
- Integer fileRetryValue = failedFileUploadsIndex.get(fileName);
- if (fileRetryValue != null && fileRetryValue > 0) {
- failedFileUploadsIndex.put(fileName, fileRetryValue - 1);
- return true;
- }
- return false;
- }
-
- /**
- * Attempts to upload a list of SdlFiles to core
- * @param files list of SdlFiles with file name and one of A) fileData, B) Uri, or C) resourceID set
- * @param listener callback that is called once core responds to all upload requests
- */
- public void uploadFiles(@NonNull List<? extends SdlFile> files, final MultipleFileCompletionListener listener) {
- if (files.isEmpty()) {
- return;
- }
- final List<PutFile> putFileRequests = new ArrayList<>();
- for (SdlFile file : files) {
- if (file.isStaticIcon()) {
- DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
- continue;
- }
- if (!file.getOverwrite() && hasUploadedFile(file)) {
- DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
- continue;
- }
- putFileRequests.add(createPutFile(file));
- }
- // if all files are static icons we complete listener with no errors
- if (putFileRequests.isEmpty()) {
- listener.onComplete(null);
- } else {
- final Map<String, String> errors = new HashMap<>();
- sendMultipleFileOperations(putFileRequests, listener, errors);
- }
- }
-
- /**
- * Attempts to upload a SdlArtwork to core
- * @param file SdlArtwork with file name and one of A) fileData, B) Uri, or C) resourceID set
- * @param listener called when core responds to the attempt to upload the file
- */
- public void uploadArtwork(final SdlArtwork file, final CompletionListener listener){
- uploadFile(file, listener);
- }
-
- /**
- * Attempts to upload a list of SdlArtworks to core
- * @param files list of SdlArtworks with file name and one of A) fileData, B) Uri, or C) resourceID set
- * @param listener callback that is called once core responds to all upload requests
- */
- public void uploadArtworks(List<SdlArtwork> files, final MultipleFileCompletionListener listener){
- uploadFiles(files, listener);
- }
-
- /**
- * Check if an SdlFile has been uploaded to core
- * @param file SdlFile
- * @return boolean that tells whether file has been uploaded to core (true) or not (false)
- */
- public boolean hasUploadedFile(@NonNull SdlFile file){
- if(file.isPersistent() && remoteFiles != null && remoteFiles.contains(file.getName())){
- return true;
- }else if(!file.isPersistent() && remoteFiles != null && remoteFiles.contains(file.getName())
- && uploadedEphemeralFileNames.contains(file.getName())){
- return true;
- }
- return false;
- }
-
- // HELPERS
-
- /**
- * Builds an error string for a given Result and info string
- * @param resultCode Result
- * @param info String returned from OnRPCRequestListener.onError()
- * @return Error string
- */
- static public String buildErrorString(Result resultCode, String info){
- return resultCode.toString() + " : " + info;
- }
-
- /**
- * Helper method to take InputStream and turn it into byte array
- * @param is valid InputStream
- * @return Resulting byte array
- */
- byte[] contentsOfInputStream(InputStream is){
- if(is == null){
- return null;
- }
- try{
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- final int bufferSize = 4096;
- final byte[] buffer = new byte[bufferSize];
- int available;
- while ((available = is.read(buffer)) >= 0) {
- os.write(buffer, 0, available);
- }
- return os.toByteArray();
- } catch (IOException e){
- DebugTool.logError(TAG, "Can't read from InputStream", e);
- return null;
- }
- }
+ final static String TAG = "FileManager";
+ final static int SPACE_AVAILABLE_MAX_VALUE = 2000000000;
+ private List<String> remoteFiles;
+ private final List<String> uploadedEphemeralFileNames;
+ private int bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
+ private final FileManagerConfig fileManagerConfig;
+ private final HashMap<String, Integer> failedFileUploadsIndex;
+
+ /**
+ * Constructor for BaseFileManager
+ *
+ * @param internalInterface ISDL
+ * @param fileManagerConfig FileManagerConfig
+ */
+ BaseFileManager(ISdl internalInterface, FileManagerConfig fileManagerConfig) {
+
+ // setup
+ super(internalInterface);
+ uploadedEphemeralFileNames = new ArrayList<>();
+ this.fileManagerConfig = fileManagerConfig;
+ failedFileUploadsIndex = new HashMap<>();
+ }
+
+ @Override
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public void start(CompletionListener listener) {
+ // prepare manager - don't set state to ready until we have list of files
+ retrieveRemoteFiles();
+ super.start(listener);
+ }
+
+ // GETTERS
+
+ /**
+ * Returns a list of file names currently residing on core
+ *
+ * @return List<String> of remote file names
+ */
+ public List<String> getRemoteFileNames() {
+ if (getState() != BaseSubManager.READY) {
+ // error and don't return list
+ throw new IllegalArgumentException("FileManager is not READY");
+ }
+ // return list (this is synchronous at this point)
+ return remoteFiles;
+ }
+
+ /**
+ * Get the number of bytes still available for files for this app.
+ *
+ * @return int value representing The number of bytes still available
+ */
+ public int getBytesAvailable() {
+ return bytesAvailable;
+ }
+
+ private void retrieveRemoteFiles() {
+ remoteFiles = new ArrayList<>();
+ // hold list in remoteFiles class var
+ ListFiles listFiles = new ListFiles();
+ listFiles.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ ListFilesResponse listFilesResponse = (ListFilesResponse) response;
+ if (listFilesResponse.getSuccess()) {
+ bytesAvailable = listFilesResponse.getSpaceAvailable() != null ? listFilesResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
+ if (listFilesResponse.getFilenames() != null) {
+ remoteFiles.addAll(listFilesResponse.getFilenames());
+ }
+ // on callback set manager to ready state
+ transitionToState(BaseSubManager.READY);
+ } else {
+ // file list could not be received. assume that setting can work and allow SDLManager to start
+ DebugTool.logError(TAG, "File Manager could not list files");
+ bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
+ transitionToState(BaseSubManager.READY);
+ }
+ }
+ });
+ internalInterface.sendRPC(listFiles);
+ }
+
+ // DELETION
+
+ /**
+ * Attempts to delete the desired file from core, calls listener with indication of success/failure
+ *
+ * @param fileName name of file to be deleted
+ * @param listener callback that is called on response from core
+ */
+ public void deleteRemoteFileWithName(@NonNull final String fileName, final CompletionListener listener) {
+ DeleteFile deleteFile = new DeleteFile();
+ deleteFile.setSdlFileName(fileName);
+ deleteFile.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DeleteFileResponse deleteFileResponse = (DeleteFileResponse) response;
+ if (deleteFileResponse.getSuccess()) {
+ bytesAvailable = deleteFileResponse.getSpaceAvailable() != null ? deleteFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
+ remoteFiles.remove(fileName);
+ uploadedEphemeralFileNames.remove(fileName);
+ }
+ if (listener != null) {
+ listener.onComplete(deleteFileResponse.getSuccess());
+ }
+ }
+ });
+ internalInterface.sendRPC(deleteFile);
+ }
+
+ /**
+ * Attempts to delete a list of files from core, calls listener with indication of success/failure
+ *
+ * @param fileNames list of file names to be deleted
+ * @param listener callback that is called once core responds to all deletion requests
+ */
+ public void deleteRemoteFilesWithNames(@NonNull List<String> fileNames, final MultipleFileCompletionListener listener) {
+ if (fileNames.isEmpty()) {
+ return;
+ }
+ final List<DeleteFile> deleteFileRequests = new ArrayList<>();
+ for (String fileName : fileNames) {
+ DeleteFile deleteFile = new DeleteFile();
+ deleteFile.setSdlFileName(fileName);
+ deleteFileRequests.add(deleteFile);
+ }
+ final Map<String, String> errors = new HashMap<>();
+ sendMultipleFileOperations(deleteFileRequests, listener, errors);
+ }
+
+ // UPLOAD FILES / ARTWORK
+
+ /**
+ * Creates and returns a PutFile request that would upload a given SdlFile
+ *
+ * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
+ * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
+ */
+ abstract PutFile createPutFile(@NonNull final SdlFile file);
+
+ /**
+ * Sends list of provided requests (strictly PutFile or DeleteFile) asynchronously through internalInterface,
+ * calls listener on conclusion of sending requests.
+ *
+ * @param requests Non-empty list of PutFile or DeleteFile requests
+ * @param listener MultipleFileCompletionListener that is called upon conclusion of sending requests
+ * @param errors a hashMap that keeps track of RPCRequest that have failed to upload and returns to developer if listener is not null
+ */
+ private void sendMultipleFileOperations(final List<? extends RPCRequest> requests, final MultipleFileCompletionListener listener, final Map<String, String> errors) {
+ final HashMap<Integer, RPCRequest> requestMap = new HashMap<>();
+ final List<RPCRequest> requestsToResend = new ArrayList<>();
+ final boolean deletionOperation;
+ if (requests.get(0) instanceof PutFile) {
+ deletionOperation = false;
+ } else if (requests.get(0) instanceof DeleteFile) {
+ deletionOperation = true;
+ } else {
+ return;
+ }
+
+ OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
+ int fileNum = 0;
+
+ @Override
+ public void addCorrelationId(int correlationId) {
+ super.addCorrelationId(correlationId);
+ requestMap.put(correlationId, requests.get(fileNum++));
+ }
+
+ @Override
+ public void onUpdate(int remainingRequests) {
+ }
+
+ @Override
+ public void onFinished() {
+ if (!deletionOperation) {
+ if (!requestsToResend.isEmpty()) {
+ sendMultipleFileOperations(requestsToResend, listener, errors);
+ } else if (listener != null) {
+ listener.onComplete(errors.isEmpty() ? null : errors);
+ }
+ } else {
+ if (listener != null) {
+ listener.onComplete(errors.isEmpty() ? null : errors);
+ }
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ if (response instanceof PutFileResponse) {
+ PutFileResponse putFileResponse = (PutFileResponse) response;
+ bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
+ PutFile putFile = ((PutFile) requestMap.get(correlationId));
+ if (putFile != null) {
+ remoteFiles.add(putFile.getSdlFileName());
+ uploadedEphemeralFileNames.add(putFile.getSdlFileName());
+ }
+
+ } else if (response instanceof DeleteFileResponse) {
+ DeleteFileResponse deleteFileResponse = (DeleteFileResponse) response;
+ bytesAvailable = deleteFileResponse.getSpaceAvailable() != null ? deleteFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
+ DeleteFile deleteFile = (DeleteFile) requestMap.get(correlationId);
+ if (deleteFile != null) {
+ remoteFiles.remove(deleteFile.getSdlFileName());
+ uploadedEphemeralFileNames.remove(deleteFile.getSdlFileName());
+ }
+ }
+ } else {
+ final RPCRequest request = requestMap.get(correlationId);
+ if (request != null) {
+ if (!deletionOperation) {
+ if (shouldReUploadFile(((PutFile) request).getSdlFileName(), ((PutFile) request).getFileType())) {
+ request.setOnRPCResponseListener(null);
+ requestsToResend.add(request);
+ } else {
+ errors.put(((PutFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
+ }
+ } else {
+ errors.put(((DeleteFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
+ }
+ }
+ }
+ }
+ };
+ internalInterface.sendRPCs(requests, onMultipleRequestListener);
+ }
+
+ /**
+ * Attempts to upload a SdlFile to core
+ *
+ * @param file SdlFile with file name and one of A) fileData, B) Uri, or C) resourceID set
+ * @param listener called when core responds to the attempt to upload the file
+ */
+ public void uploadFile(@NonNull final SdlFile file, final CompletionListener listener) {
+ if (file.isStaticIcon()) {
+ DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ listener.onComplete(true);
+ return;
+ }
+ if (!file.getOverwrite() && hasUploadedFile(file)) {
+ DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
+ listener.onComplete(true);
+ return;
+ }
+ PutFile putFile = createPutFile(file);
+ putFile.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ PutFileResponse putFileResponse = (PutFileResponse) response;
+ if (putFileResponse.getSuccess()) {
+ bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+ remoteFiles.add(file.getName());
+ uploadedEphemeralFileNames.add(file.getName());
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ } else {
+ if (shouldReUploadFile(file.getName(), file.getType())) {
+ uploadFile(file, listener);
+ } else if (listener != null) {
+ listener.onComplete(false);
+ }
+ }
+ }
+ });
+ internalInterface.sendRPC(putFile);
+ }
+
+ /**
+ * Check to see if file can be re-uploaded
+ *
+ * @param fileName a String that represents an SdlFile's name
+ * @param fileType an instances of FileType that represents a type of File
+ * @return true or false depending on if file with given type and name can be re-uploaded
+ */
+ private boolean shouldReUploadFile(String fileName, FileType fileType) {
+ if (!failedFileUploadsIndex.containsKey(fileName)) {
+ if (FileType.GRAPHIC_JPEG.equals(fileType) ||
+ FileType.GRAPHIC_BMP.equals(fileType) ||
+ FileType.GRAPHIC_PNG.equals(fileType)) {
+ failedFileUploadsIndex.put(fileName, fileManagerConfig.getArtworkRetryCount());
+ } else {
+ failedFileUploadsIndex.put(fileName, fileManagerConfig.getFileRetryCount());
+ }
+ }
+ Integer fileRetryValue = failedFileUploadsIndex.get(fileName);
+ if (fileRetryValue != null && fileRetryValue > 0) {
+ failedFileUploadsIndex.put(fileName, fileRetryValue - 1);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Attempts to upload a list of SdlFiles to core
+ *
+ * @param files list of SdlFiles with file name and one of A) fileData, B) Uri, or C) resourceID set
+ * @param listener callback that is called once core responds to all upload requests
+ */
+ public void uploadFiles(@NonNull List<? extends SdlFile> files, final MultipleFileCompletionListener listener) {
+ if (files.isEmpty()) {
+ return;
+ }
+ final List<PutFile> putFileRequests = new ArrayList<>();
+ for (SdlFile file : files) {
+ if (file.isStaticIcon()) {
+ DebugTool.logWarning(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ continue;
+ }
+ if (!file.getOverwrite() && hasUploadedFile(file)) {
+ DebugTool.logWarning(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
+ continue;
+ }
+ putFileRequests.add(createPutFile(file));
+ }
+ // if all files are static icons we complete listener with no errors
+ if (putFileRequests.isEmpty()) {
+ listener.onComplete(null);
+ } else {
+ final Map<String, String> errors = new HashMap<>();
+ sendMultipleFileOperations(putFileRequests, listener, errors);
+ }
+ }
+
+ /**
+ * Attempts to upload a SdlArtwork to core
+ *
+ * @param file SdlArtwork with file name and one of A) fileData, B) Uri, or C) resourceID set
+ * @param listener called when core responds to the attempt to upload the file
+ */
+ public void uploadArtwork(final SdlArtwork file, final CompletionListener listener) {
+ uploadFile(file, listener);
+ }
+
+ /**
+ * Attempts to upload a list of SdlArtworks to core
+ *
+ * @param files list of SdlArtworks with file name and one of A) fileData, B) Uri, or C) resourceID set
+ * @param listener callback that is called once core responds to all upload requests
+ */
+ public void uploadArtworks(List<SdlArtwork> files, final MultipleFileCompletionListener listener) {
+ uploadFiles(files, listener);
+ }
+
+ /**
+ * Check if an SdlFile has been uploaded to core
+ *
+ * @param file SdlFile
+ * @return boolean that tells whether file has been uploaded to core (true) or not (false)
+ */
+ public boolean hasUploadedFile(@NonNull SdlFile file) {
+ if (file.isPersistent() && remoteFiles != null && remoteFiles.contains(file.getName())) {
+ return true;
+ } else if (!file.isPersistent() && remoteFiles != null && remoteFiles.contains(file.getName())
+ && uploadedEphemeralFileNames.contains(file.getName())) {
+ return true;
+ }
+ return false;
+ }
+
+ // HELPERS
+
+ /**
+ * Builds an error string for a given Result and info string
+ *
+ * @param resultCode Result
+ * @param info String returned from OnRPCRequestListener.onError()
+ * @return Error string
+ */
+ static public String buildErrorString(Result resultCode, String info) {
+ return resultCode.toString() + " : " + info;
+ }
+
+ /**
+ * Helper method to take InputStream and turn it into byte array
+ *
+ * @param is valid InputStream
+ * @return Resulting byte array
+ */
+ byte[] contentsOfInputStream(InputStream is) {
+ if (is == null) {
+ return null;
+ }
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ final int bufferSize = 4096;
+ final byte[] buffer = new byte[bufferSize];
+ int available;
+ while ((available = is.read(buffer)) >= 0) {
+ os.write(buffer, 0, available);
+ }
+ return os.toByteArray();
+ } catch (IOException e) {
+ DebugTool.logError(TAG, "Can't read from InputStream", e);
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/file/FileManagerConfig.java b/base/src/main/java/com/smartdevicelink/managers/file/FileManagerConfig.java
index 7ff6207d6..7c2c9abfd 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/FileManagerConfig.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/FileManagerConfig.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.managers.file;
/**
* <strong>FileManagerConfig</strong> <br>
- *
+ * <p>
* This is set during SdlManager instantiation. <br>
*
* <li> artworkRetryCount - # of attempts allowed for SdlArtwork to be re-uploaded if they fail </li>
diff --git a/base/src/main/java/com/smartdevicelink/managers/file/MultipleFileCompletionListener.java b/base/src/main/java/com/smartdevicelink/managers/file/MultipleFileCompletionListener.java
index 588160f01..749f642a8 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/MultipleFileCompletionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/MultipleFileCompletionListener.java
@@ -35,11 +35,11 @@ import java.util.Map;
public interface MultipleFileCompletionListener {
- /**
- * @param errors - a dictionary (map) property, of type <String: String>, and contains information
- * on all failed uploads. The key is the name of the file that did not upload properly,
- * the value is an error String describing what went wrong on that particular upload attempt.
- * If all files are uploaded successfully, errors is null
- */
- void onComplete(Map<String, String> errors);
+ /**
+ * @param errors - a dictionary (map) property, of type <String: String>, and contains information
+ * on all failed uploads. The key is the name of the file that did not upload properly,
+ * the value is an error String describing what went wrong on that particular upload attempt.
+ * If all files are uploaded successfully, errors is null
+ */
+ void onComplete(Map<String, String> errors);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
index 2e005ef68..ff24763f2 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
@@ -34,18 +34,18 @@ package com.smartdevicelink.managers.lifecycle;
import androidx.annotation.NonNull;
-import com.smartdevicelink.session.SdlSession;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCNotification;
-import com.smartdevicelink.managers.ISdl;
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.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.util.DebugTool;
import java.util.HashSet;
@@ -100,7 +100,7 @@ abstract class BaseEncryptionLifecycleManager {
securedServiceListener = new ISdlServiceListener() {
@Override
public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
- if(SessionType.RPC.equals(type)){
+ if (SessionType.RPC.equals(type)) {
rpcSecuredServiceStarted = isEncrypted;
}
if (serviceEncryptionListener != null) {
@@ -160,7 +160,7 @@ abstract class BaseEncryptionLifecycleManager {
* Checks the current state and make the call back to initiate secured service flow
*/
private void checkStatusAndInitSecuredService() {
- if ((currentHMILevel != null && currentHMILevel != HMILevel.HMI_NONE) && getRequiresEncryption() && !isEncryptionReady() ) {
+ if ((currentHMILevel != null && currentHMILevel != HMILevel.HMI_NONE) && getRequiresEncryption() && !isEncryptionReady()) {
internalInterface.startRPCEncryption();
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index 03158c73c..4df572f47 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -36,13 +36,12 @@ import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import com.livio.taskmaster.Taskmaster;
-import com.smartdevicelink.session.ISdlSessionListener;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.MessageType;
@@ -51,7 +50,6 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
@@ -82,6 +80,8 @@ 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.session.ISdlSessionListener;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.util.CorrelationIdGenerator;
@@ -156,7 +156,7 @@ abstract class BaseLifecycleManager {
}
public synchronized void stop() {
- if(session != null) {
+ if (session != null) {
session.close();
session = null;
}
@@ -733,7 +733,7 @@ abstract class BaseLifecycleManager {
final ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
if (session != null) {
- pm.setSessionID((byte)session.getSessionId());
+ pm.setSessionID((byte) session.getSessionId());
}
pm.setMessageType(MessageType.RPC);
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
index a6fe2d18b..cfb2176df 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
@@ -74,497 +74,510 @@ import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
abstract class BaseSystemCapabilityManager {
- private static final String TAG = "SystemCapabilityManager";
- private final HashMap<SystemCapabilityType, Object> cachedSystemCapabilities;
- private final HashMap<SystemCapabilityType, Boolean> systemCapabilitiesSubscriptionStatus;
- private final HashMap<SystemCapabilityType, CopyOnWriteArrayList<OnSystemCapabilityListener>> onSystemCapabilityListeners;
- private final Object LISTENER_LOCK;
- private final ISdl callback;
- private boolean shouldConvertDeprecatedDisplayCapabilities;
- private HMILevel currentHMILevel;
-
- BaseSystemCapabilityManager(ISdl callback) {
- this.callback = callback;
- this.LISTENER_LOCK = new Object();
- this.onSystemCapabilityListeners = new HashMap<>();
- this.cachedSystemCapabilities = new HashMap<>();
- this.systemCapabilitiesSubscriptionStatus = new HashMap<>();
- this.systemCapabilitiesSubscriptionStatus.put(SystemCapabilityType.DISPLAYS, true);
- this.shouldConvertDeprecatedDisplayCapabilities = true;
- this.currentHMILevel = HMILevel.HMI_NONE;
-
- setupRpcListeners();
- }
-
- private List<DisplayCapability> createDisplayCapabilityList(RegisterAppInterfaceResponse rpc) {
- return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
- }
-
- private List<DisplayCapability> createDisplayCapabilityList(SetDisplayLayoutResponse rpc) {
- return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
- }
-
- private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
- // Based on deprecated Display capabilities we don't know if widgets are supported,
- // The Default MAIN window is the only window we know is supported
- WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
-
- DisplayCapability displayCapability = new DisplayCapability();
- if (display != null) {
- if (display.getDisplayName() != null) {
- displayCapability.setDisplayName(display.getDisplayName());
- } else if (display.getDisplayType() != null) {
- displayCapability.setDisplayName(display.getDisplayType().toString());
- }
- }
- displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
-
- // Create a window capability object for the default MAIN window
- WindowCapability defaultWindowCapability = new WindowCapability();
- defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
- defaultWindowCapability.setButtonCapabilities(button);
- defaultWindowCapability.setSoftButtonCapabilities(softButton);
-
- // return if display capabilities don't exist.
- if (display == null) {
- defaultWindowCapability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
- defaultWindowCapability.setImageFields(ManagerUtility.WindowCapabilityUtility.getAllImageFields());
- displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
- return Collections.singletonList(displayCapability);
- }
-
- // copy all available display capabilities
- defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
- defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
- defaultWindowCapability.setTextFields(display.getTextFields());
- defaultWindowCapability.setImageFields(display.getImageFields());
- ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
- imageTypeSupported.add(ImageType.STATIC); // static images expected to always work on any head unit
- if (display.getGraphicSupported()) {
- imageTypeSupported.add(ImageType.DYNAMIC);
- }
- defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
-
- displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
- return Collections.singletonList(displayCapability);
- }
-
- private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
- DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
- convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
- convertedCapabilities.setDisplayName(displayName);
- convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
- convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
- convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
- convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
- convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but allows empty array
- // if there are imageTypes in the response, we must assume graphics are supported
- convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported() != null && defaultMainWindow.getImageTypeSupported().size() > 0);
-
- return convertedCapabilities;
- }
-
- private void updateDeprecatedDisplayCapabilities() {
- WindowCapability defaultMainWindowCapabilities = getDefaultMainWindowCapability();
- List<DisplayCapability> displayCapabilityList = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
-
- if (defaultMainWindowCapabilities == null || displayCapabilityList == null || displayCapabilityList.size() == 0) {
- return;
- }
-
- // cover the deprecated capabilities for backward compatibility
- setCapability(SystemCapabilityType.DISPLAY, createDeprecatedDisplayCapabilities(displayCapabilityList.get(0).getDisplayName(), defaultMainWindowCapabilities));
- setCapability(SystemCapabilityType.BUTTON, defaultMainWindowCapabilities.getButtonCapabilities());
- setCapability(SystemCapabilityType.SOFTBUTTON, defaultMainWindowCapabilities.getSoftButtonCapabilities());
- }
-
- private void updateCachedDisplayCapabilityList(List<DisplayCapability> newCapabilities) {
- if (newCapabilities == null || newCapabilities.size() == 0) {
- DebugTool.logWarning(TAG, "Received invalid display capability list");
- return;
- }
-
- List<DisplayCapability> oldCapabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
-
- if (oldCapabilities == null || oldCapabilities.size() == 0) {
- setCapability(SystemCapabilityType.DISPLAYS, newCapabilities);
- updateDeprecatedDisplayCapabilities();
- return;
- }
-
- DisplayCapability oldDefaultDisplayCapabilities = oldCapabilities.get(0);
- ArrayList<WindowCapability> copyWindowCapabilities = new ArrayList<>(oldDefaultDisplayCapabilities.getWindowCapabilities());
-
- DisplayCapability newDefaultDisplayCapabilities = newCapabilities.get(0);
- List<WindowCapability> newWindowCapabilities = newDefaultDisplayCapabilities.getWindowCapabilities();
-
- if (newWindowCapabilities != null && !newWindowCapabilities.isEmpty()) {
- for (WindowCapability newWindow : newWindowCapabilities) {
- ListIterator<WindowCapability> iterator = copyWindowCapabilities.listIterator();
- boolean oldFound = false;
- while (iterator.hasNext()) {
- WindowCapability oldWindow = iterator.next();
- int newWindowID = newWindow.getWindowID() != null ? newWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- int oldWindowID = oldWindow.getWindowID() != null ? oldWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- if (newWindowID == oldWindowID) {
- iterator.set(newWindow); // replace the old window caps with new ones
- oldFound = true;
- break;
- }
- }
-
- if (!oldFound) {
- copyWindowCapabilities.add(newWindow); // this is a new unknown window
- }
- }
- }
-
- // replace the window capabilities array with the merged one.
- newDefaultDisplayCapabilities.setWindowCapabilities(copyWindowCapabilities);
- setCapability(SystemCapabilityType.DISPLAYS, Collections.singletonList(newDefaultDisplayCapabilities));
- updateDeprecatedDisplayCapabilities();
- }
-
-
- public WindowCapability getWindowCapability(int windowID) {
- List<DisplayCapability> capabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
- if (capabilities == null || capabilities.size() == 0) {
- return null;
- }
- DisplayCapability display = capabilities.get(0);
- for (WindowCapability windowCapability : display.getWindowCapabilities()) {
- int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- if (currentWindowID == windowID) {
- return windowCapability;
- }
- }
- return null;
- }
-
- public WindowCapability getDefaultMainWindowCapability() {
- return getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue());
- }
-
- void parseRAIResponse(RegisterAppInterfaceResponse response) {
- if (response != null && response.getSuccess()) {
- this.shouldConvertDeprecatedDisplayCapabilities = true; // reset the flag
- setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
- setCapability(SystemCapabilityType.HMI, response.getHmiCapabilities());
- setCapability(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
- setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, response.getAudioPassThruCapabilities());
- setCapability(SystemCapabilityType.PCM_STREAMING, response.getPcmStreamingCapabilities());
- setCapability(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
- setCapability(SystemCapabilityType.HMI_ZONE, response.getHmiZoneCapabilities());
- setCapability(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
- setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
- setCapability(SystemCapabilityType.SPEECH, response.getSpeechCapabilities());
- setCapability(SystemCapabilityType.VOICE_RECOGNITION, response.getVrCapabilities());
- setCapability(SystemCapabilityType.PRERECORDED_SPEECH, response.getPrerecordedSpeech());
- }
- }
-
- private void setupRpcListeners() {
- OnRPCListener rpcListener = new OnRPCListener() {
- @Override
- public void onReceived(RPCMessage message) {
- if (message != null) {
- if (RPCMessage.KEY_RESPONSE.equals(message.getMessageType())) {
- switch (message.getFunctionID()) {
- case SET_DISPLAY_LAYOUT:
- SetDisplayLayoutResponse response = (SetDisplayLayoutResponse) message;
- // If a setDisplayLayout fails, Capabilities did not change
- if (!response.getSuccess()) {
- return;
- }
- setCapability(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
- setCapability(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
- setCapability(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
- setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
- if (shouldConvertDeprecatedDisplayCapabilities) {
- setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
- }
- break;
- case GET_SYSTEM_CAPABILITY:
- GetSystemCapabilityResponse systemCapabilityResponse = (GetSystemCapabilityResponse) message;
- SystemCapability systemCapability = systemCapabilityResponse.getSystemCapability();
- if (systemCapabilityResponse.getSuccess() && SystemCapabilityType.DISPLAYS.equals(systemCapability.getSystemCapabilityType())) {
- shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
- List<DisplayCapability> newCapabilities = (List<DisplayCapability>) systemCapability.getCapabilityForType(SystemCapabilityType.DISPLAYS);
- updateCachedDisplayCapabilityList(newCapabilities);
- }
- break;
- }
- } else if (RPCMessage.KEY_NOTIFICATION.equals(message.getMessageType())) {
- switch (message.getFunctionID()) {
- case ON_HMI_STATUS:
- OnHMIStatus onHMIStatus = (OnHMIStatus) message;
- if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- return;
- }
- currentHMILevel = onHMIStatus.getHmiLevel();
- break;
- case ON_SYSTEM_CAPABILITY_UPDATED:
- OnSystemCapabilityUpdated onSystemCapabilityUpdated = (OnSystemCapabilityUpdated) message;
- if (onSystemCapabilityUpdated.getSystemCapability() != null) {
- SystemCapability systemCapability = onSystemCapabilityUpdated.getSystemCapability();
- SystemCapabilityType systemCapabilityType = systemCapability.getSystemCapabilityType();
- Object capability = systemCapability.getCapabilityForType(systemCapabilityType);
- if (cachedSystemCapabilities.containsKey(systemCapabilityType)) { //The capability already exists
- switch (systemCapabilityType) {
- case APP_SERVICES:
- // App services only updates what was changed so we need
- // to update the capability rather than override it
- AppServicesCapabilities appServicesCapabilities = (AppServicesCapabilities) capability;
- if (capability != null) {
- List<AppServiceCapability> appServicesCapabilitiesList = appServicesCapabilities.getAppServices();
- AppServicesCapabilities cachedAppServicesCapabilities = (AppServicesCapabilities) cachedSystemCapabilities.get(systemCapabilityType);
- //Update the cached app services
- if (cachedAppServicesCapabilities != null) {
- cachedAppServicesCapabilities.updateAppServices(appServicesCapabilitiesList);
- }
- //Set the new capability object to the updated cached capabilities
- capability = cachedAppServicesCapabilities;
- }
- break;
- case DISPLAYS:
- shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
- // this notification can return only affected windows (hence not all windows)
- List<DisplayCapability> newCapabilities = (List<DisplayCapability>) capability;
- updateCachedDisplayCapabilityList(newCapabilities);
- }
- }
- if (capability != null) {
- setCapability(systemCapabilityType, capability);
- }
- }
- }
- }
- }
- }
- };
-
- if (callback != null) {
- callback.addOnRPCListener(FunctionID.GET_SYSTEM_CAPABILITY, rpcListener);
- callback.addOnRPCListener(FunctionID.SET_DISPLAY_LAYOUT, rpcListener);
- callback.addOnRPCListener(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED, rpcListener);
- callback.addOnRPCListener(FunctionID.ON_HMI_STATUS, rpcListener);
- }
- }
-
- /**
- * Sets a capability in the cached map. This should only be done when an RPC is received and contains updates to the capability
- * that is being cached in the SystemCapabilityManager.
- * @param systemCapabilityType the system capability type that will be set
- * @param capability the value of the capability that will be set
- */
- synchronized void setCapability(SystemCapabilityType systemCapabilityType, Object capability) {
- cachedSystemCapabilities.put(systemCapabilityType, capability);
- notifyListeners(systemCapabilityType, capability);
- }
-
- /**
- * Notifies listeners in the list about the new retrieved capability
- * @param systemCapabilityType the system capability type that was retrieved
- * @param capability the system capability value that was retrieved
- */
- private void notifyListeners(SystemCapabilityType systemCapabilityType, Object capability) {
- synchronized(LISTENER_LOCK) {
- CopyOnWriteArrayList<OnSystemCapabilityListener> listeners = onSystemCapabilityListeners.get(systemCapabilityType);
- if (listeners != null && listeners.size() > 0) {
- for (OnSystemCapabilityListener listener : listeners) {
- listener.onCapabilityRetrieved(capability);
- }
- }
- }
- }
-
- /**
- * Ability to see if the connected module supports the given capability. Useful to check before
- * attempting to query for capabilities that require asynchronous calls to initialize.
- * @param type the SystemCapabilityType that is to be checked
- * @return if that capability is supported with the current, connected module
- */
- public boolean isCapabilitySupported(SystemCapabilityType type) {
- if (cachedSystemCapabilities.get(type) != null) {
- //The capability exists in the map and is not null
- return true;
- } else if (cachedSystemCapabilities.containsKey(SystemCapabilityType.HMI)) {
- HMICapabilities hmiCapabilities = ((HMICapabilities) cachedSystemCapabilities.get(SystemCapabilityType.HMI));
- Version rpcVersion = null;
- if (callback != null) {
- SdlMsgVersion version = callback.getSdlMsgVersion();
- if (version != null) {
- rpcVersion = new Version(version.getMajorVersion(), version.getMinorVersion(), version.getPatchVersion());
- }
- }
- if (hmiCapabilities != null) {
- switch (type) {
- case NAVIGATION:
- return hmiCapabilities.isNavigationAvailable();
- case PHONE_CALL:
- return hmiCapabilities.isPhoneCallAvailable();
- case VIDEO_STREAMING:
- if (rpcVersion != null) {
- if (rpcVersion.isBetween(new Version(3, 0, 0), new Version(4, 4, 0)) >= 0) {
- //This was before the system capability feature was added so check if
- // graphics are supported instead
- DisplayCapabilities displayCapabilities = (DisplayCapabilities) getCapability(SystemCapabilityType.DISPLAY, null, false);
- if (displayCapabilities != null) {
- return displayCapabilities.getGraphicSupported() != null && displayCapabilities.getGraphicSupported();
- }
- }
- }
- return hmiCapabilities.isVideoStreamingAvailable();
- case REMOTE_CONTROL:
- return hmiCapabilities.isRemoteControlAvailable();
- case APP_SERVICES:
- if (rpcVersion != null) {
- if (rpcVersion.getMajor() == 5 && rpcVersion.getMinor() == 1) {
- //This is a corner case that the param was not available in 5.1.0, but
- //the app services feature was available.
- return true;
- }
- }
- return hmiCapabilities.isAppServicesAvailable();
- case DISPLAYS:
- return hmiCapabilities.isDisplaysCapabilityAvailable();
- case SEAT_LOCATION:
- return hmiCapabilities.isSeatLocationAvailable();
- case DRIVER_DISTRACTION:
- return hmiCapabilities.isDriverDistractionAvailable();
- default:
- return false;
- }
- }
- }
- return false;
- }
-
- /**
- * Checks is subscriptions are available on the connected head unit.
- * @return True if subscriptions are supported. False if not.
- */
- public boolean supportsSubscriptions() {
- if (callback != null && callback.getSdlMsgVersion() != null) {
- Version onSystemCapabilityNotificationRPCVersion = new Version(5, 1, 0);
- Version headUnitRPCVersion = new Version(callback.getSdlMsgVersion());
- return headUnitRPCVersion.isNewerThan(onSystemCapabilityNotificationRPCVersion) >= 0;
- }
- return false;
- }
-
- /**
- * Checks if the supplied capability type is currently subscribed for or not
- * @param systemCapabilityType type of capability desired
- * @return true if subscribed and false if not
- */
- private boolean isSubscribedToSystemCapability(SystemCapabilityType systemCapabilityType) {
- return Boolean.TRUE.equals(systemCapabilitiesSubscriptionStatus.get(systemCapabilityType));
- }
-
- /** Gets the capability object that corresponds to the supplied capability type by returning the currently cached value immediately (or null) as well as calling the listener immediately with the cached value, if available. If not available, the listener will retrieve a new value and return that when the head unit responds.
- * <strong>If capability is not cached, the method will return null and trigger the supplied listener when the capability becomes available</strong>
- * @param systemCapabilityType type of capability desired
- * @param scListener callback to execute upon retrieving capability
- * @param subscribe flag to subscribe to updates of the supplied capability type. True means subscribe; false means cancel subscription; null means don't change current subscription status.
- * @param forceUpdate flag to force getting a new fresh copy of the capability from the head unit even if it is cached
- * @return desired capability if it is cached in the manager, otherwise returns a null object and works in the background to retrieve the capability for the next call
- */
- private Object getCapabilityPrivate(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final Boolean subscribe, final boolean forceUpdate) {
- Object cachedCapability = cachedSystemCapabilities.get(systemCapabilityType);
-
- // No need to force update if the app is subscribed to that type because updated values will be received via notifications anyway
- boolean shouldForceUpdate = forceUpdate && !isSubscribedToSystemCapability(systemCapabilityType);
- boolean shouldUpdateSystemCapabilitySubscription = (subscribe != null) && (subscribe != isSubscribedToSystemCapability(systemCapabilityType)) && supportsSubscriptions();
- boolean shouldSendGetCapabilityRequest = shouldForceUpdate || (cachedCapability == null) || shouldUpdateSystemCapabilitySubscription;
- boolean shouldCallListenerWithCachedValue = (cachedCapability != null) && (scListener != null) && !shouldSendGetCapabilityRequest;
-
- if (shouldCallListenerWithCachedValue) {
- scListener.onCapabilityRetrieved(cachedCapability);
- }
-
- if (shouldSendGetCapabilityRequest) {
- retrieveCapability(systemCapabilityType, scListener, subscribe);
- }
-
- return cachedCapability;
- }
-
- /** Gets the capability object that corresponds to the supplied capability type by returning the currently cached value immediately (or null) as well as calling the listener immediately with the cached value, if available. If not available, the listener will retrieve a new value and return that when the head unit responds.
- * <strong>If capability is not cached, the method will return null and trigger the supplied listener when the capability becomes available</strong>
- * @param systemCapabilityType type of capability desired
- * @param scListener callback to execute upon retrieving capability
- * @param forceUpdate flag to force getting a new fresh copy of the capability from the head unit even if it is cached
- * @return desired capability if it is cached in the manager, otherwise returns a null object
- */
- public Object getCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final boolean forceUpdate) {
- return getCapabilityPrivate(systemCapabilityType, scListener, null, forceUpdate);
- }
-
- /**
- * Adds a listener to be called whenever a new capability is retrieved. This method automatically subscribes to the supplied capability type and may call the listener multiple times if there are future updates, unlike getCapability() methods, which only call the listener one time.
- * @param systemCapabilityType Type of capability desired
- * @param listener callback to execute upon retrieving capability
- */
- public void addOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener) {
- synchronized(LISTENER_LOCK) {
- if (systemCapabilityType != null && listener != null) {
- if (onSystemCapabilityListeners.get(systemCapabilityType) == null) {
- onSystemCapabilityListeners.put(systemCapabilityType, new CopyOnWriteArrayList<OnSystemCapabilityListener>());
- }
- onSystemCapabilityListeners.get(systemCapabilityType).add(listener);
- }
- }
- getCapabilityPrivate(systemCapabilityType, listener, true, false);
- }
-
- /**
- * Removes an OnSystemCapabilityListener that was previously added
- * @param systemCapabilityType Type of capability
- * @param listener the listener that should be removed
- * @return boolean that represents whether the removal was successful or not
- */
- public boolean removeOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener) {
- boolean success = false;
- synchronized(LISTENER_LOCK) {
- if (onSystemCapabilityListeners != null
- && systemCapabilityType != null
- && listener != null
- && onSystemCapabilityListeners.get(systemCapabilityType) != null) {
- success = onSystemCapabilityListeners.get(systemCapabilityType).remove(listener);
- // If the last listener for the supplied capability type is removed, unsubscribe from the capability type
- if (success && onSystemCapabilityListeners.get(systemCapabilityType).isEmpty() && isSubscribedToSystemCapability(systemCapabilityType) && systemCapabilityType != SystemCapabilityType.DISPLAYS) {
- retrieveCapability(systemCapabilityType, null, false);
- }
- }
- }
- return success;
- }
-
- /** Sends a GetSystemCapability request for the supplied SystemCapabilityType and call the listener's callback if the systemCapabilityType is queryable
- * @param systemCapabilityType Type of capability desired
- * @param subscribe flag to subscribe to updates of the supplied capability type. True means subscribe; false means cancel subscription; null means don't change current subscription status.
- */
- private void retrieveCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final Boolean subscribe) {
- if (currentHMILevel != null && currentHMILevel.equals(HMILevel.HMI_NONE)) {
- String message = String.format("Attempted to update type: %s in HMI level NONE, which is not allowed. " +
- "Please wait until you are in HMI BACKGROUND, LIMITED, or FULL before attempting to update any SystemCapabilityType", systemCapabilityType);
- DebugTool.logError(TAG, message);
- if (scListener != null) {
- scListener.onError(message);
- }
- return;
- }
- if (!systemCapabilityType.isQueryable() || systemCapabilityType == SystemCapabilityType.DISPLAYS) {
- String message = "This systemCapabilityType cannot be queried for";
- DebugTool.logError(TAG, message);
- if (scListener != null) {
- scListener.onError(message);
- }
- return;
- }
- final GetSystemCapability request = new GetSystemCapability();
- request.setSystemCapabilityType(systemCapabilityType);
+ private static final String TAG = "SystemCapabilityManager";
+ private final HashMap<SystemCapabilityType, Object> cachedSystemCapabilities;
+ private final HashMap<SystemCapabilityType, Boolean> systemCapabilitiesSubscriptionStatus;
+ private final HashMap<SystemCapabilityType, CopyOnWriteArrayList<OnSystemCapabilityListener>> onSystemCapabilityListeners;
+ private final Object LISTENER_LOCK;
+ private final ISdl callback;
+ private boolean shouldConvertDeprecatedDisplayCapabilities;
+ private HMILevel currentHMILevel;
+
+ BaseSystemCapabilityManager(ISdl callback) {
+ this.callback = callback;
+ this.LISTENER_LOCK = new Object();
+ this.onSystemCapabilityListeners = new HashMap<>();
+ this.cachedSystemCapabilities = new HashMap<>();
+ this.systemCapabilitiesSubscriptionStatus = new HashMap<>();
+ this.systemCapabilitiesSubscriptionStatus.put(SystemCapabilityType.DISPLAYS, true);
+ this.shouldConvertDeprecatedDisplayCapabilities = true;
+ this.currentHMILevel = HMILevel.HMI_NONE;
+
+ setupRpcListeners();
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(RegisterAppInterfaceResponse rpc) {
+ return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(SetDisplayLayoutResponse rpc) {
+ return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
+ // Based on deprecated Display capabilities we don't know if widgets are supported,
+ // The Default MAIN window is the only window we know is supported
+ WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
+
+ DisplayCapability displayCapability = new DisplayCapability();
+ if (display != null) {
+ if (display.getDisplayName() != null) {
+ displayCapability.setDisplayName(display.getDisplayName());
+ } else if (display.getDisplayType() != null) {
+ displayCapability.setDisplayName(display.getDisplayType().toString());
+ }
+ }
+ displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
+
+ // Create a window capability object for the default MAIN window
+ WindowCapability defaultWindowCapability = new WindowCapability();
+ defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ defaultWindowCapability.setButtonCapabilities(button);
+ defaultWindowCapability.setSoftButtonCapabilities(softButton);
+
+ // return if display capabilities don't exist.
+ if (display == null) {
+ defaultWindowCapability.setTextFields(ManagerUtility.WindowCapabilityUtility.getAllTextFields());
+ defaultWindowCapability.setImageFields(ManagerUtility.WindowCapabilityUtility.getAllImageFields());
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ // copy all available display capabilities
+ defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
+ defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
+ defaultWindowCapability.setTextFields(display.getTextFields());
+ defaultWindowCapability.setImageFields(display.getImageFields());
+ ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
+ imageTypeSupported.add(ImageType.STATIC); // static images expected to always work on any head unit
+ if (display.getGraphicSupported()) {
+ imageTypeSupported.add(ImageType.DYNAMIC);
+ }
+ defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
+
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
+ DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
+ convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
+ convertedCapabilities.setDisplayName(displayName);
+ convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
+ convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
+ convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
+ convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
+ convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but allows empty array
+ // if there are imageTypes in the response, we must assume graphics are supported
+ convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported() != null && defaultMainWindow.getImageTypeSupported().size() > 0);
+
+ return convertedCapabilities;
+ }
+
+ private void updateDeprecatedDisplayCapabilities() {
+ WindowCapability defaultMainWindowCapabilities = getDefaultMainWindowCapability();
+ List<DisplayCapability> displayCapabilityList = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
+
+ if (defaultMainWindowCapabilities == null || displayCapabilityList == null || displayCapabilityList.size() == 0) {
+ return;
+ }
+
+ // cover the deprecated capabilities for backward compatibility
+ setCapability(SystemCapabilityType.DISPLAY, createDeprecatedDisplayCapabilities(displayCapabilityList.get(0).getDisplayName(), defaultMainWindowCapabilities));
+ setCapability(SystemCapabilityType.BUTTON, defaultMainWindowCapabilities.getButtonCapabilities());
+ setCapability(SystemCapabilityType.SOFTBUTTON, defaultMainWindowCapabilities.getSoftButtonCapabilities());
+ }
+
+ private void updateCachedDisplayCapabilityList(List<DisplayCapability> newCapabilities) {
+ if (newCapabilities == null || newCapabilities.size() == 0) {
+ DebugTool.logWarning(TAG, "Received invalid display capability list");
+ return;
+ }
+
+ List<DisplayCapability> oldCapabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
+
+ if (oldCapabilities == null || oldCapabilities.size() == 0) {
+ setCapability(SystemCapabilityType.DISPLAYS, newCapabilities);
+ updateDeprecatedDisplayCapabilities();
+ return;
+ }
+
+ DisplayCapability oldDefaultDisplayCapabilities = oldCapabilities.get(0);
+ ArrayList<WindowCapability> copyWindowCapabilities = new ArrayList<>(oldDefaultDisplayCapabilities.getWindowCapabilities());
+
+ DisplayCapability newDefaultDisplayCapabilities = newCapabilities.get(0);
+ List<WindowCapability> newWindowCapabilities = newDefaultDisplayCapabilities.getWindowCapabilities();
+
+ if (newWindowCapabilities != null && !newWindowCapabilities.isEmpty()) {
+ for (WindowCapability newWindow : newWindowCapabilities) {
+ ListIterator<WindowCapability> iterator = copyWindowCapabilities.listIterator();
+ boolean oldFound = false;
+ while (iterator.hasNext()) {
+ WindowCapability oldWindow = iterator.next();
+ int newWindowID = newWindow.getWindowID() != null ? newWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ int oldWindowID = oldWindow.getWindowID() != null ? oldWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (newWindowID == oldWindowID) {
+ iterator.set(newWindow); // replace the old window caps with new ones
+ oldFound = true;
+ break;
+ }
+ }
+
+ if (!oldFound) {
+ copyWindowCapabilities.add(newWindow); // this is a new unknown window
+ }
+ }
+ }
+
+ // replace the window capabilities array with the merged one.
+ newDefaultDisplayCapabilities.setWindowCapabilities(copyWindowCapabilities);
+ setCapability(SystemCapabilityType.DISPLAYS, Collections.singletonList(newDefaultDisplayCapabilities));
+ updateDeprecatedDisplayCapabilities();
+ }
+
+
+ public WindowCapability getWindowCapability(int windowID) {
+ List<DisplayCapability> capabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS, null, false), DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ return null;
+ }
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == windowID) {
+ return windowCapability;
+ }
+ }
+ return null;
+ }
+
+ public WindowCapability getDefaultMainWindowCapability() {
+ return getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ }
+
+ void parseRAIResponse(RegisterAppInterfaceResponse response) {
+ if (response != null && response.getSuccess()) {
+ this.shouldConvertDeprecatedDisplayCapabilities = true; // reset the flag
+ setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
+ setCapability(SystemCapabilityType.HMI, response.getHmiCapabilities());
+ setCapability(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
+ setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, response.getAudioPassThruCapabilities());
+ setCapability(SystemCapabilityType.PCM_STREAMING, response.getPcmStreamingCapabilities());
+ setCapability(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
+ setCapability(SystemCapabilityType.HMI_ZONE, response.getHmiZoneCapabilities());
+ setCapability(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
+ setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
+ setCapability(SystemCapabilityType.SPEECH, response.getSpeechCapabilities());
+ setCapability(SystemCapabilityType.VOICE_RECOGNITION, response.getVrCapabilities());
+ setCapability(SystemCapabilityType.PRERECORDED_SPEECH, response.getPrerecordedSpeech());
+ }
+ }
+
+ private void setupRpcListeners() {
+ OnRPCListener rpcListener = new OnRPCListener() {
+ @Override
+ public void onReceived(RPCMessage message) {
+ if (message != null) {
+ if (RPCMessage.KEY_RESPONSE.equals(message.getMessageType())) {
+ switch (message.getFunctionID()) {
+ case SET_DISPLAY_LAYOUT:
+ SetDisplayLayoutResponse response = (SetDisplayLayoutResponse) message;
+ // If a setDisplayLayout fails, Capabilities did not change
+ if (!response.getSuccess()) {
+ return;
+ }
+ setCapability(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
+ setCapability(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
+ setCapability(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
+ setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
+ if (shouldConvertDeprecatedDisplayCapabilities) {
+ setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
+ }
+ break;
+ case GET_SYSTEM_CAPABILITY:
+ GetSystemCapabilityResponse systemCapabilityResponse = (GetSystemCapabilityResponse) message;
+ SystemCapability systemCapability = systemCapabilityResponse.getSystemCapability();
+ if (systemCapabilityResponse.getSuccess() && SystemCapabilityType.DISPLAYS.equals(systemCapability.getSystemCapabilityType())) {
+ shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
+ List<DisplayCapability> newCapabilities = (List<DisplayCapability>) systemCapability.getCapabilityForType(SystemCapabilityType.DISPLAYS);
+ updateCachedDisplayCapabilityList(newCapabilities);
+ }
+ break;
+ }
+ } else if (RPCMessage.KEY_NOTIFICATION.equals(message.getMessageType())) {
+ switch (message.getFunctionID()) {
+ case ON_HMI_STATUS:
+ OnHMIStatus onHMIStatus = (OnHMIStatus) message;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
+ break;
+ case ON_SYSTEM_CAPABILITY_UPDATED:
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = (OnSystemCapabilityUpdated) message;
+ if (onSystemCapabilityUpdated.getSystemCapability() != null) {
+ SystemCapability systemCapability = onSystemCapabilityUpdated.getSystemCapability();
+ SystemCapabilityType systemCapabilityType = systemCapability.getSystemCapabilityType();
+ Object capability = systemCapability.getCapabilityForType(systemCapabilityType);
+ if (cachedSystemCapabilities.containsKey(systemCapabilityType)) { //The capability already exists
+ switch (systemCapabilityType) {
+ case APP_SERVICES:
+ // App services only updates what was changed so we need
+ // to update the capability rather than override it
+ AppServicesCapabilities appServicesCapabilities = (AppServicesCapabilities) capability;
+ if (capability != null) {
+ List<AppServiceCapability> appServicesCapabilitiesList = appServicesCapabilities.getAppServices();
+ AppServicesCapabilities cachedAppServicesCapabilities = (AppServicesCapabilities) cachedSystemCapabilities.get(systemCapabilityType);
+ //Update the cached app services
+ if (cachedAppServicesCapabilities != null) {
+ cachedAppServicesCapabilities.updateAppServices(appServicesCapabilitiesList);
+ }
+ //Set the new capability object to the updated cached capabilities
+ capability = cachedAppServicesCapabilities;
+ }
+ break;
+ case DISPLAYS:
+ shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
+ // this notification can return only affected windows (hence not all windows)
+ List<DisplayCapability> newCapabilities = (List<DisplayCapability>) capability;
+ updateCachedDisplayCapabilityList(newCapabilities);
+ }
+ }
+ if (capability != null) {
+ setCapability(systemCapabilityType, capability);
+ }
+ }
+ }
+ }
+ }
+ }
+ };
+
+ if (callback != null) {
+ callback.addOnRPCListener(FunctionID.GET_SYSTEM_CAPABILITY, rpcListener);
+ callback.addOnRPCListener(FunctionID.SET_DISPLAY_LAYOUT, rpcListener);
+ callback.addOnRPCListener(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED, rpcListener);
+ callback.addOnRPCListener(FunctionID.ON_HMI_STATUS, rpcListener);
+ }
+ }
+
+ /**
+ * Sets a capability in the cached map. This should only be done when an RPC is received and contains updates to the capability
+ * that is being cached in the SystemCapabilityManager.
+ *
+ * @param systemCapabilityType the system capability type that will be set
+ * @param capability the value of the capability that will be set
+ */
+ synchronized void setCapability(SystemCapabilityType systemCapabilityType, Object capability) {
+ cachedSystemCapabilities.put(systemCapabilityType, capability);
+ notifyListeners(systemCapabilityType, capability);
+ }
+
+ /**
+ * Notifies listeners in the list about the new retrieved capability
+ *
+ * @param systemCapabilityType the system capability type that was retrieved
+ * @param capability the system capability value that was retrieved
+ */
+ private void notifyListeners(SystemCapabilityType systemCapabilityType, Object capability) {
+ synchronized (LISTENER_LOCK) {
+ CopyOnWriteArrayList<OnSystemCapabilityListener> listeners = onSystemCapabilityListeners.get(systemCapabilityType);
+ if (listeners != null && listeners.size() > 0) {
+ for (OnSystemCapabilityListener listener : listeners) {
+ listener.onCapabilityRetrieved(capability);
+ }
+ }
+ }
+ }
+
+ /**
+ * Ability to see if the connected module supports the given capability. Useful to check before
+ * attempting to query for capabilities that require asynchronous calls to initialize.
+ *
+ * @param type the SystemCapabilityType that is to be checked
+ * @return if that capability is supported with the current, connected module
+ */
+ public boolean isCapabilitySupported(SystemCapabilityType type) {
+ if (cachedSystemCapabilities.get(type) != null) {
+ //The capability exists in the map and is not null
+ return true;
+ } else if (cachedSystemCapabilities.containsKey(SystemCapabilityType.HMI)) {
+ HMICapabilities hmiCapabilities = ((HMICapabilities) cachedSystemCapabilities.get(SystemCapabilityType.HMI));
+ Version rpcVersion = null;
+ if (callback != null) {
+ SdlMsgVersion version = callback.getSdlMsgVersion();
+ if (version != null) {
+ rpcVersion = new Version(version.getMajorVersion(), version.getMinorVersion(), version.getPatchVersion());
+ }
+ }
+ if (hmiCapabilities != null) {
+ switch (type) {
+ case NAVIGATION:
+ return hmiCapabilities.isNavigationAvailable();
+ case PHONE_CALL:
+ return hmiCapabilities.isPhoneCallAvailable();
+ case VIDEO_STREAMING:
+ if (rpcVersion != null) {
+ if (rpcVersion.isBetween(new Version(3, 0, 0), new Version(4, 4, 0)) >= 0) {
+ //This was before the system capability feature was added so check if
+ // graphics are supported instead
+ DisplayCapabilities displayCapabilities = (DisplayCapabilities) getCapability(SystemCapabilityType.DISPLAY, null, false);
+ if (displayCapabilities != null) {
+ return displayCapabilities.getGraphicSupported() != null && displayCapabilities.getGraphicSupported();
+ }
+ }
+ }
+ return hmiCapabilities.isVideoStreamingAvailable();
+ case REMOTE_CONTROL:
+ return hmiCapabilities.isRemoteControlAvailable();
+ case APP_SERVICES:
+ if (rpcVersion != null) {
+ if (rpcVersion.getMajor() == 5 && rpcVersion.getMinor() == 1) {
+ //This is a corner case that the param was not available in 5.1.0, but
+ //the app services feature was available.
+ return true;
+ }
+ }
+ return hmiCapabilities.isAppServicesAvailable();
+ case DISPLAYS:
+ return hmiCapabilities.isDisplaysCapabilityAvailable();
+ case SEAT_LOCATION:
+ return hmiCapabilities.isSeatLocationAvailable();
+ case DRIVER_DISTRACTION:
+ return hmiCapabilities.isDriverDistractionAvailable();
+ default:
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Checks is subscriptions are available on the connected head unit.
+ *
+ * @return True if subscriptions are supported. False if not.
+ */
+ public boolean supportsSubscriptions() {
+ if (callback != null && callback.getSdlMsgVersion() != null) {
+ Version onSystemCapabilityNotificationRPCVersion = new Version(5, 1, 0);
+ Version headUnitRPCVersion = new Version(callback.getSdlMsgVersion());
+ return headUnitRPCVersion.isNewerThan(onSystemCapabilityNotificationRPCVersion) >= 0;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the supplied capability type is currently subscribed for or not
+ *
+ * @param systemCapabilityType type of capability desired
+ * @return true if subscribed and false if not
+ */
+ private boolean isSubscribedToSystemCapability(SystemCapabilityType systemCapabilityType) {
+ return Boolean.TRUE.equals(systemCapabilitiesSubscriptionStatus.get(systemCapabilityType));
+ }
+
+ /**
+ * Gets the capability object that corresponds to the supplied capability type by returning the currently cached value immediately (or null) as well as calling the listener immediately with the cached value, if available. If not available, the listener will retrieve a new value and return that when the head unit responds.
+ * <strong>If capability is not cached, the method will return null and trigger the supplied listener when the capability becomes available</strong>
+ *
+ * @param systemCapabilityType type of capability desired
+ * @param scListener callback to execute upon retrieving capability
+ * @param subscribe flag to subscribe to updates of the supplied capability type. True means subscribe; false means cancel subscription; null means don't change current subscription status.
+ * @param forceUpdate flag to force getting a new fresh copy of the capability from the head unit even if it is cached
+ * @return desired capability if it is cached in the manager, otherwise returns a null object and works in the background to retrieve the capability for the next call
+ */
+ private Object getCapabilityPrivate(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final Boolean subscribe, final boolean forceUpdate) {
+ Object cachedCapability = cachedSystemCapabilities.get(systemCapabilityType);
+
+ // No need to force update if the app is subscribed to that type because updated values will be received via notifications anyway
+ boolean shouldForceUpdate = forceUpdate && !isSubscribedToSystemCapability(systemCapabilityType);
+ boolean shouldUpdateSystemCapabilitySubscription = (subscribe != null) && (subscribe != isSubscribedToSystemCapability(systemCapabilityType)) && supportsSubscriptions();
+ boolean shouldSendGetCapabilityRequest = shouldForceUpdate || (cachedCapability == null) || shouldUpdateSystemCapabilitySubscription;
+ boolean shouldCallListenerWithCachedValue = (cachedCapability != null) && (scListener != null) && !shouldSendGetCapabilityRequest;
+
+ if (shouldCallListenerWithCachedValue) {
+ scListener.onCapabilityRetrieved(cachedCapability);
+ }
+
+ if (shouldSendGetCapabilityRequest) {
+ retrieveCapability(systemCapabilityType, scListener, subscribe);
+ }
+
+ return cachedCapability;
+ }
+
+ /**
+ * Gets the capability object that corresponds to the supplied capability type by returning the currently cached value immediately (or null) as well as calling the listener immediately with the cached value, if available. If not available, the listener will retrieve a new value and return that when the head unit responds.
+ * <strong>If capability is not cached, the method will return null and trigger the supplied listener when the capability becomes available</strong>
+ *
+ * @param systemCapabilityType type of capability desired
+ * @param scListener callback to execute upon retrieving capability
+ * @param forceUpdate flag to force getting a new fresh copy of the capability from the head unit even if it is cached
+ * @return desired capability if it is cached in the manager, otherwise returns a null object
+ */
+ public Object getCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final boolean forceUpdate) {
+ return getCapabilityPrivate(systemCapabilityType, scListener, null, forceUpdate);
+ }
+
+ /**
+ * Adds a listener to be called whenever a new capability is retrieved. This method automatically subscribes to the supplied capability type and may call the listener multiple times if there are future updates, unlike getCapability() methods, which only call the listener one time.
+ *
+ * @param systemCapabilityType Type of capability desired
+ * @param listener callback to execute upon retrieving capability
+ */
+ public void addOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener) {
+ synchronized (LISTENER_LOCK) {
+ if (systemCapabilityType != null && listener != null) {
+ if (onSystemCapabilityListeners.get(systemCapabilityType) == null) {
+ onSystemCapabilityListeners.put(systemCapabilityType, new CopyOnWriteArrayList<OnSystemCapabilityListener>());
+ }
+ onSystemCapabilityListeners.get(systemCapabilityType).add(listener);
+ }
+ }
+ getCapabilityPrivate(systemCapabilityType, listener, true, false);
+ }
+
+ /**
+ * Removes an OnSystemCapabilityListener that was previously added
+ *
+ * @param systemCapabilityType Type of capability
+ * @param listener the listener that should be removed
+ * @return boolean that represents whether the removal was successful or not
+ */
+ public boolean removeOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener) {
+ boolean success = false;
+ synchronized (LISTENER_LOCK) {
+ if (onSystemCapabilityListeners != null
+ && systemCapabilityType != null
+ && listener != null
+ && onSystemCapabilityListeners.get(systemCapabilityType) != null) {
+ success = onSystemCapabilityListeners.get(systemCapabilityType).remove(listener);
+ // If the last listener for the supplied capability type is removed, unsubscribe from the capability type
+ if (success && onSystemCapabilityListeners.get(systemCapabilityType).isEmpty() && isSubscribedToSystemCapability(systemCapabilityType) && systemCapabilityType != SystemCapabilityType.DISPLAYS) {
+ retrieveCapability(systemCapabilityType, null, false);
+ }
+ }
+ }
+ return success;
+ }
+
+ /**
+ * Sends a GetSystemCapability request for the supplied SystemCapabilityType and call the listener's callback if the systemCapabilityType is queryable
+ *
+ * @param systemCapabilityType Type of capability desired
+ * @param subscribe flag to subscribe to updates of the supplied capability type. True means subscribe; false means cancel subscription; null means don't change current subscription status.
+ */
+ private void retrieveCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener, final Boolean subscribe) {
+ if (currentHMILevel != null && currentHMILevel.equals(HMILevel.HMI_NONE)) {
+ String message = String.format("Attempted to update type: %s in HMI level NONE, which is not allowed. " +
+ "Please wait until you are in HMI BACKGROUND, LIMITED, or FULL before attempting to update any SystemCapabilityType", systemCapabilityType);
+ DebugTool.logError(TAG, message);
+ if (scListener != null) {
+ scListener.onError(message);
+ }
+ return;
+ }
+ if (!systemCapabilityType.isQueryable() || systemCapabilityType == SystemCapabilityType.DISPLAYS) {
+ String message = "This systemCapabilityType cannot be queried for";
+ DebugTool.logError(TAG, message);
+ if (scListener != null) {
+ scListener.onError(message);
+ }
+ return;
+ }
+ final GetSystemCapability request = new GetSystemCapability();
+ request.setSystemCapabilityType(systemCapabilityType);
/*
The subscription flag in the request should be set based on multiple variables:
@@ -572,68 +585,69 @@ abstract class BaseSystemCapabilityManager {
- if subscribe is false, then willSubscribe = false
- if subscribe is true and the HU supports subscriptions, then willSubscribe = true
*/
- boolean shouldSubscribe = (subscribe != null) ? subscribe : isSubscribedToSystemCapability(systemCapabilityType);
- final boolean willSubscribe = shouldSubscribe && supportsSubscriptions();
- request.setSubscribe(willSubscribe);
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- Object retrievedCapability = ((GetSystemCapabilityResponse) response).getSystemCapability().getCapabilityForType(systemCapabilityType);
- setCapability(systemCapabilityType, retrievedCapability);
- // If the listener is not included in the onSystemCapabilityListeners map, then notify it
- // This will be triggered if we are just getting capability without adding a listener to the map
- if (scListener != null) {
- synchronized (LISTENER_LOCK) {
- CopyOnWriteArrayList<OnSystemCapabilityListener> notifiedListeners = onSystemCapabilityListeners.get(systemCapabilityType);
- boolean listenerAlreadyNotified = (notifiedListeners != null) && notifiedListeners.contains(scListener);
- if (!listenerAlreadyNotified) {
- scListener.onCapabilityRetrieved(retrievedCapability);
- }
- }
- }
- if (supportsSubscriptions()) {
- systemCapabilitiesSubscriptionStatus.put(systemCapabilityType, willSubscribe);
- }
- } else {
- if (scListener != null) {
- scListener.onError(response.getInfo());
- }
- }
- }
- });
- request.setCorrelationID(CorrelationIdGenerator.generateId());
-
- if (callback != null) {
- callback.sendRPC(request);
- }
- }
-
- /**
- * Converts a capability object into a list.
- * @param object the capability that needs to be converted
- * @param classType The class type of that should be contained in the list
- * @return a List of capabilities if object is instance of List, otherwise it will return null.
- */
- @SuppressWarnings({"unchecked"})
- public static <T> List<T> convertToList(Object object, Class<T> classType) {
- if (classType != null && object != null && object instanceof List) {
- List list = (List) object;
- if (!list.isEmpty()) {
- if (classType.isInstance(list.get(0))) {
- return (List<T>) object;
- } else {
- //The list is not of the correct list type
- return null;
- }
- } else {
- //We return a new list of type T instead of null because while we don't know if
- //the original list was of type T we want to ensure that we don't throw a cast class exception
- //but still
- return new ArrayList<>();
- }
- } else {
- return null;
- }
- }
+ boolean shouldSubscribe = (subscribe != null) ? subscribe : isSubscribedToSystemCapability(systemCapabilityType);
+ final boolean willSubscribe = shouldSubscribe && supportsSubscriptions();
+ request.setSubscribe(willSubscribe);
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ Object retrievedCapability = ((GetSystemCapabilityResponse) response).getSystemCapability().getCapabilityForType(systemCapabilityType);
+ setCapability(systemCapabilityType, retrievedCapability);
+ // If the listener is not included in the onSystemCapabilityListeners map, then notify it
+ // This will be triggered if we are just getting capability without adding a listener to the map
+ if (scListener != null) {
+ synchronized (LISTENER_LOCK) {
+ CopyOnWriteArrayList<OnSystemCapabilityListener> notifiedListeners = onSystemCapabilityListeners.get(systemCapabilityType);
+ boolean listenerAlreadyNotified = (notifiedListeners != null) && notifiedListeners.contains(scListener);
+ if (!listenerAlreadyNotified) {
+ scListener.onCapabilityRetrieved(retrievedCapability);
+ }
+ }
+ }
+ if (supportsSubscriptions()) {
+ systemCapabilitiesSubscriptionStatus.put(systemCapabilityType, willSubscribe);
+ }
+ } else {
+ if (scListener != null) {
+ scListener.onError(response.getInfo());
+ }
+ }
+ }
+ });
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+
+ if (callback != null) {
+ callback.sendRPC(request);
+ }
+ }
+
+ /**
+ * Converts a capability object into a list.
+ *
+ * @param object the capability that needs to be converted
+ * @param classType The class type of that should be contained in the list
+ * @return a List of capabilities if object is instance of List, otherwise it will return null.
+ */
+ @SuppressWarnings({"unchecked"})
+ public static <T> List<T> convertToList(Object object, Class<T> classType) {
+ if (classType != null && object != null && object instanceof List) {
+ List list = (List) object;
+ if (!list.isEmpty()) {
+ if (classType.isInstance(list.get(0))) {
+ return (List<T>) object;
+ } else {
+ //The list is not of the correct list type
+ return null;
+ }
+ } else {
+ //We return a new list of type T instead of null because while we don't know if
+ //the original list was of type T we want to ensure that we don't throw a cast class exception
+ //but still
+ return new ArrayList<>();
+ }
+ } else {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
index fa85a459b..e49e076ca 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
@@ -42,84 +42,86 @@ 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.
+ * 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;
- }
+ 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/lifecycle/OnSystemCapabilityListener.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/OnSystemCapabilityListener.java
index e4b54b207..117163053 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/OnSystemCapabilityListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/OnSystemCapabilityListener.java
@@ -32,6 +32,7 @@
package com.smartdevicelink.managers.lifecycle;
public interface OnSystemCapabilityListener {
- void onCapabilityRetrieved(Object capability);
- void onError(String info);
+ void onCapabilityRetrieved(Object capability);
+
+ void onError(String info);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
index 1c4b1fccb..9a67f3a97 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
@@ -50,31 +50,32 @@ public class RpcConverter {
private static final String TAG = "RpcConverter";
- private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
- private static final String RESPONSE_KEY = "Response";
+ private static final String RPC_PACKAGE = "com.smartdevicelink.proxy.rpc.";
+ private static final String RESPONSE_KEY = "Response";
private static final String GENERIC_RESPONSE_STRING = FunctionID.GENERIC_RESPONSE.toString();
/**
* Extracts the RPC out of the payload of a given protocol message
- * @param message protocolMessage that has the RPC in the payload
+ *
+ * @param message protocolMessage that has the RPC in the payload
* @param protocolVersion RPC spec version that should be used to create RPC
* @return the extracted RPC
*/
- public static RPCMessage extractRpc(ProtocolMessage message, Version protocolVersion){
+ public static RPCMessage extractRpc(ProtocolMessage message, Version protocolVersion) {
Hashtable<String, Object> tempTable = convertProtocolMessage(message, protocolVersion);
- if(tempTable != null){
- try{
+ if (tempTable != null) {
+ try {
return convertTableToRpc(tempTable);
- }catch (Exception e){
- DebugTool.logError(TAG, "Error converting RPC",e);
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Error converting RPC", e);
}
}
return null;
}
- static Hashtable<String, Object> convertProtocolMessage(ProtocolMessage message, Version protocolVersion){
+ static Hashtable<String, Object> convertProtocolMessage(ProtocolMessage message, Version protocolVersion) {
Hashtable<String, Object> hash = new Hashtable<>();
- if (protocolVersion!= null && protocolVersion.getMajor() > 1) {
+ if (protocolVersion != null && protocolVersion.getMajor() > 1) {
Hashtable<String, Object> hashTemp = new Hashtable<>();
hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
@@ -102,7 +103,8 @@ public class RpcConverter {
hash.put(RPCMessage.KEY_NOTIFICATION, hashTemp);
}
- if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
+ if (message.getBulkData() != null)
+ hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
if (message.getPayloadProtected()) hash.put(RPCStruct.KEY_PROTECTED, true);
return hash;
@@ -112,21 +114,21 @@ public class RpcConverter {
}
- public static RPCMessage convertTableToRpc(Hashtable<String,Object> rpcHashTable){
+ public static RPCMessage convertTableToRpc(Hashtable<String, Object> rpcHashTable) {
- Hashtable<String,Object> params;
- if(rpcHashTable.containsKey((RPCMessage.KEY_RESPONSE))){
- params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_RESPONSE));
- }else if(rpcHashTable.containsKey((RPCMessage.KEY_NOTIFICATION))){
- params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_NOTIFICATION));
- }else if(rpcHashTable.containsKey((RPCMessage.KEY_REQUEST))){
- params = (Hashtable)rpcHashTable.get((RPCMessage.KEY_REQUEST));
- }else{
+ Hashtable<String, Object> params;
+ if (rpcHashTable.containsKey((RPCMessage.KEY_RESPONSE))) {
+ params = (Hashtable) rpcHashTable.get((RPCMessage.KEY_RESPONSE));
+ } else if (rpcHashTable.containsKey((RPCMessage.KEY_NOTIFICATION))) {
+ params = (Hashtable) rpcHashTable.get((RPCMessage.KEY_NOTIFICATION));
+ } else if (rpcHashTable.containsKey((RPCMessage.KEY_REQUEST))) {
+ params = (Hashtable) rpcHashTable.get((RPCMessage.KEY_REQUEST));
+ } else {
DebugTool.logError(TAG, " Corrupted RPC table.");
return null;
}
- if(DebugTool.isDebugEnabled()) {
+ if (DebugTool.isDebugEnabled()) {
if (params != null) {
Set<String> keySet = params.keySet();
for (String key : keySet) {
@@ -135,27 +137,27 @@ public class RpcConverter {
}
}
- if(params != null && params.containsKey(RPCMessage.KEY_FUNCTION_NAME)){
+ if (params != null && params.containsKey(RPCMessage.KEY_FUNCTION_NAME)) {
StringBuilder rpcClassName = new StringBuilder();
- String functionName = (String)params.get(RPCMessage.KEY_FUNCTION_NAME);
- if(FunctionID.SHOW_CONSTANT_TBT.toString().equals(functionName)) {
- functionName = "ShowConstantTbt";
+ String functionName = (String) params.get(RPCMessage.KEY_FUNCTION_NAME);
+ if (FunctionID.SHOW_CONSTANT_TBT.toString().equals(functionName)) {
+ functionName = "ShowConstantTbt";
}
rpcClassName.append(RPC_PACKAGE);
- rpcClassName.append (functionName);
+ rpcClassName.append(functionName);
- if(rpcHashTable.containsKey(RPCMessage.KEY_RESPONSE)
- && !GENERIC_RESPONSE_STRING.equals(functionName)){
+ if (rpcHashTable.containsKey(RPCMessage.KEY_RESPONSE)
+ && !GENERIC_RESPONSE_STRING.equals(functionName)) {
rpcClassName.append(RESPONSE_KEY);
}
DebugTool.logInfo(TAG, " Attempting to create " + rpcClassName.toString());
try {
Class rpcClass = Class.forName(rpcClassName.toString());
- if(rpcClass != null){
- java.lang.reflect.Constructor rpcConstructor = rpcClass.getConstructor(Hashtable.class);
- if(rpcConstructor != null){
- return (RPCMessage)rpcConstructor.newInstance(rpcHashTable);
+ if (rpcClass != null) {
+ java.lang.reflect.Constructor rpcConstructor = rpcClass.getConstructor(Hashtable.class);
+ if (rpcConstructor != null) {
+ return (RPCMessage) rpcConstructor.newInstance(rpcHashTable);
}
} else {
DebugTool.logError(TAG, " Java class cannot be found for " + rpcClassName.toString());
@@ -163,7 +165,7 @@ public class RpcConverter {
} catch (Exception e) {
DebugTool.logError(TAG, "RPCConverter was unable to process RPC", e);
}
- }else{
+ } else {
DebugTool.logError(TAG, " Unable to parse into RPC");
}
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 686a2627d..6c05f2573 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
@@ -58,13 +58,13 @@ import java.util.Set;
import java.util.UUID;
/**
- PermissionManager gives the developer information about what permissions are permitted in specific HMI level
- and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * PermissionManager gives the developer information about what permissions are permitted in specific HMI level
+ * and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * <p>
+ * This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
+ **/
- This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
-**/
-
-abstract class BasePermissionManager extends BaseSubManager{
+abstract class BasePermissionManager extends BaseSubManager {
private HMILevel currentHMILevel;
private Map<FunctionID, PermissionItem> currentPermissionItems;
@@ -76,7 +76,9 @@ abstract class BasePermissionManager extends BaseSubManager{
@IntDef({PERMISSION_GROUP_STATUS_ALLOWED, PERMISSION_GROUP_STATUS_DISALLOWED,
PERMISSION_GROUP_STATUS_MIXED, PERMISSION_GROUP_STATUS_UNKNOWN})
@Retention(RetentionPolicy.SOURCE)
- public @interface PermissionGroupStatus {}
+ public @interface PermissionGroupStatus {
+ }
+
public static final int PERMISSION_GROUP_STATUS_ALLOWED = 0; // Every permission in the group is currently allowed
public static final int PERMISSION_GROUP_STATUS_DISALLOWED = 1; // Every permission in the group is currently disallowed
public static final int PERMISSION_GROUP_STATUS_MIXED = 2; // Some permissions in the group are allowed and some disallowed
@@ -85,15 +87,18 @@ abstract class BasePermissionManager extends BaseSubManager{
// Permission groups type constants
@IntDef({PERMISSION_GROUP_TYPE_ALL_ALLOWED, PERMISSION_GROUP_TYPE_ANY})
@Retention(RetentionPolicy.SOURCE)
- public @interface PermissionGroupType {}
+ public @interface PermissionGroupType {
+ }
+
public static final int PERMISSION_GROUP_TYPE_ALL_ALLOWED = 0; // Be notified when all of the permission in the group are allowed, or, when they all stop being allowed in some sense, that is, when they were all allowed, and now they are not.
public static final int PERMISSION_GROUP_TYPE_ANY = 1; // Be notified when any change in availability occurs among the group
/**
* Creates a new instance of the PermissionManager
+ *
* @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
*/
- BasePermissionManager(@NonNull ISdl internalInterface){
+ BasePermissionManager(@NonNull ISdl internalInterface) {
super(internalInterface);
this.currentPermissionItems = new HashMap<>();
this.filters = new ArrayList<>();
@@ -102,7 +107,7 @@ abstract class BasePermissionManager extends BaseSubManager{
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;
}
@@ -118,7 +123,7 @@ abstract class BasePermissionManager extends BaseSubManager{
onPermissionsChangeListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- List<PermissionItem> permissionItems = ((OnPermissionsChange)notification).getPermissionItem();
+ List<PermissionItem> permissionItems = ((OnPermissionsChange) notification).getPermissionItem();
Map<FunctionID, PermissionItem> previousPermissionItems = currentPermissionItems;
Boolean requireEncryptionAppLevel = ((OnPermissionsChange) notification).getRequireEncryption();
encryptionRequiredRPCs.clear();
@@ -165,14 +170,15 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Gets the encryption requirement
+ *
* @return true if encryption is required; false otherwise
*/
public boolean getRequiresEncryption() {
return !encryptionRequiredRPCs.isEmpty();
}
- private synchronized void checkState(){
- if(this.getState() == SETTING_UP && currentHMILevel != null){
+ private synchronized void checkState() {
+ if (this.getState() == SETTING_UP && currentHMILevel != null) {
transitionToState(READY);
}
}
@@ -180,46 +186,46 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Go over all developer's listeners and call them if needed because of HMI level change or permission items change
*/
- private void notifyListeners(Map<FunctionID, PermissionItem> previousPermissionItems, HMILevel previousHmiLevel, Map<FunctionID, PermissionItem> currentPermissionItems, HMILevel currentHMILevel){
+ private void notifyListeners(Map<FunctionID, PermissionItem> previousPermissionItems, HMILevel previousHmiLevel, Map<FunctionID, PermissionItem> currentPermissionItems, HMILevel currentHMILevel) {
for (PermissionFilter filter : filters) {
boolean anyChange = false;
boolean allWereAllowed = true;
boolean allNowAllowed = true;
for (PermissionElement permissionElement : filter.getPermissionElements()) {
// If at any point this condition is satisfied, then we don't need to continue
- if (anyChange && !allWereAllowed && !allNowAllowed){
+ if (anyChange && !allWereAllowed && !allNowAllowed) {
break;
}
boolean rpcWasAllowed = isRPCAllowed(permissionElement.getRPCName(), previousPermissionItems, previousHmiLevel);
boolean rpcNowAllowed = isRPCAllowed(permissionElement.getRPCName(), currentPermissionItems, currentHMILevel);
- if (rpcWasAllowed != rpcNowAllowed){
+ if (rpcWasAllowed != rpcNowAllowed) {
anyChange = true;
}
- if (!rpcWasAllowed){
+ if (!rpcWasAllowed) {
allWereAllowed = false;
}
- if (!rpcNowAllowed){
+ if (!rpcNowAllowed) {
allNowAllowed = false;
}
if (permissionElement.getParameters() != null && permissionElement.getParameters().size() > 0) {
for (String parameter : permissionElement.getParameters()) {
boolean parameterWasAllowed = isPermissionParameterAllowed(permissionElement.getRPCName(), parameter, previousPermissionItems, previousHmiLevel);
boolean parameterNowAllowed = isPermissionParameterAllowed(permissionElement.getRPCName(), parameter, currentPermissionItems, currentHMILevel);
- if (parameterWasAllowed != parameterNowAllowed){
+ if (parameterWasAllowed != parameterNowAllowed) {
anyChange = true;
}
- if (!parameterWasAllowed){
+ if (!parameterWasAllowed) {
allWereAllowed = false;
}
- if (!parameterNowAllowed){
+ if (!parameterNowAllowed) {
allNowAllowed = false;
}
}
}
}
- if (filter.getGroupType() == PERMISSION_GROUP_TYPE_ALL_ALLOWED && anyChange && (allWereAllowed || allNowAllowed)){
+ if (filter.getGroupType() == PERMISSION_GROUP_TYPE_ALL_ALLOWED && anyChange && (allWereAllowed || allNowAllowed)) {
notifyListener(filter);
- } else if (filter.getGroupType() == PERMISSION_GROUP_TYPE_ANY && anyChange){
+ } else if (filter.getGroupType() == PERMISSION_GROUP_TYPE_ANY && anyChange) {
notifyListener(filter);
}
}
@@ -227,16 +233,17 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Determine if an individual RPC is allowed
- * @param rpcName FunctionID value that represents the name of the RPC
+ *
+ * @param rpcName FunctionID value that represents the name of the RPC
* @param permissionItems Map containing HMI and parameter permissions for a specific RPC
- * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
+ * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
* @return boolean represents whether the RPC is allowed or not
*/
- private boolean isRPCAllowed(@NonNull FunctionID rpcName, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel){
+ private boolean isRPCAllowed(@NonNull FunctionID rpcName, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel) {
PermissionItem permissionItem = permissionItems.get(rpcName);
- if (hmiLevel == null || permissionItem == null || permissionItem.getHMIPermissions() == null || permissionItem.getHMIPermissions().getAllowed() == null){
+ if (hmiLevel == null || permissionItem == null || permissionItem.getHMIPermissions() == null || permissionItem.getHMIPermissions().getAllowed() == null) {
return false;
- } else if (permissionItem.getHMIPermissions().getUserDisallowed() != null){
+ } else if (permissionItem.getHMIPermissions().getUserDisallowed() != null) {
return permissionItem.getHMIPermissions().getAllowed().contains(hmiLevel) && !permissionItem.getHMIPermissions().getUserDisallowed().contains(hmiLevel);
} else {
return permissionItem.getHMIPermissions().getAllowed().contains(hmiLevel);
@@ -245,27 +252,29 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Determine if an individual RPC is allowed for the current permission items and HMI level
+ *
* @param rpcName rpcName FunctionID value that represents the name of the RPC
* @return boolean represents whether the RPC is allowed or not
*/
@SuppressWarnings("WeakerAccess")
- public boolean isRPCAllowed(@NonNull FunctionID rpcName){
+ public boolean isRPCAllowed(@NonNull FunctionID rpcName) {
return isRPCAllowed(rpcName, currentPermissionItems, currentHMILevel);
}
/**
* Determine if an individual permission parameter is allowed
- * @param rpcName FunctionID value that represents the name of the RPC
- * @param parameter String value that represents a parameter for the RPC. Ex: "rpm" or "speed" for GetVehicleData
+ *
+ * @param rpcName FunctionID value that represents the name of the RPC
+ * @param parameter String value that represents a parameter for the RPC. Ex: "rpm" or "speed" for GetVehicleData
* @param permissionItems Map containing HMI and parameter permissions for a specific RPC
- * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
+ * @param hmiLevel If the RPC is allowed at that HMI Level. Ex: None or Full
* @return boolean represents whether the permission parameter is allowed or not
*/
- private boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel){
+ private boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel) {
PermissionItem permissionItem = permissionItems.get(rpcName);
- if (permissionItem == null || !isRPCAllowed(rpcName, permissionItems, hmiLevel) || permissionItem.getParameterPermissions() == null || permissionItem.getParameterPermissions().getAllowed() == null){
+ if (permissionItem == null || !isRPCAllowed(rpcName, permissionItems, hmiLevel) || permissionItem.getParameterPermissions() == null || permissionItem.getParameterPermissions().getAllowed() == null) {
return false;
- } else if (permissionItem.getParameterPermissions().getUserDisallowed() != null){
+ } else if (permissionItem.getParameterPermissions().getUserDisallowed() != null) {
return permissionItem.getParameterPermissions().getAllowed().contains(parameter) && !permissionItem.getParameterPermissions().getUserDisallowed().contains(parameter);
} else {
return permissionItem.getParameterPermissions().getAllowed().contains(parameter);
@@ -274,12 +283,13 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Determine if an individual permission parameter is allowed for current permission items and current HMI level
- * @param rpcName FunctionID value that represents the name of the RPC
+ *
+ * @param rpcName FunctionID value that represents the name of the RPC
* @param parameter String value that represents a parameter for the RPC
* @return boolean represents whether the permission parameter is allowed or not
*/
@SuppressWarnings("WeakerAccess")
- public boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter){
+ public boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter) {
return isPermissionParameterAllowed(rpcName, parameter, currentPermissionItems, currentHMILevel);
}
@@ -288,7 +298,7 @@ abstract class BasePermissionManager extends BaseSubManager{
*/
@Override
@RestrictTo(RestrictTo.Scope.LIBRARY)
- public void dispose(){
+ public void dispose() {
super.dispose();
// Remove onHMIStatusListener
@@ -305,13 +315,15 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Determine if a group of permissions is allowed for the current HMI level
+ *
* @param permissionElements list of PermissionElement that represents the RPC names and their parameters
* @return PermissionGroupStatus int value that gives an overall view whether the permissions are allowed or not
* @see PermissionGroupStatus
*/
@SuppressWarnings("WeakerAccess")
- public @PermissionGroupStatus int getGroupStatusOfPermissions(@NonNull List<PermissionElement> permissionElements){
- if (currentHMILevel == null){
+ public @PermissionGroupStatus
+ int getGroupStatusOfPermissions(@NonNull List<PermissionElement> permissionElements) {
+ if (currentHMILevel == null) {
return PERMISSION_GROUP_STATUS_UNKNOWN;
}
@@ -324,12 +336,12 @@ abstract class BasePermissionManager extends BaseSubManager{
return PERMISSION_GROUP_STATUS_MIXED;
}
- if (permissionElement == null){
+ if (permissionElement == null) {
continue;
- } else if (!isRPCAllowed(permissionElement.getRPCName())){
+ } else if (!isRPCAllowed(permissionElement.getRPCName())) {
hasDisallowed = true;
} else {
- if (permissionElement.getParameters() == null || permissionElement.getParameters().size() == 0){
+ if (permissionElement.getParameters() == null || permissionElement.getParameters().size() == 0) {
hasAllowed = true;
} else {
for (String permissionParameter : permissionElement.getParameters()) {
@@ -343,13 +355,13 @@ abstract class BasePermissionManager extends BaseSubManager{
}
}
- if (!hasAllowed && !hasDisallowed){
+ if (!hasAllowed && !hasDisallowed) {
return PERMISSION_GROUP_STATUS_ALLOWED;
} else if (hasAllowed && hasDisallowed) {
return PERMISSION_GROUP_STATUS_MIXED;
} else if (hasAllowed) {
return PERMISSION_GROUP_STATUS_ALLOWED;
- } else{
+ } else {
return PERMISSION_GROUP_STATUS_DISALLOWED;
}
}
@@ -357,14 +369,15 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Determine if a group of permissions is allowed for the current HMI level
* This method is similar to getGroupStatusOfPermissions() but returns more detailed result about each individual permission
+ *
* @param permissionElements list of PermissionElement that represents the RPC names and their parameters
* @return a map with keys that are the passed in RPC names specifying if that RPC and its parameter permissions are currently allowed for the current HMI level
*/
@SuppressWarnings("WeakerAccess")
- public Map <FunctionID, PermissionStatus> getStatusOfPermissions(@NonNull List<PermissionElement> permissionElements){
+ public Map<FunctionID, PermissionStatus> getStatusOfPermissions(@NonNull List<PermissionElement> permissionElements) {
Map<FunctionID, PermissionStatus> statusOfPermissions = new HashMap<>();
for (PermissionElement permissionElement : permissionElements) {
- if (permissionElement == null){
+ if (permissionElement == null) {
continue;
}
Map<String, Boolean> allowedParameters = null;
@@ -382,24 +395,26 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Call the listener for a specific filter
+ *
* @param filter the permission filter to cal
*/
- private void notifyListener(@NonNull PermissionFilter filter){
+ private void notifyListener(@NonNull PermissionFilter filter) {
int permissionGroupStatus = getGroupStatusOfPermissions(filter.getPermissionElements());
- Map <FunctionID, PermissionStatus> allowedPermissions = getStatusOfPermissions(filter.getPermissionElements());
+ Map<FunctionID, PermissionStatus> allowedPermissions = getStatusOfPermissions(filter.getPermissionElements());
filter.getListener().onPermissionsChange(allowedPermissions, permissionGroupStatus);
}
/**
* Add a listener to be called when there is permissions change.
* When the listener is added it will be called immediately with the current permission values if the values comply with with the passed groupType
+ *
* @param permissionElements list of PermissionElement that represents the RPC names and their parameters
- * @param groupType PermissionGroupType int value represents whether we need the listener to be called when there is any permissions change or only when all permission become allowed
- * @param listener OnPermissionChangeListener interface
+ * @param groupType PermissionGroupType int value represents whether we need the listener to be called when there is any permissions change or only when all permission become allowed
+ * @param listener OnPermissionChangeListener interface
* @return unique uuid number for the listener. It can be used to remove the listener later.
*/
@SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
- public UUID addListener(@NonNull List<PermissionElement> permissionElements, @PermissionGroupType int groupType, @NonNull OnPermissionChangeListener listener){
+ public UUID addListener(@NonNull List<PermissionElement> permissionElements, @PermissionGroupType int groupType, @NonNull OnPermissionChangeListener listener) {
PermissionFilter filter = new PermissionFilter(null, permissionElements, groupType, listener);
filters.add(filter);
if (groupType == PERMISSION_GROUP_TYPE_ANY || (groupType == PERMISSION_GROUP_TYPE_ALL_ALLOWED && getGroupStatusOfPermissions(permissionElements) == PERMISSION_GROUP_STATUS_ALLOWED)) {
@@ -410,10 +425,11 @@ abstract class BasePermissionManager extends BaseSubManager{
/**
* Removes specific listener
+ *
* @param listenerId the id of the listener
*/
@SuppressWarnings("WeakerAccess")
- public void removeListener(@NonNull UUID listenerId){
+ public void removeListener(@NonNull UUID listenerId) {
for (PermissionFilter filter : filters) {
if (filter.getIdentifier().equals(listenerId)) {
filters.remove(filter);
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/OnPermissionChangeListener.java b/base/src/main/java/com/smartdevicelink/managers/permission/OnPermissionChangeListener.java
index 662ac795a..a21ac0e15 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/OnPermissionChangeListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/OnPermissionChangeListener.java
@@ -43,7 +43,8 @@ import java.util.Map;
public interface OnPermissionChangeListener {
/**
* Call back method that PermissionManager will call to inform the developer about permission changes
- * @param allowedPermissions an overall view about the status of the permissions
+ *
+ * @param allowedPermissions an overall view about the status of the permissions
* @param permissionGroupStatus a detailed view about which permissions are allowed and which ones are not
* @see PermissionManager.PermissionGroupStatus
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionElement.java b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionElement.java
index d09e75195..b1f330a04 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionElement.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionElement.java
@@ -47,16 +47,18 @@ public class PermissionElement {
/**
* Create a new instance of PermissionElement
- * @param rpcName the name of the RPC
+ *
+ * @param rpcName the name of the RPC
* @param parameters a list of the RPC parameters
*/
- public PermissionElement(@NonNull FunctionID rpcName, List<String> parameters){
+ public PermissionElement(@NonNull FunctionID rpcName, List<String> parameters) {
this.rpcName = rpcName;
this.parameters = parameters;
}
/**
* Get the RPC name
+ *
* @return FunctionID value represents the RPC name
*/
public FunctionID getRPCName() {
@@ -65,6 +67,7 @@ public class PermissionElement {
/**
* Get the permission parameters for the RPC
+ *
* @return List<String> represents the permission parameters for the RPC
*/
public List<String> getParameters() {
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionFilter.java b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionFilter.java
index a48b71c9f..07ec97628 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionFilter.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionFilter.java
@@ -47,6 +47,7 @@ class PermissionFilter {
/**
* Creates a new instance of PermissionFilter
+ *
* @see com.smartdevicelink.managers.permission.PermissionManager.PermissionGroupType
*/
PermissionFilter(UUID identifier, @NonNull List<PermissionElement> permissionElements, @PermissionManager.PermissionGroupType int groupType, @NonNull OnPermissionChangeListener listener) {
@@ -62,6 +63,7 @@ class PermissionFilter {
/**
* Get the unique id for the listener
+ *
* @return UUID object represents the id for the listener
*/
protected UUID getIdentifier() {
@@ -70,6 +72,7 @@ class PermissionFilter {
/**
* Get the permission elements that the developer wants to add a listener for
+ *
* @return List<PermissionElement> represents the RPCs and their parameters that the developer wants to add a listener for
*/
protected List<PermissionElement> getPermissionElements() {
@@ -78,15 +81,18 @@ class PermissionFilter {
/**
* Get how we want the listener to be called: when any change happens? or when all permissions become allowed?
+ *
* @return PermissionGroupType int value represents whether the developer needs the listener to be called when there is any permissions change or only when all permission become allowed
* @see com.smartdevicelink.managers.permission.PermissionManager.PermissionGroupType
*/
- protected @PermissionManager.PermissionGroupType int getGroupType() {
+ protected @PermissionManager.PermissionGroupType
+ int getGroupType() {
return groupType;
}
/**
* Get the listener object
+ *
* @return OnPermissionChangeListener object represents the listener for that filter
*/
protected OnPermissionChangeListener getListener() {
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java
index adae88e5d..539b0d4b3 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java
@@ -47,6 +47,7 @@ public class PermissionStatus {
/**
* Creates a new PermissionStatus instance
+ *
* @param rpcName
* @param isRPCAllowed
* @param allowedParameters
@@ -59,6 +60,7 @@ public class PermissionStatus {
/**
* Get the name of the RPC
+ *
* @return FunctionID value represents the name of the RPC
*/
public FunctionID getRPCName() {
@@ -67,6 +69,7 @@ public class PermissionStatus {
/**
* Get whether the RCP is allowed or not
+ *
* @return boolean represents whether the RCP is allowed or not
*/
public boolean getIsRPCAllowed() {
@@ -75,6 +78,7 @@ public class PermissionStatus {
/**
* Set whether the RPC is allowed or not
+ *
* @param isRPCAllowed
*/
protected void setIsRPCAllowed(boolean isRPCAllowed) {
@@ -83,6 +87,7 @@ public class PermissionStatus {
/**
* Get the status of the permission parameter for the RPC
+ *
* @return Map<String, Boolean> object with keys that represent the permission parameter names and values that represent whether the parameters are allowed or not
*/
public Map<String, Boolean> getAllowedParameters() {
@@ -91,6 +96,7 @@ public class PermissionStatus {
/**
* Set the status of the permission parameter for the RPC
+ *
* @param allowedParameters
*/
protected void setAllowedParameters(Map<String, Boolean> allowedParameters) {
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 2f7019068..8b976b2af 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -64,599 +64,643 @@ import java.util.List;
/**
* <strong>ScreenManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
-*/
+ */
abstract class BaseScreenManager extends BaseSubManager {
- private static final String TAG = "ScreenManager";
- private final WeakReference<FileManager> fileManager;
- private SoftButtonManager softButtonManager;
- private TextAndGraphicManager textAndGraphicManager;
- private VoiceCommandManager voiceCommandManager;
- private MenuManager menuManager;
- private ChoiceSetManager choiceSetManager;
- private SubscribeButtonManager subscribeButtonManager;
-
- // Sub manager listener
- private final CompletionListener subManagerListener = new CompletionListener() {
-
- @Override
- public synchronized void onComplete(boolean success) {
- if (softButtonManager != null && textAndGraphicManager != null && voiceCommandManager != null && menuManager != null && choiceSetManager != null && subscribeButtonManager != null) {
- if (softButtonManager.getState() == BaseSubManager.READY && textAndGraphicManager.getState() == BaseSubManager.READY && voiceCommandManager.getState() == BaseSubManager.READY && menuManager.getState() == BaseSubManager.READY
- && subscribeButtonManager.getState() == BaseSubManager.READY) {
- DebugTool.logInfo(TAG, "Starting screen manager, all sub managers are in ready state");
- transitionToState(READY);
- } else if (softButtonManager.getState() == BaseSubManager.ERROR && textAndGraphicManager.getState() == BaseSubManager.ERROR && voiceCommandManager.getState() == BaseSubManager.ERROR && menuManager.getState() == BaseSubManager.ERROR
- && choiceSetManager.getState() == BaseSubManager.ERROR && subscribeButtonManager.getState() == BaseSubManager.ERROR) {
- DebugTool.logError(TAG, "ERROR starting screen manager, all sub managers are in error state");
- transitionToState(ERROR);
- } else if (textAndGraphicManager.getState() == BaseSubManager.SETTING_UP || softButtonManager.getState() == BaseSubManager.SETTING_UP || voiceCommandManager.getState() == BaseSubManager.SETTING_UP || menuManager.getState() == BaseSubManager.SETTING_UP
- || choiceSetManager.getState() == BaseSubManager.SETTING_UP || subscribeButtonManager.getState() == BaseSubManager.SETTING_UP) {
- DebugTool.logInfo(TAG, "SETTING UP screen manager, at least one sub manager is still setting up");
- transitionToState(SETTING_UP);
- } else {
- DebugTool.logWarning(TAG, "LIMITED starting screen manager, at least one sub manager is in error state and the others are ready");
- transitionToState(LIMITED);
- }
- } else {
- // We should never be here, but somehow one of the sub-sub managers is null
- DebugTool.logError(TAG, "ERROR one of the screen sub managers is null");
- transitionToState(ERROR);
- }
- }
- };
-
- BaseScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
- super(internalInterface);
- this.fileManager = new WeakReference<>(fileManager);
- initialize();
- }
-
- @Override
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public void start(CompletionListener listener) {
- super.start(listener);
- this.softButtonManager.start(subManagerListener);
- this.textAndGraphicManager.start(subManagerListener);
- this.voiceCommandManager.start(subManagerListener);
- this.menuManager.start(subManagerListener);
- this.choiceSetManager.start(subManagerListener);
- this.subscribeButtonManager.start(subManagerListener);
- }
-
- private void initialize(){
- if (fileManager.get() != null) {
- this.softButtonManager = new SoftButtonManager(internalInterface, fileManager.get());
- this.textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager.get(), softButtonManager);
- this.menuManager = new MenuManager(internalInterface, fileManager.get());
- this.choiceSetManager = new ChoiceSetManager(internalInterface, fileManager.get());
- }
- this.subscribeButtonManager = new SubscribeButtonManager(internalInterface);
- this.voiceCommandManager = new VoiceCommandManager(internalInterface);
- }
-
- /**
- * <p>Called when manager is being torn down</p>
- */
- @Override
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public void dispose() {
- softButtonManager.dispose();
- textAndGraphicManager.dispose();
- voiceCommandManager.dispose();
- menuManager.dispose();
- choiceSetManager.dispose();
- subscribeButtonManager.dispose();
- super.dispose();
- }
-
- /**
- * The top text field within a template layout. Pass an empty string "" to clear the text field.
- *
- * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
- *
- * If 3 lines are available: [field1, field2, field3 - field 4]
- *
- * If 2 lines are available: [field1 - field2, field3 - field4]
- *
- * If 1 line is available: [field1 - field2 - field3 - field4]
- *
- * @param textField1 String value represents the textField1
- */
- public void setTextField1(String textField1) {
- this.softButtonManager.setCurrentMainField1(textField1);
- this.textAndGraphicManager.setTextField1(textField1);
- }
-
- /**
- * Get the current textField1 value
- * @return a String value represents the current textField1 value
- */
- public String getTextField1() {
- return this.textAndGraphicManager.getTextField1();
- }
-
- /**
- * Sets the second text field within a template layout. Pass an empty string "" to clear the text field.
- *
- * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
- *
- * If 3 lines are available: [field1, field2, field3 - field 4]
- *
- * If 2 lines are available: [field1 - field2, field3 - field4]
- *
- * If 1 line is available: [field1 - field2 - field3 - field4]
- *
- * @param textField2 String value represents the textField1
- */
- public void setTextField2(String textField2) {
- this.textAndGraphicManager.setTextField2(textField2);
- }
-
- /**
- * Get the current textField2 value
- * @return a String value represents the current textField2 value
- */
- public String getTextField2() {
- return this.textAndGraphicManager.getTextField2();
- }
-
- /**
- * Sets the third text field within a template layout. Pass an empty string "" to clear the text field.
- *
- * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
- *
- * If 3 lines are available: [field1, field2, field3 - field 4]
- *
- * If 2 lines are available: [field1 - field2, field3 - field4]
- *
- * If 1 line is available: [field1 - field2 - field3 - field4]
- *
- * @param textField3 String value represents the textField1
- */
- public void setTextField3(String textField3) {
- this.textAndGraphicManager.setTextField3(textField3);
- }
-
- /**
- * Get the current textField3 value
- * @return a String value represents the current textField3 value
- */
- public String getTextField3() {
- return this.textAndGraphicManager.getTextField3();
- }
-
- /**
- * Sets the fourth text field within a template layout. Pass an empty string "" to clear the text field.
- *
- * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
- *
- * If 3 lines are available: [field1, field2, field3 - field 4]
- *
- * If 2 lines are available: [field1 - field2, field3 - field4]
- *
- * If 1 line is available: [field1 - field2 - field3 - field4]
- *
- * @param textField4 String value represents the textField1
- */
- public void setTextField4(String textField4) {
- this.textAndGraphicManager.setTextField4(textField4);
- }
-
- /**
- * Get the current textField4 value
- * @return a String value represents the current textField4 value
- */
- public String getTextField4() {
- return this.textAndGraphicManager.getTextField4();
- }
-
- /**
- * Set the mediaTrackTextField on the head unit screen
- * @param mediaTrackTextField String value represents the mediaTrackTextField
- */
- public void setMediaTrackTextField(String mediaTrackTextField) {
- this.textAndGraphicManager.setMediaTrackTextField(mediaTrackTextField);
- }
-
- /**
- * Get the current mediaTrackTextField value
- * @return a String value represents the current mediaTrackTextField
- */
- public String getMediaTrackTextField() {
- return this.textAndGraphicManager.getMediaTrackTextField();
- }
-
- /**
- * Set the primaryGraphic on the head unit screen
- * @param primaryGraphic an SdlArtwork object represents the primaryGraphic
- */
- public void setPrimaryGraphic(SdlArtwork primaryGraphic) {
- if (primaryGraphic == null){
- primaryGraphic = textAndGraphicManager.getBlankArtwork();
- }
- this.textAndGraphicManager.setPrimaryGraphic(primaryGraphic);
- }
-
- /**
- * Get the current primaryGraphic value
- * @return an SdlArtwork object represents the current primaryGraphic
- */
- public SdlArtwork getPrimaryGraphic() {
- if (this.textAndGraphicManager.getPrimaryGraphic() == null || textAndGraphicManager.getPrimaryGraphic().getName() == null || this.textAndGraphicManager.getPrimaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
- return null;
- }
- return this.textAndGraphicManager.getPrimaryGraphic();
- }
-
- /**
- * Set the secondaryGraphic on the head unit screen
- * @param secondaryGraphic an SdlArtwork object represents the secondaryGraphic
- */
- public void setSecondaryGraphic(SdlArtwork secondaryGraphic) {
- if (secondaryGraphic == null){
- secondaryGraphic = textAndGraphicManager.getBlankArtwork();
- }
- this.textAndGraphicManager.setSecondaryGraphic(secondaryGraphic);
- }
-
- /**
- * Get the current secondaryGraphic value
- * @return an SdlArtwork object represents the current secondaryGraphic
- */
- public SdlArtwork getSecondaryGraphic() {
- if (this.textAndGraphicManager.getSecondaryGraphic() == null || textAndGraphicManager.getSecondaryGraphic().getName() == null || this.textAndGraphicManager.getSecondaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
- return null;
- }
- return this.textAndGraphicManager.getSecondaryGraphic();
- }
-
- /**
- * Set the alignment for the text fields
- * @param textAlignment TextAlignment value represents the alignment for the text fields
- */
- public void setTextAlignment(TextAlignment textAlignment) {
- this.textAndGraphicManager.setTextAlignment(textAlignment);
- }
-
- /**
- * Get the alignment for the text fields
- * @return a TextAlignment value represents the alignment for the text fields
- */
- public TextAlignment getTextAlignment() {
- return this.textAndGraphicManager.getTextAlignment();
- }
-
- /**
- * Set the metadata type for the textField1
- * @param textField1Type a MetadataType value represents the metadata for textField1
- */
- public void setTextField1Type(MetadataType textField1Type) {
- this.textAndGraphicManager.setTextField1Type(textField1Type);
- }
-
- /**
- * Get the metadata type for textField1
- * @return a MetadataType value represents the metadata for textField1
- */
- public MetadataType getTextField1Type() {
- return this.textAndGraphicManager.getTextField1Type();
- }
-
- /**
- * Set the metadata type for the textField2
- * @param textField2Type a MetadataType value represents the metadata for textField2
- */
- public void setTextField2Type(MetadataType textField2Type) {
- this.textAndGraphicManager.setTextField2Type(textField2Type);
- }
-
- /**
- * Get the metadata type for textField2
- * @return a MetadataType value represents the metadata for textField2
- */
- public MetadataType getTextField2Type() {
- return this.textAndGraphicManager.getTextField2Type();
- }
-
- /**
- * Set the metadata type for the textField3
- * @param textField3Type a MetadataType value represents the metadata for textField3
- */
- public void setTextField3Type(MetadataType textField3Type) {
- this.textAndGraphicManager.setTextField3Type(textField3Type);
- }
-
- /**
- * Get the metadata type for textField3
- * @return a MetadataType value represents the metadata for textField3
- */
- public MetadataType getTextField3Type() {
- return this.textAndGraphicManager.getTextField3Type();
- }
-
- /**
- * Set the metadata type for the textField4
- * @param textField4Type a MetadataType value represents the metadata for textField4
- */
- public void setTextField4Type(MetadataType textField4Type) {
- this.textAndGraphicManager.setTextField4Type(textField4Type);
- }
-
- /**
- * Get the metadata type for textField4
- * @return a MetadataType value represents the metadata for textField4
- */
- public MetadataType getTextField4Type() {
- return this.textAndGraphicManager.getTextField4Type();
- }
-
- /**
- * Sets the title of the new template that will be displayed.
- * Sending an empty String "" will clear the field
- * @param title the title of the new template that will be displayed. MaxLength: 100.
- */
- public void setTitle(String title){
- this.textAndGraphicManager.setTitle(title);
- }
-
- /**
- * Gets the title of the new template that will be displayed
- * @return title - String value that represents the title of the new template that will be displayed
- */
- public String getTitle(){
- return this.textAndGraphicManager.getTitle();
- }
-
- /**
- * Change the current layout to a new layout and optionally update the layout's night and day color schemes. The values set for the text, graphics,
- * buttons and template title persist between layout changes. To update the text, graphics, buttons and template title at the same time as the template,
- * batch all the updates between beginTransaction and commit. If the layout update fails while batching, then the updated text, graphics, buttons or template title will also not be updated.
- *
- * If you are connected on a < v6.0 connection and batching the update, the layout will be updated, then the text and graphics will be updated.
- * If you are connected on a >= v6.0 connection, the layout will be updated at the same time that the text and graphics are updated.
- *
- * If this update is batched between beginTransaction and commit, the completionListener here will not be called. Use the completionListener with commit(completionListener)
- *
- * NOTE: If this update returns an false, it may have been superseded by another update.
- * This means that it was cancelled while in-progress because another update was requested, whether batched or not.
- *
- * @param templateConfiguration The new configuration of the template, including the layout and color scheme.
- * @param listener A listener that will be called when the layout change finished.
- */
- public void changeLayout(@NonNull TemplateConfiguration templateConfiguration, CompletionListener listener) {
- textAndGraphicManager.changeLayout(templateConfiguration, listener);
- }
-
- /**
- * Set softButtonObjects list and upload the images to the head unit
- * @param softButtonObjects the list of the SoftButtonObject values that should be displayed on the head unit
- */
- public void setSoftButtonObjects(@NonNull List<SoftButtonObject> softButtonObjects) {
- softButtonManager.setSoftButtonObjects(softButtonObjects);
- }
-
- /**
- * Get the soft button objects list
- * @return a List<SoftButtonObject>
- */
- public List<SoftButtonObject> getSoftButtonObjects() {
- return softButtonManager.getSoftButtonObjects();
- }
-
- /**
- * Get the SoftButtonObject that has the provided name
- * @param name a String value that represents the name
- * @return a SoftButtonObject
- */
- public SoftButtonObject getSoftButtonObjectByName(@NonNull String name){
- return softButtonManager.getSoftButtonObjectByName(name);
- }
-
- /**
- * Get the SoftButtonObject that has the provided buttonId
- * @param buttonId a int value that represents the id of the button
- * @return a SoftButtonObject
- */
- public SoftButtonObject getSoftButtonObjectById(int buttonId){
- return softButtonManager.getSoftButtonObjectById(buttonId);
- }
-
- /**
- * Get the currently set voice commands
- * @return a List of Voice Command objects
- */
- public List<VoiceCommand> getVoiceCommands(){
- return voiceCommandManager.getVoiceCommands();
- }
-
- /**
- * Set voice commands
- * @param voiceCommands the voice commands to be sent to the head unit
- */
- public void setVoiceCommands(@NonNull List<VoiceCommand> voiceCommands){
- this.voiceCommandManager.setVoiceCommands(voiceCommands);
- }
-
- // MENUS
-
- /**
- * The list of currently set menu cells
- * @return a List of the currently set menu cells
- */
- public List<MenuCell> getMenu(){
- return this.menuManager.getMenuCells();
- }
-
- /**
- * Creates and sends all associated Menu RPCs
- * Note: the manager will store a deep copy the menuCells internally to be able to handle future updates correctly
- * @param menuCells - the menu cells that are to be sent to the head unit, including their sub-cells.
- */
- public void setMenu(@NonNull List<MenuCell> menuCells){
- this.menuManager.setMenuCells(menuCells);
- }
-
- /**
- * Sets the behavior of how menus are updated. For explanations of the differences, see {@link DynamicMenuUpdatesMode}
- * @param value - the update mode
- */
- public void setDynamicMenuUpdatesMode(@NonNull DynamicMenuUpdatesMode value){
- this.menuManager.setDynamicUpdatesMode(value);
- }
-
- /**
- * @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE if not set.
- */
- public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode(){
- return this.menuManager.getDynamicMenuUpdatesMode();
- }
-
- /**
- * 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 WindowCapability.menuLayoutsAvailable.
- * @param menuConfiguration - The default menuConfiguration
- */
- public void setMenuConfiguration(@NonNull MenuConfiguration menuConfiguration) {
- this.menuManager.setMenuConfiguration(menuConfiguration);
- }
-
- /**
- * The main menu layout. See available menu layouts on WindowCapability.menuLayoutsAvailable.
- * @return the currently set MenuConfiguration
- */
- public MenuConfiguration getMenuConfiguration(){
- return this.menuManager.getMenuConfiguration();
- }
-
- // CHOICE SETS
-
- /**
- * Deletes choices that were sent previously
- * @param choices - A list of ChoiceCell objects
- */
- public void deleteChoices(@NonNull List<ChoiceCell> choices){
- this.choiceSetManager.deleteChoices(choices);
- }
-
- /**
- * Preload choices to improve performance while presenting a choice set at a later time
- * @param choices - a list of ChoiceCell objects that will be part of a choice set later
- * @param listener - a completion listener to inform when the operation is complete
- */
- public void preloadChoices(@NonNull List<ChoiceCell> choices, CompletionListener listener){
- this.choiceSetManager.preloadChoices(choices, listener);
- }
-
- /**
- * Presents a searchable choice set
- * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
- * @param mode - The intended interaction mode
- * @param keyboardListener - A keyboard listener to capture user input
- */
- public void presentSearchableChoiceSet(@NonNull ChoiceSet choiceSet, @Nullable InteractionMode mode, @NonNull KeyboardListener keyboardListener){
- this.choiceSetManager.presentChoiceSet(choiceSet, mode, keyboardListener);
- }
-
- /**
- * Presents a choice set
- * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
- * @param mode - The intended interaction mode
- */
- public void presentChoiceSet(@NonNull ChoiceSet choiceSet, @Nullable InteractionMode mode){
- this.choiceSetManager.presentChoiceSet(choiceSet, mode, null);
- }
-
- /**
- * Presents a keyboard on the Head unit to capture user input
- * @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 Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
- return this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
- }
-
- /**
- * Set a custom keyboard configuration for this session. If set to null, it will reset to default keyboard configuration.
- * @param keyboardConfiguration - the custom keyboard configuration to be used when the keyboard is displayed
- */
- public void setKeyboardConfiguration(@Nullable KeyboardProperties keyboardConfiguration){
- this.choiceSetManager.setKeyboardConfiguration(keyboardConfiguration);
- }
-
- /**
- * @return A set of choice cells that have been preloaded to the head unit
- */
- public HashSet<ChoiceCell> getPreloadedChoices(){
- 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
-
- /**
- * Begin a multiple updates transaction. The updates will be applied when commit() is called<br>
- * Note: if we don't use beginTransaction & commit, every update will be sent individually.
- */
- public void beginTransaction(){
- softButtonManager.setBatchUpdates(true);
- textAndGraphicManager.setBatchUpdates(true);
- }
-
- /**
- * Pairs with beginTransaction() to batch text, graphic, and layout changes into a single update with a callback when the update is complete.
- * Update text fields with new text set into the text field properties, updates the primary and secondary images with new image(s) if new one(s) been set,
- * and updates the template if one was changed using changeLayout(TemplateConfiguration, CompletionListener).
- * NOTE: The CompletionListener in changeLayout(TemplateConfiguration, CompletionListener) will not be called if the update is batched into this update
- * NOTE: If this CompletionListener returns false, it may have been superseded by another update. This means that it was cancelled while in-progress because another update was requested, whether batched or not.
- * @param listener a CompletionListener that has a callback that will be called when the updates are finished
- */
- public void commit(final CompletionListener listener){
- softButtonManager.setBatchUpdates(false);
- textAndGraphicManager.setBatchUpdates(false);
- textAndGraphicManager.update(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (listener != null) {
- listener.onComplete(success);
- }
- }
- });
- }
-
- public void addButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener){
- subscribeButtonManager.addButtonListener(buttonName,listener);
- }
- public void removeButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener){
- subscribeButtonManager.removeButtonListener(buttonName, listener);
- }
+ private static final String TAG = "ScreenManager";
+ private final WeakReference<FileManager> fileManager;
+ private SoftButtonManager softButtonManager;
+ private TextAndGraphicManager textAndGraphicManager;
+ private VoiceCommandManager voiceCommandManager;
+ private MenuManager menuManager;
+ private ChoiceSetManager choiceSetManager;
+ private SubscribeButtonManager subscribeButtonManager;
+
+ // Sub manager listener
+ private final CompletionListener subManagerListener = new CompletionListener() {
+
+ @Override
+ public synchronized void onComplete(boolean success) {
+ if (softButtonManager != null && textAndGraphicManager != null && voiceCommandManager != null && menuManager != null && choiceSetManager != null && subscribeButtonManager != null) {
+ if (softButtonManager.getState() == BaseSubManager.READY && textAndGraphicManager.getState() == BaseSubManager.READY && voiceCommandManager.getState() == BaseSubManager.READY && menuManager.getState() == BaseSubManager.READY
+ && subscribeButtonManager.getState() == BaseSubManager.READY) {
+ DebugTool.logInfo(TAG, "Starting screen manager, all sub managers are in ready state");
+ transitionToState(READY);
+ } else if (softButtonManager.getState() == BaseSubManager.ERROR && textAndGraphicManager.getState() == BaseSubManager.ERROR && voiceCommandManager.getState() == BaseSubManager.ERROR && menuManager.getState() == BaseSubManager.ERROR
+ && choiceSetManager.getState() == BaseSubManager.ERROR && subscribeButtonManager.getState() == BaseSubManager.ERROR) {
+ DebugTool.logError(TAG, "ERROR starting screen manager, all sub managers are in error state");
+ transitionToState(ERROR);
+ } else if (textAndGraphicManager.getState() == BaseSubManager.SETTING_UP || softButtonManager.getState() == BaseSubManager.SETTING_UP || voiceCommandManager.getState() == BaseSubManager.SETTING_UP || menuManager.getState() == BaseSubManager.SETTING_UP
+ || choiceSetManager.getState() == BaseSubManager.SETTING_UP || subscribeButtonManager.getState() == BaseSubManager.SETTING_UP) {
+ DebugTool.logInfo(TAG, "SETTING UP screen manager, at least one sub manager is still setting up");
+ transitionToState(SETTING_UP);
+ } else {
+ DebugTool.logWarning(TAG, "LIMITED starting screen manager, at least one sub manager is in error state and the others are ready");
+ transitionToState(LIMITED);
+ }
+ } else {
+ // We should never be here, but somehow one of the sub-sub managers is null
+ DebugTool.logError(TAG, "ERROR one of the screen sub managers is null");
+ transitionToState(ERROR);
+ }
+ }
+ };
+
+ BaseScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
+ super(internalInterface);
+ this.fileManager = new WeakReference<>(fileManager);
+ initialize();
+ }
+
+ @Override
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public void start(CompletionListener listener) {
+ super.start(listener);
+ this.softButtonManager.start(subManagerListener);
+ this.textAndGraphicManager.start(subManagerListener);
+ this.voiceCommandManager.start(subManagerListener);
+ this.menuManager.start(subManagerListener);
+ this.choiceSetManager.start(subManagerListener);
+ this.subscribeButtonManager.start(subManagerListener);
+ }
+
+ private void initialize() {
+ if (fileManager.get() != null) {
+ this.softButtonManager = new SoftButtonManager(internalInterface, fileManager.get());
+ this.textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager.get(), softButtonManager);
+ this.menuManager = new MenuManager(internalInterface, fileManager.get());
+ this.choiceSetManager = new ChoiceSetManager(internalInterface, fileManager.get());
+ }
+ this.subscribeButtonManager = new SubscribeButtonManager(internalInterface);
+ this.voiceCommandManager = new VoiceCommandManager(internalInterface);
+ }
+
+ /**
+ * <p>Called when manager is being torn down</p>
+ */
+ @Override
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public void dispose() {
+ softButtonManager.dispose();
+ textAndGraphicManager.dispose();
+ voiceCommandManager.dispose();
+ menuManager.dispose();
+ choiceSetManager.dispose();
+ subscribeButtonManager.dispose();
+ super.dispose();
+ }
+
+ /**
+ * The top text field within a template layout. Pass an empty string "" to clear the text field.
+ * <p>
+ * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
+ * <p>
+ * If 3 lines are available: [field1, field2, field3 - field 4]
+ * <p>
+ * If 2 lines are available: [field1 - field2, field3 - field4]
+ * <p>
+ * If 1 line is available: [field1 - field2 - field3 - field4]
+ *
+ * @param textField1 String value represents the textField1
+ */
+ public void setTextField1(String textField1) {
+ this.softButtonManager.setCurrentMainField1(textField1);
+ this.textAndGraphicManager.setTextField1(textField1);
+ }
+
+ /**
+ * Get the current textField1 value
+ *
+ * @return a String value represents the current textField1 value
+ */
+ public String getTextField1() {
+ return this.textAndGraphicManager.getTextField1();
+ }
+
+ /**
+ * Sets the second text field within a template layout. Pass an empty string "" to clear the text field.
+ * <p>
+ * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
+ * <p>
+ * If 3 lines are available: [field1, field2, field3 - field 4]
+ * <p>
+ * If 2 lines are available: [field1 - field2, field3 - field4]
+ * <p>
+ * If 1 line is available: [field1 - field2 - field3 - field4]
+ *
+ * @param textField2 String value represents the textField1
+ */
+ public void setTextField2(String textField2) {
+ this.textAndGraphicManager.setTextField2(textField2);
+ }
+
+ /**
+ * Get the current textField2 value
+ *
+ * @return a String value represents the current textField2 value
+ */
+ public String getTextField2() {
+ return this.textAndGraphicManager.getTextField2();
+ }
+
+ /**
+ * Sets the third text field within a template layout. Pass an empty string "" to clear the text field.
+ * <p>
+ * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
+ * <p>
+ * If 3 lines are available: [field1, field2, field3 - field 4]
+ * <p>
+ * If 2 lines are available: [field1 - field2, field3 - field4]
+ * <p>
+ * If 1 line is available: [field1 - field2 - field3 - field4]
+ *
+ * @param textField3 String value represents the textField1
+ */
+ public void setTextField3(String textField3) {
+ this.textAndGraphicManager.setTextField3(textField3);
+ }
+
+ /**
+ * Get the current textField3 value
+ *
+ * @return a String value represents the current textField3 value
+ */
+ public String getTextField3() {
+ return this.textAndGraphicManager.getTextField3();
+ }
+
+ /**
+ * Sets the fourth text field within a template layout. Pass an empty string "" to clear the text field.
+ * <p>
+ * If the system does not support a full 4 fields, this will automatically be concatenated and properly send the field available.
+ * <p>
+ * If 3 lines are available: [field1, field2, field3 - field 4]
+ * <p>
+ * If 2 lines are available: [field1 - field2, field3 - field4]
+ * <p>
+ * If 1 line is available: [field1 - field2 - field3 - field4]
+ *
+ * @param textField4 String value represents the textField1
+ */
+ public void setTextField4(String textField4) {
+ this.textAndGraphicManager.setTextField4(textField4);
+ }
+
+ /**
+ * Get the current textField4 value
+ *
+ * @return a String value represents the current textField4 value
+ */
+ public String getTextField4() {
+ return this.textAndGraphicManager.getTextField4();
+ }
+
+ /**
+ * Set the mediaTrackTextField on the head unit screen
+ *
+ * @param mediaTrackTextField String value represents the mediaTrackTextField
+ */
+ public void setMediaTrackTextField(String mediaTrackTextField) {
+ this.textAndGraphicManager.setMediaTrackTextField(mediaTrackTextField);
+ }
+
+ /**
+ * Get the current mediaTrackTextField value
+ *
+ * @return a String value represents the current mediaTrackTextField
+ */
+ public String getMediaTrackTextField() {
+ return this.textAndGraphicManager.getMediaTrackTextField();
+ }
+
+ /**
+ * Set the primaryGraphic on the head unit screen
+ *
+ * @param primaryGraphic an SdlArtwork object represents the primaryGraphic
+ */
+ public void setPrimaryGraphic(SdlArtwork primaryGraphic) {
+ if (primaryGraphic == null) {
+ primaryGraphic = textAndGraphicManager.getBlankArtwork();
+ }
+ this.textAndGraphicManager.setPrimaryGraphic(primaryGraphic);
+ }
+
+ /**
+ * Get the current primaryGraphic value
+ *
+ * @return an SdlArtwork object represents the current primaryGraphic
+ */
+ public SdlArtwork getPrimaryGraphic() {
+ if (this.textAndGraphicManager.getPrimaryGraphic() == null || textAndGraphicManager.getPrimaryGraphic().getName() == null || this.textAndGraphicManager.getPrimaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
+ return null;
+ }
+ return this.textAndGraphicManager.getPrimaryGraphic();
+ }
+
+ /**
+ * Set the secondaryGraphic on the head unit screen
+ *
+ * @param secondaryGraphic an SdlArtwork object represents the secondaryGraphic
+ */
+ public void setSecondaryGraphic(SdlArtwork secondaryGraphic) {
+ if (secondaryGraphic == null) {
+ secondaryGraphic = textAndGraphicManager.getBlankArtwork();
+ }
+ this.textAndGraphicManager.setSecondaryGraphic(secondaryGraphic);
+ }
+
+ /**
+ * Get the current secondaryGraphic value
+ *
+ * @return an SdlArtwork object represents the current secondaryGraphic
+ */
+ public SdlArtwork getSecondaryGraphic() {
+ if (this.textAndGraphicManager.getSecondaryGraphic() == null || textAndGraphicManager.getSecondaryGraphic().getName() == null || this.textAndGraphicManager.getSecondaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
+ return null;
+ }
+ return this.textAndGraphicManager.getSecondaryGraphic();
+ }
+
+ /**
+ * Set the alignment for the text fields
+ *
+ * @param textAlignment TextAlignment value represents the alignment for the text fields
+ */
+ public void setTextAlignment(TextAlignment textAlignment) {
+ this.textAndGraphicManager.setTextAlignment(textAlignment);
+ }
+
+ /**
+ * Get the alignment for the text fields
+ *
+ * @return a TextAlignment value represents the alignment for the text fields
+ */
+ public TextAlignment getTextAlignment() {
+ return this.textAndGraphicManager.getTextAlignment();
+ }
+
+ /**
+ * Set the metadata type for the textField1
+ *
+ * @param textField1Type a MetadataType value represents the metadata for textField1
+ */
+ public void setTextField1Type(MetadataType textField1Type) {
+ this.textAndGraphicManager.setTextField1Type(textField1Type);
+ }
+
+ /**
+ * Get the metadata type for textField1
+ *
+ * @return a MetadataType value represents the metadata for textField1
+ */
+ public MetadataType getTextField1Type() {
+ return this.textAndGraphicManager.getTextField1Type();
+ }
+
+ /**
+ * Set the metadata type for the textField2
+ *
+ * @param textField2Type a MetadataType value represents the metadata for textField2
+ */
+ public void setTextField2Type(MetadataType textField2Type) {
+ this.textAndGraphicManager.setTextField2Type(textField2Type);
+ }
+
+ /**
+ * Get the metadata type for textField2
+ *
+ * @return a MetadataType value represents the metadata for textField2
+ */
+ public MetadataType getTextField2Type() {
+ return this.textAndGraphicManager.getTextField2Type();
+ }
+
+ /**
+ * Set the metadata type for the textField3
+ *
+ * @param textField3Type a MetadataType value represents the metadata for textField3
+ */
+ public void setTextField3Type(MetadataType textField3Type) {
+ this.textAndGraphicManager.setTextField3Type(textField3Type);
+ }
+
+ /**
+ * Get the metadata type for textField3
+ *
+ * @return a MetadataType value represents the metadata for textField3
+ */
+ public MetadataType getTextField3Type() {
+ return this.textAndGraphicManager.getTextField3Type();
+ }
+
+ /**
+ * Set the metadata type for the textField4
+ *
+ * @param textField4Type a MetadataType value represents the metadata for textField4
+ */
+ public void setTextField4Type(MetadataType textField4Type) {
+ this.textAndGraphicManager.setTextField4Type(textField4Type);
+ }
+
+ /**
+ * Get the metadata type for textField4
+ *
+ * @return a MetadataType value represents the metadata for textField4
+ */
+ public MetadataType getTextField4Type() {
+ return this.textAndGraphicManager.getTextField4Type();
+ }
+
+ /**
+ * Sets the title of the new template that will be displayed.
+ * Sending an empty String "" will clear the field
+ *
+ * @param title the title of the new template that will be displayed. MaxLength: 100.
+ */
+ public void setTitle(String title) {
+ this.textAndGraphicManager.setTitle(title);
+ }
+
+ /**
+ * Gets the title of the new template that will be displayed
+ *
+ * @return title - String value that represents the title of the new template that will be displayed
+ */
+ public String getTitle() {
+ return this.textAndGraphicManager.getTitle();
+ }
+
+ /**
+ * Change the current layout to a new layout and optionally update the layout's night and day color schemes. The values set for the text, graphics,
+ * buttons and template title persist between layout changes. To update the text, graphics, buttons and template title at the same time as the template,
+ * batch all the updates between beginTransaction and commit. If the layout update fails while batching, then the updated text, graphics, buttons or template title will also not be updated.
+ * <p>
+ * If you are connected on a < v6.0 connection and batching the update, the layout will be updated, then the text and graphics will be updated.
+ * If you are connected on a >= v6.0 connection, the layout will be updated at the same time that the text and graphics are updated.
+ * <p>
+ * If this update is batched between beginTransaction and commit, the completionListener here will not be called. Use the completionListener with commit(completionListener)
+ * <p>
+ * NOTE: If this update returns an false, it may have been superseded by another update.
+ * This means that it was cancelled while in-progress because another update was requested, whether batched or not.
+ *
+ * @param templateConfiguration The new configuration of the template, including the layout and color scheme.
+ * @param listener A listener that will be called when the layout change finished.
+ */
+ public void changeLayout(@NonNull TemplateConfiguration templateConfiguration, CompletionListener listener) {
+ textAndGraphicManager.changeLayout(templateConfiguration, listener);
+ }
+
+ /**
+ * Set softButtonObjects list and upload the images to the head unit
+ *
+ * @param softButtonObjects the list of the SoftButtonObject values that should be displayed on the head unit
+ */
+ public void setSoftButtonObjects(@NonNull List<SoftButtonObject> softButtonObjects) {
+ softButtonManager.setSoftButtonObjects(softButtonObjects);
+ }
+
+ /**
+ * Get the soft button objects list
+ *
+ * @return a List<SoftButtonObject>
+ */
+ public List<SoftButtonObject> getSoftButtonObjects() {
+ return softButtonManager.getSoftButtonObjects();
+ }
+
+ /**
+ * Get the SoftButtonObject that has the provided name
+ *
+ * @param name a String value that represents the name
+ * @return a SoftButtonObject
+ */
+ public SoftButtonObject getSoftButtonObjectByName(@NonNull String name) {
+ return softButtonManager.getSoftButtonObjectByName(name);
+ }
+
+ /**
+ * Get the SoftButtonObject that has the provided buttonId
+ *
+ * @param buttonId a int value that represents the id of the button
+ * @return a SoftButtonObject
+ */
+ public SoftButtonObject getSoftButtonObjectById(int buttonId) {
+ return softButtonManager.getSoftButtonObjectById(buttonId);
+ }
+
+ /**
+ * Get the currently set voice commands
+ *
+ * @return a List of Voice Command objects
+ */
+ public List<VoiceCommand> getVoiceCommands() {
+ return voiceCommandManager.getVoiceCommands();
+ }
+
+ /**
+ * Set voice commands
+ *
+ * @param voiceCommands the voice commands to be sent to the head unit
+ */
+ public void setVoiceCommands(@NonNull List<VoiceCommand> voiceCommands) {
+ this.voiceCommandManager.setVoiceCommands(voiceCommands);
+ }
+
+ // MENUS
+
+ /**
+ * The list of currently set menu cells
+ *
+ * @return a List of the currently set menu cells
+ */
+ public List<MenuCell> getMenu() {
+ return this.menuManager.getMenuCells();
+ }
+
+ /**
+ * Creates and sends all associated Menu RPCs
+ * Note: the manager will store a deep copy the menuCells internally to be able to handle future updates correctly
+ *
+ * @param menuCells - the menu cells that are to be sent to the head unit, including their sub-cells.
+ */
+ public void setMenu(@NonNull List<MenuCell> menuCells) {
+ this.menuManager.setMenuCells(menuCells);
+ }
+
+ /**
+ * Sets the behavior of how menus are updated. For explanations of the differences, see {@link DynamicMenuUpdatesMode}
+ *
+ * @param value - the update mode
+ */
+ public void setDynamicMenuUpdatesMode(@NonNull DynamicMenuUpdatesMode value) {
+ this.menuManager.setDynamicUpdatesMode(value);
+ }
+
+ /**
+ * @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE if not set.
+ */
+ public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode() {
+ return this.menuManager.getDynamicMenuUpdatesMode();
+ }
+
+ /**
+ * 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 WindowCapability.menuLayoutsAvailable.
+ *
+ * @param menuConfiguration - The default menuConfiguration
+ */
+ public void setMenuConfiguration(@NonNull MenuConfiguration menuConfiguration) {
+ this.menuManager.setMenuConfiguration(menuConfiguration);
+ }
+
+ /**
+ * The main menu layout. See available menu layouts on WindowCapability.menuLayoutsAvailable.
+ *
+ * @return the currently set MenuConfiguration
+ */
+ public MenuConfiguration getMenuConfiguration() {
+ return this.menuManager.getMenuConfiguration();
+ }
+
+ // CHOICE SETS
+
+ /**
+ * Deletes choices that were sent previously
+ *
+ * @param choices - A list of ChoiceCell objects
+ */
+ public void deleteChoices(@NonNull List<ChoiceCell> choices) {
+ this.choiceSetManager.deleteChoices(choices);
+ }
+
+ /**
+ * Preload choices to improve performance while presenting a choice set at a later time
+ *
+ * @param choices - a list of ChoiceCell objects that will be part of a choice set later
+ * @param listener - a completion listener to inform when the operation is complete
+ */
+ public void preloadChoices(@NonNull List<ChoiceCell> choices, CompletionListener listener) {
+ this.choiceSetManager.preloadChoices(choices, listener);
+ }
+
+ /**
+ * Presents a searchable choice set
+ *
+ * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
+ * @param mode - The intended interaction mode
+ * @param keyboardListener - A keyboard listener to capture user input
+ */
+ public void presentSearchableChoiceSet(@NonNull ChoiceSet choiceSet, @Nullable InteractionMode mode, @NonNull KeyboardListener keyboardListener) {
+ this.choiceSetManager.presentChoiceSet(choiceSet, mode, keyboardListener);
+ }
+
+ /**
+ * Presents a choice set
+ *
+ * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
+ * @param mode - The intended interaction mode
+ */
+ public void presentChoiceSet(@NonNull ChoiceSet choiceSet, @Nullable InteractionMode mode) {
+ this.choiceSetManager.presentChoiceSet(choiceSet, mode, null);
+ }
+
+ /**
+ * Presents a keyboard on the Head unit to capture user input
+ *
+ * @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 Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener) {
+ return this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
+ }
+
+ /**
+ * Set a custom keyboard configuration for this session. If set to null, it will reset to default keyboard configuration.
+ *
+ * @param keyboardConfiguration - the custom keyboard configuration to be used when the keyboard is displayed
+ */
+ public void setKeyboardConfiguration(@Nullable KeyboardProperties keyboardConfiguration) {
+ this.choiceSetManager.setKeyboardConfiguration(keyboardConfiguration);
+ }
+
+ /**
+ * @return A set of choice cells that have been preloaded to the head unit
+ */
+ public HashSet<ChoiceCell> getPreloadedChoices() {
+ 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
+
+ /**
+ * Begin a multiple updates transaction. The updates will be applied when commit() is called<br>
+ * Note: if we don't use beginTransaction & commit, every update will be sent individually.
+ */
+ public void beginTransaction() {
+ softButtonManager.setBatchUpdates(true);
+ textAndGraphicManager.setBatchUpdates(true);
+ }
+
+ /**
+ * Pairs with beginTransaction() to batch text, graphic, and layout changes into a single update with a callback when the update is complete.
+ * Update text fields with new text set into the text field properties, updates the primary and secondary images with new image(s) if new one(s) been set,
+ * and updates the template if one was changed using changeLayout(TemplateConfiguration, CompletionListener).
+ * NOTE: The CompletionListener in changeLayout(TemplateConfiguration, CompletionListener) will not be called if the update is batched into this update
+ * NOTE: If this CompletionListener returns false, it may have been superseded by another update. This means that it was cancelled while in-progress because another update was requested, whether batched or not.
+ *
+ * @param listener a CompletionListener that has a callback that will be called when the updates are finished
+ */
+ public void commit(final CompletionListener listener) {
+ softButtonManager.setBatchUpdates(false);
+ textAndGraphicManager.setBatchUpdates(false);
+ textAndGraphicManager.update(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (listener != null) {
+ listener.onComplete(success);
+ }
+ }
+ });
+ }
+
+ public void addButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener) {
+ subscribeButtonManager.addButtonListener(buttonName, listener);
+ }
+
+ public void removeButtonListener(@NonNull ButtonName buttonName, @NonNull OnButtonListener listener) {
+ subscribeButtonManager.removeButtonListener(buttonName, listener);
+ }
}
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 690e8e5b9..10d24c765 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
@@ -87,8 +87,9 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Creates a new instance of the SoftButtonManager
+ *
* @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
- * @param fileManager an instance of the FileManager so that button graphics can be sent
+ * @param fileManager an instance of the FileManager so that button graphics can be sent
*/
BaseSoftButtonManager(@NonNull final ISdl internalInterface, @NonNull final FileManager fileManager) {
super(internalInterface);
@@ -263,6 +264,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Get the soft button objects list
+ *
* @return a List<SoftButtonObject>
*/
protected List<SoftButtonObject> getSoftButtonObjects() {
@@ -271,6 +273,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Set softButtonObjects list and upload the images to the head unit
+ *
* @param list the list of the SoftButtonObject values that should be displayed on the head unit
*/
protected void setSoftButtonObjects(@NonNull List<SoftButtonObject> list) {
@@ -321,6 +324,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Check if two SoftButtonObject have the same name
+ *
* @param softButtonObjects a list of SoftButton objects that will be iterated through
* @return true if two buttons exist that are the same in the list, false if not
*/
@@ -338,6 +342,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Check if there is a collision in the ids provided by the developer and assign ids to the SoftButtonObjects that do not have ids
+ *
* @param softButtonObjects the list of the SoftButtonObject values that should be displayed on the head unit
* @return boolean representing whether the ids are unique or not
*/
@@ -395,6 +400,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Get the SoftButtonObject that has the provided name
+ *
* @param name a String value that represents the name
* @return a SoftButtonObject
*/
@@ -409,6 +415,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Get the SoftButtonObject that has the provided buttonId
+ *
* @param buttonId a int value that represents the id of the button
* @return a SoftButtonObject
*/
@@ -423,6 +430,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Set the batchUpdates flag that represents whether the manager should wait until commit() is called to send the updated show RPC
+ *
* @param batchUpdates Set true if the manager should batch updates together, or false if it should send them as soon as they happen
*/
protected void setBatchUpdates(boolean batchUpdates) {
@@ -438,6 +446,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Get the current String associated with MainField1
+ *
* @return the string that is currently used for MainField1
*/
protected String getCurrentMainField1() {
@@ -449,6 +458,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
/**
* Sets the String to be associated with MainField1
+ *
* @param currentMainField1 the String that will be set to TextField1 on the current template
*/
protected void setCurrentMainField1(String currentMainField1) {
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
index 05addbffe..1e6e2acca 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
@@ -116,7 +116,7 @@ abstract class BaseSubscribeButtonManager extends BaseSubManager {
* Send the UnsubscribeButton RPC
*
* @param buttonName - ButtonName - name of button
- * @param listener - OnButtonListener - listener to get notified
+ * @param listener - OnButtonListener - listener to get notified
*/
private void unsubscribeButtonRequest(final ButtonName buttonName, final OnButtonListener listener) {
UnsubscribeButton unsubscribeButtonRequest = new UnsubscribeButton(buttonName);
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 50bf7fb4e..0a201fc22 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -69,503 +69,504 @@ import static com.smartdevicelink.proxy.rpc.enums.TextAlignment.CENTERED;
*/
abstract class BaseTextAndGraphicManager extends BaseSubManager {
- private static final String TAG = "TextAndGraphicManager";
-
- boolean isDirty;
- TextAndGraphicState currentScreenData;
- HMILevel currentHMILevel;
- private final WeakReference<SoftButtonManager> softButtonManager;
- WindowCapability defaultMainWindowCapability;
- private boolean batchingUpdates;
- private final WeakReference<FileManager> fileManager;
- SdlArtwork blankArtwork;
- private OnRPCNotificationListener hmiListener;
- private OnSystemCapabilityListener onDisplaysCapabilityListener;
- private SdlArtwork primaryGraphic, secondaryGraphic;
- private TextAlignment textAlignment;
- private String textField1, textField2, textField3, textField4, mediaTrackTextField, title;
- private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
- private TemplateConfiguration templateConfiguration;
- TextAndGraphicUpdateOperation updateOperation;
- private CompletionListener currentOperationListener;
- Queue transactionQueue;
-
- //Constructors
-
- BaseTextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
- // set class vars
- super(internalInterface);
- this.fileManager = new WeakReference<>(fileManager);
- this.softButtonManager = new WeakReference<>(softButtonManager);
- batchingUpdates = false;
- isDirty = false;
- textAlignment = CENTERED;
- currentHMILevel = HMILevel.HMI_NONE;
- currentScreenData = new TextAndGraphicState();
- this.transactionQueue = newTransactionQueue();
- addListeners();
- }
-
- @Override
- public void start(CompletionListener listener) {
- transitionToState(READY);
- super.start(listener);
- }
-
- @Override
- public void dispose() {
- textField1 = null;
- textField1Type = null;
- textField2 = null;
- textField2Type = null;
- textField3 = null;
- textField3Type = null;
- textField4 = null;
- textField4Type = null;
- mediaTrackTextField = null;
- title = null;
- textAlignment = null;
- primaryGraphic = null;
- secondaryGraphic = null;
- blankArtwork = null;
- defaultMainWindowCapability = null;
- currentScreenData = null;
- isDirty = false;
- updateOperation = null;
-
- // Cancel the operations
- if (transactionQueue != null) {
- transactionQueue.close();
- transactionQueue = null;
- }
-
- // remove listeners
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- if (internalInterface.getSystemCapabilityManager() != null) {
- internalInterface.getSystemCapabilityManager().removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
- }
-
- super.dispose();
- }
-
- private Queue newTransactionQueue() {
- Queue queue = internalInterface.getTaskmaster().createQueue("TextAndGraphicManager", 3, false);
- queue.pause();
- return queue;
- }
-
- // Suspend the queue if the WindowCapabilities are null
- // OR if the HMI level is NONE since we want to delay sending RPCs until we're in non-NONE
- private void updateTransactionQueueSuspended() {
- if (defaultMainWindowCapability == null || HMILevel.HMI_NONE.equals(currentHMILevel)) {
- DebugTool.logInfo(TAG, String.format("Suspending the transaction queue. Current HMI level is NONE: %b, window capabilities are null: %b", HMILevel.HMI_NONE.equals(currentHMILevel), defaultMainWindowCapability == null));
- transactionQueue.pause();
- } else {
- DebugTool.logInfo(TAG, "Starting the transaction queue");
- transactionQueue.resume();
- }
- }
-
- // Upload / Send
-
- protected void update(CompletionListener listener) {
- // check if is batch update
- if (batchingUpdates) {
- return;
- }
- if (isDirty) {
- isDirty = false;
- sdlUpdate(true, listener);
- } else if (listener != null) {
- listener.onComplete(true);
- }
- }
-
- private synchronized void sdlUpdate(Boolean supersedePreviousOperations, final CompletionListener listener) {
- if (this.transactionQueue.getTasksAsList().size() > 0 && supersedePreviousOperations) {
- // Transactions already in queue, we need to clear it out
- transactionQueue.clear();
- updateOperation = null;
- if (currentOperationListener != null) {
- currentOperationListener.onComplete(false);
- }
- }
-
- // Task can be READY, about to start and popped of the queue, so we have to cancel it, to prevent it from starting
- if (updateOperation != null && updateOperation.getState() == Task.READY && supersedePreviousOperations) {
- updateOperation.cancelTask();
- if (currentOperationListener != null) {
- currentOperationListener.onComplete(false);
- }
- }
-
- // If Task is IN_PROGRESS, it’s not on the queue, we need to mark it as cancelled. The task will return at some point when it checks its status and call the listener back
- if (updateOperation != null && updateOperation.getState() == Task.IN_PROGRESS && supersedePreviousOperations) {
- updateOperation.cancelTask();
- }
-
- currentOperationListener = listener;
-
- CurrentScreenDataUpdatedListener currentScreenDataUpdateListener = new CurrentScreenDataUpdatedListener() {
- @Override
- public void onUpdate(TextAndGraphicState newScreenData) {
- if(newScreenData != null) {
- // Update our current screen data
- currentScreenData = newScreenData;
- updatePendingOperationsWithNewScreenData();
- }
- }
-
- @Override
- public void onError() {
- // Invalidate data that's different from our current screen data
- resetFieldsToCurrentScreenData();
- }
- };
-
- updateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager.get(), defaultMainWindowCapability, currentScreenData, currentState(), currentOperationListener, currentScreenDataUpdateListener);
- transactionQueue.add(updateOperation, false);
- }
-
- void resetFieldsToCurrentScreenData() {
- textField1 = currentScreenData.getTextField1();
- textField2 = currentScreenData.getTextField2();
- textField3 = currentScreenData.getTextField3();
- textField4 = currentScreenData.getTextField4();
- mediaTrackTextField = currentScreenData.getMediaTrackTextField();
- title = currentScreenData.getTitle();
- textAlignment = currentScreenData.getTextAlignment();
- textField1Type = currentScreenData.getTextField1Type();
- textField2Type = currentScreenData.getTextField2Type();
- textField3Type = currentScreenData.getTextField3Type();
- textField4Type = currentScreenData.getTextField4Type();
- primaryGraphic = currentScreenData.getPrimaryGraphic();
- secondaryGraphic = currentScreenData.getSecondaryGraphic();
- templateConfiguration = currentScreenData.getTemplateConfiguration();
- }
-
- //Updates pending task with current screen data
- void updatePendingOperationsWithNewScreenData() {
- for (Task task : transactionQueue.getTasksAsList()) {
- if (!(task instanceof TextAndGraphicUpdateOperation)) {
- continue;
- }
- ((TextAndGraphicUpdateOperation) task).setCurrentScreenData(currentScreenData);
- }
- if (this.softButtonManager.get() != null && currentScreenData.getTextField1() != null) {
- this.softButtonManager.get().setCurrentMainField1(currentScreenData.getTextField1());
- }
- }
-
- interface CurrentScreenDataUpdatedListener {
- void onUpdate(TextAndGraphicState newState);
- void onError();
- }
-
-
- private List<String> findNonNullTextFields() {
- List<String> array = new ArrayList<>();
-
- if (textField1 != null) {
- array.add(textField1);
- }
-
- if (textField2 != null) {
- array.add(textField2);
- }
-
- if (textField3 != null) {
- array.add(textField3);
- }
-
- if (textField4 != null) {
- array.add(textField4);
- }
-
- if (title != null) {
- array.add(title);
- }
-
- if (mediaTrackTextField != null) {
- array.add(mediaTrackTextField);
- }
-
- return array;
- }
-
- Boolean hasData() {
- boolean hasTextFields = (findNonNullTextFields().size() > 0);
- boolean hasImageFields = (primaryGraphic != null) || (secondaryGraphic != null);
-
- return hasTextFields || hasImageFields;
- }
-
- abstract SdlArtwork getBlankArtwork();
-
-
- // Convert to State
-
- TextAndGraphicState currentState() {
- return new TextAndGraphicState(textField1, textField2, textField3, textField4, mediaTrackTextField,
- title, primaryGraphic, secondaryGraphic, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type, templateConfiguration);
- }
-
- // Getters / Setters
-
- void setTextAlignment(TextAlignment textAlignment) {
- this.textAlignment = textAlignment;
- // If we aren't batching, send the update immediately, if we are, set ourselves as dirty (so we know we should send an update after the batch ends)
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- TextAlignment getTextAlignment() {
- return textAlignment;
- }
-
- void setMediaTrackTextField(String mediaTrackTextField) {
- this.mediaTrackTextField = mediaTrackTextField;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getMediaTrackTextField() {
- return mediaTrackTextField;
- }
-
- void setTextField1(String textField1) {
- this.textField1 = textField1;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getTextField1() {
- return textField1;
- }
-
- void setTextField2(String textField2) {
- this.textField2 = textField2;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getTextField2() {
- return textField2;
- }
-
- void setTextField3(String textField3) {
- this.textField3 = textField3;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getTextField3() {
- return textField3;
- }
-
- void setTextField4(String textField4) {
- this.textField4 = textField4;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getTextField4() {
- return textField4;
- }
-
- void setTextField1Type(MetadataType textField1Type) {
- this.textField1Type = textField1Type;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- MetadataType getTextField1Type() {
- return textField1Type;
- }
-
- void setTextField2Type(MetadataType textField2Type) {
- this.textField2Type = textField2Type;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- MetadataType getTextField2Type() {
- return textField2Type;
- }
-
- void setTextField3Type(MetadataType textField3Type) {
- this.textField3Type = textField3Type;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- MetadataType getTextField3Type() {
- return textField3Type;
- }
-
- void setTextField4Type(MetadataType textField4Type) {
- this.textField4Type = textField4Type;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- MetadataType getTextField4Type() {
- return textField4Type;
- }
-
- void setTitle(String title) {
- this.title = title;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- String getTitle() {
- return title;
- }
-
- void setPrimaryGraphic(SdlArtwork primaryGraphic) {
- this.primaryGraphic = primaryGraphic;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- SdlArtwork getPrimaryGraphic() {
- return primaryGraphic;
- }
-
- void setSecondaryGraphic(SdlArtwork secondaryGraphic) {
- this.secondaryGraphic = secondaryGraphic;
- if (!batchingUpdates) {
- sdlUpdate(true, null);
- } else {
- isDirty = true;
- }
- }
-
- /**
- * Change the current layout to a new layout and optionally update the layout's night and day color schemes.
- * The values set for the text, graphics, buttons and template title persist between layout changes.
- * To update the text, graphics, buttons and template title at the same time as the template, batch all the updates between beginTransaction and commit.
- * If the layout update fails while batching, then the updated text, graphics, buttons or template title will also not be updated.
- *
- * @param templateConfiguration The new configuration of the template, including the layout and color scheme.
- * @param listener A listener that will be called when the layout change finished.
- */
- void changeLayout(TemplateConfiguration templateConfiguration, CompletionListener listener) {
- setTemplateConfiguration(templateConfiguration);
- if(!batchingUpdates) {
- sdlUpdate(true, listener);
- } else {
- isDirty = true;
- }
- }
-
- TemplateConfiguration getTemplateConfiguration() {
- return templateConfiguration;
- }
-
- void setTemplateConfiguration(TemplateConfiguration templateConfiguration) {
- // Don't do the `isBatchingUpdates` like elsewhere because the call is already handled in `changeLayout(TemplateConfiguration templateConfiguration, CompletionListener listener) `
- this.templateConfiguration = templateConfiguration;
- }
-
- SdlArtwork getSecondaryGraphic() {
- return secondaryGraphic;
- }
-
- void setBatchUpdates(boolean batching) {
- this.batchingUpdates = batching;
- }
-
- private void addListeners() {
- // add listener
- hmiListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
- if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- return;
- }
- currentHMILevel = onHMIStatus.getHmiLevel();
- updateTransactionQueueSuspended();
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
- onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- // instead of using the parameter it's more safe to use the convenience method
- List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
- if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError(TAG, "TextAndGraphic Manager - Capabilities sent here are null or empty");
- defaultMainWindowCapability = null;
- } else {
- DisplayCapability display = capabilities.get(0);
- for (WindowCapability windowCapability : display.getWindowCapabilities()) {
- int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- // Check if the window capability is equal to the one we already have. If it is, abort.
- if(defaultMainWindowCapability != null && defaultMainWindowCapability.getStore().equals(windowCapability.getStore())){
- return;
- }
- defaultMainWindowCapability = windowCapability;
- }
- }
- }
- // Update the queue's suspend state
- updateTransactionQueueSuspended();
- if (hasData()) {
- // HAX: Capability updates cannot supersede earlier updates because of the case where a developer batched a `changeLayout` call w/ T&G changes on < 6.0 systems could cause this to come in before the operation completes. That would cause the operation to report a "failure" (because it was superseded by this call) when in fact the operation didn't fail at all and is just being adjusted.
- sdlUpdate(false, null);
- }
- }
-
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, "Display Capability cannot be retrieved");
- defaultMainWindowCapability = null;
- updateTransactionQueueSuspended();
- }
- };
- if (internalInterface.getSystemCapabilityManager() != null) {
- this.internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
- }
- }
+ private static final String TAG = "TextAndGraphicManager";
+
+ boolean isDirty;
+ TextAndGraphicState currentScreenData;
+ HMILevel currentHMILevel;
+ private final WeakReference<SoftButtonManager> softButtonManager;
+ WindowCapability defaultMainWindowCapability;
+ private boolean batchingUpdates;
+ private final WeakReference<FileManager> fileManager;
+ SdlArtwork blankArtwork;
+ private OnRPCNotificationListener hmiListener;
+ private OnSystemCapabilityListener onDisplaysCapabilityListener;
+ private SdlArtwork primaryGraphic, secondaryGraphic;
+ private TextAlignment textAlignment;
+ private String textField1, textField2, textField3, textField4, mediaTrackTextField, title;
+ private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
+ private TemplateConfiguration templateConfiguration;
+ TextAndGraphicUpdateOperation updateOperation;
+ private CompletionListener currentOperationListener;
+ Queue transactionQueue;
+
+ //Constructors
+
+ BaseTextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
+ // set class vars
+ super(internalInterface);
+ this.fileManager = new WeakReference<>(fileManager);
+ this.softButtonManager = new WeakReference<>(softButtonManager);
+ batchingUpdates = false;
+ isDirty = false;
+ textAlignment = CENTERED;
+ currentHMILevel = HMILevel.HMI_NONE;
+ currentScreenData = new TextAndGraphicState();
+ this.transactionQueue = newTransactionQueue();
+ addListeners();
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ transitionToState(READY);
+ super.start(listener);
+ }
+
+ @Override
+ public void dispose() {
+ textField1 = null;
+ textField1Type = null;
+ textField2 = null;
+ textField2Type = null;
+ textField3 = null;
+ textField3Type = null;
+ textField4 = null;
+ textField4Type = null;
+ mediaTrackTextField = null;
+ title = null;
+ textAlignment = null;
+ primaryGraphic = null;
+ secondaryGraphic = null;
+ blankArtwork = null;
+ defaultMainWindowCapability = null;
+ currentScreenData = null;
+ isDirty = false;
+ updateOperation = null;
+
+ // Cancel the operations
+ if (transactionQueue != null) {
+ transactionQueue.close();
+ transactionQueue = null;
+ }
+
+ // remove listeners
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ internalInterface.getSystemCapabilityManager().removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ }
+
+ super.dispose();
+ }
+
+ private Queue newTransactionQueue() {
+ Queue queue = internalInterface.getTaskmaster().createQueue("TextAndGraphicManager", 3, false);
+ queue.pause();
+ return queue;
+ }
+
+ // Suspend the queue if the WindowCapabilities are null
+ // OR if the HMI level is NONE since we want to delay sending RPCs until we're in non-NONE
+ private void updateTransactionQueueSuspended() {
+ if (defaultMainWindowCapability == null || HMILevel.HMI_NONE.equals(currentHMILevel)) {
+ DebugTool.logInfo(TAG, String.format("Suspending the transaction queue. Current HMI level is NONE: %b, window capabilities are null: %b", HMILevel.HMI_NONE.equals(currentHMILevel), defaultMainWindowCapability == null));
+ transactionQueue.pause();
+ } else {
+ DebugTool.logInfo(TAG, "Starting the transaction queue");
+ transactionQueue.resume();
+ }
+ }
+
+ // Upload / Send
+
+ protected void update(CompletionListener listener) {
+ // check if is batch update
+ if (batchingUpdates) {
+ return;
+ }
+ if (isDirty) {
+ isDirty = false;
+ sdlUpdate(true, listener);
+ } else if (listener != null) {
+ listener.onComplete(true);
+ }
+ }
+
+ private synchronized void sdlUpdate(Boolean supersedePreviousOperations, final CompletionListener listener) {
+ if (this.transactionQueue.getTasksAsList().size() > 0 && supersedePreviousOperations) {
+ // Transactions already in queue, we need to clear it out
+ transactionQueue.clear();
+ updateOperation = null;
+ if (currentOperationListener != null) {
+ currentOperationListener.onComplete(false);
+ }
+ }
+
+ // Task can be READY, about to start and popped of the queue, so we have to cancel it, to prevent it from starting
+ if (updateOperation != null && updateOperation.getState() == Task.READY && supersedePreviousOperations) {
+ updateOperation.cancelTask();
+ if (currentOperationListener != null) {
+ currentOperationListener.onComplete(false);
+ }
+ }
+
+ // If Task is IN_PROGRESS, it’s not on the queue, we need to mark it as cancelled. The task will return at some point when it checks its status and call the listener back
+ if (updateOperation != null && updateOperation.getState() == Task.IN_PROGRESS && supersedePreviousOperations) {
+ updateOperation.cancelTask();
+ }
+
+ currentOperationListener = listener;
+
+ CurrentScreenDataUpdatedListener currentScreenDataUpdateListener = new CurrentScreenDataUpdatedListener() {
+ @Override
+ public void onUpdate(TextAndGraphicState newScreenData) {
+ if (newScreenData != null) {
+ // Update our current screen data
+ currentScreenData = newScreenData;
+ updatePendingOperationsWithNewScreenData();
+ }
+ }
+
+ @Override
+ public void onError() {
+ // Invalidate data that's different from our current screen data
+ resetFieldsToCurrentScreenData();
+ }
+ };
+
+ updateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager.get(), defaultMainWindowCapability, currentScreenData, currentState(), currentOperationListener, currentScreenDataUpdateListener);
+ transactionQueue.add(updateOperation, false);
+ }
+
+ void resetFieldsToCurrentScreenData() {
+ textField1 = currentScreenData.getTextField1();
+ textField2 = currentScreenData.getTextField2();
+ textField3 = currentScreenData.getTextField3();
+ textField4 = currentScreenData.getTextField4();
+ mediaTrackTextField = currentScreenData.getMediaTrackTextField();
+ title = currentScreenData.getTitle();
+ textAlignment = currentScreenData.getTextAlignment();
+ textField1Type = currentScreenData.getTextField1Type();
+ textField2Type = currentScreenData.getTextField2Type();
+ textField3Type = currentScreenData.getTextField3Type();
+ textField4Type = currentScreenData.getTextField4Type();
+ primaryGraphic = currentScreenData.getPrimaryGraphic();
+ secondaryGraphic = currentScreenData.getSecondaryGraphic();
+ templateConfiguration = currentScreenData.getTemplateConfiguration();
+ }
+
+ //Updates pending task with current screen data
+ void updatePendingOperationsWithNewScreenData() {
+ for (Task task : transactionQueue.getTasksAsList()) {
+ if (!(task instanceof TextAndGraphicUpdateOperation)) {
+ continue;
+ }
+ ((TextAndGraphicUpdateOperation) task).setCurrentScreenData(currentScreenData);
+ }
+ if (this.softButtonManager.get() != null && currentScreenData.getTextField1() != null) {
+ this.softButtonManager.get().setCurrentMainField1(currentScreenData.getTextField1());
+ }
+ }
+
+ interface CurrentScreenDataUpdatedListener {
+ void onUpdate(TextAndGraphicState newState);
+
+ void onError();
+ }
+
+
+ private List<String> findNonNullTextFields() {
+ List<String> array = new ArrayList<>();
+
+ if (textField1 != null) {
+ array.add(textField1);
+ }
+
+ if (textField2 != null) {
+ array.add(textField2);
+ }
+
+ if (textField3 != null) {
+ array.add(textField3);
+ }
+
+ if (textField4 != null) {
+ array.add(textField4);
+ }
+
+ if (title != null) {
+ array.add(title);
+ }
+
+ if (mediaTrackTextField != null) {
+ array.add(mediaTrackTextField);
+ }
+
+ return array;
+ }
+
+ Boolean hasData() {
+ boolean hasTextFields = (findNonNullTextFields().size() > 0);
+ boolean hasImageFields = (primaryGraphic != null) || (secondaryGraphic != null);
+
+ return hasTextFields || hasImageFields;
+ }
+
+ abstract SdlArtwork getBlankArtwork();
+
+
+ // Convert to State
+
+ TextAndGraphicState currentState() {
+ return new TextAndGraphicState(textField1, textField2, textField3, textField4, mediaTrackTextField,
+ title, primaryGraphic, secondaryGraphic, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type, templateConfiguration);
+ }
+
+ // Getters / Setters
+
+ void setTextAlignment(TextAlignment textAlignment) {
+ this.textAlignment = textAlignment;
+ // If we aren't batching, send the update immediately, if we are, set ourselves as dirty (so we know we should send an update after the batch ends)
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ TextAlignment getTextAlignment() {
+ return textAlignment;
+ }
+
+ void setMediaTrackTextField(String mediaTrackTextField) {
+ this.mediaTrackTextField = mediaTrackTextField;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getMediaTrackTextField() {
+ return mediaTrackTextField;
+ }
+
+ void setTextField1(String textField1) {
+ this.textField1 = textField1;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getTextField1() {
+ return textField1;
+ }
+
+ void setTextField2(String textField2) {
+ this.textField2 = textField2;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getTextField2() {
+ return textField2;
+ }
+
+ void setTextField3(String textField3) {
+ this.textField3 = textField3;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getTextField3() {
+ return textField3;
+ }
+
+ void setTextField4(String textField4) {
+ this.textField4 = textField4;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getTextField4() {
+ return textField4;
+ }
+
+ void setTextField1Type(MetadataType textField1Type) {
+ this.textField1Type = textField1Type;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ MetadataType getTextField1Type() {
+ return textField1Type;
+ }
+
+ void setTextField2Type(MetadataType textField2Type) {
+ this.textField2Type = textField2Type;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ MetadataType getTextField2Type() {
+ return textField2Type;
+ }
+
+ void setTextField3Type(MetadataType textField3Type) {
+ this.textField3Type = textField3Type;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ MetadataType getTextField3Type() {
+ return textField3Type;
+ }
+
+ void setTextField4Type(MetadataType textField4Type) {
+ this.textField4Type = textField4Type;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ MetadataType getTextField4Type() {
+ return textField4Type;
+ }
+
+ void setTitle(String title) {
+ this.title = title;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ String getTitle() {
+ return title;
+ }
+
+ void setPrimaryGraphic(SdlArtwork primaryGraphic) {
+ this.primaryGraphic = primaryGraphic;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ SdlArtwork getPrimaryGraphic() {
+ return primaryGraphic;
+ }
+
+ void setSecondaryGraphic(SdlArtwork secondaryGraphic) {
+ this.secondaryGraphic = secondaryGraphic;
+ if (!batchingUpdates) {
+ sdlUpdate(true, null);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ /**
+ * Change the current layout to a new layout and optionally update the layout's night and day color schemes.
+ * The values set for the text, graphics, buttons and template title persist between layout changes.
+ * To update the text, graphics, buttons and template title at the same time as the template, batch all the updates between beginTransaction and commit.
+ * If the layout update fails while batching, then the updated text, graphics, buttons or template title will also not be updated.
+ *
+ * @param templateConfiguration The new configuration of the template, including the layout and color scheme.
+ * @param listener A listener that will be called when the layout change finished.
+ */
+ void changeLayout(TemplateConfiguration templateConfiguration, CompletionListener listener) {
+ setTemplateConfiguration(templateConfiguration);
+ if (!batchingUpdates) {
+ sdlUpdate(true, listener);
+ } else {
+ isDirty = true;
+ }
+ }
+
+ TemplateConfiguration getTemplateConfiguration() {
+ return templateConfiguration;
+ }
+
+ void setTemplateConfiguration(TemplateConfiguration templateConfiguration) {
+ // Don't do the `isBatchingUpdates` like elsewhere because the call is already handled in `changeLayout(TemplateConfiguration templateConfiguration, CompletionListener listener) `
+ this.templateConfiguration = templateConfiguration;
+ }
+
+ SdlArtwork getSecondaryGraphic() {
+ return secondaryGraphic;
+ }
+
+ void setBatchUpdates(boolean batching) {
+ this.batchingUpdates = batching;
+ }
+
+ private void addListeners() {
+ // add listener
+ hmiListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
+ updateTransactionQueueSuspended();
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError(TAG, "TextAndGraphic Manager - Capabilities sent here are null or empty");
+ defaultMainWindowCapability = null;
+ } else {
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ // Check if the window capability is equal to the one we already have. If it is, abort.
+ if (defaultMainWindowCapability != null && defaultMainWindowCapability.getStore().equals(windowCapability.getStore())) {
+ return;
+ }
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
+ }
+ // Update the queue's suspend state
+ updateTransactionQueueSuspended();
+ if (hasData()) {
+ // HAX: Capability updates cannot supersede earlier updates because of the case where a developer batched a `changeLayout` call w/ T&G changes on < 6.0 systems could cause this to come in before the operation completes. That would cause the operation to report a "failure" (because it was superseded by this call) when in fact the operation didn't fail at all and is just being adjusted.
+ sdlUpdate(false, null);
+ }
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
+ updateTransactionQueueSuspended();
+ }
+ };
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ this.internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java
index ba2910307..434eff4d1 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/OnButtonListener.java
@@ -11,6 +11,7 @@ public interface OnButtonListener {
/**
* Returns when a Subscribed button is pressed
+ *
* @param buttonName - Name of Button
* @param buttonPress - OnButtonPress
*/
@@ -18,6 +19,7 @@ public interface OnButtonListener {
/**
* Returns when a Subscribed button Event has occurred
+ *
* @param buttonName - Name of Button
* @param buttonEvent - OnButtonEvent
*/
@@ -25,6 +27,7 @@ public interface OnButtonListener {
/**
* Returns when there is an error with subscribing to button
+ *
* @param info - Error info
*/
void onError(String info);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
index 6f8a9593e..e401f8824 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
@@ -47,6 +47,7 @@ import java.util.List;
* SoftButtonObject defines a button that can have multiple SoftButtonState values.<br>
* The states of SoftButtonObject allow the developer to not have to manage multiple SoftButtons that have very similar functionality.<br>
* For example, a repeat button in a music app can be thought of as one SoftButtonObject with three typical states: repeat off, repeat 1, and repeat on.<br>
+ *
* @see SoftButtonState
*/
public class SoftButtonObject {
@@ -63,11 +64,12 @@ public class SoftButtonObject {
/**
* Create a new instance of the SoftButtonObject with multiple states
- * @param name a String value represents name of the object
- * @param states a list of SoftButtonState represents the SoftButtonState values for the object. <strong>states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.</strong>
+ *
+ * @param name a String value represents name of the object
+ * @param states a list of SoftButtonState represents the SoftButtonState values for the object. <strong>states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.</strong>
* @param initialStateName a String value represents the name for the initial state
- * @param onEventListener a listener that has a callback that will be triggered when a button event happens
- * Note: the initialStateName should match exactly the name of one of the states for the object. Otherwise an exception will be thrown.
+ * @param onEventListener a listener that has a callback that will be triggered when a button event happens
+ * Note: the initialStateName should match exactly the name of one of the states for the object. Otherwise an exception will be thrown.
*/
public SoftButtonObject(@NonNull String name, @NonNull List<SoftButtonState> states, @NonNull String initialStateName, OnEventListener onEventListener) {
@@ -86,8 +88,9 @@ public class SoftButtonObject {
/**
* Create a new instance of the SoftButtonObject with one state
- * @param name a String value represents name of the object
- * @param state a SoftButtonState represents state for the object
+ *
+ * @param name a String value represents name of the object
+ * @param state a SoftButtonState represents state for the object
* @param onEventListener a listener that has a callback that will be triggered when a button event happens
*/
public SoftButtonObject(@NonNull String name, @NonNull SoftButtonState state, OnEventListener onEventListener) {
@@ -96,8 +99,9 @@ public class SoftButtonObject {
/**
* Create a new instance of the SoftButtonObject with one state
- * @param name a String value represents name of the object
- * @param artwork a SdlArtwork to be displayed on the button
+ *
+ * @param name a String value represents name of the object
+ * @param artwork a SdlArtwork to be displayed on the button
* @param onEventListener a listener that has a callback that will be triggered when a button event happens
*/
public SoftButtonObject(@NonNull String name, @NonNull String text, SdlArtwork artwork, OnEventListener onEventListener) {
@@ -106,6 +110,7 @@ public class SoftButtonObject {
/**
* Transition the SoftButtonObject to a specific state
+ *
* @param newStateName a String value represents the name fo the state that we want to transition the SoftButtonObject to
* @return a boolean value that represents whether the transition succeeded or failed
*/
@@ -155,6 +160,7 @@ public class SoftButtonObject {
/**
* Get the current state for the SoftButtonObject
+ *
* @return a SoftButtonState represents the current state
*/
public SoftButtonState getCurrentState() {
@@ -167,6 +173,7 @@ public class SoftButtonObject {
/**
* Get the SoftButton object for the current state
+ *
* @return a SoftButton object that is associated with the current state
*/
public SoftButton getCurrentStateSoftButton() {
@@ -182,6 +189,7 @@ public class SoftButtonObject {
/**
* Find and get the SoftButtonState that has the provided name
+ *
* @param stateName a String value that represents the name of the state
* @return a SoftButtonState object that represents the state that has the provided name
*/
@@ -198,6 +206,7 @@ public class SoftButtonObject {
/**
* Check if two SoftButtonState have the same name
+ *
* @param states a list of SoftButtonState
* @return a boolean value that represents whether we have two states with the same name
*/
@@ -215,6 +224,7 @@ public class SoftButtonObject {
/**
* Set the SoftButtonManager's update listener
+ *
* @param updateListener the SoftButtonManager.UpdateListener object
*/
protected void setUpdateListener(UpdateListener updateListener) {
@@ -223,6 +233,7 @@ public class SoftButtonObject {
/**
* Get the name of the SoftButtonObject
+ *
* @return a String that represents the name of the SoftButtonObject
*/
public String getName() {
@@ -231,6 +242,7 @@ public class SoftButtonObject {
/**
* Set the name of the SoftButtonObject
+ *
* @param name a String that represents the name of the SoftButtonObject
*/
public void setName(@NonNull String name) {
@@ -239,6 +251,7 @@ public class SoftButtonObject {
/**
* Get the SoftButtonState list
+ *
* @return a list of the object's soft button states
*/
public List<SoftButtonState> getStates() {
@@ -247,6 +260,7 @@ public class SoftButtonObject {
/**
* Set the the SoftButtonState list
+ *
* @param states a list of the object's soft button states. <strong>states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.</strong>
*/
public void setStates(@NonNull List<SoftButtonState> states) {
@@ -255,6 +269,7 @@ public class SoftButtonObject {
/**
* Get the name of the current state
+ *
* @return a String that represents the name of the current state
*/
public String getCurrentStateName() {
@@ -263,6 +278,7 @@ public class SoftButtonObject {
/**
* Set the name of the current state
+ *
* @param currentStateName a String that represents the name of the current state
*/
public void setCurrentStateName(@NonNull String currentStateName) {
@@ -271,6 +287,7 @@ public class SoftButtonObject {
/**
* Get the id of the SoftButtonObject
+ *
* @return an int value that represents the id of the SoftButtonObject
*/
public int getButtonId() {
@@ -281,10 +298,11 @@ public class SoftButtonObject {
* Sets the id of the SoftButtonObject <br>
* <strong>Note: If the developer did not set buttonId, the manager will automatically assign an id before the SoftButtons are sent to the head unit.
* Please note that the manager may reuse ids from previous batch of SoftButtons that were already sent to the head unit</strong>
+ *
* @param buttonId an int value that represents the id of the SoftButtonObject
*/
public void setButtonId(int buttonId) {
- if (buttonId < SOFT_BUTTON_ID_MIN_VALUE){
+ if (buttonId < SOFT_BUTTON_ID_MIN_VALUE) {
DebugTool.logError(TAG, "buttonId has to be equal or more than " + SOFT_BUTTON_ID_MIN_VALUE);
return;
}
@@ -293,6 +311,7 @@ public class SoftButtonObject {
/**
* Get the event listener for the SoftButtonObject
+ *
* @return OnEventListener
*/
public OnEventListener getOnEventListener() {
@@ -301,14 +320,16 @@ public class SoftButtonObject {
/**
* Set the event listener for the SoftButtonObject
+ *
* @param onEventListener a listener that has a callback that will be triggered when a button event happens
*/
public void setOnEventListener(OnEventListener onEventListener) {
this.onEventListener = onEventListener;
}
- public interface OnEventListener{
+ public interface OnEventListener {
void onPress(SoftButtonObject softButtonObject, OnButtonPress onButtonPress);
+
void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEvent);
}
@@ -324,6 +345,7 @@ public class SoftButtonObject {
/**
* Used to compile hashcode for SoftButtonsObjects for use to compare in equals method
+ *
* @return Custom hashcode of SoftButtonObjects variables
*/
@Override
@@ -339,6 +361,7 @@ public class SoftButtonObject {
/**
* Uses our custom hashCode for SoftButtonObject objects
+ *
* @param o - The object to compare
* @return boolean of whether the objects are the same or not
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
index 9c6a7d2d4..2f5daaba6 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
@@ -44,6 +44,7 @@ import com.smartdevicelink.util.DebugTool;
* Defines an individual state for SoftButtonObject.<br>
* The states of SoftButtonObject allow the developer to not have to manage multiple SoftButtons that have very similar functionality.<br>
* For example, a repeat button in a music app can be thought of as one SoftButtonObject with three typical states: repeat off, repeat 1, and repeat on.<br>
+ *
* @see SoftButtonObject
*/
public class SoftButtonState {
@@ -55,8 +56,9 @@ public class SoftButtonState {
/**
* Creates a new instance of SoftButtonState
* Note: state names should be different for each SoftButtonObject
- * @param name a String value represents name of the state
- * @param text a String represents the text for the state
+ *
+ * @param name a String value represents name of the state
+ * @param text a String represents the text for the state
* @param artwork an SdlArtwork represents the artwork for the state
*/
public SoftButtonState(@NonNull String name, String text, SdlArtwork artwork) {
@@ -96,6 +98,7 @@ public class SoftButtonState {
/**
* Get the state name
+ *
* @return a String value represents the name of the state
*/
public String getName() {
@@ -104,6 +107,7 @@ public class SoftButtonState {
/**
* Set the state name
+ *
* @param name a String value represents the name of the state
*/
public void setName(@NonNull String name) {
@@ -112,40 +116,45 @@ public class SoftButtonState {
/**
* Get whether or not the button should be highlighted on the UI
+ *
* @return boolean representing whether or not the button should be highlighted
*/
- public boolean getHighlighted(){
+ public boolean getHighlighted() {
return this.getSoftButton().getIsHighlighted();
}
/**
* Set whether or not the button should be highlighted on the UI
+ *
* @param highlighted boolean representing whether or not the button should be highlighted
*/
- public void setHighlighted(boolean highlighted){
+ public void setHighlighted(boolean highlighted) {
this.getSoftButton().setIsHighlighted(highlighted);
}
/**
* Get whether selecting a SoftButton shall call a specific system action
* See {@link SystemAction}
+ *
* @return SystemAction value representing whether selecting a SoftButton shall call a specific action
*/
- public SystemAction getSystemAction(){
+ public SystemAction getSystemAction() {
return this.getSoftButton().getSystemAction();
}
/**
* Set whether selecting a SoftButton shall call a specific system action
* See {@link SystemAction}
+ *
* @param systemAction SystemAction value representing whether selecting a SoftButton shall call a specific action
*/
- public void setSystemAction(SystemAction systemAction){
+ public void setSystemAction(SystemAction systemAction) {
this.getSoftButton().setSystemAction(systemAction);
}
/**
* Get the SoftButton for the state
+ *
* @return a SoftButton object represents the SoftButton for the state
*/
public SoftButton getSoftButton() {
@@ -154,6 +163,7 @@ public class SoftButtonState {
/**
* Get the Artwork for the state
+ *
* @return an SdlArtwork object represents the artwork for the state
*/
public SdlArtwork getArtwork() {
@@ -162,18 +172,20 @@ public class SoftButtonState {
/**
* Used to compile hashcode for SoftButtonState for use to compare in equals method
+ *
* @return Custom hashcode of SoftButtonState variables
*/
@Override
public int hashCode() {
int result = 1;
result += ((getName() == null) ? 0 : Integer.rotateLeft(getName().hashCode(), 1));
- result += ((getArtwork() == null) ? 0 : Integer.rotateLeft(getArtwork().hashCode(),2));
+ result += ((getArtwork() == null) ? 0 : Integer.rotateLeft(getArtwork().hashCode(), 2));
return result;
}
/**
* Uses our custom hashCode for SoftButtonState objects
+ *
* @param o - The object to compare
* @return boolean of whether the objects are the same or not
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java
index 8cdc464b5..6dd89cd15 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java
@@ -150,7 +150,7 @@ class TextAndGraphicUpdateOperation extends Task {
}
});
- if(internalInterface.get() != null){
+ if (internalInterface.get() != null) {
internalInterface.get().sendRPC(show);
} else {
DebugTool.logInfo(TAG, "ISdl is null Text and Graphic update failed");
@@ -161,22 +161,21 @@ class TextAndGraphicUpdateOperation extends Task {
}
- private void sendSetDisplayLayoutWithTemplateConfiguration(TemplateConfiguration configuration, final CompletionListener listener){
- final SetDisplayLayout setLayout = new SetDisplayLayout().setDisplayLayout(configuration.getTemplate()).setDayColorScheme(configuration.getDayColorScheme()).setNightColorScheme(configuration.getNightColorScheme());
+ private void sendSetDisplayLayoutWithTemplateConfiguration(TemplateConfiguration configuration, final CompletionListener listener) {
+ final SetDisplayLayout setLayout = new SetDisplayLayout().setDisplayLayout(configuration.getTemplate()).setDayColorScheme(configuration.getDayColorScheme()).setNightColorScheme(configuration.getNightColorScheme());
setLayout.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if(response.getSuccess()){
+ if (response.getSuccess()) {
updateCurrentScreenDataFromSetDisplayLayout(setLayout);
- }
- else {
+ } else {
DebugTool.logInfo(TAG, "Text and Graphic SetDisplayLayout failed");
currentScreenDataUpdateListener.onError();
}
listener.onComplete(response.getSuccess());
}
});
- if(internalInterface.get() != null){
+ if (internalInterface.get() != null) {
internalInterface.get().sendRPC(setLayout);
} else {
DebugTool.logInfo(TAG, "ISdl is null Text and Graphic update failed");
@@ -560,8 +559,8 @@ class TextAndGraphicUpdateOperation extends Task {
}
// This is intentionally checking show.metadataTags.mainField1 because the tags may be in different places based on the capabilities, then check its own field in case that's the only field that's being used.
- if(show.getMetadataTags() != null){
- if(show.getMetadataTags().getMainField1() != null) {
+ if (show.getMetadataTags() != null) {
+ if (show.getMetadataTags().getMainField1() != null) {
currentScreenData.setTextField1Type(updatedState.getTextField1Type());
}
if (show.getMetadataTags().getMainField1() != null || show.getMetadataTags().getMainField2() != null) {
@@ -718,9 +717,9 @@ class TextAndGraphicUpdateOperation extends Task {
}
private Boolean shouldUpdateTemplateConfig() {
- if(updatedState.getTemplateConfiguration() == null) {
+ if (updatedState.getTemplateConfiguration() == null) {
return false;
- } else if(currentScreenData.getTemplateConfiguration() == null) {
+ } else if (currentScreenData.getTemplateConfiguration() == null) {
return true;
}
return !updatedState.getTemplateConfiguration().getStore().equals(currentScreenData.getTemplateConfiguration().getStore());
@@ -745,7 +744,7 @@ class TextAndGraphicUpdateOperation extends Task {
private void finishOperation(boolean success) {
DebugTool.logInfo(TAG, "Finishing text and graphic update operation");
- if(listener != null){
+ if (listener != null) {
listener.onComplete(success);
}
onFinished();
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java
index 5337dc1e1..3876ecaf4 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java
@@ -16,9 +16,9 @@ class TextAndGraphicState {
}
TextAndGraphicState(String textField1, String textField2, String textField3, String textField4, String mediaTrackTextField,
- String title, SdlArtwork primaryGraphic, SdlArtwork secondaryGraphic, TextAlignment textAlignment,
- MetadataType textField1Type, MetadataType textField2Type, MetadataType textField3Type, MetadataType textField4Type,
- TemplateConfiguration templateConfiguration) {
+ String title, SdlArtwork primaryGraphic, SdlArtwork secondaryGraphic, TextAlignment textAlignment,
+ MetadataType textField1Type, MetadataType textField2Type, MetadataType textField3Type, MetadataType textField4Type,
+ TemplateConfiguration templateConfiguration) {
this.textField1 = textField1;
this.textField2 = textField2;
this.textField3 = textField3;
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 b4a10ba33..70c9f2546 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
@@ -125,14 +125,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
@Override
- public void start(CompletionListener listener){
+ public void start(CompletionListener listener) {
transitionToState(CHECKING_VOICE);
checkVoiceOptional();
super.start(listener);
}
@Override
- public void dispose(){
+ public void dispose() {
// cancel the operations
transactionQueue.close();
@@ -156,14 +156,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
super.dispose();
}
- private void checkVoiceOptional(){
+ private void checkVoiceOptional() {
CheckChoiceVROptionalOperation checkChoiceVR = new CheckChoiceVROptionalOperation(internalInterface, new CheckChoiceVROptionalInterface() {
@Override
public void onCheckChoiceVROperationComplete(boolean vrOptional) {
isVROptional = vrOptional;
transitionToState(READY);
- DebugTool.logInfo(TAG, "VR is optional: "+ isVROptional);
+ DebugTool.logInfo(TAG, "VR is optional: " + isVROptional);
}
@Override
@@ -183,12 +183,13 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* Preload choices to improve performance while presenting a choice set at a later time
- * @param choices - a list of ChoiceCell objects that will be part of a choice set later
+ *
+ * @param choices - a list of ChoiceCell objects that will be part of a choice set later
* @param listener - a completion listener to inform when the operation is complete
*/
- public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){
+ public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener) {
- if (getState() == ERROR){
+ if (getState() == ERROR) {
return;
}
@@ -196,8 +197,8 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
choicesToUpload.removeAll(preloadedChoices);
choicesToUpload.removeAll(pendingPreloadChoices);
- if (choicesToUpload.size() == 0){
- if (listener != null){
+ if (choicesToUpload.size() == 0) {
+ if (listener != null) {
listener.onComplete(true);
}
return;
@@ -212,13 +213,13 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
PreloadChoicesOperation preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager.get(), displayName, defaultMainWindowCapability, isVROptional, choicesToUpload, new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (success){
+ if (success) {
preloadedChoices.addAll(choicesToUpload);
pendingPreloadChoices.removeAll(choicesToUpload);
- if (listener != null){
+ if (listener != null) {
listener.onComplete(true);
}
- }else {
+ } else {
DebugTool.logError(TAG, "There was an error pre loading choice cells");
if (listener != null) {
listener.onComplete(false);
@@ -235,9 +236,10 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* Deletes choices that were sent previously
+ *
* @param choices - A list of ChoiceCell objects
*/
- public void deleteChoices(@NonNull List<ChoiceCell> choices){
+ public void deleteChoices(@NonNull List<ChoiceCell> choices) {
if (getState() == ERROR) {
DebugTool.logWarning(TAG, "Choice Manager In Error State");
@@ -253,7 +255,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
pendingPresentationChoices.addAll(pendingPresentationSet.getChoices());
}
- if (pendingPresentOperation != null && pendingPresentOperation.getState() != Task.CANCELED && pendingPresentOperation.getState() != Task.FINISHED && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
+ if (pendingPresentOperation != null && pendingPresentOperation.getState() != Task.CANCELED && pendingPresentOperation.getState() != Task.FINISHED && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))) {
pendingPresentOperation.cancelTask();
DebugTool.logWarning(TAG, "Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
pendingPresentOperation = null;
@@ -261,13 +263,15 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Remove cells from pending and delete choices
pendingPresentationChoices.removeAll(cellsToBeRemovedFromPending);
- for (Task operation : transactionQueue.getTasksAsList()){
- if (!(operation instanceof PreloadChoicesOperation)){ continue; }
+ for (Task operation : transactionQueue.getTasksAsList()) {
+ if (!(operation instanceof PreloadChoicesOperation)) {
+ continue;
+ }
((PreloadChoicesOperation) operation).removeChoicesFromUpload(cellsToBeRemovedFromPending);
}
// Find Choices to delete
- if (cellsToBeDeleted.size() == 0){
+ if (cellsToBeDeleted.size() == 0) {
DebugTool.logInfo(TAG, "Cells to be deleted size == 0");
return;
}
@@ -276,7 +280,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
DeleteChoicesOperation deleteChoicesOperation = new DeleteChoicesOperation(internalInterface, cellsToBeDeleted, new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (!success){
+ if (!success) {
DebugTool.logError(TAG, "Failed to delete choices");
return;
}
@@ -288,11 +292,12 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* Presents a choice set
- * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
- * @param mode - The intended interaction mode
+ *
+ * @param choiceSet - The choice set to be presented. This can include Choice Cells that were preloaded or not
+ * @param mode - The intended interaction mode
* @param keyboardListener - A keyboard listener to capture user input
*/
- public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
+ public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener) {
if (getState() == ERROR) {
DebugTool.logWarning(TAG, "Choice Manager In Error State");
@@ -300,9 +305,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
// Perform additional checks against the ChoiceSet
- if (!setUpChoiceSet(choiceSet)){ return; }
+ if (!setUpChoiceSet(choiceSet)) {
+ return;
+ }
- if (this.pendingPresentationSet != null && pendingPresentOperation != null){
+ if (this.pendingPresentationSet != null && pendingPresentOperation != null) {
pendingPresentOperation.cancelTask();
DebugTool.logWarning(TAG, "Presenting a choice set while one is currently presented. Cancelling previous and continuing");
}
@@ -311,18 +318,18 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
preloadChoices(this.pendingPresentationSet.getChoices(), new CompletionListener() {
@Override
public void onComplete(boolean success) {
- if (!success){
+ if (!success) {
choiceSet.getChoiceSetSelectionListener().onError("There was an error pre-loading choice set choices");
- }else{
+ } else {
sendPresentOperation(keyboardListener, mode);
}
}
});
}
- private void sendPresentOperation(KeyboardListener keyboardListener, InteractionMode mode){
+ private void sendPresentOperation(KeyboardListener keyboardListener, InteractionMode mode) {
- if (mode == null){
+ if (mode == null) {
mode = InteractionMode.MANUAL_ONLY;
}
@@ -332,14 +339,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
ChoiceSetSelectionListener privateChoiceListener = new ChoiceSetSelectionListener() {
@Override
public void onChoiceSelected(ChoiceCell choiceCell, TriggerSource triggerSource, int rowIndex) {
- if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
- pendingPresentationSet.getChoiceSetSelectionListener().onChoiceSelected(choiceCell, triggerSource,rowIndex);
+ if (pendingPresentationSet.getChoiceSetSelectionListener() != null) {
+ pendingPresentationSet.getChoiceSetSelectionListener().onChoiceSelected(choiceCell, triggerSource, rowIndex);
}
}
@Override
public void onError(String error) {
- if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
+ if (pendingPresentationSet.getChoiceSetSelectionListener() != null) {
pendingPresentationSet.getChoiceSetSelectionListener().onError(error);
}
}
@@ -347,7 +354,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
PresentChoiceSetOperation presentOp;
- if (keyboardListener == null){
+ if (keyboardListener == null) {
// Non-searchable choice set
DebugTool.logInfo(TAG, "Creating non-searchable choice set");
presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener, nextCancelId++);
@@ -363,13 +370,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* Presents a keyboard on the Head unit to capture user input
- * @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
+ *
+ * @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
+ * @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 Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
- if (initialText == null || initialText.length() == 0){
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener) {
+ if (initialText == null || initialText.length() == 0) {
DebugTool.logError(TAG, "initialText cannot be an empty string.");
return null;
}
@@ -379,14 +387,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
return null;
}
- if (pendingPresentationSet != null && pendingPresentOperation != null){
+ if (pendingPresentationSet != null && pendingPresentOperation != null) {
pendingPresentOperation.cancelTask();
pendingPresentationSet = null;
DebugTool.logWarning(TAG, "There is a current or pending choice set, cancelling and continuing.");
}
- if (customKeyboardConfig == null){
- if (this.keyboardConfiguration != null){
+ if (customKeyboardConfig == null) {
+ if (this.keyboardConfiguration != null) {
customKeyboardConfig = this.keyboardConfiguration;
} else {
customKeyboardConfig = defaultKeyboardConfiguration();
@@ -404,9 +412,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
/**
- * 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+.
+ * 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.
+ * <p>
+ * 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`
*/
@@ -423,11 +431,15 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
// Next, attempt to cancel keyboard operations that have not yet started
- for (Task operation : transactionQueue.getTasksAsList()){
- if (!(operation instanceof PresentKeyboardOperation)){ continue; }
+ for (Task operation : transactionQueue.getTasksAsList()) {
+ if (!(operation instanceof PresentKeyboardOperation)) {
+ continue;
+ }
PresentKeyboardOperation pendingOp = (PresentKeyboardOperation) operation;
- if (!(pendingOp.getCancelID().equals(cancelID))) { continue; }
+ if (!(pendingOp.getCancelID().equals(cancelID))) {
+ continue;
+ }
pendingOp.dismissKeyboard();
break;
@@ -436,12 +448,13 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* Set a custom keyboard configuration for this session. If set to null, it will reset to default keyboard configuration.
+ *
* @param keyboardConfiguration - the custom keyboard configuration to be used when the keyboard is displayed
*/
- public void setKeyboardConfiguration(@Nullable KeyboardProperties keyboardConfiguration){
- if (keyboardConfiguration == null){
+ public void setKeyboardConfiguration(@Nullable KeyboardProperties keyboardConfiguration) {
+ if (keyboardConfiguration == null) {
this.keyboardConfiguration = defaultKeyboardConfiguration();
- } else{
+ } else {
KeyboardProperties properties = new KeyboardProperties();
properties.setLanguage((keyboardConfiguration.getLanguage() == null ? Language.EN_US : keyboardConfiguration.getLanguage()));
properties.setKeyboardLayout((keyboardConfiguration.getKeyboardLayout() == null ? KeyboardLayout.QWERTZ : keyboardConfiguration.getKeyboardLayout()));
@@ -457,50 +470,50 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
/**
* @return A set of choice cells that have been preloaded to the head unit
*/
- public HashSet<ChoiceCell> getPreloadedChoices(){
+ public HashSet<ChoiceCell> getPreloadedChoices() {
return this.preloadedChoices;
}
// CHOICE SET MANAGEMENT HELPERS
- HashSet<ChoiceCell> choicesToBeDeletedWithArray(List<ChoiceCell> choices){
+ HashSet<ChoiceCell> choicesToBeDeletedWithArray(List<ChoiceCell> choices) {
HashSet<ChoiceCell> choicesSet = new HashSet<>(choices);
choicesSet.retainAll(this.preloadedChoices);
return choicesSet;
}
- HashSet<ChoiceCell> choicesToBeRemovedFromPendingWithArray(List<ChoiceCell> choices){
+ HashSet<ChoiceCell> choicesToBeRemovedFromPendingWithArray(List<ChoiceCell> choices) {
HashSet<ChoiceCell> choicesSet = new HashSet<>(choices);
choicesSet.retainAll(this.pendingPreloadChoices);
return choicesSet;
}
- void updateIdsOnChoices(HashSet<ChoiceCell> choices){
- for (ChoiceCell cell : choices){
+ void updateIdsOnChoices(HashSet<ChoiceCell> choices) {
+ for (ChoiceCell cell : choices) {
cell.setChoiceId(this.nextChoiceId);
this.nextChoiceId++;
}
}
- private void findIdsOnChoiceSet(ChoiceSet choiceSet){
+ private void findIdsOnChoiceSet(ChoiceSet choiceSet) {
findIdsOnChoices(new HashSet<>(choiceSet.getChoices()));
}
- private void findIdsOnChoices(HashSet<ChoiceCell> choices){
- for (ChoiceCell cell : choices){
+ private void findIdsOnChoices(HashSet<ChoiceCell> choices) {
+ for (ChoiceCell cell : choices) {
ChoiceCell uploadCell = null;
- if (pendingPreloadChoices.contains(cell)){
+ if (pendingPreloadChoices.contains(cell)) {
uploadCell = findIfPresent(cell, pendingPreloadChoices);
- }else if (preloadedChoices.contains(cell)){
+ } else if (preloadedChoices.contains(cell)) {
uploadCell = findIfPresent(cell, preloadedChoices);
}
- if (uploadCell != null ){
+ if (uploadCell != null) {
cell.setChoiceId(uploadCell.getChoiceId());
}
}
}
- ChoiceCell findIfPresent(ChoiceCell cell, HashSet<ChoiceCell> set){
+ ChoiceCell findIfPresent(ChoiceCell cell, HashSet<ChoiceCell> set) {
if (set.contains(cell)) {
for (ChoiceCell setCell : set) {
if (setCell.equals(cell))
@@ -512,7 +525,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// LISTENERS
- private void addListeners(){
+ private void addListeners() {
// DISPLAY/WINDOW CAPABILITIES - via SCM
onDisplayCapabilityListener = new OnSystemCapabilityListener() {
@Override
@@ -521,7 +534,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
if (capabilities == null || capabilities.size() == 0) {
DebugTool.logError(TAG, "SoftButton Manager - Capabilities sent here are null or empty");
- }else {
+ } else {
DisplayCapability display = capabilities.get(0);
displayName = display.getDisplayName();
for (WindowCapability windowCapability : display.getWindowCapabilities()) {
@@ -535,40 +548,40 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onError(String info) {
- DebugTool.logError(TAG, "Unable to retrieve display capabilities. Many things will probably break. Info: "+ info);
+ DebugTool.logError(TAG, "Unable to retrieve display capabilities. Many things will probably break. Info: " + info);
defaultMainWindowCapability = null;
}
};
if (internalInterface.getSystemCapabilityManager() != null) {
this.internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
}
-
+
// HMI UPDATES
hmiListener = 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();
- if (currentHMILevel == HMILevel.HMI_NONE){
+ if (currentHMILevel == HMILevel.HMI_NONE) {
transactionQueue.pause();
}
- if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
+ if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE) {
transactionQueue.resume();
}
currentSystemContext = onHMIStatus.getSystemContext();
- if (currentSystemContext == SystemContext.SYSCTXT_HMI_OBSCURED || currentSystemContext == SystemContext.SYSCTXT_ALERT){
+ if (currentSystemContext == SystemContext.SYSCTXT_HMI_OBSCURED || currentSystemContext == SystemContext.SYSCTXT_ALERT) {
transactionQueue.pause();
}
- if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE){
+ if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE) {
transactionQueue.resume();
}
@@ -632,7 +645,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
return true;
}
- KeyboardProperties defaultKeyboardConfiguration(){
+ KeyboardProperties defaultKeyboardConfiguration() {
KeyboardProperties defaultProperties = new KeyboardProperties();
defaultProperties.setLanguage(Language.EN_US);
defaultProperties.setKeyboardLayout(KeyboardLayout.QWERTY);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalInterface.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalInterface.java
index f40c26e5c..1cbd59559 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalInterface.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalInterface.java
@@ -36,6 +36,7 @@
package com.smartdevicelink.managers.screen.choiceset;
interface CheckChoiceVROptionalInterface {
- void onCheckChoiceVROperationComplete(boolean vrOptional);
- void onError(String error);
+ void onCheckChoiceVROperationComplete(boolean vrOptional);
+
+ void onError(String error);
}
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 f99eebc85..ecbe795e9 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
@@ -48,113 +48,113 @@ import java.lang.ref.WeakReference;
import java.util.Collections;
class CheckChoiceVROptionalOperation extends Task {
- private static final String TAG = "CheckChoiceVROptionalOperation";
- private final CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
- private final WeakReference<ISdl> internalInterface;
- private boolean isVROptional;
+ private static final String TAG = "CheckChoiceVROptionalOperation";
+ private final CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
+ private final WeakReference<ISdl> internalInterface;
+ private boolean isVROptional;
- CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface){
- super("CheckChoiceVROptionalOperation");
- this.internalInterface = new WeakReference<>(internalInterface);
- this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
- }
+ CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface) {
+ super("CheckChoiceVROptionalOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
+ }
- @Override
- public void onExecute() {
- DebugTool.logInfo(TAG, "Choice Operation: Executing check vr optional operation");
- sendTestChoiceNoVR();
- }
+ @Override
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing check vr optional operation");
+ sendTestChoiceNoVR();
+ }
- /**
- * As VR used to me mandatory, we first will sent a choice cell WITHOUT VR. If this succeeds, we are good,
- * if not check again without.
- */
- private void sendTestChoiceNoVR() {
- CreateInteractionChoiceSet cics = testCellWithVR(false);
- cics.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- // The request was successful, now send the SDLPerformInteraction RPC
- DebugTool.logInfo(TAG, "Connected head unit supports choice cells without voice commands. " +
- "Cells without voice will be sent without voice from now on (no placeholder voice).");
- isVROptional = true;
- deleteTestChoiceSet();
- }else{
- DebugTool.logWarning(TAG, "Head unit doesn't support choices with no VR.");
- sendTestChoiceWithVR();
- }
- }
- });
+ /**
+ * As VR used to me mandatory, we first will sent a choice cell WITHOUT VR. If this succeeds, we are good,
+ * if not check again without.
+ */
+ private void sendTestChoiceNoVR() {
+ CreateInteractionChoiceSet cics = testCellWithVR(false);
+ cics.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // The request was successful, now send the SDLPerformInteraction RPC
+ DebugTool.logInfo(TAG, "Connected head unit supports choice cells without voice commands. " +
+ "Cells without voice will be sent without voice from now on (no placeholder voice).");
+ isVROptional = true;
+ deleteTestChoiceSet();
+ } else {
+ DebugTool.logWarning(TAG, "Head unit doesn't support choices with no VR.");
+ sendTestChoiceWithVR();
+ }
+ }
+ });
- if (internalInterface.get() != null) {
- internalInterface.get().sendRPC(cics);
- }
- }
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(cics);
+ }
+ }
- /**
- * The initial request failed. Try again without VR, if this fails, return and put CSM in error state
- */
- private void sendTestChoiceWithVR(){
- CreateInteractionChoiceSet cics = testCellWithVR(true);
- cics.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- // The request was successful, now send the SDLPerformInteraction RPC
- DebugTool.logWarning(TAG, "Connected head unit does not support choice cells without voice commands. " +
- "Cells without voice will be sent with placeholder voices from now on.");
- isVROptional = false;
- deleteTestChoiceSet();
- }else{
- DebugTool.logError(TAG, "Connected head unit has rejected all choice cells, choice manager disabled. Error: " + response.getInfo());
- isVROptional = false;
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onError(response.getInfo());
- }
+ /**
+ * The initial request failed. Try again without VR, if this fails, return and put CSM in error state
+ */
+ private void sendTestChoiceWithVR() {
+ CreateInteractionChoiceSet cics = testCellWithVR(true);
+ cics.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // The request was successful, now send the SDLPerformInteraction RPC
+ DebugTool.logWarning(TAG, "Connected head unit does not support choice cells without voice commands. " +
+ "Cells without voice will be sent with placeholder voices from now on.");
+ isVROptional = false;
+ deleteTestChoiceSet();
+ } else {
+ DebugTool.logError(TAG, "Connected head unit has rejected all choice cells, choice manager disabled. Error: " + response.getInfo());
+ isVROptional = false;
+ if (checkChoiceVROptionalInterface != null) {
+ checkChoiceVROptionalInterface.onError(response.getInfo());
+ }
- CheckChoiceVROptionalOperation.super.onFinished();
- }
- }
- });
+ CheckChoiceVROptionalOperation.super.onFinished();
+ }
+ }
+ });
- if (internalInterface.get() != null) {
- internalInterface.get().sendRPC(cics);
- }
- }
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(cics);
+ }
+ }
- private void deleteTestChoiceSet(){
- DeleteInteractionChoiceSet delete = createDeleteInteractionChoiceSet();
- delete.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()){
- DebugTool.logInfo(TAG, "Delete choice test set: "+ response.getSuccess());
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
- }
- } else {
- DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onError(response.getInfo());
- }
- }
- CheckChoiceVROptionalOperation.super.onFinished();
- }
- });
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(delete);
- }
- }
+ private void deleteTestChoiceSet() {
+ DeleteInteractionChoiceSet delete = createDeleteInteractionChoiceSet();
+ delete.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ DebugTool.logInfo(TAG, "Delete choice test set: " + response.getSuccess());
+ if (checkChoiceVROptionalInterface != null) {
+ checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
+ }
+ } else {
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
+ if (checkChoiceVROptionalInterface != null) {
+ checkChoiceVROptionalInterface.onError(response.getInfo());
+ }
+ }
+ CheckChoiceVROptionalOperation.super.onFinished();
+ }
+ });
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(delete);
+ }
+ }
- DeleteInteractionChoiceSet createDeleteInteractionChoiceSet(){
- return new DeleteInteractionChoiceSet(0);
- }
+ DeleteInteractionChoiceSet createDeleteInteractionChoiceSet() {
+ return new DeleteInteractionChoiceSet(0);
+ }
- CreateInteractionChoiceSet testCellWithVR(boolean hasVR){
- Choice choice = new Choice(0, "Test Cell");
- choice.setVrCommands((hasVR ? Collections.singletonList("Test VR") : null));
- choice.setIgnoreAddingVRItems(true);
- return new CreateInteractionChoiceSet(0, Collections.singletonList(choice));
- }
+ CreateInteractionChoiceSet testCellWithVR(boolean hasVR) {
+ Choice choice = new Choice(0, "Test Cell");
+ choice.setVrCommands((hasVR ? Collections.singletonList("Test VR") : null));
+ choice.setIgnoreAddingVRItems(true);
+ return new CreateInteractionChoiceSet(0, Collections.singletonList(choice));
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCell.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCell.java
index f6995279c..5e690fe0a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCell.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceCell.java
@@ -62,9 +62,9 @@ public class ChoiceCell {
/**
* Initialize the cell with text, optional artwork, and optional voice commands
*
- * @param text - The primary text of the cell
+ * @param text - The primary text of the cell
* @param voiceCommands - Strings that can be spoken by the user to activate this cell in a voice or both interaction mode
- * @param artwork - The primary artwork of the cell
+ * @param artwork - The primary artwork of the cell
*/
public ChoiceCell(@NonNull String text, List<String> voiceCommands, SdlArtwork artwork) {
setText(text);
@@ -76,11 +76,11 @@ public class ChoiceCell {
/**
* Initialize the cell with all optional items
*
- * @param text - The primary text
- * @param secondaryText - The secondary text
- * @param tertiaryText - The tertiary text
- * @param voiceCommands - Strings that can be spoken by the user to activate this cell in a voice or both interaction mode
- * @param artwork - The primary artwork of the cell
+ * @param text - The primary text
+ * @param secondaryText - The secondary text
+ * @param tertiaryText - The tertiary text
+ * @param voiceCommands - Strings that can be spoken by the user to activate this cell in a voice or both interaction mode
+ * @param artwork - The primary artwork of the cell
* @param secondaryArtwork - The secondary artwork of the cell
*/
public ChoiceCell(@NonNull String text, String secondaryText, String tertiaryText, List<String> voiceCommands, SdlArtwork artwork, SdlArtwork secondaryArtwork) {
@@ -96,6 +96,7 @@ public class ChoiceCell {
/**
* Maps to Choice.menuName. The primary text of the cell. Duplicates within an `ChoiceSet`
* are not permitted and will result in the `ChoiceSet` failing to initialize.
+ *
* @return The primary text of the cell
*/
public String getText() {
@@ -104,7 +105,7 @@ public class ChoiceCell {
/**
* @param text - Maps to Choice.menuName. The primary text of the cell. Duplicates within an `ChoiceSet`
- * are not permitted and will result in the `ChoiceSet` failing to initialize.
+ * are not permitted and will result in the `ChoiceSet` failing to initialize.
*/
void setText(@NonNull String text) {
this.text = text;
@@ -113,6 +114,7 @@ public class ChoiceCell {
/**
* Maps to Choice.secondaryText. Optional secondary text of the cell, if available. Duplicates
* within an `ChoiceSet` are permitted.
+ *
* @return Optional secondary text of the cell
*/
public String getSecondaryText() {
@@ -121,7 +123,7 @@ public class ChoiceCell {
/**
* @param secondaryText - Maps to Choice.secondaryText. Optional secondary text of the cell, if
- * available. Duplicates within an `ChoiceSet` are permitted.
+ * available. Duplicates within an `ChoiceSet` are permitted.
*/
void setSecondaryText(String secondaryText) {
this.secondaryText = secondaryText;
@@ -129,6 +131,7 @@ public class ChoiceCell {
/**
* Maps to Choice.tertiaryText. Optional tertiary text of the cell, if available. Duplicates within an `ChoiceSet` are permitted.
+ *
* @return Optional tertiary text of the cell
*/
public String getTertiaryText() {
@@ -137,7 +140,7 @@ public class ChoiceCell {
/**
* @param tertiaryText - Maps to Choice.tertiaryText. Optional tertiary text of the cell, if
- * available. Duplicates within an `ChoiceSet` are permitted.
+ * available. Duplicates within an `ChoiceSet` are permitted.
*/
void setTertiaryText(String tertiaryText) {
this.tertiaryText = tertiaryText;
@@ -149,6 +152,7 @@ public class ChoiceCell {
* item appears. However, this would be a very poor experience for a user if the choice set is
* presented as a voice only interaction or both interaction mode. Therefore, consider not setting
* this only when you know the choice set will be presented as a touch only interaction.
+ *
* @return The list of voice command strings
*/
public List<String> getVoiceCommands() {
@@ -157,10 +161,10 @@ public class ChoiceCell {
/**
* @param voiceCommands - Maps to Choice.vrCommands. Optional voice commands the user can speak to activate the cell.
- * If not set and the head unit requires it, this will be set to the number in the list that this
- * item appears. However, this would be a very poor experience for a user if the choice set is
- * presented as a voice only interaction or both interaction mode. Therefore, consider not setting
- * this only when you know the choice set will be presented as a touch only interaction.
+ * If not set and the head unit requires it, this will be set to the number in the list that this
+ * item appears. However, this would be a very poor experience for a user if the choice set is
+ * presented as a voice only interaction or both interaction mode. Therefore, consider not setting
+ * this only when you know the choice set will be presented as a touch only interaction.
*/
void setVoiceCommands(List<String> voiceCommands) {
this.voiceCommands = voiceCommands;
@@ -169,6 +173,7 @@ public class ChoiceCell {
/**
* Maps to Choice.image. Optional image for the cell. This will be uploaded before the cell is
* used when the cell is preloaded or presented for the first time.
+ *
* @return The SdlArtwork
*/
public SdlArtwork getArtwork() {
@@ -177,7 +182,7 @@ public class ChoiceCell {
/**
* @param artwork - Maps to Choice.image. Optional image for the cell. This will be uploaded
- * before the cell is used when the cell is preloaded or presented for the first time.
+ * before the cell is used when the cell is preloaded or presented for the first time.
*/
void setArtwork(SdlArtwork artwork) {
this.artwork = artwork;
@@ -186,6 +191,7 @@ public class ChoiceCell {
/**
* Maps to Choice.secondaryImage. Optional secondary image for the cell. This will be uploaded
* before the cell is used when the cell is preloaded or presented for the first time.
+ *
* @return The SdlArtwork
*/
public SdlArtwork getSecondaryArtwork() {
@@ -194,7 +200,7 @@ public class ChoiceCell {
/**
* @param secondaryArtwork - Maps to Choice.secondaryImage. Optional secondary image for the cell.
- * This will be uploaded before the cell is used when the cell is preloaded or presented for the first time.
+ * This will be uploaded before the cell is used when the cell is preloaded or presented for the first time.
*/
void setSecondaryArtwork(SdlArtwork secondaryArtwork) {
this.secondaryArtwork = secondaryArtwork;
@@ -203,6 +209,7 @@ public class ChoiceCell {
/**
* NOTE: USED INTERNALLY
* Set the choice Id.
+ *
* @param choiceId - the choice Id
*/
void setChoiceId(int choiceId) {
@@ -212,6 +219,7 @@ public class ChoiceCell {
/**
* NOTE: USED INTERNALLY
* Get the choiceId
+ *
* @return the choiceId for this Choice Cell
*/
int getChoiceId() {
@@ -232,12 +240,15 @@ public class ChoiceCell {
/**
* Uses our custom hashCode for ChoiceCell objects
+ *
* @param o - The object to compare
* @return boolean of whether the objects are the same or not
*/
@Override
public boolean equals(Object o) {
- if (o == null) { return false; }
+ if (o == null) {
+ return false;
+ }
// if this is the same memory address, its the same
if (this == o) return true;
// if this is not an instance of this class, not the same
@@ -249,12 +260,13 @@ public class ChoiceCell {
/**
* @return A string description of the cell, useful for debugging.
*/
- @Override @NonNull
+ @Override
+ @NonNull
public String toString() {
- return "ChoiceCell: ID: " + this.choiceId + " Text: " + text+ " - Secondary Text: "+ secondaryText+" - Tertiary Text: "+ tertiaryText+ " " +
- "| Artwork Names: "+ ((getArtwork() == null || getArtwork().getName() == null) ? "Primary Art null" : getArtwork().getName())
- + " Secondary Art - "+((getSecondaryArtwork() == null || getSecondaryArtwork().getName() == null) ? "Secondary Art null" : getSecondaryArtwork().getName()) +
- " | Voice Commands Size: "+ ((getVoiceCommands() == null) ? 0 : getVoiceCommands().size());
+ return "ChoiceCell: ID: " + this.choiceId + " Text: " + text + " - Secondary Text: " + secondaryText + " - Tertiary Text: " + tertiaryText + " " +
+ "| Artwork Names: " + ((getArtwork() == null || getArtwork().getName() == null) ? "Primary Art null" : getArtwork().getName())
+ + " Secondary Art - " + ((getSecondaryArtwork() == null || getSecondaryArtwork().getName() == null) ? "Secondary Art null" : getSecondaryArtwork().getName()) +
+ " | Voice Commands Size: " + ((getVoiceCommands() == null) ? 0 : getVoiceCommands().size());
}
}
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 f40b57c74..d3d938c7b 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
@@ -66,9 +66,9 @@ public class ChoiceSet {
* Initialize with a title, listener, and choices. It will use the default timeout and layout,
* all other properties (such as prompts) will be `null`.
*
- * @param title - The choice set's title
+ * @param title - The choice set's title
* @param listener - The choice set listener called after the user has interacted with your choice set
- * @param choices - The choices to be displayed to the user for interaction
+ * @param choices - The choices to be displayed to the user for interaction
*/
public ChoiceSet(@NonNull String title, @NonNull List<ChoiceCell> choices, @NonNull ChoiceSetSelectionListener listener) {
@@ -87,15 +87,15 @@ public class ChoiceSet {
/**
* Constructor with all possible properties.
*
- * @param title - The choice set's title
- * @param listener - The choice set listener called after the user has interacted with your choice set
- * @param layout - The layout of choice options (Manual/touch only)
- * @param timeout - The timeout of a touch interaction (Manual/touch only). <strong>This is set to seconds if using the screen manager.</strong>
- * @param initialPrompt - A voice prompt spoken to the user when this set is displayed
- * @param timeoutPrompt - A voice prompt spoken to the user when the set times out (Voice only)
- * @param helpPrompt - A voice prompt spoken to the user when the user asks for "help"
- * @param helpList - A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)
- * @param choices - The list of choices presented to the user either as a manual/touch interaction or via the user's voice
+ * @param title - The choice set's title
+ * @param listener - The choice set listener called after the user has interacted with your choice set
+ * @param layout - The layout of choice options (Manual/touch only)
+ * @param timeout - The timeout of a touch interaction (Manual/touch only). <strong>This is set to seconds if using the screen manager.</strong>
+ * @param initialPrompt - A voice prompt spoken to the user when this set is displayed
+ * @param timeoutPrompt - A voice prompt spoken to the user when the set times out (Voice only)
+ * @param helpPrompt - A voice prompt spoken to the user when the user asks for "help"
+ * @param helpList - A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)
+ * @param choices - The list of choices presented to the user either as a manual/touch interaction or via the user's voice
* @param customKeyboardConfiguration - Implement this in order to provide a custom keyboard configuration to just this keyboard. To apply default settings to all keyboards, see ScreenManager.setKeyboardConfiguration
*/
public ChoiceSet(@NonNull String title, @Nullable ChoiceSetLayout layout, @Nullable Integer timeout, @Nullable String initialPrompt, @Nullable String timeoutPrompt, @Nullable String helpPrompt, @Nullable List<VrHelpItem> helpList, @Nullable KeyboardProperties customKeyboardConfiguration, @NonNull List<ChoiceCell> choices, @NonNull ChoiceSetSelectionListener listener) {
@@ -108,15 +108,15 @@ public class ChoiceSet {
setCustomKeyboardConfiguration(customKeyboardConfiguration);
// Help the dev by creating TTS chunks for them
- if (initialPrompt != null){
+ if (initialPrompt != null) {
setInitialPrompt(Collections.singletonList(new TTSChunk(initialPrompt, SpeechCapabilities.TEXT)));
}
- if (timeoutPrompt != null){
+ if (timeoutPrompt != null) {
setTimeoutPrompt(Collections.singletonList(new TTSChunk(timeoutPrompt, SpeechCapabilities.TEXT)));
}
- if (helpPrompt != null){
+ if (helpPrompt != null) {
setHelpPrompt(Collections.singletonList(new TTSChunk(helpPrompt, SpeechCapabilities.TEXT)));
}
@@ -128,15 +128,15 @@ public class ChoiceSet {
/**
* Constructor with all possible properties.
*
- * @param title - The choice set's title
- * @param listener - The choice set listener called after the user has interacted with your choice set
- * @param layout - The layout of choice options (Manual/touch only)
- * @param timeout - The timeout of a touch interaction (Manual/touch only). <strong>This is set to seconds if using the screen manager.</strong>
- * @param initialPrompt - A voice prompt spoken to the user when this set is displayed
- * @param timeoutPrompt - A voice prompt spoken to the user when the set times out (Voice only)
- * @param helpPrompt - A voice prompt spoken to the user when the user asks for "help"
- * @param helpList - A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)
- * @param choices - The list of choices presented to the user either as a manual/touch interaction or via the user's voice
+ * @param title - The choice set's title
+ * @param listener - The choice set listener called after the user has interacted with your choice set
+ * @param layout - The layout of choice options (Manual/touch only)
+ * @param timeout - The timeout of a touch interaction (Manual/touch only). <strong>This is set to seconds if using the screen manager.</strong>
+ * @param initialPrompt - A voice prompt spoken to the user when this set is displayed
+ * @param timeoutPrompt - A voice prompt spoken to the user when the set times out (Voice only)
+ * @param helpPrompt - A voice prompt spoken to the user when the user asks for "help"
+ * @param helpList - A table list of text and images shown to the user during a voice recognition session for this choice set (Voice only)
+ * @param choices - The list of choices presented to the user either as a manual/touch interaction or via the user's voice
* @param customKeyboardConfiguration - Implement this in order to provide a custom keyboard configuration to just this keyboard. To apply default settings to all keyboards, see ScreenManager.setKeyboardConfiguration
*/
public ChoiceSet(@NonNull String title, @Nullable ChoiceSetLayout layout, @Nullable Integer timeout, @Nullable List<TTSChunk> initialPrompt, @Nullable List<TTSChunk> timeoutPrompt, @Nullable List<TTSChunk> helpPrompt, @Nullable List<VrHelpItem> helpList, @Nullable KeyboardProperties customKeyboardConfiguration, @NonNull List<ChoiceCell> choices, @NonNull ChoiceSetSelectionListener listener) {
@@ -168,6 +168,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.initialText. The title of the choice set, and/or the initial text on a keyboard prompt.
+ *
* @return the title
*/
public String getTitle() {
@@ -184,6 +185,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.initialPrompt. The initial prompt spoken to the user at the start of an interaction.
+ *
* @return The list of TTSChunks
*/
public List<TTSChunk> getInitialPrompt() {
@@ -200,6 +202,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.timeoutPrompt. This text is spoken when a VR interaction times out.
* If this set is presented in a manual (non-voice) only interaction, this will be ignored.
+ *
* @return - The list of TTS Chunks
*/
public List<TTSChunk> getTimeoutPrompt() {
@@ -208,7 +211,7 @@ public class ChoiceSet {
/**
* @param timeoutPrompt - Maps to PerformInteraction.timeoutPrompt. This text is spoken when a
- * VR interaction times out. If this set is presented in a manual (non-voice) only interaction, this will be ignored.
+ * VR interaction times out. If this set is presented in a manual (non-voice) only interaction, this will be ignored.
*/
public void setTimeoutPrompt(List<TTSChunk> timeoutPrompt) {
this.timeoutPrompt = timeoutPrompt;
@@ -216,6 +219,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.helpPrompt. This is the spoken string when a user speaks "help" when the interaction is occurring.
+ *
* @return The List of TTS Chunks
*/
public List<TTSChunk> getHelpPrompt() {
@@ -224,7 +228,7 @@ public class ChoiceSet {
/**
* @param helpPrompt - Maps to PerformInteraction.helpPrompt. This is the spoken string when a user
- * speaks "help" when the interaction is occurring.
+ * speaks "help" when the interaction is occurring.
*/
public void setHelpPrompt(List<TTSChunk> helpPrompt) {
this.helpPrompt = helpPrompt;
@@ -234,7 +238,7 @@ public class ChoiceSet {
* Maps to PerformInteraction.vrHelp. This is a list of help text presented to the user when
* they are in a voice recognition interaction from your choice set of options. If this set is
* presented in a touch only interaction, this will be ignored.
- *
+ * <p>
* Note: That while VRHelpItem's position will be automatically set based on position in the
* array, the image will need to uploaded by you before use using the FileManager.
*
@@ -246,11 +250,11 @@ public class ChoiceSet {
/**
* @param vrHelpList - Maps to PerformInteraction.vrHelp. This is a list of help text presented to the user when
- * they are in a voice recognition interaction from your choice set of options. If this set is
- * presented in a touch only interaction, this will be ignored.
- *
- * Note: That while SDLVRHelpItem's position will be automatically set based on position in the
- * array, the image will need to uploaded by you before use using the FileManager.
+ * they are in a voice recognition interaction from your choice set of options. If this set is
+ * presented in a touch only interaction, this will be ignored.
+ * <p>
+ * Note: That while SDLVRHelpItem's position will be automatically set based on position in the
+ * array, the image will need to uploaded by you before use using the FileManager.
*/
public void setVrHelpList(List<VrHelpItem> vrHelpList) {
this.vrHelpList = setUpHelpItems(vrHelpList);
@@ -259,6 +263,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.interactionLayout. Whether the presented choices are arranged as
* a set of tiles or a list.
+ *
* @return The ChoiceSetLayout
*/
public ChoiceSetLayout getLayout() {
@@ -267,10 +272,10 @@ public class ChoiceSet {
/**
* @param layout - Maps to PerformInteraction.interactionLayout. Whether the presented choices
- * are arranged as a set of tiles or a list.
+ * are arranged as a set of tiles or a list.
*/
public void setLayout(ChoiceSetLayout layout) {
- if (layout == null){
+ if (layout == null) {
this.layout = defaultLayout;
} else {
this.layout = layout;
@@ -280,6 +285,7 @@ public class ChoiceSet {
/**
* Maps to PerformInteraction.timeout. This applies only to a manual selection (not a voice
* selection, which has its timeout handled by the system). Defaults to `defaultTimeout`.
+ *
* @return The Timeout
*/
public Integer getTimeout() {
@@ -288,8 +294,8 @@ public class ChoiceSet {
/**
* @param timeout - Maps to PerformInteraction.timeout. This applies only to a manual selection
- * (not a voice selection, which has its timeout handled by the system). Defaults to `defaultTimeout`.
- * <strong>This is set to seconds if using the screen manager.</strong>
+ * (not a voice selection, which has its timeout handled by the system). Defaults to `defaultTimeout`.
+ * <strong>This is set to seconds if using the screen manager.</strong>
*/
public void setTimeout(Integer timeout) {
if (timeout == null) {
@@ -303,9 +309,10 @@ public class ChoiceSet {
/**
* The choices to be displayed to the user within this choice set. These choices could match
* those already preloaded
- *
+ * <p>
* This is limited to 100 items. If you attempt to set more than 100 items, the set will not
* have any items (this array will be empty).
+ *
* @return The List of ChoiceCells
*/
public List<ChoiceCell> getChoices() {
@@ -314,10 +321,10 @@ public class ChoiceSet {
/**
* @param choices - The choices to be displayed to the user within this choice set. These choices could match
- * those already preloaded
- *
- * This is limited to 100 items. If you attempt to set more than 100 items, the set will not
- * have any items (this array will be empty).
+ * those already preloaded
+ * <p>
+ * This is limited to 100 items. If you attempt to set more than 100 items, the set will not
+ * have any items (this array will be empty).
*/
public void setChoices(List<ChoiceCell> choices) {
this.choices = choices;
@@ -326,6 +333,7 @@ public class ChoiceSet {
/**
* The listener of this choice set, called when the user interacts with it.
+ *
* @return The listener
*/
public ChoiceSetSelectionListener getChoiceSetSelectionListener() {
@@ -342,6 +350,7 @@ public class ChoiceSet {
/**
* Implement this in order to provide a custom keyboard configuration to just this keyboard.
* To apply default settings to all keyboards, see ScreenManager.setKeyboardConfiguration
+ *
* @param customKeyboardConfiguration - the keyboard config used for this choice set
*/
public void setCustomKeyboardConfiguration(KeyboardProperties customKeyboardConfiguration) {
@@ -351,6 +360,7 @@ public class ChoiceSet {
/**
* Implement this in order to provide a custom keyboard configuration to just this keyboard.
* To apply default settings to all keyboards, see ScreenManager.setKeyboardConfiguration
+ *
* @return the custom keyboard configuration
*/
public KeyboardProperties getCustomKeyboardConfiguration() {
@@ -359,7 +369,7 @@ public class ChoiceSet {
// HELPERS
- private void checkChoiceSetParameters(){
+ private void checkChoiceSetParameters() {
if (DebugTool.isDebugEnabled()) {
if (getTitle() != null) {
if (getTitle().length() == 0 || getTitle().length() > 500) {
@@ -373,13 +383,13 @@ public class ChoiceSet {
}
if (getChoices() != null) {
if (getChoices().size() == 0 || getChoices().size() > 100) {
- DebugTool.logWarning(TAG, "Attempted to create a choice set with "+getChoices().size()+" choices; Only 1 - 100 choices are valid");
+ DebugTool.logWarning(TAG, "Attempted to create a choice set with " + getChoices().size() + " choices; Only 1 - 100 choices are valid");
}
}
}
}
- private List<VrHelpItem> setUpHelpItems(List<VrHelpItem> helpItems){
+ private List<VrHelpItem> setUpHelpItems(List<VrHelpItem> helpItems) {
List<VrHelpItem> clonedHelpItems = null;
VrHelpItem clonedHelpItem;
if (helpItems != null) {
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetSelectionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetSelectionListener.java
index 5f477b58a..591e1ff86 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetSelectionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetSelectionListener.java
@@ -36,5 +36,6 @@ import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
public interface ChoiceSetSelectionListener {
void onChoiceSelected(ChoiceCell choiceCell, TriggerSource triggerSource, int rowIndex);
+
void onError(String error);
}
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 ad35a1ea5..53f209eae 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
@@ -49,72 +49,72 @@ import java.util.HashSet;
import java.util.List;
class DeleteChoicesOperation extends Task {
- private static final String TAG = "DeleteChoicesOperation";
- private final WeakReference<ISdl> internalInterface;
- private final HashSet<ChoiceCell> cellsToDelete;
- private final CompletionListener completionListener;
+ private static final String TAG = "DeleteChoicesOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final HashSet<ChoiceCell> cellsToDelete;
+ private final CompletionListener completionListener;
- DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener){
- super("DeleteChoicesOperation");
- this.internalInterface = new WeakReference<>(internalInterface);
- this.cellsToDelete = cellsToDelete;
- this.completionListener = completionListener;
- }
+ DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener) {
+ super("DeleteChoicesOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.cellsToDelete = cellsToDelete;
+ this.completionListener = completionListener;
+ }
- @Override
- public void onExecute() {
- DebugTool.logInfo(TAG, "Choice Operation: Executing delete choices operation");
- sendDeletions();
- }
+ @Override
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing delete choices operation");
+ sendDeletions();
+ }
- private void sendDeletions(){
+ private void sendDeletions() {
- List<DeleteInteractionChoiceSet> deleteChoices = createDeleteSets();
+ List<DeleteInteractionChoiceSet> deleteChoices = createDeleteSets();
- if (deleteChoices.size() > 0) {
+ if (deleteChoices.size() > 0) {
- if (internalInterface.get() != null) {
- internalInterface.get().sendRPCs(deleteChoices, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
- }
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPCs(deleteChoices, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+ }
- @Override
- public void onFinished() {
- if (completionListener != null) {
- completionListener.onComplete(true);
- }
- DebugTool.logInfo(TAG, "Successfully deleted choices");
+ @Override
+ public void onFinished() {
+ if (completionListener != null) {
+ completionListener.onComplete(true);
+ }
+ DebugTool.logInfo(TAG, "Successfully deleted choices");
- DeleteChoicesOperation.super.onFinished();
- }
+ DeleteChoicesOperation.super.onFinished();
+ }
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (!response.getSuccess()) {
- if (completionListener != null) {
- completionListener.onComplete(false);
- }
- DebugTool.logError(TAG, "Failed to delete choice: " + response.getInfo() + " | Corr ID: " + correlationId);
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ DebugTool.logError(TAG, "Failed to delete choice: " + response.getInfo() + " | Corr ID: " + correlationId);
- DeleteChoicesOperation.super.onFinished();
- }
- }
- });
- }
- } else{
- if (completionListener != null) {
- completionListener.onComplete(true);
- }
- DebugTool.logInfo(TAG, "No Choices to delete, continue");
- }
- }
+ DeleteChoicesOperation.super.onFinished();
+ }
+ }
+ });
+ }
+ } else {
+ if (completionListener != null) {
+ completionListener.onComplete(true);
+ }
+ DebugTool.logInfo(TAG, "No Choices to delete, continue");
+ }
+ }
- List<DeleteInteractionChoiceSet> createDeleteSets(){
- List<DeleteInteractionChoiceSet> deleteChoices = new ArrayList<>(cellsToDelete.size());
- for (ChoiceCell cell : cellsToDelete){
- deleteChoices.add(new DeleteInteractionChoiceSet(cell.getChoiceId()));
- }
- return deleteChoices;
- }
+ List<DeleteInteractionChoiceSet> createDeleteSets() {
+ List<DeleteInteractionChoiceSet> deleteChoices = new ArrayList<>(cellsToDelete.size());
+ for (ChoiceCell cell : cellsToDelete) {
+ deleteChoices.add(new DeleteInteractionChoiceSet(cell.getChoiceId()));
+ }
+ return deleteChoices;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
index 9178e6c74..e8c44fae5 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
@@ -36,9 +36,10 @@ import java.util.List;
public interface KeyboardAutocompleteCompletionListener {
- /**
- * This listener is called when you wish to update your autocomplete suggestions list in response to the user's input
- * @param updatedAutoCompleteList - The new autocomplete suggestions list to use
- */
- void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList);
+ /**
+ * This listener is called when you wish to update your autocomplete suggestions list in response to the user's input
+ *
+ * @param updatedAutoCompleteList - The new autocomplete suggestions list to use
+ */
+ void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardCharacterSetCompletionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardCharacterSetCompletionListener.java
index 7221bf7d1..688f82794 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardCharacterSetCompletionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardCharacterSetCompletionListener.java
@@ -4,9 +4,10 @@ import java.util.List;
public interface KeyboardCharacterSetCompletionListener {
- /**
- * This listener is called when you wish to update your keyboard's limitedCharacterSet in response to the user's input
- * @param updatedCharacterSet - The new set of characters to use
- */
- void onUpdatedCharacterSet(List<String> updatedCharacterSet);
+ /**
+ * This listener is called when you wish to update your keyboard's limitedCharacterSet in response to the user's input
+ *
+ * @param updatedCharacterSet - The new set of characters to use
+ */
+ void onUpdatedCharacterSet(List<String> updatedCharacterSet);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardListener.java
index a92fafa75..175f39324 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardListener.java
@@ -38,24 +38,24 @@ public interface KeyboardListener {
/**
* The keyboard session completed with some input.
- *
- * This will be sent upon ENTRY_SUBMITTED or ENTRY_VOICE. If the event is ENTRY_VOICE, the user
- * requested to start a voice session in order to submit input to this keyboard. This MUST be
- * handled by you. Start an Audio Pass Thru session if supported.
+ * <p>
+ * This will be sent upon ENTRY_SUBMITTED or ENTRY_VOICE. If the event is ENTRY_VOICE, the user
+ * requested to start a voice session in order to submit input to this keyboard. This MUST be
+ * handled by you. Start an Audio Pass Thru session if supported.
*
* @param inputText - The submitted input text on the keyboard
- * @param event - ENTRY_SUBMITTED if the user pressed the submit button on the keyboard, ENTRY_VOICE
- * if the user requested that a voice session begin
+ * @param event - ENTRY_SUBMITTED if the user pressed the submit button on the keyboard, ENTRY_VOICE
+ * if the user requested that a voice session begin
*/
void onUserDidSubmitInput(String inputText, KeyboardEvent event);
/**
* The keyboard session aborted.
- *
+ * <p>
* This will be sent if the keyboard event ENTRY_CANCELLED or ENTRY_ABORTED is sent
*
* @param event - ENTRY_CANCELLED if the user cancelled the keyboard input, or ENTRY_ABORTED if
- * the system aborted the input due to a higher priority event
+ * the system aborted the input due to a higher priority event
*/
void onKeyboardDidAbortWithReason(KeyboardEvent event);
@@ -63,7 +63,7 @@ public interface KeyboardListener {
* Implement this in order to provide a custom keyboard configuration to just this keyboard. To
* apply default settings to all keyboards, see SDLScreenManager.keyboardConfiguration
*
- * @param currentInputText - The user's full current input text
+ * @param currentInputText - The user's full current input text
* @param keyboardAutocompleteCompletionListener - A listener to update the autoCompleteText
*/
void updateAutocompleteWithInput(String currentInputText, KeyboardAutocompleteCompletionListener keyboardAutocompleteCompletionListener);
@@ -72,7 +72,7 @@ public interface KeyboardListener {
* Implement this if you wish to update the limitedCharacterSet as the user updates their input.
* This is called upon a KEYPRESS event.
*
- * @param currentInputText - The user's full current input text
+ * @param currentInputText - The user's full current input text
* @param keyboardCharacterSetCompletionListener - A listener to update the limitedCharacterSet
*/
void updateCharacterSetWithInput(String currentInputText, KeyboardCharacterSetCompletionListener keyboardCharacterSetCompletionListener);
@@ -80,7 +80,7 @@ public interface KeyboardListener {
/**
* Implement this to be notified of all events occurring on the keyboard
*
- * @param event - The event that occurred
+ * @param event - The event that occurred
* @param currentInputText - The user's full current input text
*/
void onKeyboardDidSendEvent(KeyboardEvent event, String currentInputText);
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 7864ef8de..6bf0b7d25 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
@@ -63,216 +63,218 @@ import java.util.List;
import java.util.Map;
class PreloadChoicesOperation extends Task {
- private static final String TAG = "PreloadChoicesOperation";
- private final WeakReference<ISdl> internalInterface;
- private final WeakReference<FileManager> fileManager;
- private final WindowCapability defaultMainWindowCapability;
- private final String displayName;
- private final HashSet<ChoiceCell> cellsToUpload;
- private final CompletionListener completionListener;
- private boolean isRunning;
- private final boolean isVROptional;
- private boolean choiceError = false;
-
- PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, String displayName, WindowCapability defaultMainWindowCapability,
- Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener){
- super("PreloadChoicesOperation");
- this.internalInterface = new WeakReference<>(internalInterface);
- this.fileManager = new WeakReference<>(fileManager);
- this.displayName = displayName;
- this.defaultMainWindowCapability = defaultMainWindowCapability;
- this.isVROptional = isVROptional;
- this.cellsToUpload = cellsToPreload;
- this.completionListener = listener;
- }
-
- @Override
- public void onExecute() {
- DebugTool.logInfo(TAG, "Choice Operation: Executing preload choices operation");
- preloadCellArtworks(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- preloadCells();
- }
- });
- }
-
- void removeChoicesFromUpload(HashSet<ChoiceCell> choices){
- if (isRunning){ return; }
- cellsToUpload.removeAll(choices);
- }
-
- private void preloadCellArtworks(@NonNull final CompletionListener listener){
- isRunning = true;
-
- List<SdlArtwork> artworksToUpload = artworksToUpload();
-
- if (artworksToUpload.size() == 0){
- DebugTool.logInfo(TAG, "Choice Preload: No Choice Artworks to upload");
- listener.onComplete(true);
- isRunning = false;
- return;
- }
-
- if (fileManager.get() != null){
- fileManager.get().uploadArtworks(artworksToUpload, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- if (errors != null && errors.size() > 0){
- DebugTool.logError(TAG, "Error uploading choice cell Artworks: "+ errors.toString());
- listener.onComplete(false);
- isRunning = false;
- }else{
- DebugTool.logInfo(TAG, "Choice Artworks Uploaded");
- listener.onComplete(true);
- isRunning = false;
- }
- }
- });
- }else{
- DebugTool.logError(TAG, "File manager is null in choice preload operation");
- listener.onComplete(false);
- isRunning = false;
- }
- }
-
- private void preloadCells(){
- isRunning = true;
- List<CreateInteractionChoiceSet> choiceRPCs = new ArrayList<>(cellsToUpload.size());
- for (ChoiceCell cell : cellsToUpload){
- CreateInteractionChoiceSet csCell = choiceFromCell(cell);
- if (csCell != null){
- choiceRPCs.add(csCell);
- }
- }
-
- if (choiceRPCs.size() == 0){
- DebugTool.logError(TAG, " All Choice cells to send are null, so the choice set will not be shown");
- completionListener.onComplete(true);
- isRunning = false;
- return;
- }
-
- if (internalInterface.get() != null){
- internalInterface.get().sendRPCs(choiceRPCs, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
-
- }
-
- @Override
- public void onFinished() {
- isRunning = false;
- DebugTool.logInfo(TAG, "Finished pre loading choice cells");
- completionListener.onComplete(!choiceError);
- choiceError = false;
- PreloadChoicesOperation.super.onFinished();
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (!response.getSuccess()) {
- DebugTool.logError(TAG, "There was an error uploading a choice cell: "+ response.getInfo() + " resultCode: " + response.getResultCode());
- choiceError = true;
- }
- }
- });
- }else{
- DebugTool.logError(TAG, "Internal Interface null in preload choice operation");
- isRunning = false;
- completionListener.onComplete(false);
- }
- }
-
- private CreateInteractionChoiceSet choiceFromCell(ChoiceCell cell){
-
- List<String> vrCommands;
- if (cell.getVoiceCommands() == null){
- vrCommands = isVROptional ? null : Collections.singletonList(String.valueOf(cell.getChoiceId()));
- }else{
- vrCommands = cell.getVoiceCommands();
- }
-
- String menuName = shouldSendChoiceText() ? cell.getText() : null;
-
- if (menuName == null){
- DebugTool.logError(TAG, "Could not convert Choice Cell to CreateInteractionChoiceSet. It will not be shown. Cell: "+ cell.toString());
- return null;
- }
-
- String secondaryText = shouldSendChoiceSecondaryText() ? cell.getSecondaryText() : null;
- String tertiaryText = shouldSendChoiceTertiaryText() ? cell.getTertiaryText() : null;
-
- Image image = shouldSendChoicePrimaryImage() && cell.getArtwork() != null ? cell.getArtwork().getImageRPC() : null;
- Image secondaryImage = shouldSendChoiceSecondaryImage() && cell.getSecondaryArtwork() != null ? cell.getSecondaryArtwork().getImageRPC() : null;
-
- Choice choice = new Choice(cell.getChoiceId(), menuName);
- choice.setVrCommands(vrCommands);
- choice.setSecondaryText(secondaryText);
- choice.setTertiaryText(tertiaryText);
- choice.setIgnoreAddingVRItems(true);
-
- if (fileManager.get() != null){
- if (image != null && (cell.getArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getArtwork()))) {
- choice.setImage(image);
- }
- if (secondaryImage != null && (cell.getSecondaryArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getSecondaryArtwork()))) {
- choice.setSecondaryImage(secondaryImage);
- }
- }
-
- return new CreateInteractionChoiceSet(choice.getChoiceID(), Collections.singletonList(choice));
- }
-
- // HELPERS
- boolean shouldSendChoiceText() {
- if (this.displayName != null && this.displayName.equals(DisplayType.GEN3_8_INCH.toString())){
- return true;
- }
- return templateSupportsTextField(TextFieldName.menuName);
- }
-
- boolean shouldSendChoiceSecondaryText() {
- return templateSupportsTextField(TextFieldName.secondaryText);
- }
-
- boolean shouldSendChoiceTertiaryText() {
- return templateSupportsTextField(TextFieldName.tertiaryText);
- }
-
- boolean shouldSendChoicePrimaryImage() {
- return templateSupportsImageField(ImageFieldName.choiceImage);
- }
-
- boolean shouldSendChoiceSecondaryImage() {
- return templateSupportsImageField(ImageFieldName.choiceSecondaryImage);
- }
-
- boolean templateSupportsTextField(TextFieldName name) {
- return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(defaultMainWindowCapability, name);
- }
-
- boolean templateSupportsImageField(ImageFieldName name) {
- return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, name);
- }
-
- List<SdlArtwork> artworksToUpload(){
- List<SdlArtwork> artworksToUpload = new ArrayList<>();
- for (ChoiceCell cell : cellsToUpload){
- if (shouldSendChoicePrimaryImage() && artworkNeedsUpload(cell.getArtwork())){
- artworksToUpload.add(cell.getArtwork());
- }
- if (shouldSendChoiceSecondaryImage() && artworkNeedsUpload(cell.getSecondaryArtwork())){
- artworksToUpload.add(cell.getSecondaryArtwork());
- }
- }
- return artworksToUpload;
- }
-
- boolean artworkNeedsUpload(SdlArtwork artwork){
- if (fileManager.get() != null){
- return (artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon());
- }
- return false;
- }
+ private static final String TAG = "PreloadChoicesOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final WeakReference<FileManager> fileManager;
+ private final WindowCapability defaultMainWindowCapability;
+ private final String displayName;
+ private final HashSet<ChoiceCell> cellsToUpload;
+ private final CompletionListener completionListener;
+ private boolean isRunning;
+ private final boolean isVROptional;
+ private boolean choiceError = false;
+
+ PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, String displayName, WindowCapability defaultMainWindowCapability,
+ Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener) {
+ super("PreloadChoicesOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.fileManager = new WeakReference<>(fileManager);
+ this.displayName = displayName;
+ this.defaultMainWindowCapability = defaultMainWindowCapability;
+ this.isVROptional = isVROptional;
+ this.cellsToUpload = cellsToPreload;
+ this.completionListener = listener;
+ }
+
+ @Override
+ public void onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing preload choices operation");
+ preloadCellArtworks(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ preloadCells();
+ }
+ });
+ }
+
+ void removeChoicesFromUpload(HashSet<ChoiceCell> choices) {
+ if (isRunning) {
+ return;
+ }
+ cellsToUpload.removeAll(choices);
+ }
+
+ private void preloadCellArtworks(@NonNull final CompletionListener listener) {
+ isRunning = true;
+
+ List<SdlArtwork> artworksToUpload = artworksToUpload();
+
+ if (artworksToUpload.size() == 0) {
+ DebugTool.logInfo(TAG, "Choice Preload: No Choice Artworks to upload");
+ listener.onComplete(true);
+ isRunning = false;
+ return;
+ }
+
+ if (fileManager.get() != null) {
+ fileManager.get().uploadArtworks(artworksToUpload, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ if (errors != null && errors.size() > 0) {
+ DebugTool.logError(TAG, "Error uploading choice cell Artworks: " + errors.toString());
+ listener.onComplete(false);
+ isRunning = false;
+ } else {
+ DebugTool.logInfo(TAG, "Choice Artworks Uploaded");
+ listener.onComplete(true);
+ isRunning = false;
+ }
+ }
+ });
+ } else {
+ DebugTool.logError(TAG, "File manager is null in choice preload operation");
+ listener.onComplete(false);
+ isRunning = false;
+ }
+ }
+
+ private void preloadCells() {
+ isRunning = true;
+ List<CreateInteractionChoiceSet> choiceRPCs = new ArrayList<>(cellsToUpload.size());
+ for (ChoiceCell cell : cellsToUpload) {
+ CreateInteractionChoiceSet csCell = choiceFromCell(cell);
+ if (csCell != null) {
+ choiceRPCs.add(csCell);
+ }
+ }
+
+ if (choiceRPCs.size() == 0) {
+ DebugTool.logError(TAG, " All Choice cells to send are null, so the choice set will not be shown");
+ completionListener.onComplete(true);
+ isRunning = false;
+ return;
+ }
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPCs(choiceRPCs, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+ isRunning = false;
+ DebugTool.logInfo(TAG, "Finished pre loading choice cells");
+ completionListener.onComplete(!choiceError);
+ choiceError = false;
+ PreloadChoicesOperation.super.onFinished();
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ DebugTool.logError(TAG, "There was an error uploading a choice cell: " + response.getInfo() + " resultCode: " + response.getResultCode());
+ choiceError = true;
+ }
+ }
+ });
+ } else {
+ DebugTool.logError(TAG, "Internal Interface null in preload choice operation");
+ isRunning = false;
+ completionListener.onComplete(false);
+ }
+ }
+
+ private CreateInteractionChoiceSet choiceFromCell(ChoiceCell cell) {
+
+ List<String> vrCommands;
+ if (cell.getVoiceCommands() == null) {
+ vrCommands = isVROptional ? null : Collections.singletonList(String.valueOf(cell.getChoiceId()));
+ } else {
+ vrCommands = cell.getVoiceCommands();
+ }
+
+ String menuName = shouldSendChoiceText() ? cell.getText() : null;
+
+ if (menuName == null) {
+ DebugTool.logError(TAG, "Could not convert Choice Cell to CreateInteractionChoiceSet. It will not be shown. Cell: " + cell.toString());
+ return null;
+ }
+
+ String secondaryText = shouldSendChoiceSecondaryText() ? cell.getSecondaryText() : null;
+ String tertiaryText = shouldSendChoiceTertiaryText() ? cell.getTertiaryText() : null;
+
+ Image image = shouldSendChoicePrimaryImage() && cell.getArtwork() != null ? cell.getArtwork().getImageRPC() : null;
+ Image secondaryImage = shouldSendChoiceSecondaryImage() && cell.getSecondaryArtwork() != null ? cell.getSecondaryArtwork().getImageRPC() : null;
+
+ Choice choice = new Choice(cell.getChoiceId(), menuName);
+ choice.setVrCommands(vrCommands);
+ choice.setSecondaryText(secondaryText);
+ choice.setTertiaryText(tertiaryText);
+ choice.setIgnoreAddingVRItems(true);
+
+ if (fileManager.get() != null) {
+ if (image != null && (cell.getArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getArtwork()))) {
+ choice.setImage(image);
+ }
+ if (secondaryImage != null && (cell.getSecondaryArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getSecondaryArtwork()))) {
+ choice.setSecondaryImage(secondaryImage);
+ }
+ }
+
+ return new CreateInteractionChoiceSet(choice.getChoiceID(), Collections.singletonList(choice));
+ }
+
+ // HELPERS
+ boolean shouldSendChoiceText() {
+ if (this.displayName != null && this.displayName.equals(DisplayType.GEN3_8_INCH.toString())) {
+ return true;
+ }
+ return templateSupportsTextField(TextFieldName.menuName);
+ }
+
+ boolean shouldSendChoiceSecondaryText() {
+ return templateSupportsTextField(TextFieldName.secondaryText);
+ }
+
+ boolean shouldSendChoiceTertiaryText() {
+ return templateSupportsTextField(TextFieldName.tertiaryText);
+ }
+
+ boolean shouldSendChoicePrimaryImage() {
+ return templateSupportsImageField(ImageFieldName.choiceImage);
+ }
+
+ boolean shouldSendChoiceSecondaryImage() {
+ return templateSupportsImageField(ImageFieldName.choiceSecondaryImage);
+ }
+
+ boolean templateSupportsTextField(TextFieldName name) {
+ return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(defaultMainWindowCapability, name);
+ }
+
+ boolean templateSupportsImageField(ImageFieldName name) {
+ return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, name);
+ }
+
+ List<SdlArtwork> artworksToUpload() {
+ List<SdlArtwork> artworksToUpload = new ArrayList<>();
+ for (ChoiceCell cell : cellsToUpload) {
+ if (shouldSendChoicePrimaryImage() && artworkNeedsUpload(cell.getArtwork())) {
+ artworksToUpload.add(cell.getArtwork());
+ }
+ if (shouldSendChoiceSecondaryImage() && artworkNeedsUpload(cell.getSecondaryArtwork())) {
+ artworksToUpload.add(cell.getSecondaryArtwork());
+ }
+ }
+ return artworksToUpload;
+ }
+
+ boolean artworkNeedsUpload(SdlArtwork artwork) {
+ if (fileManager.get() != null) {
+ return (artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon());
+ }
+ return false;
+ }
} \ No newline at end of file
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 6efa1b8d1..8a502e26c 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
@@ -62,310 +62,310 @@ import java.util.ArrayList;
import java.util.List;
class PresentChoiceSetOperation extends Task {
- private static final String TAG = "PresentChoiceSetOperation";
- private final WeakReference<ISdl> internalInterface;
- private final ChoiceSet choiceSet;
- private final Integer cancelID;
- private final InteractionMode presentationMode;
- private final KeyboardProperties originalKeyboardProperties;
- private KeyboardProperties keyboardProperties;
- private ChoiceCell selectedCell;
- private TriggerSource selectedTriggerSource;
- private boolean updatedKeyboardProperties;
- private OnRPCNotificationListener keyboardRPCListener;
- private final ChoiceSetSelectionListener choiceSetSelectionListener;
- Integer selectedCellRow;
- KeyboardListener keyboardListener;
- final SdlMsgVersion sdlMsgVersion;
-
- PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
- KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID){
- super("PresentChoiceSetOperation");
- 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 onExecute() {
- DebugTool.logInfo(TAG, "Choice Operation: Executing present choice set operation");
- addListeners();
- start();
- }
-
- private void start(){
- if (getState() == Task.CANCELED) {
- 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();
- updatedKeyboardProperties = true;
- }
-
- updateKeyboardProperties(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (getState() == Task.CANCELED) {
- finishOperation();
- return;
- }
- presentChoiceSet();
- }
- });
- }
-
- // SENDING REQUESTS
-
- private void updateKeyboardProperties(final CompletionListener listener){
- if (keyboardProperties == null){
- if (listener != null){
- listener.onComplete(false);
- }
- return;
- }
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setKeyboardProperties(keyboardProperties);
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
-
- if (!response.getSuccess()){
- if (listener != null){
- listener.onComplete(false);
- }
- DebugTool.logError(TAG, "Error Setting keyboard properties in present choice set operation");
- return;
- }
-
- updatedKeyboardProperties = true;
-
- if (listener != null){
- listener.onComplete(true);
- }
- DebugTool.logInfo(TAG, "Success Setting keyboard properties in present choice set operation");
- }
- });
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(setGlobalProperties);
- } else {
- DebugTool.logError(TAG, "Internal interface null - present choice set op - choice");
- }
- }
-
- private void presentChoiceSet() {
- PerformInteraction pi = getPerformInteraction();
- pi.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (!response.getSuccess()){
- DebugTool.logError(TAG, "Presenting Choice set failed: "+ response.getInfo());
-
- if (choiceSetSelectionListener != null){
- choiceSetSelectionListener.onError(response.getInfo());
- }
- finishOperation();
- return;
- }
-
- PerformInteractionResponse performInteractionResponse = (PerformInteractionResponse) response;
- setSelectedCellWithId(performInteractionResponse.getChoiceID());
- selectedTriggerSource = performInteractionResponse.getTriggerSource();
-
- if (choiceSetSelectionListener != null && selectedCell != null && selectedTriggerSource != null && selectedCellRow != null){
- choiceSetSelectionListener.onChoiceSelected(selectedCell, selectedTriggerSource, selectedCellRow);
- }
-
- finishOperation();
- }
- });
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(pi);
- }else {
- DebugTool.logError(TAG, "Internal Interface null when presenting choice set in operation");
- }
- }
-
- void finishOperation() {
- if (updatedKeyboardProperties) {
- // We need to reset the keyboard properties
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setKeyboardProperties(originalKeyboardProperties);
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- updatedKeyboardProperties = false;
- DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
- } else {
- DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
- }
- PresentChoiceSetOperation.super.onFinished();
- }
- });
-
- if (internalInterface.get() != null) {
- internalInterface.get().sendRPC(setGlobalProperties);
- internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
- } else {
- DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
- }
- } else {
- PresentChoiceSetOperation.super.onFinished();
- }
- }
-
- /*
- * 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 ((getState() == Task.FINISHED)) {
- DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
- return;
- } else if (getState() == Task.CANCELED) {
- DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
- return;
- } else if ((getState() == Task.IN_PROGRESS)) {
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning(TAG, "Canceling a presented choice set is not supported on this head unit");
- return;
- }
-
- DebugTool.logInfo(TAG, "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(TAG, "Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
- }
- });
-
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(cancelInteraction);
- } else {
- DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for choice set");
- }
- } else {
- DebugTool.logInfo(TAG, "Canceling a choice set that has not yet been sent to Core");
- this.cancelTask();
- }
- }
-
- // GETTERS
-
- PerformInteraction getPerformInteraction() {
- PerformInteraction pi = new PerformInteraction(choiceSet.getTitle(), presentationMode, getChoiceIds());
- pi.setInitialPrompt(choiceSet.getInitialPrompt());
- pi.setHelpPrompt(choiceSet.getHelpPrompt());
- pi.setTimeoutPrompt(choiceSet.getTimeoutPrompt());
- pi.setVrHelp(choiceSet.getVrHelpList());
- pi.setTimeout(choiceSet.getTimeout() * 1000);
- pi.setInteractionLayout(getLayoutMode());
- pi.setCancelID(cancelID);
- return pi;
- }
-
- LayoutMode getLayoutMode() {
- switch (choiceSet.getLayout()){
- case CHOICE_SET_LAYOUT_LIST:
- return keyboardListener != null ? LayoutMode.LIST_WITH_SEARCH : LayoutMode.LIST_ONLY;
- case CHOICE_SET_LAYOUT_TILES:
- return keyboardListener != null ? LayoutMode.ICON_WITH_SEARCH : LayoutMode.ICON_ONLY;
- }
- return LayoutMode.LIST_ONLY; // default
- }
-
- private List<Integer> getChoiceIds() {
-
- List<Integer> choiceIds = new ArrayList<>(choiceSet.getChoices().size());
- for (ChoiceCell cell : choiceSet.getChoices()){
- choiceIds.add(cell.getChoiceId());
- }
- return choiceIds;
- }
-
- // HELPERS
-
- void setSelectedCellWithId(Integer cellId){
- if (choiceSet.getChoices() != null && cellId != null) {
- List<ChoiceCell> cells = choiceSet.getChoices();
- for (int i = 0; i < cells.size(); i++) {
- if (cells.get(i).getChoiceId() == cellId) {
- selectedCell = cells.get(i);
- selectedCellRow = i;
- return;
- }
- }
- }
- }
-
- // LISTENERS
-
- private void addListeners(){
-
- keyboardRPCListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- if (getState() == Task.CANCELED) {
- finishOperation();
- return;
- }
-
- if (keyboardListener == null){
- DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
- return;
- }
-
- OnKeyboardInput onKeyboard = (OnKeyboardInput) notification;
- keyboardListener.onKeyboardDidSendEvent(onKeyboard.getEvent(), onKeyboard.getData());
-
- if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_VOICE) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_SUBMITTED)){
- // Submit Voice or Text
- keyboardListener.onUserDidSubmitInput(onKeyboard.getData(), onKeyboard.getEvent());
- } else if (onKeyboard.getEvent().equals(KeyboardEvent.KEYPRESS)){
- // Notify of Keypress
- keyboardListener.updateAutocompleteWithInput(onKeyboard.getData(), new KeyboardAutocompleteCompletionListener() {
- @Override
- public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
- keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
- updateKeyboardProperties(null);
- }
- });
-
- keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
- @Override
- public void onUpdatedCharacterSet(List<String> updatedCharacterSet) {
- keyboardProperties.setLimitedCharacterList(updatedCharacterSet);
- updateKeyboardProperties(null);
- }
- });
- } else if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_ABORTED) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_CANCELLED)){
- // Notify of abort / Cancellation
- keyboardListener.onKeyboardDidAbortWithReason(onKeyboard.getEvent());
- }
- }
- };
-
- if (internalInterface.get() != null) {
- internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
- } else {
- DebugTool.logError(TAG, "Present Choice Set Keyboard Listener Not Added");
- }
- }
+ private static final String TAG = "PresentChoiceSetOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final ChoiceSet choiceSet;
+ private final Integer cancelID;
+ private final InteractionMode presentationMode;
+ private final KeyboardProperties originalKeyboardProperties;
+ private KeyboardProperties keyboardProperties;
+ private ChoiceCell selectedCell;
+ private TriggerSource selectedTriggerSource;
+ private boolean updatedKeyboardProperties;
+ private OnRPCNotificationListener keyboardRPCListener;
+ private final ChoiceSetSelectionListener choiceSetSelectionListener;
+ Integer selectedCellRow;
+ KeyboardListener keyboardListener;
+ final SdlMsgVersion sdlMsgVersion;
+
+ PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
+ KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID) {
+ super("PresentChoiceSetOperation");
+ 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 onExecute() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing present choice set operation");
+ addListeners();
+ start();
+ }
+
+ private void start() {
+ if (getState() == Task.CANCELED) {
+ 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();
+ updatedKeyboardProperties = true;
+ }
+
+ updateKeyboardProperties(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (getState() == Task.CANCELED) {
+ finishOperation();
+ return;
+ }
+ presentChoiceSet();
+ }
+ });
+ }
+
+ // SENDING REQUESTS
+
+ private void updateKeyboardProperties(final CompletionListener listener) {
+ if (keyboardProperties == null) {
+ if (listener != null) {
+ listener.onComplete(false);
+ }
+ return;
+ }
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setKeyboardProperties(keyboardProperties);
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+
+ if (!response.getSuccess()) {
+ if (listener != null) {
+ listener.onComplete(false);
+ }
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present choice set operation");
+ return;
+ }
+
+ updatedKeyboardProperties = true;
+
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ DebugTool.logInfo(TAG, "Success Setting keyboard properties in present choice set operation");
+ }
+ });
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(setGlobalProperties);
+ } else {
+ DebugTool.logError(TAG, "Internal interface null - present choice set op - choice");
+ }
+ }
+
+ private void presentChoiceSet() {
+ PerformInteraction pi = getPerformInteraction();
+ pi.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ DebugTool.logError(TAG, "Presenting Choice set failed: " + response.getInfo());
+
+ if (choiceSetSelectionListener != null) {
+ choiceSetSelectionListener.onError(response.getInfo());
+ }
+ finishOperation();
+ return;
+ }
+
+ PerformInteractionResponse performInteractionResponse = (PerformInteractionResponse) response;
+ setSelectedCellWithId(performInteractionResponse.getChoiceID());
+ selectedTriggerSource = performInteractionResponse.getTriggerSource();
+
+ if (choiceSetSelectionListener != null && selectedCell != null && selectedTriggerSource != null && selectedCellRow != null) {
+ choiceSetSelectionListener.onChoiceSelected(selectedCell, selectedTriggerSource, selectedCellRow);
+ }
+
+ finishOperation();
+ }
+ });
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(pi);
+ } else {
+ DebugTool.logError(TAG, "Internal Interface null when presenting choice set in operation");
+ }
+ }
+
+ void finishOperation() {
+ if (updatedKeyboardProperties) {
+ // We need to reset the keyboard properties
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setKeyboardProperties(originalKeyboardProperties);
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ updatedKeyboardProperties = false;
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ } else {
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
+ }
+ PresentChoiceSetOperation.super.onFinished();
+ }
+ });
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(setGlobalProperties);
+ internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
+ } else {
+ DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
+ }
+ } else {
+ PresentChoiceSetOperation.super.onFinished();
+ }
+ }
+
+ /*
+ * 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 ((getState() == Task.FINISHED)) {
+ DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
+ return;
+ } else if (getState() == Task.CANCELED) {
+ DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if ((getState() == Task.IN_PROGRESS)) {
+ if (sdlMsgVersion.getMajorVersion() < 6) {
+ DebugTool.logWarning(TAG, "Canceling a presented choice set is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo(TAG, "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(TAG, "Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+ });
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for choice set");
+ }
+ } else {
+ DebugTool.logInfo(TAG, "Canceling a choice set that has not yet been sent to Core");
+ this.cancelTask();
+ }
+ }
+
+ // GETTERS
+
+ PerformInteraction getPerformInteraction() {
+ PerformInteraction pi = new PerformInteraction(choiceSet.getTitle(), presentationMode, getChoiceIds());
+ pi.setInitialPrompt(choiceSet.getInitialPrompt());
+ pi.setHelpPrompt(choiceSet.getHelpPrompt());
+ pi.setTimeoutPrompt(choiceSet.getTimeoutPrompt());
+ pi.setVrHelp(choiceSet.getVrHelpList());
+ pi.setTimeout(choiceSet.getTimeout() * 1000);
+ pi.setInteractionLayout(getLayoutMode());
+ pi.setCancelID(cancelID);
+ return pi;
+ }
+
+ LayoutMode getLayoutMode() {
+ switch (choiceSet.getLayout()) {
+ case CHOICE_SET_LAYOUT_LIST:
+ return keyboardListener != null ? LayoutMode.LIST_WITH_SEARCH : LayoutMode.LIST_ONLY;
+ case CHOICE_SET_LAYOUT_TILES:
+ return keyboardListener != null ? LayoutMode.ICON_WITH_SEARCH : LayoutMode.ICON_ONLY;
+ }
+ return LayoutMode.LIST_ONLY; // default
+ }
+
+ private List<Integer> getChoiceIds() {
+
+ List<Integer> choiceIds = new ArrayList<>(choiceSet.getChoices().size());
+ for (ChoiceCell cell : choiceSet.getChoices()) {
+ choiceIds.add(cell.getChoiceId());
+ }
+ return choiceIds;
+ }
+
+ // HELPERS
+
+ void setSelectedCellWithId(Integer cellId) {
+ if (choiceSet.getChoices() != null && cellId != null) {
+ List<ChoiceCell> cells = choiceSet.getChoices();
+ for (int i = 0; i < cells.size(); i++) {
+ if (cells.get(i).getChoiceId() == cellId) {
+ selectedCell = cells.get(i);
+ selectedCellRow = i;
+ return;
+ }
+ }
+ }
+ }
+
+ // LISTENERS
+
+ private void addListeners() {
+
+ keyboardRPCListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ if (getState() == Task.CANCELED) {
+ finishOperation();
+ return;
+ }
+
+ if (keyboardListener == null) {
+ DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
+ return;
+ }
+
+ OnKeyboardInput onKeyboard = (OnKeyboardInput) notification;
+ keyboardListener.onKeyboardDidSendEvent(onKeyboard.getEvent(), onKeyboard.getData());
+
+ if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_VOICE) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_SUBMITTED)) {
+ // Submit Voice or Text
+ keyboardListener.onUserDidSubmitInput(onKeyboard.getData(), onKeyboard.getEvent());
+ } else if (onKeyboard.getEvent().equals(KeyboardEvent.KEYPRESS)) {
+ // Notify of Keypress
+ keyboardListener.updateAutocompleteWithInput(onKeyboard.getData(), new KeyboardAutocompleteCompletionListener() {
+ @Override
+ public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
+ keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
+ updateKeyboardProperties(null);
+ }
+ });
+
+ keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
+ @Override
+ public void onUpdatedCharacterSet(List<String> updatedCharacterSet) {
+ keyboardProperties.setLimitedCharacterList(updatedCharacterSet);
+ updateKeyboardProperties(null);
+ }
+ });
+ } else if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_ABORTED) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_CANCELLED)) {
+ // Notify of abort / Cancellation
+ keyboardListener.onKeyboardDidAbortWithReason(onKeyboard.getEvent());
+ }
+ }
+ };
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
+ } else {
+ DebugTool.logError(TAG, "Present Choice Set Keyboard Listener Not Added");
+ }
+ }
} \ No newline at end of file
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 0dbcf0c39..54c26aaa6 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
@@ -61,259 +61,259 @@ import java.util.Collections;
import java.util.List;
class PresentKeyboardOperation extends Task {
- private static final String TAG = "PresentKeyboardOperation";
- private final WeakReference<ISdl> internalInterface;
- private final KeyboardListener keyboardListener;
- private final KeyboardProperties originalKeyboardProperties;
- private KeyboardProperties keyboardProperties;
- private final KeyboardProperties customConfig;
- private boolean updatedKeyboardProperties;
- private final String initialText;
- private OnRPCNotificationListener keyboardRPCListener;
- private final Integer cancelID;
- final SdlMsgVersion sdlMsgVersion;
-
- PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID){
- super("PresentKeyboardOperation");
- 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 onExecute() {
- DebugTool.logInfo(TAG, "Keyboard Operation: Executing present keyboard operation");
- addListeners();
- start();
- }
-
- private void start(){
- DebugTool.logInfo(TAG, "Choice Operation: Executing present keyboard operation");
-
- if (getState() == Task.CANCELED) {
- finishOperation();
- return;
- }
-
- if (keyboardListener != null){
- keyboardProperties = customConfig;
- updatedKeyboardProperties = true;
- }
-
- updateKeyboardProperties(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (getState() == Task.CANCELED) {
- finishOperation();
- return;
- }
-
- presentKeyboard();
- }
- });
- }
-
- // SENDING REQUESTS
-
- private void presentKeyboard(){
- if (internalInterface.get() != null){
- PerformInteraction pi = getPerformInteraction();
- pi.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (!response.getSuccess()) {
- DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
- }
- finishOperation();
- }
- });
-
- internalInterface.get().sendRPC(pi);
-
- }else{
- DebugTool.logError(TAG, "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 ((getState() == Task.FINISHED)) {
- DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
- return;
- } else if (getState() == Task.CANCELED) {
- DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
- return;
- } else if (getState() == Task.IN_PROGRESS) {
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning(TAG, "Canceling a keyboard is not supported on this head unit");
- return;
- }
-
- DebugTool.logInfo(TAG, "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(TAG, "Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
- }
- });
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(cancelInteraction);
- } else {
- DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for keyboard.");
- }
- } else {
- DebugTool.logInfo(TAG, "Canceling a keyboard that has not yet been sent to Core.");
- this.cancelTask();
- }
- }
-
- private void updateKeyboardProperties(final CompletionListener listener){
- if (keyboardProperties == null){
- if (listener != null){
- listener.onComplete(false);
- }
- return;
- }
-
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setKeyboardProperties(keyboardProperties);
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
-
- if (!response.getSuccess()){
- if (listener != null){
- listener.onComplete(false);
- }
- DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager");
- return;
- }
-
- updatedKeyboardProperties = true;
-
- if (listener != null){
- listener.onComplete(true);
- }
- DebugTool.logInfo(TAG, "Success Setting keyboard properties in present keyboard operation - choice manager");
- }
- });
-
- if (internalInterface.get() != null){
- internalInterface.get().sendRPC(setGlobalProperties);
- } else {
- DebugTool.logError(TAG, "Internal interface null - present keyboard op - choice");
- }
- }
-
- void finishOperation() {
- if (updatedKeyboardProperties) {
- // We need to reset the keyboard properties
- SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
- setGlobalProperties.setKeyboardProperties(originalKeyboardProperties);
- setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- updatedKeyboardProperties = false;
- DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
- } else {
- DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
- }
- PresentKeyboardOperation.super.onFinished();
- }
- });
-
- if (internalInterface.get() != null) {
- internalInterface.get().sendRPC(setGlobalProperties);
- internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
- } else {
- DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
- }
- } else {
- PresentKeyboardOperation.super.onFinished();
- }
- }
-
- // GETTERS
-
- PerformInteraction getPerformInteraction() {
- PerformInteraction pi = new PerformInteraction();
- pi.setInitialText(initialText);
- 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(){
-
- keyboardRPCListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- if (getState() == Task.CANCELED) {
- finishOperation();
- return;
- }
-
- if (keyboardListener == null){
- DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
- return;
- }
-
- OnKeyboardInput onKeyboard = (OnKeyboardInput) notification;
- keyboardListener.onKeyboardDidSendEvent(onKeyboard.getEvent(), onKeyboard.getData());
-
- if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_VOICE) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_SUBMITTED)){
- // Submit Voice or Text
- keyboardListener.onUserDidSubmitInput(onKeyboard.getData(), onKeyboard.getEvent());
- } else if (onKeyboard.getEvent().equals(KeyboardEvent.KEYPRESS)){
- // Notify of Keypress
- keyboardListener.updateAutocompleteWithInput(onKeyboard.getData(), new KeyboardAutocompleteCompletionListener() {
- @Override
- public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
- keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
- keyboardProperties.setAutoCompleteText(updatedAutoCompleteList != null && !updatedAutoCompleteList.isEmpty() ? updatedAutoCompleteList.get(0) : null);
- updateKeyboardProperties(null);
- }
- });
-
- keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
- @Override
- public void onUpdatedCharacterSet(List<String> updatedCharacterSet) {
- keyboardProperties.setLimitedCharacterList(updatedCharacterSet);
- updateKeyboardProperties(null);
- }
- });
- } else if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_ABORTED) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_CANCELLED)){
- // Notify of abort / Cancellation
- keyboardListener.onKeyboardDidAbortWithReason(onKeyboard.getEvent());
- }
-
- }
- };
-
- if (internalInterface.get() != null) {
- internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
- } else {
- DebugTool.logError(TAG, "Present Keyboard Listener Not Added - choice manager");
- }
- }
+ private static final String TAG = "PresentKeyboardOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final KeyboardListener keyboardListener;
+ private final KeyboardProperties originalKeyboardProperties;
+ private KeyboardProperties keyboardProperties;
+ private final KeyboardProperties customConfig;
+ private boolean updatedKeyboardProperties;
+ private final String initialText;
+ private OnRPCNotificationListener keyboardRPCListener;
+ private final Integer cancelID;
+ final SdlMsgVersion sdlMsgVersion;
+
+ PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID) {
+ super("PresentKeyboardOperation");
+ 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 onExecute() {
+ DebugTool.logInfo(TAG, "Keyboard Operation: Executing present keyboard operation");
+ addListeners();
+ start();
+ }
+
+ private void start() {
+ DebugTool.logInfo(TAG, "Choice Operation: Executing present keyboard operation");
+
+ if (getState() == Task.CANCELED) {
+ finishOperation();
+ return;
+ }
+
+ if (keyboardListener != null) {
+ keyboardProperties = customConfig;
+ updatedKeyboardProperties = true;
+ }
+
+ updateKeyboardProperties(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (getState() == Task.CANCELED) {
+ finishOperation();
+ return;
+ }
+
+ presentKeyboard();
+ }
+ });
+ }
+
+ // SENDING REQUESTS
+
+ private void presentKeyboard() {
+ if (internalInterface.get() != null) {
+ PerformInteraction pi = getPerformInteraction();
+ pi.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
+ }
+ finishOperation();
+ }
+ });
+
+ internalInterface.get().sendRPC(pi);
+
+ } else {
+ DebugTool.logError(TAG, "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.
+ * <p>
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ */
+ void dismissKeyboard() {
+ if ((getState() == Task.FINISHED)) {
+ DebugTool.logInfo(TAG, "This operation has already finished so it can not be canceled.");
+ return;
+ } else if (getState() == Task.CANCELED) {
+ DebugTool.logInfo(TAG, "This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (getState() == Task.IN_PROGRESS) {
+ if (sdlMsgVersion.getMajorVersion() < 6) {
+ DebugTool.logWarning(TAG, "Canceling a keyboard is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo(TAG, "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(TAG, "Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+ });
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError(TAG, "Internal interface null - could not send cancel interaction for keyboard.");
+ }
+ } else {
+ DebugTool.logInfo(TAG, "Canceling a keyboard that has not yet been sent to Core.");
+ this.cancelTask();
+ }
+ }
+
+ private void updateKeyboardProperties(final CompletionListener listener) {
+ if (keyboardProperties == null) {
+ if (listener != null) {
+ listener.onComplete(false);
+ }
+ return;
+ }
+
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setKeyboardProperties(keyboardProperties);
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+
+ if (!response.getSuccess()) {
+ if (listener != null) {
+ listener.onComplete(false);
+ }
+ DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager");
+ return;
+ }
+
+ updatedKeyboardProperties = true;
+
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ DebugTool.logInfo(TAG, "Success Setting keyboard properties in present keyboard operation - choice manager");
+ }
+ });
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(setGlobalProperties);
+ } else {
+ DebugTool.logError(TAG, "Internal interface null - present keyboard op - choice");
+ }
+ }
+
+ void finishOperation() {
+ if (updatedKeyboardProperties) {
+ // We need to reset the keyboard properties
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setKeyboardProperties(originalKeyboardProperties);
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ updatedKeyboardProperties = false;
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ } else {
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
+ }
+ PresentKeyboardOperation.super.onFinished();
+ }
+ });
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().sendRPC(setGlobalProperties);
+ internalInterface.get().removeOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
+ } else {
+ DebugTool.logError(TAG, "Internal Interface null when finishing choice keyboard reset");
+ }
+ } else {
+ PresentKeyboardOperation.super.onFinished();
+ }
+ }
+
+ // GETTERS
+
+ PerformInteraction getPerformInteraction() {
+ PerformInteraction pi = new PerformInteraction();
+ pi.setInitialText(initialText);
+ 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() {
+
+ keyboardRPCListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ if (getState() == Task.CANCELED) {
+ finishOperation();
+ return;
+ }
+
+ if (keyboardListener == null) {
+ DebugTool.logError(TAG, "Received Keyboard Input But Listener is null");
+ return;
+ }
+
+ OnKeyboardInput onKeyboard = (OnKeyboardInput) notification;
+ keyboardListener.onKeyboardDidSendEvent(onKeyboard.getEvent(), onKeyboard.getData());
+
+ if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_VOICE) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_SUBMITTED)) {
+ // Submit Voice or Text
+ keyboardListener.onUserDidSubmitInput(onKeyboard.getData(), onKeyboard.getEvent());
+ } else if (onKeyboard.getEvent().equals(KeyboardEvent.KEYPRESS)) {
+ // Notify of Keypress
+ keyboardListener.updateAutocompleteWithInput(onKeyboard.getData(), new KeyboardAutocompleteCompletionListener() {
+ @Override
+ public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
+ keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
+ keyboardProperties.setAutoCompleteText(updatedAutoCompleteList != null && !updatedAutoCompleteList.isEmpty() ? updatedAutoCompleteList.get(0) : null);
+ updateKeyboardProperties(null);
+ }
+ });
+
+ keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
+ @Override
+ public void onUpdatedCharacterSet(List<String> updatedCharacterSet) {
+ keyboardProperties.setLimitedCharacterList(updatedCharacterSet);
+ updateKeyboardProperties(null);
+ }
+ });
+ } else if (onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_ABORTED) || onKeyboard.getEvent().equals(KeyboardEvent.ENTRY_CANCELLED)) {
+ // Notify of abort / Cancellation
+ keyboardListener.onKeyboardDidAbortWithReason(onKeyboard.getEvent());
+ }
+
+ }
+ };
+
+ if (internalInterface.get() != null) {
+ internalInterface.get().addOnRPCNotificationListener(FunctionID.ON_KEYBOARD_INPUT, keyboardRPCListener);
+ } else {
+ DebugTool.logError(TAG, "Present Keyboard Listener Not Added - choice manager");
+ }
+ }
} \ No newline at end of file
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 7224960ee..dbf9c211c 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
@@ -79,208 +79,210 @@ import java.util.List;
import java.util.Map;
abstract class BaseMenuManager extends BaseSubManager {
- private static final String TAG = "BaseMenuManager";
- private static final int KEEP = 0;
- private static final int MARKED_FOR_ADDITION = 1;
- private static final int MARKED_FOR_DELETION = 2;
-
- private final WeakReference<FileManager> fileManager;
-
- List<MenuCell> menuCells, waitingUpdateMenuCells, oldMenuCells, keepsNew, keepsOld;
- List<RPCRequest> inProgressUpdate;
- DynamicMenuUpdatesMode dynamicMenuUpdatesMode;
- MenuConfiguration menuConfiguration;
- SdlMsgVersion sdlMsgVersion;
- private String displayType;
-
- boolean waitingOnHMIUpdate;
- private boolean hasQueuedUpdate;
- HMILevel currentHMILevel;
-
- OnRPCNotificationListener hmiListener, commandListener;
- OnSystemCapabilityListener onDisplaysCapabilityListener;
- WindowCapability defaultMainWindowCapability;
-
- private static final int MAX_ID = 2000000000;
- private static final int parentIdNotFound = MAX_ID;
- private static final int menuCellIdMin = 1;
- int lastMenuId;
-
- SystemContext currentSystemContext;
-
- BaseMenuManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
-
- super(internalInterface);
-
- // Set up some Vars
- this.fileManager = new WeakReference<>(fileManager);
- currentSystemContext = SystemContext.SYSCTXT_MAIN;
- currentHMILevel = HMILevel.HMI_NONE;
- lastMenuId = menuCellIdMin;
- dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
- sdlMsgVersion = internalInterface.getSdlMsgVersion();
-
- addListeners();
- }
-
- @Override
- public void start(CompletionListener listener) {
- transitionToState(READY);
- super.start(listener);
- }
-
- @Override
- public void dispose(){
-
- lastMenuId = menuCellIdMin;
- menuCells = null;
- oldMenuCells = null;
- currentHMILevel = null;
- currentSystemContext = SystemContext.SYSCTXT_MAIN;
- dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
- defaultMainWindowCapability = null;
- inProgressUpdate = null;
- hasQueuedUpdate = false;
- waitingOnHMIUpdate = false;
- waitingUpdateMenuCells = null;
- keepsNew = null;
- keepsOld = null;
- menuConfiguration = null;
- sdlMsgVersion = null;
-
- // remove listeners
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
- if (internalInterface.getSystemCapabilityManager() != null) {
- internalInterface.getSystemCapabilityManager().removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
- }
-
- super.dispose();
- }
-
- // SETTERS
-
- public void setDynamicUpdatesMode(@NonNull DynamicMenuUpdatesMode value){
- this.dynamicMenuUpdatesMode = value;
- }
-
- /**
- * Creates and sends all associated Menu RPCs
- * @param cells - the menu cells that are to be sent to the head unit, including their sub-cells.
- */
- public void setMenuCells(@NonNull List<MenuCell> cells){
-
- // Create a deep copy of the list so future changes by developers don't affect the algorithm logic
- List <MenuCell> clonedCells = cloneMenuCellsList(cells);
-
- 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
- waitingOnHMIUpdate = true;
- waitingUpdateMenuCells = new ArrayList<>();
- if (clonedCells != null && !clonedCells.isEmpty()) {
- waitingUpdateMenuCells.addAll(clonedCells);
- }
- return;
- }
- waitingOnHMIUpdate = false;
-
- // Update our Lists
- // set old list
- if (menuCells != null) {
- oldMenuCells = new ArrayList<>(menuCells);
- }
- // copy new list
- menuCells = new ArrayList<>();
- if (clonedCells != null && !clonedCells.isEmpty()) {
- menuCells.addAll(clonedCells);
- }
-
- // HashSet order doesnt matter / does not allow duplicates
- HashSet<String> titleCheckSet = new HashSet<>();
- HashSet<String> allMenuVoiceCommands = new HashSet<>();
- int voiceCommandCount = 0;
-
- for (MenuCell cell : menuCells){
- titleCheckSet.add(cell.getTitle());
- if (cell.getVoiceCommands() != null){
- allMenuVoiceCommands.addAll(cell.getVoiceCommands());
- voiceCommandCount += cell.getVoiceCommands().size();
- }
- }
- // Check for duplicate titles
- if (titleCheckSet.size() != menuCells.size()){
- DebugTool.logError(TAG, "Not all cell titles are unique. The menu will not be set");
- return;
- }
-
- // Check for duplicate voice commands
- if (allMenuVoiceCommands.size() != voiceCommandCount){
- DebugTool.logError(TAG, "Attempted to create a menu with duplicate voice commands. Voice commands must be unique. The menu will not be set");
- return;
- }
-
- // Upload the Artworks
- List<SdlArtwork> artworksToBeUploaded = findAllArtworksToBeUploadedFromCells(menuCells);
- if (artworksToBeUploaded.size() > 0 && fileManager.get() != null){
- fileManager.get().uploadArtworks(artworksToBeUploaded, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
-
- if (errors != null && errors.size() > 0){
- DebugTool.logError(TAG, "Error uploading Menu Artworks: "+ errors.toString());
- }else{
- DebugTool.logInfo(TAG, "Menu Artworks Uploaded");
- }
- // proceed
- updateMenuAndDetermineBestUpdateMethod();
- }
- });
- }else{
- // No Artworks to be uploaded, send off
- updateMenuAndDetermineBestUpdateMethod();
- }
- }
-
- /**
- * Returns current list of menu cells
- * @return a List of Currently set menu cells
- */
- public List<MenuCell> getMenuCells(){
-
- if (menuCells != null) {
- return menuCells;
- } else if (waitingOnHMIUpdate && waitingUpdateMenuCells != null) {
- // this will keep from returning null if the menu list is set and we are pending HMI FULL
- return waitingUpdateMenuCells;
- } else {
- return null;
- }
- }
-
- /**
- * @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE
- */
- public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode() {
- return this.dynamicMenuUpdatesMode;
- }
+ private static final String TAG = "BaseMenuManager";
+ private static final int KEEP = 0;
+ private static final int MARKED_FOR_ADDITION = 1;
+ private static final int MARKED_FOR_DELETION = 2;
+
+ private final WeakReference<FileManager> fileManager;
+
+ List<MenuCell> menuCells, waitingUpdateMenuCells, oldMenuCells, keepsNew, keepsOld;
+ List<RPCRequest> inProgressUpdate;
+ DynamicMenuUpdatesMode dynamicMenuUpdatesMode;
+ MenuConfiguration menuConfiguration;
+ SdlMsgVersion sdlMsgVersion;
+ private String displayType;
+
+ boolean waitingOnHMIUpdate;
+ private boolean hasQueuedUpdate;
+ HMILevel currentHMILevel;
+
+ OnRPCNotificationListener hmiListener, commandListener;
+ OnSystemCapabilityListener onDisplaysCapabilityListener;
+ WindowCapability defaultMainWindowCapability;
+
+ private static final int MAX_ID = 2000000000;
+ private static final int parentIdNotFound = MAX_ID;
+ private static final int menuCellIdMin = 1;
+ int lastMenuId;
+
+ SystemContext currentSystemContext;
+
+ BaseMenuManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
+
+ super(internalInterface);
+
+ // Set up some Vars
+ this.fileManager = new WeakReference<>(fileManager);
+ currentSystemContext = SystemContext.SYSCTXT_MAIN;
+ currentHMILevel = HMILevel.HMI_NONE;
+ lastMenuId = menuCellIdMin;
+ dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
+ sdlMsgVersion = internalInterface.getSdlMsgVersion();
+
+ addListeners();
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ transitionToState(READY);
+ super.start(listener);
+ }
+
+ @Override
+ public void dispose() {
+
+ lastMenuId = menuCellIdMin;
+ menuCells = null;
+ oldMenuCells = null;
+ currentHMILevel = null;
+ currentSystemContext = SystemContext.SYSCTXT_MAIN;
+ dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
+ defaultMainWindowCapability = null;
+ inProgressUpdate = null;
+ hasQueuedUpdate = false;
+ waitingOnHMIUpdate = false;
+ waitingUpdateMenuCells = null;
+ keepsNew = null;
+ keepsOld = null;
+ menuConfiguration = null;
+ sdlMsgVersion = null;
+
+ // remove listeners
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ internalInterface.getSystemCapabilityManager().removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ }
+
+ super.dispose();
+ }
+
+ // SETTERS
+
+ public void setDynamicUpdatesMode(@NonNull DynamicMenuUpdatesMode value) {
+ this.dynamicMenuUpdatesMode = value;
+ }
+
+ /**
+ * Creates and sends all associated Menu RPCs
+ *
+ * @param cells - the menu cells that are to be sent to the head unit, including their sub-cells.
+ */
+ public void setMenuCells(@NonNull List<MenuCell> cells) {
+
+ // Create a deep copy of the list so future changes by developers don't affect the algorithm logic
+ List<MenuCell> clonedCells = cloneMenuCellsList(cells);
+
+ 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
+ waitingOnHMIUpdate = true;
+ waitingUpdateMenuCells = new ArrayList<>();
+ if (clonedCells != null && !clonedCells.isEmpty()) {
+ waitingUpdateMenuCells.addAll(clonedCells);
+ }
+ return;
+ }
+ waitingOnHMIUpdate = false;
+
+ // Update our Lists
+ // set old list
+ if (menuCells != null) {
+ oldMenuCells = new ArrayList<>(menuCells);
+ }
+ // copy new list
+ menuCells = new ArrayList<>();
+ if (clonedCells != null && !clonedCells.isEmpty()) {
+ menuCells.addAll(clonedCells);
+ }
+
+ // HashSet order doesnt matter / does not allow duplicates
+ HashSet<String> titleCheckSet = new HashSet<>();
+ HashSet<String> allMenuVoiceCommands = new HashSet<>();
+ int voiceCommandCount = 0;
+
+ for (MenuCell cell : menuCells) {
+ titleCheckSet.add(cell.getTitle());
+ if (cell.getVoiceCommands() != null) {
+ allMenuVoiceCommands.addAll(cell.getVoiceCommands());
+ voiceCommandCount += cell.getVoiceCommands().size();
+ }
+ }
+ // Check for duplicate titles
+ if (titleCheckSet.size() != menuCells.size()) {
+ DebugTool.logError(TAG, "Not all cell titles are unique. The menu will not be set");
+ return;
+ }
+
+ // Check for duplicate voice commands
+ if (allMenuVoiceCommands.size() != voiceCommandCount) {
+ DebugTool.logError(TAG, "Attempted to create a menu with duplicate voice commands. Voice commands must be unique. The menu will not be set");
+ return;
+ }
+
+ // Upload the Artworks
+ List<SdlArtwork> artworksToBeUploaded = findAllArtworksToBeUploadedFromCells(menuCells);
+ if (artworksToBeUploaded.size() > 0 && fileManager.get() != null) {
+ fileManager.get().uploadArtworks(artworksToBeUploaded, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+
+ if (errors != null && errors.size() > 0) {
+ DebugTool.logError(TAG, "Error uploading Menu Artworks: " + errors.toString());
+ } else {
+ DebugTool.logInfo(TAG, "Menu Artworks Uploaded");
+ }
+ // proceed
+ updateMenuAndDetermineBestUpdateMethod();
+ }
+ });
+ } else {
+ // No Artworks to be uploaded, send off
+ updateMenuAndDetermineBestUpdateMethod();
+ }
+ }
+
+ /**
+ * Returns current list of menu cells
+ *
+ * @return a List of Currently set menu cells
+ */
+ public List<MenuCell> getMenuCells() {
+
+ if (menuCells != null) {
+ return menuCells;
+ } else if (waitingOnHMIUpdate && waitingUpdateMenuCells != null) {
+ // this will keep from returning null if the menu list is set and we are pending HMI FULL
+ return waitingUpdateMenuCells;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE
+ */
+ public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode() {
+ return this.dynamicMenuUpdatesMode;
+ }
// OPEN MENU RPCs
/**
* Opens the Main Menu
*/
- public boolean openMenu(){
+ public boolean openMenu() {
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning(TAG, "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());
+ if (sdlMsgVersion.getMajorVersion() < 6) {
+ DebugTool.logWarning(TAG, "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()){
+ if (response.getSuccess()) {
DebugTool.logInfo(TAG, "Open Main Menu Request Successful");
} else {
DebugTool.logError(TAG, "Open Main Menu Request Failed");
@@ -293,38 +295,39 @@ abstract class BaseMenuManager extends BaseSubManager {
/**
* 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){
+ public boolean openSubMenu(@NonNull MenuCell cell) {
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning(TAG, "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());
+ if (sdlMsgVersion.getMajorVersion() < 6) {
+ DebugTool.logWarning(TAG, "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){
+ if (oldMenuCells == null) {
DebugTool.logError(TAG, "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){
+ 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;
+ sendOpenSubMenu(clonedCell.getCellId());
+ return true;
}
}
return false;
}
- private void sendOpenSubMenu(Integer id){
+ 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()){
+ if (response.getSuccess()) {
DebugTool.logInfo(TAG, "Open Sub Menu Request Successful");
} else {
DebugTool.logError(TAG, "Open Sub Menu Request Failed");
@@ -337,9 +340,10 @@ abstract class BaseMenuManager extends BaseSubManager {
// 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) {
@@ -349,14 +353,14 @@ abstract class BaseMenuManager extends BaseSubManager {
return;
}
- if (sdlMsgVersion.getMajorVersion() < 6){
- DebugTool.logWarning(TAG, "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());
+ if (sdlMsgVersion.getMajorVersion() < 6) {
+ DebugTool.logWarning(TAG, "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)){
+ 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(TAG, "Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
+ DebugTool.logError(TAG, "Could not set main menu configuration, HMI level: " + currentHMILevel + ", required: 'Not-NONE', system context: " + currentSystemContext + ", required: 'Not MENU'");
return;
}
@@ -365,974 +369,974 @@ abstract class BaseMenuManager extends BaseSubManager {
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(TAG, "Menu Configuration successfully set: " + menuConfiguration.toString());
- } else {
- DebugTool.logError(TAG, "onError: " + response.getResultCode() + " | Info: " + response.getInfo());
- }
- }
- });
- internalInterface.sendRPC(setGlobalProperties);
- } else {
- DebugTool.logInfo(TAG, "Menu Layout is null, not sending setGlobalProperties");
- }
+ 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(TAG, "Menu Configuration successfully set: " + menuConfiguration.toString());
+ } else {
+ DebugTool.logError(TAG, "onError: " + response.getResultCode() + " | Info: " + response.getInfo());
+ }
+ }
+ });
+ internalInterface.sendRPC(setGlobalProperties);
+ } else {
+ DebugTool.logInfo(TAG, "Menu Layout is null, not sending setGlobalProperties");
+ }
}
- public MenuConfiguration getMenuConfiguration(){
+ public MenuConfiguration getMenuConfiguration() {
return this.menuConfiguration;
}
- // UPDATING SYSTEM
-
- // ROOT MENU
-
- private void updateMenuAndDetermineBestUpdateMethod(){
-
- 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.logInfo(TAG, "HMI in None or System Context Menu, returning");
- waitingOnHMIUpdate = true;
- waitingUpdateMenuCells = menuCells;
- return;
- }
-
- if (inProgressUpdate != null && inProgressUpdate.size() > 0){
- // there's an in-progress update so this needs to wait
- DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
- hasQueuedUpdate = true;
- return;
- }
-
- // Checks against what the developer set for update mode and against the display type
- // to determine how the menu will be updated. This has the ability to be changed during
- // a session.
- if (checkUpdateMode(dynamicMenuUpdatesMode, displayType)) {
- // run the lists through the new algorithm
- RunScore rootScore = runMenuCompareAlgorithm(oldMenuCells, menuCells);
- if (rootScore == null) {
- // send initial menu (score will return null)
- // make a copy of our current cells
- DebugTool.logInfo(TAG, "Creating initial Menu");
- // Set the IDs if needed
- lastMenuId = menuCellIdMin;
- updateIdsOnMenuCells(menuCells, parentIdNotFound);
- this.oldMenuCells = new ArrayList<>(menuCells);
- createAndSendEntireMenu();
- } else {
- DebugTool.logInfo(TAG, "Dynamically Updating Menu");
- if (menuCells.size() == 0 && (oldMenuCells != null && oldMenuCells.size() > 0)) {
- // the dev wants to clear the menu. We have old cells and an empty array of new ones.
- deleteMenuWhenNewCellsEmpty();
- } else {
- // lets dynamically update the root menu
- dynamicallyUpdateRootMenu(rootScore);
- }
- }
- } else {
- // we are in compatibility mode
- DebugTool.logInfo(TAG, "Updating menus in compatibility mode");
- lastMenuId = menuCellIdMin;
- updateIdsOnMenuCells(menuCells, parentIdNotFound);
- // if the old cell array is not null, we want to delete the entire thing, else copy the new array
- if (oldMenuCells == null) {
- this.oldMenuCells = new ArrayList<>(menuCells);
- }
- createAndSendEntireMenu();
- }
- }
-
- private boolean checkUpdateMode(DynamicMenuUpdatesMode updateMode, String displayType){
-
- if (updateMode.equals(DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE)){
- if (displayType == null){
- return true;
- }
- return (!displayType.equals(DisplayType.GEN3_8_INCH.toString()));
-
- } else if (updateMode.equals(DynamicMenuUpdatesMode.FORCE_OFF)){
- return false;
- } else if (updateMode.equals(DynamicMenuUpdatesMode.FORCE_ON)){
- return true;
- }
-
- return true;
- }
-
- private void deleteMenuWhenNewCellsEmpty(){
- sendDeleteRPCs(createDeleteRPCsForCells(oldMenuCells), new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- inProgressUpdate = null;
-
- if (!success){
- DebugTool.logError(TAG, "Error Sending Current Menu");
- }else{
- DebugTool.logInfo(TAG, "Successfully Cleared Menu");
- }
- oldMenuCells = null;
- if (hasQueuedUpdate){
- hasQueuedUpdate = false;
- }
- }
- });
- }
-
- private void dynamicallyUpdateRootMenu(RunScore bestRootScore){
-
- // we need to run through the keeps and see if they have subCells, as they also need to be run
- // through the compare function.
- List<Integer> newIntArray = bestRootScore.getCurrentMenu();
- List<Integer> oldIntArray = bestRootScore.getOldMenu();
- List<RPCRequest> deleteCommands;
-
- // Set up deletes
- List<MenuCell> deletes = new ArrayList<>();
- keepsOld = new ArrayList<>();
- for (int x = 0; x < oldIntArray.size(); x++) {
- Integer old = oldIntArray.get(x);
- if (old.equals(MARKED_FOR_DELETION)){
- // grab cell to send to function to create delete commands
- deletes.add(oldMenuCells.get(x));
- } else if (old.equals(KEEP)) {
- keepsOld.add(oldMenuCells.get(x));
- }
- }
- // create the delete commands
- deleteCommands = createDeleteRPCsForCells(deletes);
-
- // Set up the adds
- List<MenuCell> adds = new ArrayList<>();
- keepsNew = new ArrayList<>();
- for (int x = 0; x < newIntArray.size(); x++) {
- Integer newInt = newIntArray.get(x);
- if (newInt.equals(MARKED_FOR_ADDITION)){
- // grab cell to send to function to create add commands
- adds.add(menuCells.get(x));
- } else if (newInt.equals(KEEP)){
- keepsNew.add(menuCells.get(x));
- }
- }
- updateIdsOnDynamicCells(adds);
- // this is needed for the onCommands to still work
- transferIdsToKeptCells(keepsNew);
-
- if (adds.size() > 0){
- DebugTool.logInfo(TAG, "Sending root menu updates");
- sendDynamicRootMenuRPCs(deleteCommands, adds);
- }else{
- DebugTool.logInfo(TAG, "All root menu items are kept. Check the sub menus");
- runSubMenuCompareAlgorithm();
- }
- }
-
- // OTHER
-
- private void sendDynamicRootMenuRPCs(List<RPCRequest> deleteCommands,final List<MenuCell> updatedCells){
- sendDeleteRPCs(deleteCommands,new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- createAndSendMenuCellRPCs(updatedCells, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- inProgressUpdate = null;
-
- if (!success){
- DebugTool.logError(TAG, "Error Sending Current Menu");
- }
-
- if (hasQueuedUpdate){
- //setMenuCells(waitingUpdateMenuCells);
- hasQueuedUpdate = false;
- }
- }
- });
- }
- });
- }
-
- // SUB MENUS
-
- // This is called in the listener in the sendMenu and sendSubMenuCommands Methods
- private void runSubMenuCompareAlgorithm(){
- // any cells that were re-added have their sub-cells added with them
- // at this point all we care about are the cells that were deemed equal and kept.
- if (keepsNew == null || keepsNew.size() == 0) {
- return;
- }
-
- List<SubCellCommandList> commandLists = new ArrayList<>();
-
- for (int i = 0; i < keepsNew.size(); i++) {
-
- MenuCell keptCell = keepsNew.get(i);
- MenuCell oldKeptCell = keepsOld.get(i);
-
- if (oldKeptCell.getSubCells() != null && oldKeptCell.getSubCells().size() > 0 && keptCell.getSubCells() != null && keptCell.getSubCells().size() > 0){
- // ACTUAL LOGIC
- RunScore subScore = compareOldAndNewLists(oldKeptCell.getSubCells(), keptCell.getSubCells());
-
- if (subScore != null){
- DebugTool.logInfo(TAG, "Sub menu Run Score: "+ oldKeptCell.getTitle()+ " Score: "+ subScore.getScore());
- SubCellCommandList commandList = new SubCellCommandList(oldKeptCell.getTitle(), oldKeptCell.getCellId(), subScore, oldKeptCell.getSubCells(), keptCell.getSubCells());
- commandLists.add(commandList);
- }
- }
- }
- createSubMenuDynamicCommands(commandLists);
- }
-
- private void createSubMenuDynamicCommands(final List<SubCellCommandList> commandLists){
-
- // break out
- if (commandLists.size() == 0){
- if (inProgressUpdate != null){
- inProgressUpdate = null;
- }
-
- if (hasQueuedUpdate) {
- DebugTool.logInfo(TAG, "Menu Manager has waiting updates, sending now");
- setMenuCells(waitingUpdateMenuCells);
- hasQueuedUpdate = false;
- }
- DebugTool.logInfo(TAG, "All menu updates, including sub menus - done.");
- return;
- }
-
- final SubCellCommandList commandList = commandLists.remove(0);
-
- DebugTool.logInfo(TAG, "Creating and Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
-
- // grab the scores
- RunScore score = commandList.getListsScore();
- List<Integer> newIntArray = score.getCurrentMenu();
- List<Integer> oldIntArray = score.getOldMenu();
-
- // Grab the sub-menus from the parent cell
- final List<MenuCell> oldCells = commandList.getOldList();
- final List<MenuCell> newCells = commandList.getNewList();
-
- // Create the list for the adds
- List<MenuCell> subCellKeepsNew = new ArrayList<>();
-
- List<RPCRequest> deleteCommands;
-
- // Set up deletes
- List<MenuCell> deletes = new ArrayList<>();
- for (int x = 0; x < oldIntArray.size(); x++) {
- Integer old = oldIntArray.get(x);
- if (old.equals(MARKED_FOR_DELETION)){
- // grab cell to send to function to create delete commands
- deletes.add(oldCells.get(x));
- }
- }
- // create the delete commands
- deleteCommands = createDeleteRPCsForCells(deletes);
-
- // Set up the adds
- List<MenuCell> adds = new ArrayList<>();
- for (int x = 0; x < newIntArray.size(); x++) {
- Integer newInt = newIntArray.get(x);
- if (newInt.equals(MARKED_FOR_ADDITION)){
- // grab cell to send to function to create add commands
- adds.add(newCells.get(x));
- } else if (newInt.equals(KEEP)){
- subCellKeepsNew.add(newCells.get(x));
- }
- }
- final List<MenuCell> addsWithNewIds = updateIdsOnDynamicSubCells(oldCells, adds, commandList.getParentId());
- // this is needed for the onCommands to still work
- transferIdsToKeptSubCells(oldCells, subCellKeepsNew);
-
- sendDeleteRPCs(deleteCommands,new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (addsWithNewIds != null && addsWithNewIds.size() > 0) {
- createAndSendDynamicSubMenuRPCs(newCells, addsWithNewIds, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- // recurse through next sub list
- DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
- createSubMenuDynamicCommands(commandLists);
- }
- });
- } else{
- // no add commands to send, recurse through next sub list
- DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: "+ commandList.getMenuTitle());
- createSubMenuDynamicCommands(commandLists);
- }
- }
- });
- }
-
- // OTHER HELPER METHODS:
-
- // COMPARISONS
-
- RunScore runMenuCompareAlgorithm(List<MenuCell> oldCells, List<MenuCell> newCells){
-
- if (oldCells == null || oldCells.size() == 0){
- return null;
- }
-
- RunScore bestScore = compareOldAndNewLists(oldCells, newCells);
- DebugTool.logInfo(TAG, "Best menu run score: "+ bestScore.getScore());
-
- return bestScore;
- }
-
- private RunScore compareOldAndNewLists(List<MenuCell> oldCells, List<MenuCell> newCells){
-
- RunScore bestRunScore = null;
-
- // This first loop is for each 'run'
- for (int run = 0; run < oldCells.size(); run++) {
-
- List<Integer> oldArray = new ArrayList<>(oldCells.size());
- List<Integer> newArray = new ArrayList<>(newCells.size());
-
- // Set the statuses
- setDeleteStatus(oldCells.size(), oldArray);
- setAddStatus(newCells.size(), newArray);
-
- int startIndex = 0;
-
- // Keep items that appear in both lists
- for (int oldItems = run; oldItems < oldCells.size(); oldItems++) {
-
- for (int newItems = startIndex; newItems < newCells.size(); newItems++) {
-
- if (oldCells.get(oldItems).equals(newCells.get(newItems))){
- oldArray.set(oldItems, KEEP);
- newArray.set(newItems, KEEP);
- // set the new start index
- startIndex = newItems + 1;
- break;
- }
- }
- }
-
- // Calculate number of adds, or the 'score' for this run
- int numberOfAdds = 0;
-
- for (int x = 0; x < newArray.size(); x++) {
- if (newArray.get(x).equals(MARKED_FOR_ADDITION)){
- numberOfAdds++;
- }
- }
-
- // see if we have a new best score and set it if we do
- if (bestRunScore == null || numberOfAdds < bestRunScore.getScore()){
- bestRunScore = new RunScore(numberOfAdds, oldArray, newArray);
- }
-
- }
- return bestRunScore;
- }
-
- private void setDeleteStatus(Integer size, List<Integer> oldArray){
- for (int i = 0; i < size; i++) {
- oldArray.add(MARKED_FOR_DELETION);
- }
- }
-
- private void setAddStatus(Integer size, List<Integer> newArray){
- for (int i = 0; i < size; i++) {
- newArray.add(MARKED_FOR_ADDITION);
- }
- }
-
- // ARTWORKS
-
- private List<SdlArtwork> findAllArtworksToBeUploadedFromCells(List<MenuCell> cells){
- // Make sure we can use images in the menus
- if (!supportsImages()){
- return new ArrayList<>();
- }
-
- List<SdlArtwork> artworks = new ArrayList<>();
- for (MenuCell cell : cells){
- if (artworkNeedsUpload(cell.getIcon())){
- artworks.add(cell.getIcon());
- }
- if (cell.getSubCells() != null && cell.getSubCells().size() > 0){
- artworks.addAll(findAllArtworksToBeUploadedFromCells(cell.getSubCells()));
- }
- }
-
- return artworks;
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- private boolean supportsImages(){
- return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, ImageFieldName.cmdIcon);
- }
-
- private boolean artworkNeedsUpload(SdlArtwork artwork){
- if (fileManager.get() != null){
- return (artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon());
- }
- return false;
- }
-
- // IDs
-
- private void updateIdsOnDynamicCells(List<MenuCell> dynamicCells){
- if (menuCells != null && menuCells.size() > 0 && dynamicCells != null && dynamicCells.size() > 0) {
- for (int z = 0; z < menuCells.size(); z++) {
- MenuCell mainCell = menuCells.get(z);
- for (int i = 0; i < dynamicCells.size(); i++) {
- MenuCell dynamicCell = dynamicCells.get(i);
- if (mainCell.equals(dynamicCell)) {
- int newId = ++lastMenuId;
- menuCells.get(z).setCellId(newId);
- dynamicCells.get(i).setCellId(newId);
-
- if (mainCell.getSubCells() != null && mainCell.getSubCells().size() > 0) {
- updateIdsOnMenuCells(mainCell.getSubCells(), mainCell.getCellId());
- }
- break;
- }
- }
- }
- }
- }
-
- private List<MenuCell> updateIdsOnDynamicSubCells(List<MenuCell> oldList, List<MenuCell> dynamicCells, Integer parentId){
- if (oldList != null && oldList.size() > 0 && dynamicCells != null && dynamicCells.size() > 0) {
- for (int z = 0; z < oldList.size(); z++) {
- MenuCell mainCell = oldList.get(z);
- for (int i = 0; i < dynamicCells.size(); i++) {
- MenuCell dynamicCell = dynamicCells.get(i);
- if (mainCell.equals(dynamicCell)) {
- int newId = ++lastMenuId;
- oldList.get(z).setCellId(newId);
- dynamicCells.get(i).setParentCellId(parentId);
- dynamicCells.get(i).setCellId(newId);
- }else{
- int newId = ++lastMenuId;
- dynamicCells.get(i).setParentCellId(parentId);
- dynamicCells.get(i).setCellId(newId);
- }
- }
- }
- return dynamicCells;
- }
- return null;
- }
-
- private void updateIdsOnMenuCells(List<MenuCell> cells, int parentId) {
- for (MenuCell cell : cells) {
- int newId = ++lastMenuId;
- cell.setCellId(newId);
- cell.setParentCellId(parentId);
- if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
- updateIdsOnMenuCells(cell.getSubCells(), cell.getCellId());
- }
- }
- }
-
- private void transferIdsToKeptCells(List<MenuCell> keeps) {
- for (int z = 0; z < oldMenuCells.size(); z++) {
- MenuCell oldCell = oldMenuCells.get(z);
- for (int i = 0; i < keeps.size(); i++) {
- MenuCell keptCell = keeps.get(i);
- if (oldCell.equals(keptCell)) {
- keptCell.setCellId(oldCell.getCellId());
- break;
- }
- }
- }
- }
-
- private void transferIdsToKeptSubCells(List<MenuCell> old, List<MenuCell> keeps) {
- for (int z = 0; z < old.size(); z++) {
- MenuCell oldCell = old.get(z);
- for (int i = 0; i < keeps.size(); i++) {
- MenuCell keptCell = keeps.get(i);
- if (oldCell.equals(keptCell)) {
- keptCell.setCellId(oldCell.getCellId());
- break;
- }
- }
- }
- }
-
- // DELETES
-
- private List<RPCRequest> createDeleteRPCsForCells(List<MenuCell> cells){
- List<RPCRequest> deletes = new ArrayList<>();
- for (MenuCell cell : cells){
- if (cell.getSubCells() == null){
- DeleteCommand delete = new DeleteCommand(cell.getCellId());
- deletes.add(delete);
- }else{
- DeleteSubMenu delete = new DeleteSubMenu(cell.getCellId());
- deletes.add(delete);
- }
- }
- return deletes;
- }
-
- // COMMANDS / SUBMENU RPCs
-
- private List<RPCRequest> mainMenuCommandsForCells(List<MenuCell> cellsToAdd, boolean shouldHaveArtwork) {
- List<RPCRequest> builtCommands = new ArrayList<>();
-
- // We need the index so we will use this type of loop
- for (int z = 0; z < menuCells.size(); z++) {
- MenuCell mainCell = menuCells.get(z);
- for (int i = 0; i < cellsToAdd.size(); i++) {
- MenuCell addCell = cellsToAdd.get(i);
- if (mainCell.equals(addCell)) {
- if (addCell.getSubCells() != null && addCell.getSubCells().size() > 0) {
- builtCommands.add(subMenuCommandForMenuCell(addCell, shouldHaveArtwork, z));
- } else {
- builtCommands.add(commandForMenuCell(addCell, shouldHaveArtwork, z));
- }
- break;
- }
- }
- }
- return builtCommands;
- }
-
- private List<RPCRequest> subMenuCommandsForCells(List<MenuCell> cells, boolean shouldHaveArtwork){
- List<RPCRequest> builtCommands = new ArrayList<>();
- for (MenuCell cell : cells){
- if (cell.getSubCells() != null && cell.getSubCells().size() > 0){
- builtCommands.addAll(allCommandsForCells(cell.getSubCells(), shouldHaveArtwork));
- }
- }
- return builtCommands;
- }
-
- List<RPCRequest> allCommandsForCells(List<MenuCell> cells, boolean shouldHaveArtwork){
- List<RPCRequest> builtCommands = new ArrayList<>();
-
- // We need the index so we will use this type of loop
- for (int i = 0; i < cells.size(); i++) {
- MenuCell cell = cells.get(i);
- if (cell.getSubCells() != null && cell.getSubCells().size() > 0){
- builtCommands.add(subMenuCommandForMenuCell(cell, shouldHaveArtwork, i));
- // recursively grab the commands for all the sub cells
- builtCommands.addAll(allCommandsForCells(cell.getSubCells(), shouldHaveArtwork));
- }else{
- builtCommands.add(commandForMenuCell(cell, shouldHaveArtwork, i));
- }
- }
- return builtCommands;
- }
-
- private List<RPCRequest> createCommandsForDynamicSubCells(List<MenuCell> oldMenuCells, List<MenuCell> cells, boolean shouldHaveArtwork) {
- List<RPCRequest> builtCommands = new ArrayList<>();
- for (int z = 0; z < oldMenuCells.size(); z++) {
- MenuCell oldCell = oldMenuCells.get(z);
- for (int i = 0; i < cells.size(); i++) {
- MenuCell cell = cells.get(i);
- if (cell.equals(oldCell)){
- builtCommands.add(commandForMenuCell(cell, shouldHaveArtwork, z));
- break;
- }
- }
- }
- return builtCommands;
- }
-
- private AddCommand commandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position){
-
- MenuParams params = new MenuParams(cell.getTitle());
- params.setParentID(cell.getParentCellId() != MAX_ID ? cell.getParentCellId() : null);
- params.setPosition(position);
-
- AddCommand command = new AddCommand(cell.getCellId());
- command.setMenuParams(params);
- if (cell.getVoiceCommands() != null && !cell.getVoiceCommands().isEmpty()) {
- command.setVrCommands(cell.getVoiceCommands());
- } else {
- command.setVrCommands(null);
- }
- command.setCmdIcon((cell.getIcon() != null && shouldHaveArtwork) ? cell.getIcon().getImageRPC() : null);
-
- return command;
- }
-
- private AddSubMenu subMenuCommandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position){
- AddSubMenu subMenu = new AddSubMenu(cell.getCellId(), cell.getTitle());
- subMenu.setPosition(position);
- 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;
- }
-
- // CELL COMMAND HANDLING
-
- private boolean callListenerForCells(List<MenuCell> cells, OnCommand command){
- if (cells != null && cells.size() > 0 && command != null) {
- for (MenuCell cell : cells) {
-
- if (cell.getCellId() == command.getCmdID() && cell.getMenuSelectionListener() != null) {
- cell.getMenuSelectionListener().onTriggered(command.getTriggerSource());
- return true;
- }
- if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
- // for each cell, if it has sub cells, recursively loop through those as well
- if (callListenerForCells(cell.getSubCells(), command)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- // LISTENERS
-
- private void addListeners(){
- // DISPLAY CAPABILITIES - via SCM
- onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- // instead of using the parameter it's more safe to use the convenience method
- List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
- if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError(TAG, "SoftButton Manager - Capabilities sent here are null or empty");
- }else {
- DisplayCapability display = capabilities.get(0);
- displayType = display.getDisplayName();
- for (WindowCapability windowCapability : display.getWindowCapabilities()) {
- int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- defaultMainWindowCapability = windowCapability;
- }
- }
- }
- }
-
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, "Display Capability cannot be retrieved");
- defaultMainWindowCapability = null;
- }
- };
- if (internalInterface.getSystemCapabilityManager() != null) {
- this.internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
- }
-
- // HMI UPDATES
- 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.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){
- if (waitingOnHMIUpdate){
- DebugTool.logInfo(TAG, "We now have proper HMI, sending waiting update");
- setMenuCells(waitingUpdateMenuCells);
- waitingUpdateMenuCells.clear();
- return;
- }
- }
-
- // 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 = onHMIStatus.getSystemContext();
-
- if (oldContext == SystemContext.SYSCTXT_MENU && currentSystemContext != SystemContext.SYSCTXT_MENU && currentHMILevel != HMILevel.HMI_NONE){
- if (waitingOnHMIUpdate){
- DebugTool.logInfo(TAG, "We now have a proper system context, sending waiting update");
- setMenuCells(waitingUpdateMenuCells);
- waitingUpdateMenuCells.clear();
- }
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
- // COMMANDS
- commandListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- OnCommand onCommand = (OnCommand) notification;
- callListenerForCells(menuCells, onCommand);
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
- }
-
- // SEND NEW MENU ITEMS
-
- private void createAndSendEntireMenu(){
-
- 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.logInfo(TAG, "HMI in None or System Context Menu, returning");
- waitingOnHMIUpdate = true;
- waitingUpdateMenuCells = menuCells;
- return;
- }
-
- if (inProgressUpdate != null && inProgressUpdate.size() > 0){
- // there's an in-progress update so this needs to wait
- DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
- hasQueuedUpdate = true;
- return;
- }
-
- deleteRootMenu(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- createAndSendMenuCellRPCs(menuCells, new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- inProgressUpdate = null;
-
- if (!success) {
- DebugTool.logError(TAG, "Error Sending Current Menu");
- }
-
- if (hasQueuedUpdate) {
- setMenuCells(waitingUpdateMenuCells);
- hasQueuedUpdate = false;
- }
- }
- });
- }
- });
- }
-
- private void createAndSendMenuCellRPCs(final List<MenuCell> menu, final CompletionListener listener){
-
- if (menu.size() == 0){
- if (listener != null){
- // This can be considered a success if the user was clearing out their menu
- listener.onComplete(true);
- }
- return;
- }
-
- List<RPCRequest> mainMenuCommands;
- final List<RPCRequest> subMenuCommands;
-
- if (findAllArtworksToBeUploadedFromCells(menu).size() > 0 || !supportsImages()){
- // Send artwork-less menu
- mainMenuCommands = mainMenuCommandsForCells(menu, false);
- subMenuCommands = subMenuCommandsForCells(menu, false);
- } else {
- mainMenuCommands = mainMenuCommandsForCells(menu, true);
- subMenuCommands = subMenuCommandsForCells(menu, true);
- }
-
- // add all built commands to inProgressUpdate
- inProgressUpdate = new ArrayList<>(mainMenuCommands);
- inProgressUpdate.addAll(subMenuCommands);
-
- internalInterface.sendSequentialRPCs(mainMenuCommands, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
- // nothing here
- }
-
- @Override
- public void onFinished() {
-
- if (subMenuCommands.size() > 0) {
- sendSubMenuCommandRPCs(subMenuCommands, listener);
- DebugTool.logInfo(TAG, "Finished sending main menu commands. Sending sub menu commands.");
- } else {
-
- if (keepsNew != null && keepsNew.size() > 0){
- runSubMenuCompareAlgorithm();
- }else {
- inProgressUpdate = null;
- DebugTool.logInfo(TAG, "Finished sending main menu commands.");
- }
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- try {
- DebugTool.logInfo(TAG, "Main Menu response: " + response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- } else {
- DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
- }
- }
- });
- }
-
- private void sendSubMenuCommandRPCs(List<RPCRequest> commands, final CompletionListener listener){
-
- internalInterface.sendSequentialRPCs(commands, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
-
- }
-
- @Override
- public void onFinished() {
-
- if (keepsNew != null && keepsNew.size() > 0){
- runSubMenuCompareAlgorithm();
- }else {
- DebugTool.logInfo(TAG, "Finished Updating Menu");
- inProgressUpdate = null;
-
- if (listener != null) {
- listener.onComplete(true);
- }
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- try {
- DebugTool.logInfo(TAG, "Sub Menu response: " + response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- } else {
- DebugTool.logError(TAG, "Failed to send sub menu commands: "+ response.getInfo());
- if (listener != null){
- listener.onComplete(false);
- }
- }
- }
- });
- }
-
- private void createAndSendDynamicSubMenuRPCs(List<MenuCell> newMenu, final List<MenuCell> adds, final CompletionListener listener){
-
- if (adds.size() == 0){
- if (listener != null){
- // This can be considered a success if the user was clearing out their menu
- DebugTool.logError(TAG, "Called createAndSendDynamicSubMenuRPCs with empty menu");
- listener.onComplete(true);
- }
- return;
- }
-
- List<RPCRequest> mainMenuCommands;
-
- if (findAllArtworksToBeUploadedFromCells(adds).size() > 0 || !supportsImages()){
- // Send artwork-less menu
- mainMenuCommands = createCommandsForDynamicSubCells(newMenu, adds, false);
- } else {
- mainMenuCommands = createCommandsForDynamicSubCells(newMenu, adds, true);
- }
-
- internalInterface.sendSequentialRPCs(mainMenuCommands, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
- // nothing here
- }
-
- @Override
- public void onFinished() {
-
- if (listener != null){
- listener.onComplete(true);
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- try {
- DebugTool.logInfo(TAG, "Dynamic Sub Menu response: " + response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- } else {
- DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
- }
- }
- });
- }
-
- // DELETE OLD MENU ITEMS
-
- private void deleteRootMenu(final CompletionListener listener){
-
- if (oldMenuCells == null || oldMenuCells.size() == 0) {
- if (listener != null){
- // technically this method is successful if there's nothing to delete
- DebugTool.logInfo(TAG, "No old cells to delete, returning");
- listener.onComplete(true);
- }
- } else {
- sendDeleteRPCs(createDeleteRPCsForCells(oldMenuCells), listener);
- }
- }
-
- private void sendDeleteRPCs(List<RPCRequest> deleteCommands, final CompletionListener listener){
- if (oldMenuCells != null && oldMenuCells.size() == 0) {
- if (listener != null){
- // technically this method is successful if there's nothing to delete
- DebugTool.logInfo(TAG, "No old cells to delete, returning");
- listener.onComplete(true);
- }
- return;
- }
-
- if (deleteCommands == null || deleteCommands.size() == 0){
- // no dynamic deletes required. return
- if (listener != null){
- // technically this method is successful if there's nothing to delete
- listener.onComplete(true);
- }
- return;
- }
-
- internalInterface.sendRPCs(deleteCommands, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
-
- }
-
- @Override
- public void onFinished() {
- DebugTool.logInfo(TAG, "Successfully deleted cells");
- if (listener != null){
- listener.onComplete(true);
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
-
- }
- });
- }
-
- private List<MenuCell> cloneMenuCellsList(List<MenuCell> originalList) {
- if (originalList == null) {
- return null;
- }
-
- List<MenuCell> clone = new ArrayList<>();
- for (MenuCell menuCell : originalList) {
- clone.add(menuCell.clone());
- }
- return clone;
- }
+ // UPDATING SYSTEM
+
+ // ROOT MENU
+
+ private void updateMenuAndDetermineBestUpdateMethod() {
+
+ 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.logInfo(TAG, "HMI in None or System Context Menu, returning");
+ waitingOnHMIUpdate = true;
+ waitingUpdateMenuCells = menuCells;
+ return;
+ }
+
+ if (inProgressUpdate != null && inProgressUpdate.size() > 0) {
+ // there's an in-progress update so this needs to wait
+ DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
+ hasQueuedUpdate = true;
+ return;
+ }
+
+ // Checks against what the developer set for update mode and against the display type
+ // to determine how the menu will be updated. This has the ability to be changed during
+ // a session.
+ if (checkUpdateMode(dynamicMenuUpdatesMode, displayType)) {
+ // run the lists through the new algorithm
+ RunScore rootScore = runMenuCompareAlgorithm(oldMenuCells, menuCells);
+ if (rootScore == null) {
+ // send initial menu (score will return null)
+ // make a copy of our current cells
+ DebugTool.logInfo(TAG, "Creating initial Menu");
+ // Set the IDs if needed
+ lastMenuId = menuCellIdMin;
+ updateIdsOnMenuCells(menuCells, parentIdNotFound);
+ this.oldMenuCells = new ArrayList<>(menuCells);
+ createAndSendEntireMenu();
+ } else {
+ DebugTool.logInfo(TAG, "Dynamically Updating Menu");
+ if (menuCells.size() == 0 && (oldMenuCells != null && oldMenuCells.size() > 0)) {
+ // the dev wants to clear the menu. We have old cells and an empty array of new ones.
+ deleteMenuWhenNewCellsEmpty();
+ } else {
+ // lets dynamically update the root menu
+ dynamicallyUpdateRootMenu(rootScore);
+ }
+ }
+ } else {
+ // we are in compatibility mode
+ DebugTool.logInfo(TAG, "Updating menus in compatibility mode");
+ lastMenuId = menuCellIdMin;
+ updateIdsOnMenuCells(menuCells, parentIdNotFound);
+ // if the old cell array is not null, we want to delete the entire thing, else copy the new array
+ if (oldMenuCells == null) {
+ this.oldMenuCells = new ArrayList<>(menuCells);
+ }
+ createAndSendEntireMenu();
+ }
+ }
+
+ private boolean checkUpdateMode(DynamicMenuUpdatesMode updateMode, String displayType) {
+
+ if (updateMode.equals(DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE)) {
+ if (displayType == null) {
+ return true;
+ }
+ return (!displayType.equals(DisplayType.GEN3_8_INCH.toString()));
+
+ } else if (updateMode.equals(DynamicMenuUpdatesMode.FORCE_OFF)) {
+ return false;
+ } else if (updateMode.equals(DynamicMenuUpdatesMode.FORCE_ON)) {
+ return true;
+ }
+
+ return true;
+ }
+
+ private void deleteMenuWhenNewCellsEmpty() {
+ sendDeleteRPCs(createDeleteRPCsForCells(oldMenuCells), new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ inProgressUpdate = null;
+
+ if (!success) {
+ DebugTool.logError(TAG, "Error Sending Current Menu");
+ } else {
+ DebugTool.logInfo(TAG, "Successfully Cleared Menu");
+ }
+ oldMenuCells = null;
+ if (hasQueuedUpdate) {
+ hasQueuedUpdate = false;
+ }
+ }
+ });
+ }
+
+ private void dynamicallyUpdateRootMenu(RunScore bestRootScore) {
+
+ // we need to run through the keeps and see if they have subCells, as they also need to be run
+ // through the compare function.
+ List<Integer> newIntArray = bestRootScore.getCurrentMenu();
+ List<Integer> oldIntArray = bestRootScore.getOldMenu();
+ List<RPCRequest> deleteCommands;
+
+ // Set up deletes
+ List<MenuCell> deletes = new ArrayList<>();
+ keepsOld = new ArrayList<>();
+ for (int x = 0; x < oldIntArray.size(); x++) {
+ Integer old = oldIntArray.get(x);
+ if (old.equals(MARKED_FOR_DELETION)) {
+ // grab cell to send to function to create delete commands
+ deletes.add(oldMenuCells.get(x));
+ } else if (old.equals(KEEP)) {
+ keepsOld.add(oldMenuCells.get(x));
+ }
+ }
+ // create the delete commands
+ deleteCommands = createDeleteRPCsForCells(deletes);
+
+ // Set up the adds
+ List<MenuCell> adds = new ArrayList<>();
+ keepsNew = new ArrayList<>();
+ for (int x = 0; x < newIntArray.size(); x++) {
+ Integer newInt = newIntArray.get(x);
+ if (newInt.equals(MARKED_FOR_ADDITION)) {
+ // grab cell to send to function to create add commands
+ adds.add(menuCells.get(x));
+ } else if (newInt.equals(KEEP)) {
+ keepsNew.add(menuCells.get(x));
+ }
+ }
+ updateIdsOnDynamicCells(adds);
+ // this is needed for the onCommands to still work
+ transferIdsToKeptCells(keepsNew);
+
+ if (adds.size() > 0) {
+ DebugTool.logInfo(TAG, "Sending root menu updates");
+ sendDynamicRootMenuRPCs(deleteCommands, adds);
+ } else {
+ DebugTool.logInfo(TAG, "All root menu items are kept. Check the sub menus");
+ runSubMenuCompareAlgorithm();
+ }
+ }
+
+ // OTHER
+
+ private void sendDynamicRootMenuRPCs(List<RPCRequest> deleteCommands, final List<MenuCell> updatedCells) {
+ sendDeleteRPCs(deleteCommands, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ createAndSendMenuCellRPCs(updatedCells, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ inProgressUpdate = null;
+
+ if (!success) {
+ DebugTool.logError(TAG, "Error Sending Current Menu");
+ }
+
+ if (hasQueuedUpdate) {
+ //setMenuCells(waitingUpdateMenuCells);
+ hasQueuedUpdate = false;
+ }
+ }
+ });
+ }
+ });
+ }
+
+ // SUB MENUS
+
+ // This is called in the listener in the sendMenu and sendSubMenuCommands Methods
+ private void runSubMenuCompareAlgorithm() {
+ // any cells that were re-added have their sub-cells added with them
+ // at this point all we care about are the cells that were deemed equal and kept.
+ if (keepsNew == null || keepsNew.size() == 0) {
+ return;
+ }
+
+ List<SubCellCommandList> commandLists = new ArrayList<>();
+
+ for (int i = 0; i < keepsNew.size(); i++) {
+
+ MenuCell keptCell = keepsNew.get(i);
+ MenuCell oldKeptCell = keepsOld.get(i);
+
+ if (oldKeptCell.getSubCells() != null && oldKeptCell.getSubCells().size() > 0 && keptCell.getSubCells() != null && keptCell.getSubCells().size() > 0) {
+ // ACTUAL LOGIC
+ RunScore subScore = compareOldAndNewLists(oldKeptCell.getSubCells(), keptCell.getSubCells());
+
+ if (subScore != null) {
+ DebugTool.logInfo(TAG, "Sub menu Run Score: " + oldKeptCell.getTitle() + " Score: " + subScore.getScore());
+ SubCellCommandList commandList = new SubCellCommandList(oldKeptCell.getTitle(), oldKeptCell.getCellId(), subScore, oldKeptCell.getSubCells(), keptCell.getSubCells());
+ commandLists.add(commandList);
+ }
+ }
+ }
+ createSubMenuDynamicCommands(commandLists);
+ }
+
+ private void createSubMenuDynamicCommands(final List<SubCellCommandList> commandLists) {
+
+ // break out
+ if (commandLists.size() == 0) {
+ if (inProgressUpdate != null) {
+ inProgressUpdate = null;
+ }
+
+ if (hasQueuedUpdate) {
+ DebugTool.logInfo(TAG, "Menu Manager has waiting updates, sending now");
+ setMenuCells(waitingUpdateMenuCells);
+ hasQueuedUpdate = false;
+ }
+ DebugTool.logInfo(TAG, "All menu updates, including sub menus - done.");
+ return;
+ }
+
+ final SubCellCommandList commandList = commandLists.remove(0);
+
+ DebugTool.logInfo(TAG, "Creating and Sending Dynamic Sub Commands For Root Menu Cell: " + commandList.getMenuTitle());
+
+ // grab the scores
+ RunScore score = commandList.getListsScore();
+ List<Integer> newIntArray = score.getCurrentMenu();
+ List<Integer> oldIntArray = score.getOldMenu();
+
+ // Grab the sub-menus from the parent cell
+ final List<MenuCell> oldCells = commandList.getOldList();
+ final List<MenuCell> newCells = commandList.getNewList();
+
+ // Create the list for the adds
+ List<MenuCell> subCellKeepsNew = new ArrayList<>();
+
+ List<RPCRequest> deleteCommands;
+
+ // Set up deletes
+ List<MenuCell> deletes = new ArrayList<>();
+ for (int x = 0; x < oldIntArray.size(); x++) {
+ Integer old = oldIntArray.get(x);
+ if (old.equals(MARKED_FOR_DELETION)) {
+ // grab cell to send to function to create delete commands
+ deletes.add(oldCells.get(x));
+ }
+ }
+ // create the delete commands
+ deleteCommands = createDeleteRPCsForCells(deletes);
+
+ // Set up the adds
+ List<MenuCell> adds = new ArrayList<>();
+ for (int x = 0; x < newIntArray.size(); x++) {
+ Integer newInt = newIntArray.get(x);
+ if (newInt.equals(MARKED_FOR_ADDITION)) {
+ // grab cell to send to function to create add commands
+ adds.add(newCells.get(x));
+ } else if (newInt.equals(KEEP)) {
+ subCellKeepsNew.add(newCells.get(x));
+ }
+ }
+ final List<MenuCell> addsWithNewIds = updateIdsOnDynamicSubCells(oldCells, adds, commandList.getParentId());
+ // this is needed for the onCommands to still work
+ transferIdsToKeptSubCells(oldCells, subCellKeepsNew);
+
+ sendDeleteRPCs(deleteCommands, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (addsWithNewIds != null && addsWithNewIds.size() > 0) {
+ createAndSendDynamicSubMenuRPCs(newCells, addsWithNewIds, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ // recurse through next sub list
+ DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: " + commandList.getMenuTitle());
+ createSubMenuDynamicCommands(commandLists);
+ }
+ });
+ } else {
+ // no add commands to send, recurse through next sub list
+ DebugTool.logInfo(TAG, "Finished Sending Dynamic Sub Commands For Root Menu Cell: " + commandList.getMenuTitle());
+ createSubMenuDynamicCommands(commandLists);
+ }
+ }
+ });
+ }
+
+ // OTHER HELPER METHODS:
+
+ // COMPARISONS
+
+ RunScore runMenuCompareAlgorithm(List<MenuCell> oldCells, List<MenuCell> newCells) {
+
+ if (oldCells == null || oldCells.size() == 0) {
+ return null;
+ }
+
+ RunScore bestScore = compareOldAndNewLists(oldCells, newCells);
+ DebugTool.logInfo(TAG, "Best menu run score: " + bestScore.getScore());
+
+ return bestScore;
+ }
+
+ private RunScore compareOldAndNewLists(List<MenuCell> oldCells, List<MenuCell> newCells) {
+
+ RunScore bestRunScore = null;
+
+ // This first loop is for each 'run'
+ for (int run = 0; run < oldCells.size(); run++) {
+
+ List<Integer> oldArray = new ArrayList<>(oldCells.size());
+ List<Integer> newArray = new ArrayList<>(newCells.size());
+
+ // Set the statuses
+ setDeleteStatus(oldCells.size(), oldArray);
+ setAddStatus(newCells.size(), newArray);
+
+ int startIndex = 0;
+
+ // Keep items that appear in both lists
+ for (int oldItems = run; oldItems < oldCells.size(); oldItems++) {
+
+ for (int newItems = startIndex; newItems < newCells.size(); newItems++) {
+
+ if (oldCells.get(oldItems).equals(newCells.get(newItems))) {
+ oldArray.set(oldItems, KEEP);
+ newArray.set(newItems, KEEP);
+ // set the new start index
+ startIndex = newItems + 1;
+ break;
+ }
+ }
+ }
+
+ // Calculate number of adds, or the 'score' for this run
+ int numberOfAdds = 0;
+
+ for (int x = 0; x < newArray.size(); x++) {
+ if (newArray.get(x).equals(MARKED_FOR_ADDITION)) {
+ numberOfAdds++;
+ }
+ }
+
+ // see if we have a new best score and set it if we do
+ if (bestRunScore == null || numberOfAdds < bestRunScore.getScore()) {
+ bestRunScore = new RunScore(numberOfAdds, oldArray, newArray);
+ }
+
+ }
+ return bestRunScore;
+ }
+
+ private void setDeleteStatus(Integer size, List<Integer> oldArray) {
+ for (int i = 0; i < size; i++) {
+ oldArray.add(MARKED_FOR_DELETION);
+ }
+ }
+
+ private void setAddStatus(Integer size, List<Integer> newArray) {
+ for (int i = 0; i < size; i++) {
+ newArray.add(MARKED_FOR_ADDITION);
+ }
+ }
+
+ // ARTWORKS
+
+ private List<SdlArtwork> findAllArtworksToBeUploadedFromCells(List<MenuCell> cells) {
+ // Make sure we can use images in the menus
+ if (!supportsImages()) {
+ return new ArrayList<>();
+ }
+
+ List<SdlArtwork> artworks = new ArrayList<>();
+ for (MenuCell cell : cells) {
+ if (artworkNeedsUpload(cell.getIcon())) {
+ artworks.add(cell.getIcon());
+ }
+ if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
+ artworks.addAll(findAllArtworksToBeUploadedFromCells(cell.getSubCells()));
+ }
+ }
+
+ return artworks;
+ }
+
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
+ private boolean supportsImages() {
+ return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, ImageFieldName.cmdIcon);
+ }
+
+ private boolean artworkNeedsUpload(SdlArtwork artwork) {
+ if (fileManager.get() != null) {
+ return (artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon());
+ }
+ return false;
+ }
+
+ // IDs
+
+ private void updateIdsOnDynamicCells(List<MenuCell> dynamicCells) {
+ if (menuCells != null && menuCells.size() > 0 && dynamicCells != null && dynamicCells.size() > 0) {
+ for (int z = 0; z < menuCells.size(); z++) {
+ MenuCell mainCell = menuCells.get(z);
+ for (int i = 0; i < dynamicCells.size(); i++) {
+ MenuCell dynamicCell = dynamicCells.get(i);
+ if (mainCell.equals(dynamicCell)) {
+ int newId = ++lastMenuId;
+ menuCells.get(z).setCellId(newId);
+ dynamicCells.get(i).setCellId(newId);
+
+ if (mainCell.getSubCells() != null && mainCell.getSubCells().size() > 0) {
+ updateIdsOnMenuCells(mainCell.getSubCells(), mainCell.getCellId());
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private List<MenuCell> updateIdsOnDynamicSubCells(List<MenuCell> oldList, List<MenuCell> dynamicCells, Integer parentId) {
+ if (oldList != null && oldList.size() > 0 && dynamicCells != null && dynamicCells.size() > 0) {
+ for (int z = 0; z < oldList.size(); z++) {
+ MenuCell mainCell = oldList.get(z);
+ for (int i = 0; i < dynamicCells.size(); i++) {
+ MenuCell dynamicCell = dynamicCells.get(i);
+ if (mainCell.equals(dynamicCell)) {
+ int newId = ++lastMenuId;
+ oldList.get(z).setCellId(newId);
+ dynamicCells.get(i).setParentCellId(parentId);
+ dynamicCells.get(i).setCellId(newId);
+ } else {
+ int newId = ++lastMenuId;
+ dynamicCells.get(i).setParentCellId(parentId);
+ dynamicCells.get(i).setCellId(newId);
+ }
+ }
+ }
+ return dynamicCells;
+ }
+ return null;
+ }
+
+ private void updateIdsOnMenuCells(List<MenuCell> cells, int parentId) {
+ for (MenuCell cell : cells) {
+ int newId = ++lastMenuId;
+ cell.setCellId(newId);
+ cell.setParentCellId(parentId);
+ if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
+ updateIdsOnMenuCells(cell.getSubCells(), cell.getCellId());
+ }
+ }
+ }
+
+ private void transferIdsToKeptCells(List<MenuCell> keeps) {
+ for (int z = 0; z < oldMenuCells.size(); z++) {
+ MenuCell oldCell = oldMenuCells.get(z);
+ for (int i = 0; i < keeps.size(); i++) {
+ MenuCell keptCell = keeps.get(i);
+ if (oldCell.equals(keptCell)) {
+ keptCell.setCellId(oldCell.getCellId());
+ break;
+ }
+ }
+ }
+ }
+
+ private void transferIdsToKeptSubCells(List<MenuCell> old, List<MenuCell> keeps) {
+ for (int z = 0; z < old.size(); z++) {
+ MenuCell oldCell = old.get(z);
+ for (int i = 0; i < keeps.size(); i++) {
+ MenuCell keptCell = keeps.get(i);
+ if (oldCell.equals(keptCell)) {
+ keptCell.setCellId(oldCell.getCellId());
+ break;
+ }
+ }
+ }
+ }
+
+ // DELETES
+
+ private List<RPCRequest> createDeleteRPCsForCells(List<MenuCell> cells) {
+ List<RPCRequest> deletes = new ArrayList<>();
+ for (MenuCell cell : cells) {
+ if (cell.getSubCells() == null) {
+ DeleteCommand delete = new DeleteCommand(cell.getCellId());
+ deletes.add(delete);
+ } else {
+ DeleteSubMenu delete = new DeleteSubMenu(cell.getCellId());
+ deletes.add(delete);
+ }
+ }
+ return deletes;
+ }
+
+ // COMMANDS / SUBMENU RPCs
+
+ private List<RPCRequest> mainMenuCommandsForCells(List<MenuCell> cellsToAdd, boolean shouldHaveArtwork) {
+ List<RPCRequest> builtCommands = new ArrayList<>();
+
+ // We need the index so we will use this type of loop
+ for (int z = 0; z < menuCells.size(); z++) {
+ MenuCell mainCell = menuCells.get(z);
+ for (int i = 0; i < cellsToAdd.size(); i++) {
+ MenuCell addCell = cellsToAdd.get(i);
+ if (mainCell.equals(addCell)) {
+ if (addCell.getSubCells() != null && addCell.getSubCells().size() > 0) {
+ builtCommands.add(subMenuCommandForMenuCell(addCell, shouldHaveArtwork, z));
+ } else {
+ builtCommands.add(commandForMenuCell(addCell, shouldHaveArtwork, z));
+ }
+ break;
+ }
+ }
+ }
+ return builtCommands;
+ }
+
+ private List<RPCRequest> subMenuCommandsForCells(List<MenuCell> cells, boolean shouldHaveArtwork) {
+ List<RPCRequest> builtCommands = new ArrayList<>();
+ for (MenuCell cell : cells) {
+ if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
+ builtCommands.addAll(allCommandsForCells(cell.getSubCells(), shouldHaveArtwork));
+ }
+ }
+ return builtCommands;
+ }
+
+ List<RPCRequest> allCommandsForCells(List<MenuCell> cells, boolean shouldHaveArtwork) {
+ List<RPCRequest> builtCommands = new ArrayList<>();
+
+ // We need the index so we will use this type of loop
+ for (int i = 0; i < cells.size(); i++) {
+ MenuCell cell = cells.get(i);
+ if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
+ builtCommands.add(subMenuCommandForMenuCell(cell, shouldHaveArtwork, i));
+ // recursively grab the commands for all the sub cells
+ builtCommands.addAll(allCommandsForCells(cell.getSubCells(), shouldHaveArtwork));
+ } else {
+ builtCommands.add(commandForMenuCell(cell, shouldHaveArtwork, i));
+ }
+ }
+ return builtCommands;
+ }
+
+ private List<RPCRequest> createCommandsForDynamicSubCells(List<MenuCell> oldMenuCells, List<MenuCell> cells, boolean shouldHaveArtwork) {
+ List<RPCRequest> builtCommands = new ArrayList<>();
+ for (int z = 0; z < oldMenuCells.size(); z++) {
+ MenuCell oldCell = oldMenuCells.get(z);
+ for (int i = 0; i < cells.size(); i++) {
+ MenuCell cell = cells.get(i);
+ if (cell.equals(oldCell)) {
+ builtCommands.add(commandForMenuCell(cell, shouldHaveArtwork, z));
+ break;
+ }
+ }
+ }
+ return builtCommands;
+ }
+
+ private AddCommand commandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position) {
+
+ MenuParams params = new MenuParams(cell.getTitle());
+ params.setParentID(cell.getParentCellId() != MAX_ID ? cell.getParentCellId() : null);
+ params.setPosition(position);
+
+ AddCommand command = new AddCommand(cell.getCellId());
+ command.setMenuParams(params);
+ if (cell.getVoiceCommands() != null && !cell.getVoiceCommands().isEmpty()) {
+ command.setVrCommands(cell.getVoiceCommands());
+ } else {
+ command.setVrCommands(null);
+ }
+ command.setCmdIcon((cell.getIcon() != null && shouldHaveArtwork) ? cell.getIcon().getImageRPC() : null);
+
+ return command;
+ }
+
+ private AddSubMenu subMenuCommandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position) {
+ AddSubMenu subMenu = new AddSubMenu(cell.getCellId(), cell.getTitle());
+ subMenu.setPosition(position);
+ 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;
+ }
+
+ // CELL COMMAND HANDLING
+
+ private boolean callListenerForCells(List<MenuCell> cells, OnCommand command) {
+ if (cells != null && cells.size() > 0 && command != null) {
+ for (MenuCell cell : cells) {
+
+ if (cell.getCellId() == command.getCmdID() && cell.getMenuSelectionListener() != null) {
+ cell.getMenuSelectionListener().onTriggered(command.getTriggerSource());
+ return true;
+ }
+ if (cell.getSubCells() != null && cell.getSubCells().size() > 0) {
+ // for each cell, if it has sub cells, recursively loop through those as well
+ if (callListenerForCells(cell.getSubCells(), command)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ // LISTENERS
+
+ private void addListeners() {
+ // DISPLAY CAPABILITIES - via SCM
+ onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError(TAG, "SoftButton Manager - Capabilities sent here are null or empty");
+ } else {
+ DisplayCapability display = capabilities.get(0);
+ displayType = display.getDisplayName();
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
+ }
+ };
+ if (internalInterface.getSystemCapabilityManager() != null) {
+ this.internalInterface.getSystemCapabilityManager().addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ }
+
+ // HMI UPDATES
+ 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.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) {
+ if (waitingOnHMIUpdate) {
+ DebugTool.logInfo(TAG, "We now have proper HMI, sending waiting update");
+ setMenuCells(waitingUpdateMenuCells);
+ waitingUpdateMenuCells.clear();
+ return;
+ }
+ }
+
+ // 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 = onHMIStatus.getSystemContext();
+
+ if (oldContext == SystemContext.SYSCTXT_MENU && currentSystemContext != SystemContext.SYSCTXT_MENU && currentHMILevel != HMILevel.HMI_NONE) {
+ if (waitingOnHMIUpdate) {
+ DebugTool.logInfo(TAG, "We now have a proper system context, sending waiting update");
+ setMenuCells(waitingUpdateMenuCells);
+ waitingUpdateMenuCells.clear();
+ }
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ // COMMANDS
+ commandListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnCommand onCommand = (OnCommand) notification;
+ callListenerForCells(menuCells, onCommand);
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
+ }
+
+ // SEND NEW MENU ITEMS
+
+ private void createAndSendEntireMenu() {
+
+ 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.logInfo(TAG, "HMI in None or System Context Menu, returning");
+ waitingOnHMIUpdate = true;
+ waitingUpdateMenuCells = menuCells;
+ return;
+ }
+
+ if (inProgressUpdate != null && inProgressUpdate.size() > 0) {
+ // there's an in-progress update so this needs to wait
+ DebugTool.logInfo(TAG, "There is an in progress Menu Update, returning");
+ hasQueuedUpdate = true;
+ return;
+ }
+
+ deleteRootMenu(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ createAndSendMenuCellRPCs(menuCells, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ inProgressUpdate = null;
+
+ if (!success) {
+ DebugTool.logError(TAG, "Error Sending Current Menu");
+ }
+
+ if (hasQueuedUpdate) {
+ setMenuCells(waitingUpdateMenuCells);
+ hasQueuedUpdate = false;
+ }
+ }
+ });
+ }
+ });
+ }
+
+ private void createAndSendMenuCellRPCs(final List<MenuCell> menu, final CompletionListener listener) {
+
+ if (menu.size() == 0) {
+ if (listener != null) {
+ // This can be considered a success if the user was clearing out their menu
+ listener.onComplete(true);
+ }
+ return;
+ }
+
+ List<RPCRequest> mainMenuCommands;
+ final List<RPCRequest> subMenuCommands;
+
+ if (findAllArtworksToBeUploadedFromCells(menu).size() > 0 || !supportsImages()) {
+ // Send artwork-less menu
+ mainMenuCommands = mainMenuCommandsForCells(menu, false);
+ subMenuCommands = subMenuCommandsForCells(menu, false);
+ } else {
+ mainMenuCommands = mainMenuCommandsForCells(menu, true);
+ subMenuCommands = subMenuCommandsForCells(menu, true);
+ }
+
+ // add all built commands to inProgressUpdate
+ inProgressUpdate = new ArrayList<>(mainMenuCommands);
+ inProgressUpdate.addAll(subMenuCommands);
+
+ internalInterface.sendSequentialRPCs(mainMenuCommands, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+ // nothing here
+ }
+
+ @Override
+ public void onFinished() {
+
+ if (subMenuCommands.size() > 0) {
+ sendSubMenuCommandRPCs(subMenuCommands, listener);
+ DebugTool.logInfo(TAG, "Finished sending main menu commands. Sending sub menu commands.");
+ } else {
+
+ if (keepsNew != null && keepsNew.size() > 0) {
+ runSubMenuCompareAlgorithm();
+ } else {
+ inProgressUpdate = null;
+ DebugTool.logInfo(TAG, "Finished sending main menu commands.");
+ }
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Main Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
+ }
+ }
+ });
+ }
+
+ private void sendSubMenuCommandRPCs(List<RPCRequest> commands, final CompletionListener listener) {
+
+ internalInterface.sendSequentialRPCs(commands, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+
+ if (keepsNew != null && keepsNew.size() > 0) {
+ runSubMenuCompareAlgorithm();
+ } else {
+ DebugTool.logInfo(TAG, "Finished Updating Menu");
+ inProgressUpdate = null;
+
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Sub Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Failed to send sub menu commands: " + response.getInfo());
+ if (listener != null) {
+ listener.onComplete(false);
+ }
+ }
+ }
+ });
+ }
+
+ private void createAndSendDynamicSubMenuRPCs(List<MenuCell> newMenu, final List<MenuCell> adds, final CompletionListener listener) {
+
+ if (adds.size() == 0) {
+ if (listener != null) {
+ // This can be considered a success if the user was clearing out their menu
+ DebugTool.logError(TAG, "Called createAndSendDynamicSubMenuRPCs with empty menu");
+ listener.onComplete(true);
+ }
+ return;
+ }
+
+ List<RPCRequest> mainMenuCommands;
+
+ if (findAllArtworksToBeUploadedFromCells(adds).size() > 0 || !supportsImages()) {
+ // Send artwork-less menu
+ mainMenuCommands = createCommandsForDynamicSubCells(newMenu, adds, false);
+ } else {
+ mainMenuCommands = createCommandsForDynamicSubCells(newMenu, adds, true);
+ }
+
+ internalInterface.sendSequentialRPCs(mainMenuCommands, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+ // nothing here
+ }
+
+ @Override
+ public void onFinished() {
+
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Dynamic Sub Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
+ }
+ }
+ });
+ }
+
+ // DELETE OLD MENU ITEMS
+
+ private void deleteRootMenu(final CompletionListener listener) {
+
+ if (oldMenuCells == null || oldMenuCells.size() == 0) {
+ if (listener != null) {
+ // technically this method is successful if there's nothing to delete
+ DebugTool.logInfo(TAG, "No old cells to delete, returning");
+ listener.onComplete(true);
+ }
+ } else {
+ sendDeleteRPCs(createDeleteRPCsForCells(oldMenuCells), listener);
+ }
+ }
+
+ private void sendDeleteRPCs(List<RPCRequest> deleteCommands, final CompletionListener listener) {
+ if (oldMenuCells != null && oldMenuCells.size() == 0) {
+ if (listener != null) {
+ // technically this method is successful if there's nothing to delete
+ DebugTool.logInfo(TAG, "No old cells to delete, returning");
+ listener.onComplete(true);
+ }
+ return;
+ }
+
+ if (deleteCommands == null || deleteCommands.size() == 0) {
+ // no dynamic deletes required. return
+ if (listener != null) {
+ // technically this method is successful if there's nothing to delete
+ listener.onComplete(true);
+ }
+ return;
+ }
+
+ internalInterface.sendRPCs(deleteCommands, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+ DebugTool.logInfo(TAG, "Successfully deleted cells");
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+
+ }
+ });
+ }
+
+ private List<MenuCell> cloneMenuCellsList(List<MenuCell> originalList) {
+ if (originalList == null) {
+ return null;
+ }
+
+ List<MenuCell> clone = new ArrayList<>();
+ for (MenuCell menuCell : originalList) {
+ clone.add(menuCell.clone());
+ }
+ return clone;
+ }
}
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 6ddd37124..4c449ff61 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
@@ -54,272 +54,273 @@ import java.util.ArrayList;
import java.util.List;
abstract class BaseVoiceCommandManager extends BaseSubManager {
- private static final String TAG = "BaseVoiceCommandManager";
- List<VoiceCommand> voiceCommands, oldVoiceCommands;
+ private static final String TAG = "BaseVoiceCommandManager";
+ List<VoiceCommand> voiceCommands, oldVoiceCommands;
- List<AddCommand> inProgressUpdate;
-
- int lastVoiceCommandId;
- private static final int voiceCommandIdMin = 1900000000;
-
- boolean waitingOnHMIUpdate;
- boolean hasQueuedUpdate;
-
- HMILevel currentHMILevel;
- OnRPCNotificationListener hmiListener;
- OnRPCNotificationListener commandListener;
-
- // CONSTRUCTORS
-
- BaseVoiceCommandManager(@NonNull ISdl internalInterface) {
- super(internalInterface);
-
- currentHMILevel = HMILevel.HMI_NONE;
- addListeners();
- lastVoiceCommandId = voiceCommandIdMin;
- }
-
- @Override
- public void start(CompletionListener listener) {
- transitionToState(READY);
- super.start(listener);
- }
-
- @Override
- public void dispose(){
-
- lastVoiceCommandId = voiceCommandIdMin;
- voiceCommands = null;
- oldVoiceCommands = null;
-
- waitingOnHMIUpdate = false;
- currentHMILevel = null;
- inProgressUpdate = null;
- hasQueuedUpdate = false;
-
- // remove listeners
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
-
- super.dispose();
- }
-
- // SETTERS
-
- public void setVoiceCommands(List<VoiceCommand> voiceCommands){
-
- // we actually need voice commands to set.
- if (voiceCommands == null || voiceCommands.size() == 0){
- DebugTool.logInfo(TAG, "Trying to set empty list of voice commands, returning");
- return;
- }
-
- // make sure hmi is not none
- if (currentHMILevel == null || currentHMILevel == HMILevel.HMI_NONE){
- // Trying to send on HMI_NONE, waiting for full
- this.voiceCommands = new ArrayList<>(voiceCommands);
- waitingOnHMIUpdate = true;
- return;
- }
-
- waitingOnHMIUpdate = false;
- lastVoiceCommandId = voiceCommandIdMin;
- updateIdsOnVoiceCommands(voiceCommands);
- this.oldVoiceCommands = new ArrayList<>();
- if (this.voiceCommands != null && !this.voiceCommands.isEmpty()) {
- this.oldVoiceCommands.addAll(this.voiceCommands);
- }
- this.voiceCommands = new ArrayList<>(voiceCommands);
-
- update();
- }
-
- public List<VoiceCommand> getVoiceCommands(){
- return voiceCommands;
- }
-
- // UPDATING SYSTEM
-
- private void update(){
-
- if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE)){
- waitingOnHMIUpdate = true;
- return;
- }
-
- if (inProgressUpdate != null){
- // There's an in-progress update, put this on hold
- hasQueuedUpdate = true;
- return;
- }
-
- sendDeleteCurrentVoiceCommands(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- // we don't care about errors from deleting, send new add commands
- sendCurrentVoiceCommands(new CompletionListener() {
- @Override
- public void onComplete(boolean success2) {
- inProgressUpdate = null;
-
- if (hasQueuedUpdate){
- update();
- hasQueuedUpdate = false;
- }
-
- if (!success2){
- DebugTool.logError(TAG, "Error sending voice commands");
- }
- }
- });
- }
- });
-
- }
-
- // DELETING OLD MENU ITEMS
-
- private void sendDeleteCurrentVoiceCommands(final CompletionListener listener){
-
- if (oldVoiceCommands == null || oldVoiceCommands.size() == 0){
- if (listener != null){
- listener.onComplete(true);
- }
- return;
- }
-
- List<DeleteCommand> deleteVoiceCommands = deleteCommandsForVoiceCommands(oldVoiceCommands);
- oldVoiceCommands.clear();
- internalInterface.sendRPCs(deleteVoiceCommands, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
-
- }
-
- @Override
- public void onFinished() {
- DebugTool.logInfo(TAG, "Successfully deleted old voice commands");
- if (listener != null){
- listener.onComplete(true);
- }
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {}
- });
-
- }
-
- // SEND NEW MENU ITEMS
-
- private void sendCurrentVoiceCommands(final CompletionListener listener){
-
- if (voiceCommands == null || voiceCommands.size() == 0){
- if (listener != null){
- listener.onComplete(true); // no voice commands to send doesnt mean that its an error
- }
- return;
- }
-
- inProgressUpdate = addCommandsForVoiceCommands(voiceCommands);
-
- internalInterface.sendRPCs(inProgressUpdate, new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
-
- }
-
- @Override
- public void onFinished() {
- DebugTool.logInfo(TAG, "Sending Voice Commands Complete");
- if (listener != null){
- listener.onComplete(true);
- }
- oldVoiceCommands = voiceCommands;
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- }
- });
- }
-
- // DELETES
-
- List<DeleteCommand> deleteCommandsForVoiceCommands(List<VoiceCommand> voiceCommands){
- List<DeleteCommand> deleteCommandList = new ArrayList<>();
- for (VoiceCommand command : voiceCommands){
- DeleteCommand delete = new DeleteCommand(command.getCommandId());
- deleteCommandList.add(delete);
- }
- return deleteCommandList;
- }
-
- // COMMANDS
-
- List<AddCommand> addCommandsForVoiceCommands(List<VoiceCommand> voiceCommands){
- List<AddCommand> addCommandList = new ArrayList<>();
- for (VoiceCommand command : voiceCommands){
- addCommandList.add(commandForVoiceCommand(command));
- }
- return addCommandList;
- }
-
- private AddCommand commandForVoiceCommand(VoiceCommand voiceCommand){
- AddCommand command = new AddCommand(voiceCommand.getCommandId());
- command.setVrCommands(voiceCommand.getVoiceCommands());
- return command;
- }
-
- // HELPERS
-
- private void updateIdsOnVoiceCommands(List<VoiceCommand> voiceCommands){
- for (VoiceCommand command : voiceCommands){
- command.setCommandId(++lastVoiceCommandId);
- }
- }
-
- // LISTENERS
-
- private void addListeners(){
-
- // HMI UPDATES
- 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.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){
- setVoiceCommands(voiceCommands);
- }
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
- // COMMANDS
- commandListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- OnCommand onCommand = (OnCommand) notification;
- if (voiceCommands != null && voiceCommands.size() > 0){
- for (VoiceCommand command : voiceCommands){
- if (onCommand.getCmdID() == command.getCommandId()){
- if (command.getVoiceCommandSelectionListener() != null) {
- command.getVoiceCommandSelectionListener().onVoiceCommandSelected();
- break;
- }
- }
- }
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
- }
+ List<AddCommand> inProgressUpdate;
+
+ int lastVoiceCommandId;
+ private static final int voiceCommandIdMin = 1900000000;
+
+ boolean waitingOnHMIUpdate;
+ boolean hasQueuedUpdate;
+
+ HMILevel currentHMILevel;
+ OnRPCNotificationListener hmiListener;
+ OnRPCNotificationListener commandListener;
+
+ // CONSTRUCTORS
+
+ BaseVoiceCommandManager(@NonNull ISdl internalInterface) {
+ super(internalInterface);
+
+ currentHMILevel = HMILevel.HMI_NONE;
+ addListeners();
+ lastVoiceCommandId = voiceCommandIdMin;
+ }
+
+ @Override
+ public void start(CompletionListener listener) {
+ transitionToState(READY);
+ super.start(listener);
+ }
+
+ @Override
+ public void dispose() {
+
+ lastVoiceCommandId = voiceCommandIdMin;
+ voiceCommands = null;
+ oldVoiceCommands = null;
+
+ waitingOnHMIUpdate = false;
+ currentHMILevel = null;
+ inProgressUpdate = null;
+ hasQueuedUpdate = false;
+
+ // remove listeners
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
+
+ super.dispose();
+ }
+
+ // SETTERS
+
+ public void setVoiceCommands(List<VoiceCommand> voiceCommands) {
+
+ // we actually need voice commands to set.
+ if (voiceCommands == null || voiceCommands.size() == 0) {
+ DebugTool.logInfo(TAG, "Trying to set empty list of voice commands, returning");
+ return;
+ }
+
+ // make sure hmi is not none
+ if (currentHMILevel == null || currentHMILevel == HMILevel.HMI_NONE) {
+ // Trying to send on HMI_NONE, waiting for full
+ this.voiceCommands = new ArrayList<>(voiceCommands);
+ waitingOnHMIUpdate = true;
+ return;
+ }
+
+ waitingOnHMIUpdate = false;
+ lastVoiceCommandId = voiceCommandIdMin;
+ updateIdsOnVoiceCommands(voiceCommands);
+ this.oldVoiceCommands = new ArrayList<>();
+ if (this.voiceCommands != null && !this.voiceCommands.isEmpty()) {
+ this.oldVoiceCommands.addAll(this.voiceCommands);
+ }
+ this.voiceCommands = new ArrayList<>(voiceCommands);
+
+ update();
+ }
+
+ public List<VoiceCommand> getVoiceCommands() {
+ return voiceCommands;
+ }
+
+ // UPDATING SYSTEM
+
+ private void update() {
+
+ if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE)) {
+ waitingOnHMIUpdate = true;
+ return;
+ }
+
+ if (inProgressUpdate != null) {
+ // There's an in-progress update, put this on hold
+ hasQueuedUpdate = true;
+ return;
+ }
+
+ sendDeleteCurrentVoiceCommands(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ // we don't care about errors from deleting, send new add commands
+ sendCurrentVoiceCommands(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success2) {
+ inProgressUpdate = null;
+
+ if (hasQueuedUpdate) {
+ update();
+ hasQueuedUpdate = false;
+ }
+
+ if (!success2) {
+ DebugTool.logError(TAG, "Error sending voice commands");
+ }
+ }
+ });
+ }
+ });
+
+ }
+
+ // DELETING OLD MENU ITEMS
+
+ private void sendDeleteCurrentVoiceCommands(final CompletionListener listener) {
+
+ if (oldVoiceCommands == null || oldVoiceCommands.size() == 0) {
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ return;
+ }
+
+ List<DeleteCommand> deleteVoiceCommands = deleteCommandsForVoiceCommands(oldVoiceCommands);
+ oldVoiceCommands.clear();
+ internalInterface.sendRPCs(deleteVoiceCommands, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+ DebugTool.logInfo(TAG, "Successfully deleted old voice commands");
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ }
+ });
+
+ }
+
+ // SEND NEW MENU ITEMS
+
+ private void sendCurrentVoiceCommands(final CompletionListener listener) {
+
+ if (voiceCommands == null || voiceCommands.size() == 0) {
+ if (listener != null) {
+ listener.onComplete(true); // no voice commands to send doesnt mean that its an error
+ }
+ return;
+ }
+
+ inProgressUpdate = addCommandsForVoiceCommands(voiceCommands);
+
+ internalInterface.sendRPCs(inProgressUpdate, new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+ DebugTool.logInfo(TAG, "Sending Voice Commands Complete");
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ oldVoiceCommands = voiceCommands;
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ }
+ });
+ }
+
+ // DELETES
+
+ List<DeleteCommand> deleteCommandsForVoiceCommands(List<VoiceCommand> voiceCommands) {
+ List<DeleteCommand> deleteCommandList = new ArrayList<>();
+ for (VoiceCommand command : voiceCommands) {
+ DeleteCommand delete = new DeleteCommand(command.getCommandId());
+ deleteCommandList.add(delete);
+ }
+ return deleteCommandList;
+ }
+
+ // COMMANDS
+
+ List<AddCommand> addCommandsForVoiceCommands(List<VoiceCommand> voiceCommands) {
+ List<AddCommand> addCommandList = new ArrayList<>();
+ for (VoiceCommand command : voiceCommands) {
+ addCommandList.add(commandForVoiceCommand(command));
+ }
+ return addCommandList;
+ }
+
+ private AddCommand commandForVoiceCommand(VoiceCommand voiceCommand) {
+ AddCommand command = new AddCommand(voiceCommand.getCommandId());
+ command.setVrCommands(voiceCommand.getVoiceCommands());
+ return command;
+ }
+
+ // HELPERS
+
+ private void updateIdsOnVoiceCommands(List<VoiceCommand> voiceCommands) {
+ for (VoiceCommand command : voiceCommands) {
+ command.setCommandId(++lastVoiceCommandId);
+ }
+ }
+
+ // LISTENERS
+
+ private void addListeners() {
+
+ // HMI UPDATES
+ 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.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) {
+ setVoiceCommands(voiceCommands);
+ }
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ // COMMANDS
+ commandListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnCommand onCommand = (OnCommand) notification;
+ if (voiceCommands != null && voiceCommands.size() > 0) {
+ for (VoiceCommand command : voiceCommands) {
+ if (onCommand.getCmdID() == command.getCommandId()) {
+ if (command.getVoiceCommandSelectionListener() != null) {
+ command.getVoiceCommandSelectionListener().onVoiceCommandSelected();
+ break;
+ }
+ }
+ }
+ }
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesMode.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesMode.java
index b04cb4626..3c1346559 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesMode.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/DynamicMenuUpdatesMode.java
@@ -34,33 +34,33 @@ package com.smartdevicelink.managers.screen.menu;
public enum DynamicMenuUpdatesMode {
- /**
- * FORCE_ON: This mode forces the menu manager to always dynamically update menu items for each menu
- * update. This will provide the best performance but may cause ordering issues on some SYNC Gen 3 head units.
- */
- FORCE_ON,
+ /**
+ * FORCE_ON: This mode forces the menu manager to always dynamically update menu items for each menu
+ * update. This will provide the best performance but may cause ordering issues on some SYNC Gen 3 head units.
+ */
+ FORCE_ON,
- /**
- * FORCE_OFF: Forces off compatibility mode. This will force the menu manager to delete and re-add
- * each menu item for every menu update. This mode is generally not advised due to performance issues.
- */
- FORCE_OFF,
+ /**
+ * FORCE_OFF: Forces off compatibility mode. This will force the menu manager to delete and re-add
+ * each menu item for every menu update. This mode is generally not advised due to performance issues.
+ */
+ FORCE_OFF,
- /**
- * ON_WITH_COMPAT_MODE: This mode checks whether the phone is connected to a SYNC Gen 3 head unit, which has known
- * menu ordering issues. If it is, it will always delete and re-add every menu item, if not, it will dynamically update
- * the menus.
- */
- ON_WITH_COMPAT_MODE,
+ /**
+ * ON_WITH_COMPAT_MODE: This mode checks whether the phone is connected to a SYNC Gen 3 head unit, which has known
+ * menu ordering issues. If it is, it will always delete and re-add every menu item, if not, it will dynamically update
+ * the menus.
+ */
+ ON_WITH_COMPAT_MODE,
- ;
+ ;
- public static DynamicMenuUpdatesMode valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static DynamicMenuUpdatesMode valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
index 4eef7777f..83e265f8e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
@@ -42,293 +42,316 @@ import com.smartdevicelink.util.DebugTool;
import java.util.ArrayList;
import java.util.List;
-public class MenuCell implements Cloneable{
-
- /**
- * The cell's text to be displayed
- */
- private String title;
-
- /**
- * The cell's icon to be displayed
- */
- private SdlArtwork icon;
-
- /**
- * The strings the user can say to activate this voice command
- */
- private List<String> voiceCommands;
-
- /**
- * If this is not null, this cell will be a sub-menu button, displaying the sub-cells in a menu when pressed.
- */
- private List<MenuCell> subCells;
-
- /**
- * The listener that will be called when the command is activated
- */
- private MenuSelectionListener menuSelectionListener;
-
- /**
- * Used internally for cell ordering
- */
- private int parentCellId;
-
- /**
- * Used internally for cell ordering
- */
- private int cellId;
-
- /**
- * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
- * layout set via the screen manager's `MenuConfiguration` will be used.
- */
- private MenuLayout subMenuLayout;
-
- /**
- * MAX ID for cells - Cannot use Integer.MAX_INT as the value is too high.
- */
- private static final int MAX_ID = 2000000000;
-
- // CONSTRUCTORS
-
- // SINGLE MENU ITEM CONSTRUCTORS
-
- /**
- * Creates a new MenuCell Object with multiple parameters set
- * @param title The cell's primary text
- * @param icon The cell's image
- * @param voiceCommands Voice commands that will activate the menu cell
- * @param listener Calls the code that will be run when the menu cell is selected
- */
- public MenuCell(@NonNull String title, @Nullable SdlArtwork icon, @Nullable List<String> voiceCommands, @Nullable MenuSelectionListener listener) {
- setTitle(title); // title is the only required param
- setIcon(icon);
- setVoiceCommands(voiceCommands);
- setMenuSelectionListener(listener);
- setCellId(MAX_ID);
- setParentCellId(MAX_ID);
- }
-
- // CONSTRUCTOR FOR CELL THAT WILL LINK TO SUB MENU
-
- /**
- * Creates a new MenuCell Object with multiple parameters set
- * <strong>NOTE: because this has sub-cells, there does not need to be a listener</strong>
- * @param title The cell's primary text
- * @param subMenuLayout The submenu's layout that the subCells will be shown in. If `null`, the
- * default submenu layout in the screen manager's `MenuConfiguration` will be used.
- * @param icon The cell's image
- * @param subCells The sub-cells for the sub menu that will appear when the cell is selected
- */
- public MenuCell(@NonNull String title, @Nullable MenuLayout subMenuLayout, @Nullable SdlArtwork icon, @Nullable List<MenuCell> subCells) {
- setTitle(title); // title is the only required param
- setSubMenuLayout(subMenuLayout);
- setIcon(icon);
- setSubCells(subCells);
- setCellId(MAX_ID);
- setParentCellId(MAX_ID);
- }
-
- // SETTERS / GETTERS
-
- // PUBLIC METHODS
-
- /**
- * Sets the title of the menu cell
- * @param title - the title of the cell. Required
- */
- public void setTitle(@NonNull String title){
- this.title = title;
- }
-
- /**
- * Gets the title of the menu cell
- * @return The title of the cell object
- */
- public String getTitle(){
- return title;
- }
-
- /**
- * Sets the icon of the menu cell
- * @param icon - the icon being set, of type {@link SdlArtwork}
- */
- public void setIcon(SdlArtwork icon){
- this.icon = icon;
- }
-
- /**
- * Gets the icon for the cell
- * @return the {@link SdlArtwork} icon for the cell
- */
- public SdlArtwork getIcon() {
- return icon;
- }
-
- /**
- * A list of Strings that will be used for voice commands
- * @param voiceCommands - the string list used by the IVI system for voice commands
- */
- public void setVoiceCommands(List<String> voiceCommands) {
- this.voiceCommands = voiceCommands;
- }
-
- /**
- * the string list used by the IVI system for voice commands
- * @return The String List used by the menu cell object for voice commands
- */
- public List<String> getVoiceCommands() {
- return voiceCommands;
- }
-
- /**
- * The list of MenuCells that can be set as subCells
- * @param subCells - the list of subCells for this menu item
- */
- public void setSubCells(List<MenuCell> subCells) {
- this.subCells = subCells;
- }
-
- /**
- * The list of subCells for this menu item
- * @return a list of MenuCells that are the subCells for this menu item
- */
- public List<MenuCell> getSubCells() {
- return subCells;
- }
-
- /**
- * The listener for when a menu item is selected
- * @param menuSelectionListener the listener for this menuCell object
- */
- public void setMenuSelectionListener(MenuSelectionListener menuSelectionListener) {
- this.menuSelectionListener = menuSelectionListener;
- }
-
- /**
- * The listener that gets triggered when the menuCell object is selected
- * @return the MenuSelectionListener for the cell
- */
- public MenuSelectionListener getMenuSelectionListener() {
- return menuSelectionListener;
- }
-
- /**
- * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
- * layout set via the screen manager's `MenuConfiguration` will be used.
- * @param subMenuLayout - the layout used for the sub menu
- */
- public void setSubMenuLayout(MenuLayout subMenuLayout) {
- this.subMenuLayout = subMenuLayout;
- }
-
- /**
- * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
- * layout set via the screen manager's `MenuConfiguration` will be used.
- * @return - the layout used for the sub menu
- */
- public MenuLayout getSubMenuLayout() {
- return this.subMenuLayout;
- }
-
- // INTERNALLY USED METHODS
-
- /**
- * Set the cell Id.
- * @param cellId - the cell Id
- */
- void setCellId(int cellId) {
- this.cellId = cellId;
- }
-
- /**
- * Get the cellId
- * @return the cellId for this menuCell
- */
- int getCellId() {
- return cellId;
- }
-
- /**
- * Sets the ParentCellId
- * @param parentCellId the parent cell's Id
- */
- void setParentCellId(int parentCellId) {
- this.parentCellId = parentCellId;
- }
-
- /**
- * Get the parent cell's Id
- * @return the parent cell's Id
- */
- int getParentCellId() {
- return parentCellId;
- }
-
- // HELPER
-
- /**
- * Note: You should compare using the {@link #equals(Object)} method. <br>
- * Hash the parameters of the object and return the result for comparison
- * For each param, increase the rotation distance by one.
- * It is necessary to rotate each of our properties because a simple bitwise OR will produce equivalent results if, for example:
- * Object 1: getText() = "Hi", getSecondaryText() = "Hello"
- * Object 2: getText() = "Hello", getSecondaryText() = "Hi"
- * @return the hash code as an int
- */
- @Override
- public int hashCode() {
- int result = 1;
- result += ((getTitle() == null) ? 0 : Integer.rotateLeft(getTitle().hashCode(), 1));
- result += ((getIcon() == null) ? 0 : Integer.rotateLeft(getIcon().hashCode(), 2));
- result += ((getVoiceCommands() == null) ? 0 : Integer.rotateLeft(getVoiceCommands().hashCode(), 3));
- result += ((getSubCells() == null) ? 0 : Integer.rotateLeft(1, 4));
- return result;
- }
-
- /**
- * Uses our custom hashCode for MenuCell objects, but does <strong>NOT</strong> compare the listener objects
- * @param o - The object to compare
- * @return boolean of whether the objects are the same or not
- */
- @Override
- public boolean equals(Object o) {
- if (o == null) { return false; }
- // if this is the same memory address, its the same
- if (this == o) return true;
- // if this is not an instance of this class, not the same
- if (!(o instanceof MenuCell)) return false;
- // if we get to this point, create the hashes and compare them
- return hashCode() == o.hashCode();
- }
-
- /**
- * Creates a deep copy of the object
- * @return deep copy of the object, null if an exception occurred
- */
- @Override
- public MenuCell clone() {
- try {
- MenuCell clone = (MenuCell) super.clone();
- if(this.icon != null){
- clone.icon = this.icon.clone();
- }
- if(this.subCells != null){
- ArrayList<MenuCell> cloneSubCells = new ArrayList<>();
- for(MenuCell subCell : subCells){
- cloneSubCells.add(subCell.clone());
- }
- clone.subCells = cloneSubCells;
- }
-
- return clone;
- } catch (CloneNotSupportedException e) {
- if(DebugTool.isDebugEnabled()){
- throw new RuntimeException("Clone not supported by super class");
- }
- }
-
- return null;
- }
+public class MenuCell implements Cloneable {
+
+ /**
+ * The cell's text to be displayed
+ */
+ private String title;
+
+ /**
+ * The cell's icon to be displayed
+ */
+ private SdlArtwork icon;
+
+ /**
+ * The strings the user can say to activate this voice command
+ */
+ private List<String> voiceCommands;
+
+ /**
+ * If this is not null, this cell will be a sub-menu button, displaying the sub-cells in a menu when pressed.
+ */
+ private List<MenuCell> subCells;
+
+ /**
+ * The listener that will be called when the command is activated
+ */
+ private MenuSelectionListener menuSelectionListener;
+
+ /**
+ * Used internally for cell ordering
+ */
+ private int parentCellId;
+
+ /**
+ * Used internally for cell ordering
+ */
+ private int cellId;
+
+ /**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ */
+ private MenuLayout subMenuLayout;
+
+ /**
+ * MAX ID for cells - Cannot use Integer.MAX_INT as the value is too high.
+ */
+ private static final int MAX_ID = 2000000000;
+
+ // CONSTRUCTORS
+
+ // SINGLE MENU ITEM CONSTRUCTORS
+
+ /**
+ * Creates a new MenuCell Object with multiple parameters set
+ *
+ * @param title The cell's primary text
+ * @param icon The cell's image
+ * @param voiceCommands Voice commands that will activate the menu cell
+ * @param listener Calls the code that will be run when the menu cell is selected
+ */
+ public MenuCell(@NonNull String title, @Nullable SdlArtwork icon, @Nullable List<String> voiceCommands, @Nullable MenuSelectionListener listener) {
+ setTitle(title); // title is the only required param
+ setIcon(icon);
+ setVoiceCommands(voiceCommands);
+ setMenuSelectionListener(listener);
+ setCellId(MAX_ID);
+ setParentCellId(MAX_ID);
+ }
+
+ // CONSTRUCTOR FOR CELL THAT WILL LINK TO SUB MENU
+
+ /**
+ * Creates a new MenuCell Object with multiple parameters set
+ * <strong>NOTE: because this has sub-cells, there does not need to be a listener</strong>
+ *
+ * @param title The cell's primary text
+ * @param subMenuLayout The submenu's layout that the subCells will be shown in. If `null`, the
+ * default submenu layout in the screen manager's `MenuConfiguration` will be used.
+ * @param icon The cell's image
+ * @param subCells The sub-cells for the sub menu that will appear when the cell is selected
+ */
+ public MenuCell(@NonNull String title, @Nullable MenuLayout subMenuLayout, @Nullable SdlArtwork icon, @Nullable List<MenuCell> subCells) {
+ setTitle(title); // title is the only required param
+ setSubMenuLayout(subMenuLayout);
+ setIcon(icon);
+ setSubCells(subCells);
+ setCellId(MAX_ID);
+ setParentCellId(MAX_ID);
+ }
+
+ // SETTERS / GETTERS
+
+ // PUBLIC METHODS
+
+ /**
+ * Sets the title of the menu cell
+ *
+ * @param title - the title of the cell. Required
+ */
+ public void setTitle(@NonNull String title) {
+ this.title = title;
+ }
+
+ /**
+ * Gets the title of the menu cell
+ *
+ * @return The title of the cell object
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Sets the icon of the menu cell
+ *
+ * @param icon - the icon being set, of type {@link SdlArtwork}
+ */
+ public void setIcon(SdlArtwork icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * Gets the icon for the cell
+ *
+ * @return the {@link SdlArtwork} icon for the cell
+ */
+ public SdlArtwork getIcon() {
+ return icon;
+ }
+
+ /**
+ * A list of Strings that will be used for voice commands
+ *
+ * @param voiceCommands - the string list used by the IVI system for voice commands
+ */
+ public void setVoiceCommands(List<String> voiceCommands) {
+ this.voiceCommands = voiceCommands;
+ }
+
+ /**
+ * the string list used by the IVI system for voice commands
+ *
+ * @return The String List used by the menu cell object for voice commands
+ */
+ public List<String> getVoiceCommands() {
+ return voiceCommands;
+ }
+
+ /**
+ * The list of MenuCells that can be set as subCells
+ *
+ * @param subCells - the list of subCells for this menu item
+ */
+ public void setSubCells(List<MenuCell> subCells) {
+ this.subCells = subCells;
+ }
+
+ /**
+ * The list of subCells for this menu item
+ *
+ * @return a list of MenuCells that are the subCells for this menu item
+ */
+ public List<MenuCell> getSubCells() {
+ return subCells;
+ }
+
+ /**
+ * The listener for when a menu item is selected
+ *
+ * @param menuSelectionListener the listener for this menuCell object
+ */
+ public void setMenuSelectionListener(MenuSelectionListener menuSelectionListener) {
+ this.menuSelectionListener = menuSelectionListener;
+ }
+
+ /**
+ * The listener that gets triggered when the menuCell object is selected
+ *
+ * @return the MenuSelectionListener for the cell
+ */
+ public MenuSelectionListener getMenuSelectionListener() {
+ return menuSelectionListener;
+ }
+
+ /**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ *
+ * @param subMenuLayout - the layout used for the sub menu
+ */
+ public void setSubMenuLayout(MenuLayout subMenuLayout) {
+ this.subMenuLayout = subMenuLayout;
+ }
+
+ /**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ *
+ * @return - the layout used for the sub menu
+ */
+ public MenuLayout getSubMenuLayout() {
+ return this.subMenuLayout;
+ }
+
+ // INTERNALLY USED METHODS
+
+ /**
+ * Set the cell Id.
+ *
+ * @param cellId - the cell Id
+ */
+ void setCellId(int cellId) {
+ this.cellId = cellId;
+ }
+
+ /**
+ * Get the cellId
+ *
+ * @return the cellId for this menuCell
+ */
+ int getCellId() {
+ return cellId;
+ }
+
+ /**
+ * Sets the ParentCellId
+ *
+ * @param parentCellId the parent cell's Id
+ */
+ void setParentCellId(int parentCellId) {
+ this.parentCellId = parentCellId;
+ }
+
+ /**
+ * Get the parent cell's Id
+ *
+ * @return the parent cell's Id
+ */
+ int getParentCellId() {
+ return parentCellId;
+ }
+
+ // HELPER
+
+ /**
+ * Note: You should compare using the {@link #equals(Object)} method. <br>
+ * Hash the parameters of the object and return the result for comparison
+ * For each param, increase the rotation distance by one.
+ * It is necessary to rotate each of our properties because a simple bitwise OR will produce equivalent results if, for example:
+ * Object 1: getText() = "Hi", getSecondaryText() = "Hello"
+ * Object 2: getText() = "Hello", getSecondaryText() = "Hi"
+ *
+ * @return the hash code as an int
+ */
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result += ((getTitle() == null) ? 0 : Integer.rotateLeft(getTitle().hashCode(), 1));
+ result += ((getIcon() == null) ? 0 : Integer.rotateLeft(getIcon().hashCode(), 2));
+ result += ((getVoiceCommands() == null) ? 0 : Integer.rotateLeft(getVoiceCommands().hashCode(), 3));
+ result += ((getSubCells() == null) ? 0 : Integer.rotateLeft(1, 4));
+ return result;
+ }
+
+ /**
+ * Uses our custom hashCode for MenuCell objects, but does <strong>NOT</strong> compare the listener objects
+ *
+ * @param o - The object to compare
+ * @return boolean of whether the objects are the same or not
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == null) {
+ return false;
+ }
+ // if this is the same memory address, its the same
+ if (this == o) return true;
+ // if this is not an instance of this class, not the same
+ if (!(o instanceof MenuCell)) return false;
+ // if we get to this point, create the hashes and compare them
+ return hashCode() == o.hashCode();
+ }
+
+ /**
+ * Creates a deep copy of the object
+ *
+ * @return deep copy of the object, null if an exception occurred
+ */
+ @Override
+ public MenuCell clone() {
+ try {
+ MenuCell clone = (MenuCell) super.clone();
+ if (this.icon != null) {
+ clone.icon = this.icon.clone();
+ }
+ if (this.subCells != null) {
+ ArrayList<MenuCell> cloneSubCells = new ArrayList<>();
+ for (MenuCell subCell : subCells) {
+ cloneSubCells.add(subCell.clone());
+ }
+ clone.subCells = cloneSubCells;
+ }
+
+ return clone;
+ } catch (CloneNotSupportedException e) {
+ if (DebugTool.isDebugEnabled()) {
+ throw new RuntimeException("Clone not supported by super class");
+ }
+ }
+
+ return null;
+ }
}
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 59bf7974f..f478c80fc 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,58 +41,64 @@ import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
public class MenuConfiguration {
- private MenuLayout mainMenuLayout, submenuLayout;
+ private MenuLayout mainMenuLayout, submenuLayout;
- /**
- * 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(submenuLayout);
- }
+ /**
+ * 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(submenuLayout);
+ }
- /**
- * Changes the default main menu layout.
- * @param mainMenuLayout - the layout of the main menu
- */
- private void setMenuLayout(MenuLayout mainMenuLayout){
- this.mainMenuLayout = mainMenuLayout;
- }
+ /**
+ * Changes the default main menu layout.
+ *
+ * @param mainMenuLayout - the layout of the main menu
+ */
+ private void setMenuLayout(MenuLayout mainMenuLayout) {
+ this.mainMenuLayout = mainMenuLayout;
+ }
- /**
- * Changes the default main menu layout.
- * @return - the layout of the main menu
- */
- public MenuLayout getMenuLayout() {
- return this.mainMenuLayout;
- }
+ /**
+ * Changes the default main menu layout.
+ *
+ * @return - the layout of the main menu
+ */
+ public MenuLayout getMenuLayout() {
+ return this.mainMenuLayout;
+ }
- /**
- * 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.
- * @param submenuLayout - the MenuLayout for this sub menu
- */
- 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.
+ *
+ * @param submenuLayout - the MenuLayout for this sub menu
+ */
+ 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.
- * @return - the MenuLayout for this sub menu
- */
- public MenuLayout getSubMenuLayout() {
- return 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.
+ *
+ * @return - the MenuLayout for this sub menu
+ */
+ public MenuLayout getSubMenuLayout() {
+ return submenuLayout;
+ }
- /**
- * @return A string description of the cell, useful for debugging.
- */
- @Override @NonNull
- public String toString() {
- return "MenuConfiguration: MenuLayout = "+ this.mainMenuLayout + " | SubMenuLayout = "+ this.submenuLayout;
- }
+ /**
+ * @return A string description of the cell, useful for debugging.
+ */
+ @Override
+ @NonNull
+ public String toString() {
+ return "MenuConfiguration: MenuLayout = " + this.mainMenuLayout + " | SubMenuLayout = " + this.submenuLayout;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuSelectionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuSelectionListener.java
index 5c9ed5ce4..0b5577280 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuSelectionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuSelectionListener.java
@@ -36,6 +36,6 @@ import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
public interface MenuSelectionListener {
- void onTriggered(TriggerSource trigger);
+ void onTriggered(TriggerSource trigger);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/RunScore.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/RunScore.java
index 2cc7db0b8..6d031bb0e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/RunScore.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/RunScore.java
@@ -36,37 +36,37 @@ import java.util.List;
class RunScore {
- private int score;
- private List<Integer> oldMenu, currentMenu;
+ private int score;
+ private List<Integer> oldMenu, currentMenu;
- RunScore(int score, List<Integer> oldMenu, List<Integer> currentMenu){
- setScore(score);
- setOldMenu(oldMenu);
- setCurrentMenu(currentMenu);
- }
+ RunScore(int score, List<Integer> oldMenu, List<Integer> currentMenu) {
+ setScore(score);
+ setOldMenu(oldMenu);
+ setCurrentMenu(currentMenu);
+ }
- private void setCurrentMenu(List<Integer> currentMenu) {
- this.currentMenu = currentMenu;
- }
+ private void setCurrentMenu(List<Integer> currentMenu) {
+ this.currentMenu = currentMenu;
+ }
- List<Integer> getCurrentMenu() {
- return currentMenu;
- }
+ List<Integer> getCurrentMenu() {
+ return currentMenu;
+ }
- private void setOldMenu(List<Integer> oldMenu) {
- this.oldMenu = oldMenu;
- }
+ private void setOldMenu(List<Integer> oldMenu) {
+ this.oldMenu = oldMenu;
+ }
- List<Integer> getOldMenu() {
- return oldMenu;
- }
+ List<Integer> getOldMenu() {
+ return oldMenu;
+ }
- private void setScore(int score) {
- this.score = score;
- }
+ private void setScore(int score) {
+ this.score = score;
+ }
- public int getScore() {
- return score;
- }
+ public int getScore() {
+ return score;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/SubCellCommandList.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/SubCellCommandList.java
index d5eee6ef1..604d52b09 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/SubCellCommandList.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/SubCellCommandList.java
@@ -36,56 +36,56 @@ import java.util.List;
class SubCellCommandList {
- private RunScore listsScore;
- private String menuTitle;
- private Integer parentId;
- private List<MenuCell> oldList, newList;
+ private RunScore listsScore;
+ private String menuTitle;
+ private Integer parentId;
+ private List<MenuCell> oldList, newList;
- SubCellCommandList(String menuTitle, Integer parentId, RunScore listsScore, List<MenuCell> oldList, List<MenuCell> newList){
- setMenuTitle(menuTitle);
- setParentId(parentId);
- setListsScore(listsScore);
- setOldList(oldList);
- setNewList(newList);
- }
+ SubCellCommandList(String menuTitle, Integer parentId, RunScore listsScore, List<MenuCell> oldList, List<MenuCell> newList) {
+ setMenuTitle(menuTitle);
+ setParentId(parentId);
+ setListsScore(listsScore);
+ setOldList(oldList);
+ setNewList(newList);
+ }
- private void setParentId(Integer parentId) {
- this.parentId = parentId;
- }
+ private void setParentId(Integer parentId) {
+ this.parentId = parentId;
+ }
- Integer getParentId() {
- return parentId;
- }
+ Integer getParentId() {
+ return parentId;
+ }
- private void setMenuTitle(String menuTitle) {
- this.menuTitle = menuTitle;
- }
+ private void setMenuTitle(String menuTitle) {
+ this.menuTitle = menuTitle;
+ }
- String getMenuTitle() {
- return menuTitle;
- }
+ String getMenuTitle() {
+ return menuTitle;
+ }
- private void setListsScore(RunScore listsScore){
- this.listsScore = listsScore;
- }
+ private void setListsScore(RunScore listsScore) {
+ this.listsScore = listsScore;
+ }
- RunScore getListsScore() {
- return listsScore;
- }
+ RunScore getListsScore() {
+ return listsScore;
+ }
- private void setOldList(List<MenuCell> oldList) {
- this.oldList = oldList;
- }
+ private void setOldList(List<MenuCell> oldList) {
+ this.oldList = oldList;
+ }
- List<MenuCell> getOldList() {
- return oldList;
- }
+ List<MenuCell> getOldList() {
+ return oldList;
+ }
- private void setNewList(List<MenuCell> newList) {
- this.newList = newList;
- }
+ private void setNewList(List<MenuCell> newList) {
+ this.newList = newList;
+ }
- List<MenuCell> getNewList() {
- return newList;
- }
+ List<MenuCell> getNewList() {
+ return newList;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
index aa94dd533..2d1b875cc 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java
@@ -39,82 +39,89 @@ import java.util.List;
public class VoiceCommand {
- /**
- * The strings the user can say to activate this voice command
- */
- private List<String> voiceCommands;
-
- /**
- * The listener that will be called when the command is activated
- */
- private VoiceCommandSelectionListener voiceCommandSelectionListener;
-
- /**
- * Used Internally to identify the command
- */
- private int commandId;
-
- // CONSTRUCTOR(S)
-
- /**
- * Constructor that sets all parameters for this class
- * <strong>NOTE: While it is possible to pass in null for the listener, It is the easiest way to know when it was triggered.</strong>
- * @param voiceCommands The strings the user can say to activate this voice command
- * @param voiceCommandSelectionListener The listener that will be called when the command is activated
- */
- public VoiceCommand(@NonNull List<String> voiceCommands, @Nullable VoiceCommandSelectionListener voiceCommandSelectionListener){
- setVoiceCommands(voiceCommands);
- setVoiceCommandSelectionListener(voiceCommandSelectionListener);
- }
-
- // SETTERS / GETTERS
-
- /**
- * The strings the user can say to activate this voice command
- * @param voiceCommands - the list of commands to send to the head unit
- */
- public void setVoiceCommands(@NonNull List<String> voiceCommands) {
- this.voiceCommands = voiceCommands;
- }
-
- /**
- * The strings the user can say to activate this voice command
- * @return the List of voice commands
- */
- public List<String> getVoiceCommands() {
- return voiceCommands;
- }
-
- /**
- * The listener that will be called when the command is activated
- * @param voiceCommandSelectionListener - the listener for this object
- */
- public void setVoiceCommandSelectionListener(VoiceCommandSelectionListener voiceCommandSelectionListener) {
- this.voiceCommandSelectionListener = voiceCommandSelectionListener;
- }
-
- /**
- * The listener that will be called when the command is activated
- * @return voiceCommandSelectionListener - the listener for this object
- */
- public VoiceCommandSelectionListener getVoiceCommandSelectionListener() {
- return voiceCommandSelectionListener;
- }
-
- /**
- * set the command' ID
- * <strong>NOTE: PLEASE DO NOT SET. This is used internally</strong>
- * @param commandId the id to identify the command
- */
- void setCommandId(int commandId) {
- this.commandId = commandId;
- }
-
- /**
- * the id used to identify the command
- * @return the id
- */
- int getCommandId() {
- return commandId;
- }
+ /**
+ * The strings the user can say to activate this voice command
+ */
+ private List<String> voiceCommands;
+
+ /**
+ * The listener that will be called when the command is activated
+ */
+ private VoiceCommandSelectionListener voiceCommandSelectionListener;
+
+ /**
+ * Used Internally to identify the command
+ */
+ private int commandId;
+
+ // CONSTRUCTOR(S)
+
+ /**
+ * Constructor that sets all parameters for this class
+ * <strong>NOTE: While it is possible to pass in null for the listener, It is the easiest way to know when it was triggered.</strong>
+ *
+ * @param voiceCommands The strings the user can say to activate this voice command
+ * @param voiceCommandSelectionListener The listener that will be called when the command is activated
+ */
+ public VoiceCommand(@NonNull List<String> voiceCommands, @Nullable VoiceCommandSelectionListener voiceCommandSelectionListener) {
+ setVoiceCommands(voiceCommands);
+ setVoiceCommandSelectionListener(voiceCommandSelectionListener);
+ }
+
+ // SETTERS / GETTERS
+
+ /**
+ * The strings the user can say to activate this voice command
+ *
+ * @param voiceCommands - the list of commands to send to the head unit
+ */
+ public void setVoiceCommands(@NonNull List<String> voiceCommands) {
+ this.voiceCommands = voiceCommands;
+ }
+
+ /**
+ * The strings the user can say to activate this voice command
+ *
+ * @return the List of voice commands
+ */
+ public List<String> getVoiceCommands() {
+ return voiceCommands;
+ }
+
+ /**
+ * The listener that will be called when the command is activated
+ *
+ * @param voiceCommandSelectionListener - the listener for this object
+ */
+ public void setVoiceCommandSelectionListener(VoiceCommandSelectionListener voiceCommandSelectionListener) {
+ this.voiceCommandSelectionListener = voiceCommandSelectionListener;
+ }
+
+ /**
+ * The listener that will be called when the command is activated
+ *
+ * @return voiceCommandSelectionListener - the listener for this object
+ */
+ public VoiceCommandSelectionListener getVoiceCommandSelectionListener() {
+ return voiceCommandSelectionListener;
+ }
+
+ /**
+ * set the command' ID
+ * <strong>NOTE: PLEASE DO NOT SET. This is used internally</strong>
+ *
+ * @param commandId the id to identify the command
+ */
+ void setCommandId(int commandId) {
+ this.commandId = commandId;
+ }
+
+ /**
+ * the id used to identify the command
+ *
+ * @return the id
+ */
+ int getCommandId() {
+ return commandId;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java
index 1af92d3f4..922f3d94d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandSelectionListener.java
@@ -34,6 +34,6 @@ package com.smartdevicelink.managers.screen.menu;
public interface VoiceCommandSelectionListener {
- void onVoiceCommandSelected();
+ void onVoiceCommandSelected();
}
diff --git a/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java b/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
index 70759e3be..85ef4e4df 100644
--- a/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
+++ b/base/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -54,104 +54,104 @@ import java.util.List;
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class JsonRPCMarshaller {
- private static final String TAG = "JsonRPCMarshaller";
- private static final String SDL_LIB_PRIVATE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
+ private static final String TAG = "JsonRPCMarshaller";
+ private static final String SDL_LIB_PRIVATE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
- /**
- * @param msg RPC message to be marshaled
- * @param version protocol version
- * @return byte array of the marshalled message
- */
- public static byte[] marshall(RPCMessage msg, byte version) {
- byte[] jsonBytes = null;
- try {
- JSONObject jsonObject = msg.serializeJSON(version);
- jsonBytes = jsonObject.toString().getBytes();
-
- SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Transmit, jsonBytes, SDL_LIB_PRIVATE_KEY);
- } catch (JSONException e) {
- DebugTool.logError(TAG, "Failed to encode messages to JSON.", e);
- }
- return jsonBytes;
- }
-
- public static Hashtable<String, Object> unmarshall(byte[] message) {
- SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Receive, message, SDL_LIB_PRIVATE_KEY);
- Hashtable<String, Object> ret = null;
- try {
- String jsonString = new String(message);
- JSONObject jsonObject = new JSONObject(jsonString);
- ret = deserializeJSONObject(jsonObject);
- } catch (JSONException e) {
- DebugTool.logError(TAG, "Failed to parse JSON", e);
- }
- return ret;
- }
-
- public static Hashtable<String, Object> deserializeJSONObject(JSONObject jsonObject)
- throws JSONException {
- Hashtable<String, Object> ret = new Hashtable<>();
- Iterator<String> it = jsonObject.keys();
- String key;
- while (it.hasNext()) {
- key = it.next();
- Object value = jsonObject.get(key);
- if (value instanceof JSONObject) {
- ret.put(key, deserializeJSONObject((JSONObject)value));
- } else if (value instanceof JSONArray) {
- JSONArray arrayValue = (JSONArray) value;
- List<Object> putList = new ArrayList<>(arrayValue.length());
- for (int i = 0; i < arrayValue.length(); i++) {
- Object anObject = arrayValue.get(i);
- if (anObject instanceof JSONObject) {
- Hashtable<String, Object> deserializedObject = deserializeJSONObject((JSONObject)anObject);
- putList.add(deserializedObject);
- } else {
- putList.add(anObject);
- }
- }
- ret.put(key, putList);
- } else {
- ret.put(key, value);
- }
- }
- return ret;
- }
+ /**
+ * @param msg RPC message to be marshaled
+ * @param version protocol version
+ * @return byte array of the marshalled message
+ */
+ public static byte[] marshall(RPCMessage msg, byte version) {
+ byte[] jsonBytes = null;
+ try {
+ JSONObject jsonObject = msg.serializeJSON(version);
+ jsonBytes = jsonObject.toString().getBytes();
- @SuppressWarnings("unchecked" )
- private static JSONArray serializeList(List<?> list) throws JSONException{
- JSONArray toPut = new JSONArray();
- Iterator<Object> valueIterator = (Iterator<Object>) list.iterator();
- while(valueIterator.hasNext()){
- Object anObject = valueIterator.next();
- if (anObject instanceof RPCStruct) {
- RPCStruct toSerialize = (RPCStruct) anObject;
- toPut.put(toSerialize.serializeJSON());
- } else if(anObject instanceof Hashtable){
- Hashtable<String, Object> toSerialize = (Hashtable<String, Object>)anObject;
- toPut.put(serializeHashtable(toSerialize));
- } else {
- toPut.put(anObject);
- }
- }
- return toPut;
- }
+ SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Transmit, jsonBytes, SDL_LIB_PRIVATE_KEY);
+ } catch (JSONException e) {
+ DebugTool.logError(TAG, "Failed to encode messages to JSON.", e);
+ }
+ return jsonBytes;
+ }
- @SuppressWarnings({"unchecked" })
- public static JSONObject serializeHashtable(Hashtable<String, Object> hash) throws JSONException{
- JSONObject obj = new JSONObject();
- for (String key : hash.keySet()) {
- Object value = hash.get(key);
- if (value instanceof RPCStruct) {
- obj.put(key, ((RPCStruct) value).serializeJSON());
- } else if (value instanceof List<?>) {
- obj.put(key, serializeList((List<?>) value));
- } else if (value instanceof Hashtable) {
- obj.put(key, serializeHashtable((Hashtable<String, Object>) value));
- } else {
- obj.put(key, value);
- }
- }
- return obj;
- }
+ public static Hashtable<String, Object> unmarshall(byte[] message) {
+ SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Receive, message, SDL_LIB_PRIVATE_KEY);
+ Hashtable<String, Object> ret = null;
+ try {
+ String jsonString = new String(message);
+ JSONObject jsonObject = new JSONObject(jsonString);
+ ret = deserializeJSONObject(jsonObject);
+ } catch (JSONException e) {
+ DebugTool.logError(TAG, "Failed to parse JSON", e);
+ }
+ return ret;
+ }
+
+ public static Hashtable<String, Object> deserializeJSONObject(JSONObject jsonObject)
+ throws JSONException {
+ Hashtable<String, Object> ret = new Hashtable<>();
+ Iterator<String> it = jsonObject.keys();
+ String key;
+ while (it.hasNext()) {
+ key = it.next();
+ Object value = jsonObject.get(key);
+ if (value instanceof JSONObject) {
+ ret.put(key, deserializeJSONObject((JSONObject) value));
+ } else if (value instanceof JSONArray) {
+ JSONArray arrayValue = (JSONArray) value;
+ List<Object> putList = new ArrayList<>(arrayValue.length());
+ for (int i = 0; i < arrayValue.length(); i++) {
+ Object anObject = arrayValue.get(i);
+ if (anObject instanceof JSONObject) {
+ Hashtable<String, Object> deserializedObject = deserializeJSONObject((JSONObject) anObject);
+ putList.add(deserializedObject);
+ } else {
+ putList.add(anObject);
+ }
+ }
+ ret.put(key, putList);
+ } else {
+ ret.put(key, value);
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static JSONArray serializeList(List<?> list) throws JSONException {
+ JSONArray toPut = new JSONArray();
+ Iterator<Object> valueIterator = (Iterator<Object>) list.iterator();
+ while (valueIterator.hasNext()) {
+ Object anObject = valueIterator.next();
+ if (anObject instanceof RPCStruct) {
+ RPCStruct toSerialize = (RPCStruct) anObject;
+ toPut.put(toSerialize.serializeJSON());
+ } else if (anObject instanceof Hashtable) {
+ Hashtable<String, Object> toSerialize = (Hashtable<String, Object>) anObject;
+ toPut.put(serializeHashtable(toSerialize));
+ } else {
+ toPut.put(anObject);
+ }
+ }
+ return toPut;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public static JSONObject serializeHashtable(Hashtable<String, Object> hash) throws JSONException {
+ JSONObject obj = new JSONObject();
+ for (String key : hash.keySet()) {
+ Object value = hash.get(key);
+ if (value instanceof RPCStruct) {
+ obj.put(key, ((RPCStruct) value).serializeJSON());
+ } else if (value instanceof List<?>) {
+ obj.put(key, serializeList((List<?>) value));
+ } else if (value instanceof Hashtable) {
+ obj.put(key, serializeHashtable((Hashtable<String, Object>) value));
+ } else {
+ obj.put(key, value);
+ }
+ }
+ return obj;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java b/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
index 2b47eca1c..9694d3f06 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java
@@ -45,332 +45,338 @@ import java.util.HashMap;
*/
class BaseSdlPacket {
- /**
- * This is the amount of bytes added to the bundle from the router service for a specific int
- * flag; this data will always and must be included. This flag is the
- * TransportConstants.BYTES_TO_SEND_FLAGS.
- *
- * @see com.smartdevicelink.transport.TransportConstants#BYTES_TO_SEND_FLAGS
- */
- private static final int EXTRA_PARCEL_DATA_LENGTH = 24;
-
- public static final int HEADER_SIZE = 12;
- public static final int HEADER_SIZE_V1 = 8;//Backwards
-
- private static final int ENCRYPTION_MASK = 0x08; //4th lowest bit
-
- public static final int FRAME_TYPE_CONTROL = 0x00;
- public static final int FRAME_TYPE_SINGLE = 0x01;
- public static final int FRAME_TYPE_FIRST = 0x02;
- public static final int FRAME_TYPE_CONSECUTIVE = 0x03;
-
- /*
- * Service Type
- */
- public static final int SERVICE_TYPE_CONTROL = 0x00;
- //RESERVED 0x01 - 0x06
- public static final int SERVICE_TYPE_RPC = 0x07;
- //RESERVED 0x08 - 0x09
- public static final int SERVICE_TYPE_PCM = 0x0A;
- public static final int SERVICE_TYPE_VIDEO = 0x0B;
- //RESERVED 0x0C - 0x0E
- public static final int SERVICE_TYPE_BULK_DATA = 0x0F;
- //RESERVED 0x10 - 0xFF
-
-
- /*
- * Frame Info
- */
- //Control Frame Info
- public static final int FRAME_INFO_HEART_BEAT = 0x00;
- public static final int FRAME_INFO_START_SERVICE = 0x01;
- public static final int FRAME_INFO_START_SERVICE_ACK = 0x02;
- public static final int FRAME_INFO_START_SERVICE_NAK = 0x03;
- public static final int FRAME_INFO_END_SERVICE = 0x04;
- public static final int FRAME_INFO_END_SERVICE_ACK = 0x05;
- public static final int FRAME_INFO_END_SERVICE_NAK = 0x06;
- public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT = 0x07;
- public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_ACK = 0x08;
- public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_NAK = 0x09;
- //0x0A-0xFC are reserved
- public static final int FRAME_INFO_TRANSPORT_EVENT_UPDATE = 0xFD;
- public static final int FRAME_INFO_SERVICE_DATA_ACK = 0xFE;
- public static final int FRAME_INFO_HEART_BEAT_ACK = 0xFF;
-
- public static final int FRAME_INFO_FINAL_CONNESCUTIVE_FRAME = 0x00;
-
- //Most others
- public static final int FRAME_INFO_RESERVED = 0x00;
-
-
- int version;
- boolean encryption;
- int frameType;
- int serviceType;
- int frameInfo;
- int sessionId;
- int dataSize;
- int messageId;
- int priorityCoefficient;
- byte[] payload = null;
- HashMap<String, Object> bsonPayload;
-
- int messagingVersion = 1;
- TransportRecord transportRecord;
-
- BaseSdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload) {
- this.version = version;
- this.encryption = encryption;
- this.frameType = frameType;
- this.serviceType = serviceType;
- this.frameInfo = frameInfo;
- this.sessionId = sessionId;
- this.dataSize = dataSize;
- this.messageId = messageId;
- this.priorityCoefficient = 0;
- if(payload!=null){
- this.payload = new byte[payload.length];
- System.arraycopy(payload, 0, this.payload, 0, payload.length);
- }
- }
-
- BaseSdlPacket(int version, boolean encryption, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
- this.version = version;
- this.encryption = encryption;
- this.frameType = frameType;
- this.serviceType = serviceType;
- this.frameInfo = frameInfo;
- this.sessionId = sessionId;
- this.dataSize = dataSize;
- this.messageId = messageId;
- this.priorityCoefficient = 0;
- if(payload!=null){
- this.payload = new byte[bytesToWrite];
- System.arraycopy(payload, offset, this.payload, 0, bytesToWrite);
- }
- }
- /**
- * This constructor is available as a protected method. A few defaults have been set, however a few things <b>MUST</b> be set before use. The rest will "work"
- * however, it won't be valid data.
- *
- * <p>Frame Type
- * <p>Service Type
- * <p>Frame Info
- * <p>
- */
- protected BaseSdlPacket(){
- //Package only empty constructor
- this.version = 1;
- this.encryption = false;
- this.frameType = -1; //This NEEDS to be set
- this.serviceType = -1;
- this.frameInfo = -1;
- this.sessionId = 0;
- this.dataSize = 0;
- this.messageId = 0;
-
- }
-
- /**
- * Creates a new packet based on previous packet definitions. Will not copy payload.
- * @param packet an instance of the packet that should be copied.
- */
- protected BaseSdlPacket(BaseSdlPacket packet){
- this.version = packet.version;
- this.encryption = packet.encryption;
- this.frameType = packet.frameType;
- this.serviceType = packet.serviceType;
- this.frameInfo = packet.frameInfo;
- this.sessionId = packet.sessionId;
- this.dataSize = 0;
- this.messageId = 0;
- }
-
- public int getVersion() {
- return version;
- }
-
- public boolean isEncrypted() {
- return encryption;
- }
-
- public FrameType getFrameType() {
- switch(frameType){
- case FRAME_TYPE_CONTROL:
- return FrameType.Control;
- case FRAME_TYPE_FIRST:
- return FrameType.First;
- case FRAME_TYPE_CONSECUTIVE:
- return FrameType.Consecutive;
- case FRAME_TYPE_SINGLE:
- default:
- return FrameType.Single;
- }
- }
-
- public int getServiceType() {
- return serviceType;
- }
-
- public int getFrameInfo() {
- return frameInfo;
- }
-
- public int getSessionId() {
- return sessionId;
- }
-
- public int getMessageId() {
- return messageId;
- }
-
- public long getDataSize() {
- return dataSize;
- }
-
- public byte[] getPayload() {
- return payload;
- }
-
- public byte[] constructPacket() {
- if (bsonPayload != null && !bsonPayload.isEmpty()) {
- byte[] bsonBytes = BsonEncoder.encodeToBytes(bsonPayload);
- if(bsonBytes != null) {
- payload = bsonBytes;
- dataSize = bsonBytes.length;
- }
- }
- return constructPacket(version, encryption, frameType,
- serviceType, frameInfo, sessionId,
- dataSize, messageId, payload);
- }
- public void setPayload(byte[] bytes){
- this.payload = bytes;
- }
- /**
- * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
- * @param priority the priority of this packet
- */
- public void setPriorityCoefficient(int priority){
- this.priorityCoefficient = priority;
- }
- public int getPrioirtyCoefficient(){
- return this.priorityCoefficient;
- }
-
- public void setTransportRecord(TransportRecord transportRecord){
- this.transportRecord = transportRecord;
- }
-
- public TransportRecord getTransportRecord() {
- return this.transportRecord;
- }
-
- /**
- * This method takes in the various components to the SDL packet structure and creates a new byte array that can be sent via the transport
- * @param version protocol version to use
- * @param encryption whether or not this packet is encrypted
- * @param frameType the packet frame type
- * @param serviceType the service that this packet is associated with
- * @param controlFrameInfo specific frame info related to this packet
- * @param sessionId ID this packet is associated with
- * @param dataSize size of the payload that will be added
- * @param messageId ID of this specific packet
- * @param payload raw data that will be attached to the packet (RPC message, raw bytes, etc)
- * @return a byte[] representation of an SdlPacket built using the supplied params
- */
- public static byte[] constructPacket(int version, boolean encryption, int frameType,
- int serviceType, int controlFrameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload){
-
- ByteBuffer builder;
- if (version == 1) {
- builder = ByteBuffer.allocate(HEADER_SIZE_V1 + dataSize);
- } else {
- builder = ByteBuffer.allocate(HEADER_SIZE + dataSize);
- }
-
- builder.put((byte)((version<<4) + getEncryptionBit(encryption) + frameType));
- builder.put((byte)serviceType);
- builder.put((byte)controlFrameInfo);
- builder.put((byte)sessionId);
-
- builder.put((byte)((dataSize&0xFF000000)>>24));
- builder.put((byte)((dataSize&0x00FF0000)>>16));
- builder.put((byte)((dataSize&0x0000FF00)>>8));
- builder.put((byte)((dataSize&0x000000FF)));
-
- if(version>1){ //Version 1 did not include this part of the header
- builder.put((byte)((messageId&0xFF000000)>>24));
- builder.put((byte)((messageId&0x00FF0000)>>16));
- builder.put((byte)((messageId&0x0000FF00)>>8));
- builder.put((byte)((messageId&0x000000FF)));
- }
-
- if(payload!=null && payload.length>0){
- builder.put(payload);
- }
-
- return builder.array();
- }
-
-
- public static int getEncryptionBit(boolean encryption){
- if(encryption){
- return ENCRYPTION_MASK;
- }else{
- return 0;
- }
- }
-
-
-
-@Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("***** Sdl Packet ******");
- builder.append("\nVersion: ").append(version);
- builder.append("\nEncryption: ").append(encryption);
- builder.append("\nFrameType: ").append(frameType);
- builder.append("\nServiceType: ").append(serviceType);
- builder.append("\nFrameInfo: ").append(frameInfo);
- builder.append("\nSessionId: ").append(sessionId);
- builder.append("\nDataSize: ").append(dataSize);
- if(version>1){
- builder.append("\nMessageId: ").append(messageId);
- }
- builder.append("\n***** Sdl Packet End******");
-
-
- return builder.toString();
- }
-
- public void setMessagingVersion(int version){
- this.messagingVersion = version;
- }
-
- public void putTag(String tag, Object data){
- if(bsonPayload == null){
- bsonPayload = new HashMap<>();
- }
- bsonPayload.put(tag, data);
- }
-
- public Object getTag(String tag){
- if(payload == null){
- return null;
- }else if(bsonPayload == null || bsonPayload.isEmpty()){
- bsonPayload = BsonEncoder.decodeFromBytes(payload);
- }
-
- if(bsonPayload == null){
- return null;
- }
-
- return bsonPayload.get(tag);
- }
+ /**
+ * This is the amount of bytes added to the bundle from the router service for a specific int
+ * flag; this data will always and must be included. This flag is the
+ * TransportConstants.BYTES_TO_SEND_FLAGS.
+ *
+ * @see com.smartdevicelink.transport.TransportConstants#BYTES_TO_SEND_FLAGS
+ */
+ private static final int EXTRA_PARCEL_DATA_LENGTH = 24;
+
+ public static final int HEADER_SIZE = 12;
+ public static final int HEADER_SIZE_V1 = 8;//Backwards
+
+ private static final int ENCRYPTION_MASK = 0x08; //4th lowest bit
+
+ public static final int FRAME_TYPE_CONTROL = 0x00;
+ public static final int FRAME_TYPE_SINGLE = 0x01;
+ public static final int FRAME_TYPE_FIRST = 0x02;
+ public static final int FRAME_TYPE_CONSECUTIVE = 0x03;
+
+ /*
+ * Service Type
+ */
+ public static final int SERVICE_TYPE_CONTROL = 0x00;
+ //RESERVED 0x01 - 0x06
+ public static final int SERVICE_TYPE_RPC = 0x07;
+ //RESERVED 0x08 - 0x09
+ public static final int SERVICE_TYPE_PCM = 0x0A;
+ public static final int SERVICE_TYPE_VIDEO = 0x0B;
+ //RESERVED 0x0C - 0x0E
+ public static final int SERVICE_TYPE_BULK_DATA = 0x0F;
+ //RESERVED 0x10 - 0xFF
+
+
+ /*
+ * Frame Info
+ */
+ //Control Frame Info
+ public static final int FRAME_INFO_HEART_BEAT = 0x00;
+ public static final int FRAME_INFO_START_SERVICE = 0x01;
+ public static final int FRAME_INFO_START_SERVICE_ACK = 0x02;
+ public static final int FRAME_INFO_START_SERVICE_NAK = 0x03;
+ public static final int FRAME_INFO_END_SERVICE = 0x04;
+ public static final int FRAME_INFO_END_SERVICE_ACK = 0x05;
+ public static final int FRAME_INFO_END_SERVICE_NAK = 0x06;
+ public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT = 0x07;
+ public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_ACK = 0x08;
+ public static final int FRAME_INFO_REGISTER_SECONDARY_TRANSPORT_NAK = 0x09;
+ //0x0A-0xFC are reserved
+ public static final int FRAME_INFO_TRANSPORT_EVENT_UPDATE = 0xFD;
+ public static final int FRAME_INFO_SERVICE_DATA_ACK = 0xFE;
+ public static final int FRAME_INFO_HEART_BEAT_ACK = 0xFF;
+
+ public static final int FRAME_INFO_FINAL_CONNESCUTIVE_FRAME = 0x00;
+
+ //Most others
+ public static final int FRAME_INFO_RESERVED = 0x00;
+
+
+ int version;
+ boolean encryption;
+ int frameType;
+ int serviceType;
+ int frameInfo;
+ int sessionId;
+ int dataSize;
+ int messageId;
+ int priorityCoefficient;
+ byte[] payload = null;
+ HashMap<String, Object> bsonPayload;
+
+ int messagingVersion = 1;
+ TransportRecord transportRecord;
+
+ BaseSdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ this.version = version;
+ this.encryption = encryption;
+ this.frameType = frameType;
+ this.serviceType = serviceType;
+ this.frameInfo = frameInfo;
+ this.sessionId = sessionId;
+ this.dataSize = dataSize;
+ this.messageId = messageId;
+ this.priorityCoefficient = 0;
+ if (payload != null) {
+ this.payload = new byte[payload.length];
+ System.arraycopy(payload, 0, this.payload, 0, payload.length);
+ }
+ }
+
+ BaseSdlPacket(int version, boolean encryption, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset, int bytesToWrite) {
+ this.version = version;
+ this.encryption = encryption;
+ this.frameType = frameType;
+ this.serviceType = serviceType;
+ this.frameInfo = frameInfo;
+ this.sessionId = sessionId;
+ this.dataSize = dataSize;
+ this.messageId = messageId;
+ this.priorityCoefficient = 0;
+ if (payload != null) {
+ this.payload = new byte[bytesToWrite];
+ System.arraycopy(payload, offset, this.payload, 0, bytesToWrite);
+ }
+ }
+
+ /**
+ * This constructor is available as a protected method. A few defaults have been set, however a few things <b>MUST</b> be set before use. The rest will "work"
+ * however, it won't be valid data.
+ *
+ * <p>Frame Type
+ * <p>Service Type
+ * <p>Frame Info
+ * <p>
+ */
+ protected BaseSdlPacket() {
+ //Package only empty constructor
+ this.version = 1;
+ this.encryption = false;
+ this.frameType = -1; //This NEEDS to be set
+ this.serviceType = -1;
+ this.frameInfo = -1;
+ this.sessionId = 0;
+ this.dataSize = 0;
+ this.messageId = 0;
+
+ }
+
+ /**
+ * Creates a new packet based on previous packet definitions. Will not copy payload.
+ *
+ * @param packet an instance of the packet that should be copied.
+ */
+ protected BaseSdlPacket(BaseSdlPacket packet) {
+ this.version = packet.version;
+ this.encryption = packet.encryption;
+ this.frameType = packet.frameType;
+ this.serviceType = packet.serviceType;
+ this.frameInfo = packet.frameInfo;
+ this.sessionId = packet.sessionId;
+ this.dataSize = 0;
+ this.messageId = 0;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public boolean isEncrypted() {
+ return encryption;
+ }
+
+ public FrameType getFrameType() {
+ switch (frameType) {
+ case FRAME_TYPE_CONTROL:
+ return FrameType.Control;
+ case FRAME_TYPE_FIRST:
+ return FrameType.First;
+ case FRAME_TYPE_CONSECUTIVE:
+ return FrameType.Consecutive;
+ case FRAME_TYPE_SINGLE:
+ default:
+ return FrameType.Single;
+ }
+ }
+
+ public int getServiceType() {
+ return serviceType;
+ }
+
+ public int getFrameInfo() {
+ return frameInfo;
+ }
+
+ public int getSessionId() {
+ return sessionId;
+ }
+
+ public int getMessageId() {
+ return messageId;
+ }
+
+ public long getDataSize() {
+ return dataSize;
+ }
+
+ public byte[] getPayload() {
+ return payload;
+ }
+
+ public byte[] constructPacket() {
+ if (bsonPayload != null && !bsonPayload.isEmpty()) {
+ byte[] bsonBytes = BsonEncoder.encodeToBytes(bsonPayload);
+ if (bsonBytes != null) {
+ payload = bsonBytes;
+ dataSize = bsonBytes.length;
+ }
+ }
+ return constructPacket(version, encryption, frameType,
+ serviceType, frameInfo, sessionId,
+ dataSize, messageId, payload);
+ }
+
+ public void setPayload(byte[] bytes) {
+ this.payload = bytes;
+ }
+
+ /**
+ * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
+ *
+ * @param priority the priority of this packet
+ */
+ public void setPriorityCoefficient(int priority) {
+ this.priorityCoefficient = priority;
+ }
+
+ public int getPrioirtyCoefficient() {
+ return this.priorityCoefficient;
+ }
+
+ public void setTransportRecord(TransportRecord transportRecord) {
+ this.transportRecord = transportRecord;
+ }
+
+ public TransportRecord getTransportRecord() {
+ return this.transportRecord;
+ }
+
+ /**
+ * This method takes in the various components to the SDL packet structure and creates a new byte array that can be sent via the transport
+ *
+ * @param version protocol version to use
+ * @param encryption whether or not this packet is encrypted
+ * @param frameType the packet frame type
+ * @param serviceType the service that this packet is associated with
+ * @param controlFrameInfo specific frame info related to this packet
+ * @param sessionId ID this packet is associated with
+ * @param dataSize size of the payload that will be added
+ * @param messageId ID of this specific packet
+ * @param payload raw data that will be attached to the packet (RPC message, raw bytes, etc)
+ * @return a byte[] representation of an SdlPacket built using the supplied params
+ */
+ public static byte[] constructPacket(int version, boolean encryption, int frameType,
+ int serviceType, int controlFrameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+
+ ByteBuffer builder;
+ if (version == 1) {
+ builder = ByteBuffer.allocate(HEADER_SIZE_V1 + dataSize);
+ } else {
+ builder = ByteBuffer.allocate(HEADER_SIZE + dataSize);
+ }
+
+ builder.put((byte) ((version << 4) + getEncryptionBit(encryption) + frameType));
+ builder.put((byte) serviceType);
+ builder.put((byte) controlFrameInfo);
+ builder.put((byte) sessionId);
+
+ builder.put((byte) ((dataSize & 0xFF000000) >> 24));
+ builder.put((byte) ((dataSize & 0x00FF0000) >> 16));
+ builder.put((byte) ((dataSize & 0x0000FF00) >> 8));
+ builder.put((byte) ((dataSize & 0x000000FF)));
+
+ if (version > 1) { //Version 1 did not include this part of the header
+ builder.put((byte) ((messageId & 0xFF000000) >> 24));
+ builder.put((byte) ((messageId & 0x00FF0000) >> 16));
+ builder.put((byte) ((messageId & 0x0000FF00) >> 8));
+ builder.put((byte) ((messageId & 0x000000FF)));
+ }
+
+ if (payload != null && payload.length > 0) {
+ builder.put(payload);
+ }
+
+ return builder.array();
+ }
+
+
+ public static int getEncryptionBit(boolean encryption) {
+ if (encryption) {
+ return ENCRYPTION_MASK;
+ } else {
+ return 0;
+ }
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("***** Sdl Packet ******");
+ builder.append("\nVersion: ").append(version);
+ builder.append("\nEncryption: ").append(encryption);
+ builder.append("\nFrameType: ").append(frameType);
+ builder.append("\nServiceType: ").append(serviceType);
+ builder.append("\nFrameInfo: ").append(frameInfo);
+ builder.append("\nSessionId: ").append(sessionId);
+ builder.append("\nDataSize: ").append(dataSize);
+ if (version > 1) {
+ builder.append("\nMessageId: ").append(messageId);
+ }
+ builder.append("\n***** Sdl Packet End******");
+
+
+ return builder.toString();
+ }
+
+ public void setMessagingVersion(int version) {
+ this.messagingVersion = version;
+ }
+
+ public void putTag(String tag, Object data) {
+ if (bsonPayload == null) {
+ bsonPayload = new HashMap<>();
+ }
+ bsonPayload.put(tag, data);
+ }
+
+ public Object getTag(String tag) {
+ if (payload == null) {
+ return null;
+ } else if (bsonPayload == null || bsonPayload.isEmpty()) {
+ bsonPayload = BsonEncoder.decodeFromBytes(payload);
+ }
+
+ if (bsonPayload == null) {
+ return null;
+ }
+
+ return bsonPayload.get(tag);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java b/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
index eaabf27d7..e665237cd 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/BinaryFrameHeader.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,116 +36,118 @@ import androidx.annotation.RestrictTo;
import com.smartdevicelink.util.BitConverter;
import com.smartdevicelink.util.DebugTool;
+
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class BinaryFrameHeader {
- private static final String TAG = "BinaryFrameHeader";
-
- private byte _rpcType;
- private int _functionID;
- private int _correlationID;
- private int _jsonSize;
-
- private byte[] _jsonData;
- private byte[] _bulkData;
-
- public BinaryFrameHeader() {}
-
- public static BinaryFrameHeader parseBinaryHeader(byte[] binHeader) {
- BinaryFrameHeader msg = new BinaryFrameHeader();
-
- byte RPC_Type = (byte) (binHeader[0] >>> 4);
- msg.setRPCType(RPC_Type);
-
- int _functionID = (BitConverter.intFromByteArray(binHeader, 0) & 0x0FFFFFFF);
- msg.setFunctionID(_functionID);
-
- int corrID = BitConverter.intFromByteArray(binHeader, 4);
- msg.setCorrID(corrID);
-
- int _jsonSize = BitConverter.intFromByteArray(binHeader, 8);
- msg.setJsonSize(_jsonSize);
-
- try {
- if (_jsonSize > 0) {
- byte[] _jsonData = new byte[_jsonSize];
- System.arraycopy(binHeader, 12, _jsonData, 0, _jsonSize);
- msg.setJsonData(_jsonData);
- }
-
- if (binHeader.length - _jsonSize - 12 > 0) {
- byte[] _bulkData = new byte[binHeader.length - _jsonSize - 12];
- System.arraycopy(binHeader, 12 + _jsonSize, _bulkData, 0, _bulkData.length);
- msg.setBulkData(_bulkData);
- }
- } catch (OutOfMemoryError|ArrayIndexOutOfBoundsException e){
- DebugTool.logError(TAG, "Unable to process data to form header");
- return null;
- }
-
- return msg;
- }
-
- public byte[] assembleHeaderBytes() {
- int binHeader = _functionID;
+ private static final String TAG = "BinaryFrameHeader";
+
+ private byte _rpcType;
+ private int _functionID;
+ private int _correlationID;
+ private int _jsonSize;
+
+ private byte[] _jsonData;
+ private byte[] _bulkData;
+
+ public BinaryFrameHeader() {
+ }
+
+ public static BinaryFrameHeader parseBinaryHeader(byte[] binHeader) {
+ BinaryFrameHeader msg = new BinaryFrameHeader();
+
+ byte RPC_Type = (byte) (binHeader[0] >>> 4);
+ msg.setRPCType(RPC_Type);
+
+ int _functionID = (BitConverter.intFromByteArray(binHeader, 0) & 0x0FFFFFFF);
+ msg.setFunctionID(_functionID);
+
+ int corrID = BitConverter.intFromByteArray(binHeader, 4);
+ msg.setCorrID(corrID);
+
+ int _jsonSize = BitConverter.intFromByteArray(binHeader, 8);
+ msg.setJsonSize(_jsonSize);
+
+ try {
+ if (_jsonSize > 0) {
+ byte[] _jsonData = new byte[_jsonSize];
+ System.arraycopy(binHeader, 12, _jsonData, 0, _jsonSize);
+ msg.setJsonData(_jsonData);
+ }
+
+ if (binHeader.length - _jsonSize - 12 > 0) {
+ byte[] _bulkData = new byte[binHeader.length - _jsonSize - 12];
+ System.arraycopy(binHeader, 12 + _jsonSize, _bulkData, 0, _bulkData.length);
+ msg.setBulkData(_bulkData);
+ }
+ } catch (OutOfMemoryError | ArrayIndexOutOfBoundsException e) {
+ DebugTool.logError(TAG, "Unable to process data to form header");
+ return null;
+ }
+
+ return msg;
+ }
+
+ public byte[] assembleHeaderBytes() {
+ int binHeader = _functionID;
// reset the 4 leftmost bits, for _rpcType
binHeader &= 0xFFFFFFFF >>> 4;
- binHeader |= (_rpcType << 28);
-
- byte[] ret = new byte[12];
- System.arraycopy(BitConverter.intToByteArray(binHeader), 0, ret, 0, 4);
- System.arraycopy(BitConverter.intToByteArray(_correlationID), 0, ret, 4, 4);
- System.arraycopy(BitConverter.intToByteArray(_jsonSize), 0, ret, 8, 4);
-
- return ret;
- }
-
- public byte getRPCType() {
- return _rpcType;
- }
-
- public void setRPCType(byte _rpcType) {
- this._rpcType = _rpcType;
- }
-
- public int getFunctionID() {
- return _functionID;
- }
-
- public void setFunctionID(int _functionID) {
- this._functionID = _functionID;
- }
-
- public int getCorrID() {
- return _correlationID;
- }
-
- public void setCorrID(int _correlationID) {
- this._correlationID = _correlationID;
- }
-
- public int getJsonSize() {
- return _jsonSize;
- }
-
- public void setJsonSize(int _jsonSize) {
- this._jsonSize = _jsonSize;
- }
-
- public byte[] getJsonData() {
- return _jsonData;
- }
-
- public void setJsonData(byte[] _jsonData) {
- this._jsonData = new byte[this._jsonSize];
- System.arraycopy(_jsonData, 0, this._jsonData, 0, _jsonSize);
- //this._jsonData = _jsonData;
- }
-
- public byte[] getBulkData() {
- return _bulkData;
- }
-
- public void setBulkData(byte[] _bulkData) {
- this._bulkData = _bulkData;
- }
+ binHeader |= (_rpcType << 28);
+
+ byte[] ret = new byte[12];
+ System.arraycopy(BitConverter.intToByteArray(binHeader), 0, ret, 0, 4);
+ System.arraycopy(BitConverter.intToByteArray(_correlationID), 0, ret, 4, 4);
+ System.arraycopy(BitConverter.intToByteArray(_jsonSize), 0, ret, 8, 4);
+
+ return ret;
+ }
+
+ public byte getRPCType() {
+ return _rpcType;
+ }
+
+ public void setRPCType(byte _rpcType) {
+ this._rpcType = _rpcType;
+ }
+
+ public int getFunctionID() {
+ return _functionID;
+ }
+
+ public void setFunctionID(int _functionID) {
+ this._functionID = _functionID;
+ }
+
+ public int getCorrID() {
+ return _correlationID;
+ }
+
+ public void setCorrID(int _correlationID) {
+ this._correlationID = _correlationID;
+ }
+
+ public int getJsonSize() {
+ return _jsonSize;
+ }
+
+ public void setJsonSize(int _jsonSize) {
+ this._jsonSize = _jsonSize;
+ }
+
+ public byte[] getJsonData() {
+ return _jsonData;
+ }
+
+ public void setJsonData(byte[] _jsonData) {
+ this._jsonData = new byte[this._jsonSize];
+ System.arraycopy(_jsonData, 0, this._jsonData, 0, _jsonSize);
+ //this._jsonData = _jsonData;
+ }
+
+ public byte[] getBulkData() {
+ return _bulkData;
+ }
+
+ public void setBulkData(byte[] _bulkData) {
+ this._bulkData = _bulkData;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java b/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
index 69cbfb8a7..25a802557 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
@@ -45,26 +45,29 @@ import com.smartdevicelink.util.Version;
public interface ISdlProtocol {
/**
- * Called to indicate that a complete message (RPC, BULK, etc.) has been received.
+ * Called to indicate that a complete message (RPC, BULK, etc.) has been received.
+ *
* @param msg the message that was received
*/
void onProtocolMessageReceived(ProtocolMessage msg);
/**
* Called to indicate that a service has been started
- * @param packet the control packet StartServiceACK received from the connected device
+ *
+ * @param packet the control packet StartServiceACK received from the connected device
* @param serviceType the service type that has been started
- * @param sessionID the session ID that this service has been started on
- * @param version the protocol version used for this session and service
+ * @param sessionID the session ID that this service has been started on
+ * @param version the protocol version used for this session and service
* @param isEncrypted if the service is encrypted
*/
void onServiceStarted(SdlPacket packet, SessionType serviceType, int sessionID, Version version, boolean isEncrypted);
/**
* This will get called when a service has ended
- * @param packet the packet received that ended this service
+ *
+ * @param packet the packet received that ended this service
* @param serviceType the service type that has ended
- * @param sessionID the id of the session that this service was operating on
+ * @param sessionID the id of the session that this service was operating on
*/
void onServiceEnded(SdlPacket packet, SessionType serviceType, int sessionID);
@@ -72,23 +75,26 @@ public interface ISdlProtocol {
* If there is an error with starting or stopping the service or any other error this method
* will be called. This will also be called if the service was operating on a transport that
* has been disconnected.
- * @param packet if there is a packet that caused this error it will be included, however this
- * can be null.
+ *
+ * @param packet if there is a packet that caused this error it will be included, however this
+ * can be null.
* @param serviceType the service type that experienced the error
- * @param sessionID the session ID that this service was associated with
- * @param error a human readable string of the error
+ * @param sessionID the session ID that this service was associated with
+ * @param error a human readable string of the error
*/
void onServiceError(SdlPacket packet, SessionType serviceType, int sessionID, String error);
/**
* Called to indicate that a protocol error was detected in received data.
+ *
* @param info a human readable string of the error
- * @param e the exception if one occurred
+ * @param e the exception if one occurred
*/
void onProtocolError(String info, Exception e);
/**
* Method that the protocol layer will use to obtain the session ID
+ *
* @return the session ID associated with the protocol instance
*/
int getSessionId();
@@ -96,22 +102,25 @@ public interface ISdlProtocol {
/**
* A request made by the protocol layer to shutdown the layers above it. Likely due to
* the RPC service being shutdown or the primary transport disconnecting.
+ *
* @param info human readable string on why the shutdown should occur
*/
void shutdown(String info);
/**
* Called when a transport disconnects
- * @param info a human readable string including information on the disconnected transport
+ *
+ * @param info a human readable string including information on the disconnected transport
* @param altTransportAvailable a boolean flag indicating if there is another transport that can
* be used to connect with the SDL enabled device.
- * @param transportConfig the previously supplied transport config
+ * @param transportConfig the previously supplied transport config
*/
void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig);
/**
* A method that should be implemented by the hosting class of the SdlProtocol instance that will
* return the currently being used security library if any.
+ *
* @return the security library to be used to encrypt/decrypt packets
*/
SdlSecurityBase getSdlSecurity();
@@ -120,6 +129,7 @@ public interface ISdlProtocol {
* A method that should be implemented by the hosting class of the SdlProtocol instance that will
* return the desired video streaming parameters. These parameters will be requested if
* another component has requested the video streaming service to start.
+ *
* @return the developer supplied desired video streaming parameters
*/
VideoStreamingParameters getDesiredVideoParams();
@@ -128,6 +138,7 @@ public interface ISdlProtocol {
* A callback that will be called when the video service has been successfully started and the
* streaming parameters have been negotiated. This should be called prior to the video service
* started callback.
+ *
* @param acceptedVideoParams the negotiated and accepted video parameters that should be used
* to stream to the SDL enabled device.
*/
@@ -136,6 +147,7 @@ public interface ISdlProtocol {
/**
* A callback to indicate the SDL connected device has supplied an authentication token to this
* application. It will be called after the service start callback.
+ *
* @param authToken
*/
void onAuthTokenReceived(String authToken);
diff --git a/base/src/main/java/com/smartdevicelink/protocol/ISdlServiceListener.java b/base/src/main/java/com/smartdevicelink/protocol/ISdlServiceListener.java
index d5bc9ebb4..4b29e9684 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/ISdlServiceListener.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/ISdlServiceListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,11 +32,13 @@
package com.smartdevicelink.protocol;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
public interface ISdlServiceListener {
void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted);
+
void onServiceEnded(SdlSession session, SessionType type);
+
void onServiceError(SdlSession session, SessionType type, String reason);
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/ISecondaryTransportListener.java b/base/src/main/java/com/smartdevicelink/protocol/ISecondaryTransportListener.java
index 6f65b55bd..ae1403cf0 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/ISecondaryTransportListener.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/ISecondaryTransportListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,6 +37,7 @@ import com.smartdevicelink.transport.utl.TransportRecord;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public interface ISecondaryTransportListener {
- void onConnectionSuccess(TransportRecord transportRecord);
- void onConnectionFailure();
+ void onConnectionSuccess(TransportRecord transportRecord);
+
+ void onConnectionFailure();
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java b/base/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
index 33967b57f..8a1968f36 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,148 +38,151 @@ import com.smartdevicelink.protocol.enums.SessionType;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class ProtocolMessage {
- private byte version = 1;
- private SessionType _sessionType = SessionType.RPC;
- private MessageType _messageType = MessageType.UNDEFINED;
- private byte _sessionID = 0;
- private byte _rpcType;
- private int _functionID;
- private int _correlationID;
- private int _jsonSize;
- private boolean payloadProtected = false;
-
- int priorityCoefficient = 0;
-
- private byte[] _data = null;
- private byte[] _bulkData = null;
-
- public ProtocolMessage() {}
-
- public byte getVersion() {
- return version;
- }
-
- public void setVersion(byte version) {
- this.version = version;
- }
-
- public byte getSessionID() {
- return _sessionID;
- }
-
- public void setSessionID(byte sessionID) {
- this._sessionID = sessionID;
- }
-
- public byte[] getData() {
- return _data;
- }
-
- public void setData(byte[] data) {
- this._data = data;
- this._jsonSize = data.length;
- }
-
- public void setData(byte[] data, int length) {
- setData(data, 0, length);
- }
-
- public void setData(byte[] data, int offset, int length) {
- if (this._data != null)
- this._data = null;
- this._data = new byte[length];
- System.arraycopy(data, offset, this._data, 0, length);
- this._jsonSize = 0;
- }
-
- public byte[] getBulkData() {
- return _bulkData;
- }
-
- public void setBulkDataNoCopy(byte[] bulkData) {
- this._bulkData = bulkData;
- }
-
- public void setBulkData(byte[] bulkData) {
- if (this._bulkData != null)
- this._bulkData = null;
- this._bulkData = new byte[bulkData.length];
- System.arraycopy(bulkData, 0, this._bulkData, 0, bulkData.length);
- //this._bulkData = bulkData;
- }
-
- public void setBulkData(byte[] bulkData, int length) {
- if (this._bulkData != null)
- this._bulkData = null;
- this._bulkData = new byte[length];
- System.arraycopy(bulkData, 0, this._bulkData, 0, length);
- //this._bulkData = bulkData;
- }
-
- public SessionType getSessionType() {
- return _sessionType;
- }
-
- public void setSessionType(SessionType sessionType) {
- this._sessionType = sessionType;
- }
-
- public MessageType getMessageType() {
- return _messageType;
- }
-
- public void setMessageType(MessageType messageType) {
- this._messageType = messageType;
- }
-
- public byte getRPCType() {
- return _rpcType;
- }
-
- public void setRPCType(byte _rpcType) {
- this._rpcType = _rpcType;
- }
-
- public int getFunctionID() {
- return _functionID;
- }
-
- public void setFunctionID(int _functionID) {
- this._functionID = _functionID;
- }
-
- public int getCorrID() {
- return _correlationID;
- }
-
- public void setCorrID(int _correlationID) {
- this._correlationID = _correlationID;
- }
-
- public int getJsonSize() {
- return _jsonSize;
- }
-
- public void setJsonSize(int _jsonSize) {
- this._jsonSize = _jsonSize;
- }
-
- public void setPayloadProtected(boolean bVal) {
- payloadProtected = bVal;
- }
-
- public boolean getPayloadProtected() {
- return payloadProtected;
- }
-
- /**
- * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
- * @param priority the priority of this message
- */
- public void setPriorityCoefficient(int priority){
- this.priorityCoefficient = priority;
- }
- public int getPrioirtyCoefficient(){
- return this.priorityCoefficient;
- }
+ private byte version = 1;
+ private SessionType _sessionType = SessionType.RPC;
+ private MessageType _messageType = MessageType.UNDEFINED;
+ private byte _sessionID = 0;
+ private byte _rpcType;
+ private int _functionID;
+ private int _correlationID;
+ private int _jsonSize;
+ private boolean payloadProtected = false;
+
+ int priorityCoefficient = 0;
+
+ private byte[] _data = null;
+ private byte[] _bulkData = null;
+
+ public ProtocolMessage() {
+ }
+
+ public byte getVersion() {
+ return version;
+ }
+
+ public void setVersion(byte version) {
+ this.version = version;
+ }
+
+ public byte getSessionID() {
+ return _sessionID;
+ }
+
+ public void setSessionID(byte sessionID) {
+ this._sessionID = sessionID;
+ }
+
+ public byte[] getData() {
+ return _data;
+ }
+
+ public void setData(byte[] data) {
+ this._data = data;
+ this._jsonSize = data.length;
+ }
+
+ public void setData(byte[] data, int length) {
+ setData(data, 0, length);
+ }
+
+ public void setData(byte[] data, int offset, int length) {
+ if (this._data != null)
+ this._data = null;
+ this._data = new byte[length];
+ System.arraycopy(data, offset, this._data, 0, length);
+ this._jsonSize = 0;
+ }
+
+ public byte[] getBulkData() {
+ return _bulkData;
+ }
+
+ public void setBulkDataNoCopy(byte[] bulkData) {
+ this._bulkData = bulkData;
+ }
+
+ public void setBulkData(byte[] bulkData) {
+ if (this._bulkData != null)
+ this._bulkData = null;
+ this._bulkData = new byte[bulkData.length];
+ System.arraycopy(bulkData, 0, this._bulkData, 0, bulkData.length);
+ //this._bulkData = bulkData;
+ }
+
+ public void setBulkData(byte[] bulkData, int length) {
+ if (this._bulkData != null)
+ this._bulkData = null;
+ this._bulkData = new byte[length];
+ System.arraycopy(bulkData, 0, this._bulkData, 0, length);
+ //this._bulkData = bulkData;
+ }
+
+ public SessionType getSessionType() {
+ return _sessionType;
+ }
+
+ public void setSessionType(SessionType sessionType) {
+ this._sessionType = sessionType;
+ }
+
+ public MessageType getMessageType() {
+ return _messageType;
+ }
+
+ public void setMessageType(MessageType messageType) {
+ this._messageType = messageType;
+ }
+
+ public byte getRPCType() {
+ return _rpcType;
+ }
+
+ public void setRPCType(byte _rpcType) {
+ this._rpcType = _rpcType;
+ }
+
+ public int getFunctionID() {
+ return _functionID;
+ }
+
+ public void setFunctionID(int _functionID) {
+ this._functionID = _functionID;
+ }
+
+ public int getCorrID() {
+ return _correlationID;
+ }
+
+ public void setCorrID(int _correlationID) {
+ this._correlationID = _correlationID;
+ }
+
+ public int getJsonSize() {
+ return _jsonSize;
+ }
+
+ public void setJsonSize(int _jsonSize) {
+ this._jsonSize = _jsonSize;
+ }
+
+ public void setPayloadProtected(boolean bVal) {
+ payloadProtected = bVal;
+ }
+
+ public boolean getPayloadProtected() {
+ return payloadProtected;
+ }
+
+ /**
+ * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
+ *
+ * @param priority the priority of this message
+ */
+ public void setPriorityCoefficient(int priority) {
+ this.priorityCoefficient = priority;
+ }
+
+ public int getPrioirtyCoefficient() {
+ return this.priorityCoefficient;
+ }
} // end-class \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java b/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
index 33ffad27f..364dc4e30 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
@@ -41,107 +41,107 @@ import com.smartdevicelink.util.BitConverter;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SdlPacketFactory {
- /*
- * public SdlPacket(int version, boolean compression, int frameType,
- int serviceType, int frameInfo, int sessionId,
- int dataSize, int messageId, byte[] payload) {
- */
- public static SdlPacket createStartSession(SessionType serviceType, int messageID, byte version, byte sessionID, boolean encrypted) {
-
- return new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),SdlPacket.FRAME_INFO_START_SERVICE,sessionID,
- 0,messageID,null);
- }
+ /*
+ * public SdlPacket(int version, boolean compression, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ */
+ public static SdlPacket createStartSession(SessionType serviceType, int messageID, byte version, byte sessionID, boolean encrypted) {
+
+ return new SdlPacket(version, encrypted, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), SdlPacket.FRAME_INFO_START_SERVICE, sessionID,
+ 0, messageID, null);
+ }
public static SdlPacket createHeartbeat(SessionType serviceType, byte sessionID, byte version) {
-
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),FrameDataControlFrameType.Heartbeat.value(),sessionID,
- 0,0,null);
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), FrameDataControlFrameType.Heartbeat.value(), sessionID,
+ 0, 0, null);
+
+ }
+
+ public static SdlPacket createHeartbeatACK(SessionType serviceType, byte sessionID, byte version) {
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), FrameDataControlFrameType.HeartbeatACK.value(), sessionID,
+ 0, 0, null);
+ }
+
+ public static SdlPacket createStartSessionACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
+
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), FrameDataControlFrameType.StartSessionACK.value(), sessionID,
+ 0, messageID, null);
+
+ }
+
+ public static SdlPacket createStartSessionNACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
+
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), SdlPacket.FRAME_INFO_START_SERVICE_NAK, sessionID,
+ 0, messageID, null);
+ }
+
+ public static SdlPacket createEndSession(SessionType serviceType, byte sessionID, int messageID, byte version, byte[] payload) {
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), SdlPacket.FRAME_INFO_END_SERVICE, sessionID,
+ payload.length, messageID, payload);
+ }
+
+ public static SdlPacket createEndSession(SessionType serviceType, byte sessionID, int messageID, byte version, int hashID) {
+ if (version < 5) {
+ byte[] payload = BitConverter.intToByteArray(hashID);
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), SdlPacket.FRAME_INFO_END_SERVICE, sessionID,
+ payload.length, messageID, payload);
+ } else {
+ SdlPacket endSession = new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(), SdlPacket.FRAME_INFO_END_SERVICE, sessionID,
+ 0, messageID, null);
+ endSession.putTag(ControlFrameTags.RPC.EndService.HASH_ID, hashID);
+ return endSession;
+ }
+ }
+
+ public static SdlPacket createSingleSendData(SessionType serviceType, byte sessionID,
+ int dataLength, int messageID, byte version, byte[] payload, boolean encrypted) {
+
+ return new SdlPacket(version, encrypted, SdlPacket.FRAME_TYPE_SINGLE,
+ serviceType.getValue(), 0, sessionID,
+ payload.length, messageID, payload);
+ }
+
+ public static SdlPacket createMultiSendDataFirst(SessionType serviceType, byte sessionID,
+ int messageID, byte version, byte[] payload, boolean encrypted) {
+
+ return new SdlPacket(version, encrypted, SdlPacket.FRAME_TYPE_FIRST,
+ serviceType.getValue(), 0, sessionID,
+ 8, messageID, payload);
+
+ }
+
+ public static SdlPacket createMultiSendDataRest(SessionType serviceType, byte sessionID,
+ int dataLength, byte frameSequenceNumber, int messageID, byte version, byte[] payload, int offset, int length, boolean encrypted) {
+
+ return new SdlPacket(version, encrypted, SdlPacket.FRAME_TYPE_CONSECUTIVE,
+ serviceType.getValue(), frameSequenceNumber, sessionID,
+ length, messageID, payload, offset, length);
+ }
+
+ public static SdlPacket createRegisterSecondaryTransport(byte sessionID, byte version) {
+ return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
+ SessionType.CONTROL.getValue(), SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT,
+ sessionID, 0, 0x01, null);
+ }
+
+ public static BinaryFrameHeader createBinaryFrameHeader(byte rpcType, int functionID, int corrID, int jsonSize) {
+ BinaryFrameHeader msg = new BinaryFrameHeader();
+ msg.setRPCType(rpcType);
+ msg.setFunctionID(functionID);
+ msg.setCorrID(corrID);
+ msg.setJsonSize(jsonSize);
+
+ return msg;
}
- public static SdlPacket createHeartbeatACK(SessionType serviceType, byte sessionID, byte version) {
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),FrameDataControlFrameType.HeartbeatACK.value(),sessionID,
- 0,0,null);
- }
-
- public static SdlPacket createStartSessionACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
-
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),FrameDataControlFrameType.StartSessionACK.value(),sessionID,
- 0,messageID,null);
-
- }
-
- public static SdlPacket createStartSessionNACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
-
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),SdlPacket.FRAME_INFO_START_SERVICE_NAK,sessionID,
- 0,messageID,null);
- }
-
- public static SdlPacket createEndSession(SessionType serviceType, byte sessionID, int messageID, byte version, byte[] payload) {
- return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(),SdlPacket.FRAME_INFO_END_SERVICE,sessionID,
- payload.length,messageID,payload);
- }
-
- public static SdlPacket createEndSession(SessionType serviceType, byte sessionID, int messageID, byte version, int hashID) {
- if (version < 5) {
- byte[] payload = BitConverter.intToByteArray(hashID);
- return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(), SdlPacket.FRAME_INFO_END_SERVICE, sessionID,
- payload.length, messageID, payload);
- } else {
- SdlPacket endSession = new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
- serviceType.getValue(), SdlPacket.FRAME_INFO_END_SERVICE, sessionID,
- 0, messageID, null);
- endSession.putTag(ControlFrameTags.RPC.EndService.HASH_ID, hashID);
- return endSession;
- }
- }
-
- public static SdlPacket createSingleSendData(SessionType serviceType, byte sessionID,
- int dataLength, int messageID, byte version, byte[] payload, boolean encrypted) {
-
- return new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_SINGLE,
- serviceType.getValue(),0,sessionID,
- payload.length,messageID,payload);
- }
-
- public static SdlPacket createMultiSendDataFirst(SessionType serviceType, byte sessionID,
- int messageID, byte version, byte[] payload, boolean encrypted) {
-
- return new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_FIRST,
- serviceType.getValue(),0,sessionID,
- 8,messageID,payload);
-
- }
-
- public static SdlPacket createMultiSendDataRest(SessionType serviceType, byte sessionID,
- int dataLength, byte frameSequenceNumber, int messageID, byte version, byte[] payload,int offset,int length, boolean encrypted) {
-
- return new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_CONSECUTIVE,
- serviceType.getValue(),frameSequenceNumber,sessionID,
- length,messageID,payload,offset,length);
- }
-
- public static SdlPacket createRegisterSecondaryTransport(byte sessionID, byte version) {
- return new SdlPacket(version, false, SdlPacket.FRAME_TYPE_CONTROL,
- SessionType.CONTROL.getValue(), SdlPacket.FRAME_INFO_REGISTER_SECONDARY_TRANSPORT,
- sessionID, 0, 0x01, null);
- }
-
- public static BinaryFrameHeader createBinaryFrameHeader(byte rpcType, int functionID, int corrID, int jsonSize) {
- BinaryFrameHeader msg = new BinaryFrameHeader();
- msg.setRPCType(rpcType);
- msg.setFunctionID(functionID);
- msg.setCorrID(corrID);
- msg.setJsonSize(jsonSize);
-
- return msg;
- }
-
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
index 8a497cb53..bb5e9cb31 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
@@ -67,13 +67,13 @@ import java.util.Map;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SdlProtocolBase {
- private static final String TAG ="SdlProtocol";
+ private static final String TAG = "SdlProtocol";
private final static String FailurePropagating_Msg = "Failure propagating ";
private static final int TLS_MAX_RECORD_SIZE = 16384;
- private static final int PRIMARY_TRANSPORT_ID = 1;
- private static final int SECONDARY_TRANSPORT_ID = 2;
+ private static final int PRIMARY_TRANSPORT_ID = 1;
+ private static final int SECONDARY_TRANSPORT_ID = 2;
/**
* Original header size based on version 1.0.0 only
@@ -143,13 +143,13 @@ public class SdlProtocolBase {
public SdlProtocolBase(@NonNull ISdlProtocol iSdlProtocol, @NonNull BaseTransportConfig config) {
- if (iSdlProtocol == null ) {
+ if (iSdlProtocol == null) {
throw new IllegalArgumentException("Provided protocol listener interface reference is null");
} // end-if
this.iSdlProtocol = iSdlProtocol;
this.transportConfig = config;
- if(!config.getTransportType().equals(TransportType.MULTIPLEX)) {
+ if (!config.getTransportType().equals(TransportType.MULTIPLEX)) {
this.requestedPrimaryTransports = Collections.singletonList(transportConfig.getTransportType());
this.requestedSecondaryTransports = Collections.emptyList();
this.requiresHighBandwidth = false;
@@ -158,7 +158,7 @@ public class SdlProtocolBase {
} // end-ctor
- void setTransportManager(TransportManagerBase transportManager){
+ void setTransportManager(TransportManagerBase transportManager) {
synchronized (TRANSPORT_MANAGER_LOCK) {
this.transportManager = transportManager;
}
@@ -175,13 +175,14 @@ public class SdlProtocolBase {
/**
* Retrieves the max payload size for a packet to be sent to the module
+ *
* @return the max transfer unit
*/
- public int getMtu(){
+ public int getMtu() {
return Long.valueOf(getMtu(SessionType.RPC)).intValue();
}
- public long getMtu(SessionType type){
+ public long getMtu(SessionType type) {
Long mtu = mtus.get(type);
if (mtu == null) {
mtu = mtus.get(SessionType.RPC);
@@ -193,10 +194,10 @@ public class SdlProtocolBase {
}
@Deprecated
- public void resetSession (){
+ public void resetSession() {
}
- public boolean isConnected(){
+ public boolean isConnected() {
synchronized (TRANSPORT_MANAGER_LOCK) {
return transportManager != null && transportManager.isConnected(null, null);
}
@@ -205,7 +206,7 @@ public class SdlProtocolBase {
/**
* Resets the protocol to init status
*/
- protected void reset(){
+ protected void reset() {
protocolVersion = new Version("1.0.0");
hashID = 0;
messageID = 0;
@@ -221,20 +222,20 @@ public class SdlProtocolBase {
/**
* For logging purposes, prints active services on each connected transport
*/
- protected void printActiveTransports(){
+ protected void printActiveTransports() {
StringBuilder activeTransportString = new StringBuilder();
activeTransportString.append("Active transports --- \n");
- for(Map.Entry entry : activeTransports.entrySet()){
+ for (Map.Entry entry : activeTransports.entrySet()) {
String sessionString = null;
- if(entry.getKey().equals(SessionType.NAV)) {
+ if (entry.getKey().equals(SessionType.NAV)) {
sessionString = "NAV";
- }else if(entry.getKey().equals(SessionType.PCM)) {
+ } else if (entry.getKey().equals(SessionType.PCM)) {
sessionString = "PCM";
- }else if(entry.getKey().equals(SessionType.RPC)) {
+ } else if (entry.getKey().equals(SessionType.RPC)) {
sessionString = "RPC";
}
- if(sessionString != null){
+ if (sessionString != null) {
activeTransportString.append("Session: ");
activeTransportString.append(sessionString);
@@ -246,29 +247,29 @@ public class SdlProtocolBase {
DebugTool.logInfo(TAG, activeTransportString.toString());
}
- protected void printSecondaryTransportDetails(List<String> secondary, List<Integer> audio, List<Integer> video){
+ protected void printSecondaryTransportDetails(List<String> secondary, List<Integer> audio, List<Integer> video) {
StringBuilder secondaryDetailsBldr = new StringBuilder();
secondaryDetailsBldr.append("Checking secondary transport details \n");
- if(secondary != null){
+ if (secondary != null) {
secondaryDetailsBldr.append("Supported secondary transports: ");
- for(String s : secondary){
+ for (String s : secondary) {
secondaryDetailsBldr.append(" ").append(s);
}
secondaryDetailsBldr.append("\n");
- }else{
+ } else {
DebugTool.logInfo(TAG, "Supported secondary transports list is empty!");
}
- if(audio != null){
+ if (audio != null) {
secondaryDetailsBldr.append("Supported audio transports: ");
- for(int a : audio){
+ for (int a : audio) {
secondaryDetailsBldr.append(" ").append(a);
}
secondaryDetailsBldr.append("\n");
}
- if(video != null){
+ if (video != null) {
secondaryDetailsBldr.append("Supported video transports: ");
- for(int v : video){
+ for (int v : video) {
secondaryDetailsBldr.append(" ").append(v);
}
secondaryDetailsBldr.append("\n");
@@ -278,19 +279,19 @@ public class SdlProtocolBase {
}
- private TransportRecord getTransportForSession(SessionType type){
+ private TransportRecord getTransportForSession(SessionType type) {
return activeTransports.get(type);
}
- private void setTransportPriorityForService(SessionType serviceType, List<Integer> order){
- if(transportPriorityForServiceMap == null){
+ private void setTransportPriorityForService(SessionType serviceType, List<Integer> order) {
+ if (transportPriorityForServiceMap == null) {
transportPriorityForServiceMap = new HashMap<>();
}
this.transportPriorityForServiceMap.put(serviceType, order);
- for(SessionType service : HIGH_BANDWIDTH_SERVICES){
+ for (SessionType service : HIGH_BANDWIDTH_SERVICES) {
if (transportPriorityForServiceMap.get(service) != null
&& transportPriorityForServiceMap.get(service).contains(PRIMARY_TRANSPORT_ID)) {
- if(connectedPrimaryTransport != null) {
+ if (connectedPrimaryTransport != null) {
activeTransports.put(service, connectedPrimaryTransport);
}
}
@@ -299,24 +300,25 @@ public class SdlProtocolBase {
/**
* Handles when a secondary transport can be used to start services on or when the request as failed.
+ *
* @param transportRecord the transport type that the event has taken place on
- * @param registered if the transport was successfully registered on
+ * @param registered if the transport was successfully registered on
*/
- private void handleSecondaryTransportRegistration(TransportRecord transportRecord, boolean registered){
- if(registered) {
+ private void handleSecondaryTransportRegistration(TransportRecord transportRecord, boolean registered) {
+ if (registered) {
//Session has been registered on secondary transport
DebugTool.logInfo(TAG, transportRecord.getType().toString() + " transport was registered!");
if (supportedSecondaryTransports.contains(transportRecord.getType())) {
// If the transport type that is now available to be used it should be checked
// against the list of services that might be able to be started on it
- for(SessionType secondaryService : HIGH_BANDWIDTH_SERVICES){
+ for (SessionType secondaryService : HIGH_BANDWIDTH_SERVICES) {
if (transportPriorityForServiceMap.containsKey(secondaryService)) {
// If this service type has extra information from the RPC StartServiceACK
// parse through it to find which transport should be used to start this
// specific service type
List<Integer> transportNumList = transportPriorityForServiceMap.get(secondaryService);
- if (transportNumList != null){
+ if (transportNumList != null) {
for (int transportNum : transportNumList) {
if (transportNum == PRIMARY_TRANSPORT_ID) {
break; // Primary is favored for this service type, break out...
@@ -330,38 +332,38 @@ public class SdlProtocolBase {
}
}
}
- }else{
+ } else {
DebugTool.logInfo(TAG, transportRecord.toString() + " transport was NOT registered!");
}
//Notify any listeners for this secondary transport
List<ISecondaryTransportListener> listenerList = secondaryTransportListeners.remove(transportRecord.getType());
- if(listenerList != null){
- for(ISecondaryTransportListener listener : listenerList){
- if(registered) {
+ if (listenerList != null) {
+ for (ISecondaryTransportListener listener : listenerList) {
+ if (registered) {
listener.onConnectionSuccess(transportRecord);
- }else{
+ } else {
listener.onConnectionFailure();
}
}
}
- if(DebugTool.isDebugEnabled()){
+ if (DebugTool.isDebugEnabled()) {
printActiveTransports();
}
}
- private void onTransportsConnectedUpdate(List<TransportRecord> transports){
+ private void onTransportsConnectedUpdate(List<TransportRecord> transports) {
//DebugTool.logInfo(TAG, "Connected transport update");
//Temporary: this logic should all be changed to handle multiple transports of the same type
ArrayList<TransportType> connectedTransports = new ArrayList<>();
- if(transports != null) {
+ if (transports != null) {
for (TransportRecord record : transports) {
connectedTransports.add(record.getType());
}
}
- if(connectedPrimaryTransport != null && !connectedTransports.contains(connectedPrimaryTransport.getType())){
+ if (connectedPrimaryTransport != null && !connectedTransports.contains(connectedPrimaryTransport.getType())) {
//The primary transport being used is no longer part of the connected transports
//The transport manager callbacks should handle the disconnect code
connectedPrimaryTransport = null;
@@ -369,28 +371,28 @@ public class SdlProtocolBase {
return;
}
- if(activeTransports.get(SessionType.RPC) == null){
+ if (activeTransports.get(SessionType.RPC) == null) {
//There is no currently active transport for the RPC service meaning no primary transport
- TransportRecord preferredPrimaryTransport = getPreferredTransport(requestedPrimaryTransports,transports);
- if(preferredPrimaryTransport != null) {
+ TransportRecord preferredPrimaryTransport = getPreferredTransport(requestedPrimaryTransports, transports);
+ if (preferredPrimaryTransport != null) {
connectedPrimaryTransport = preferredPrimaryTransport;
startService(SessionType.RPC, (byte) 0x00, false);
- }else{
+ } else {
onTransportNotAccepted("No transports match requested primary transport");
}
//Return to that the developer does not receive the transport callback at this time
// as it is better to wait until the RPC service is registered and secondary transport
//information is available
return;
- }else if(secondaryTransportListeners != null
+ } else if (secondaryTransportListeners != null
&& transports != null
- && iSdlProtocol!= null){
+ && iSdlProtocol != null) {
// Check to see if there is a listener for a given transport.
// If a listener exists, it can be assumed that the transport should be registered on
- for(TransportRecord record: transports){
- if(secondaryTransportListeners.get(record.getType()) != null
- && !secondaryTransportListeners.get(record.getType()).isEmpty()){
- registerSecondaryTransport((byte)iSdlProtocol.getSessionId(), record);
+ for (TransportRecord record : transports) {
+ if (secondaryTransportListeners.get(record.getType()) != null
+ && !secondaryTransportListeners.get(record.getType()).isEmpty()) {
+ registerSecondaryTransport((byte) iSdlProtocol.getSessionId(), record);
}
}
}
@@ -401,25 +403,26 @@ public class SdlProtocolBase {
/**
* Check to see if a transport is available to start/use the supplied service.
+ *
* @param serviceType the session that should be checked for transport availability
* @return true if there is either a supported
- * transport currently connected or a transport is
- * available to connect with for the supplied service type.
- * <br>false if there is no
- * transport connected to support the service type in question and
- * no possibility in the foreseeable future.
+ * transport currently connected or a transport is
+ * available to connect with for the supplied service type.
+ * <br>false if there is no
+ * transport connected to support the service type in question and
+ * no possibility in the foreseeable future.
*/
- public boolean isTransportForServiceAvailable(@NonNull SessionType serviceType){
- if(connectedPrimaryTransport == null){
+ public boolean isTransportForServiceAvailable(@NonNull SessionType serviceType) {
+ if (connectedPrimaryTransport == null) {
//If there is no connected primary then there is no transport available for any service
return false;
- }else if(activeTransports!= null && activeTransports.containsKey(serviceType)){
+ } else if (activeTransports != null && activeTransports.containsKey(serviceType)) {
//There is an active transport that this service can be used on
//This should catch RPC, Bulk, and Control service types
return true;
}
- if(transportPriorityForServiceMap != null) {
+ if (transportPriorityForServiceMap != null) {
List<Integer> transportPriority = transportPriorityForServiceMap.get(serviceType);
if (transportPriority != null && !transportPriority.isEmpty()) {
@@ -435,11 +438,11 @@ public class SdlProtocolBase {
}
//No transport priority for this service type
- if(connectedPrimaryTransport.getType() == TransportType.USB || connectedPrimaryTransport.getType() == TransportType.TCP){
+ if (connectedPrimaryTransport.getType() == TransportType.USB || connectedPrimaryTransport.getType() == TransportType.TCP) {
//Since the only service type that should reach this point are ones that require a high
//bandwidth, true can be returned if the primary transport is a high bandwidth transport
return true;
- }else{
+ } else {
//Since the only service type that should reach this point are ones that require a high
//bandwidth, true can be returned if a secondary transport is a high bandwidth transport
return isSecondaryTransportAvailable(true);
@@ -448,14 +451,15 @@ public class SdlProtocolBase {
/**
* Checks to see if a secondary transport is available for this session
+ *
* @param onlyHighBandwidth if only high bandwidth transports should be included in this check
* @return true if any connected or potential transport meets the criteria to be a secondary
- * transport
+ * transport
*/
- private boolean isSecondaryTransportAvailable(boolean onlyHighBandwidth){
+ private boolean isSecondaryTransportAvailable(boolean onlyHighBandwidth) {
if (supportedSecondaryTransports != null) {
for (TransportType supportedSecondary : supportedSecondaryTransports) {
- if(!onlyHighBandwidth || supportedSecondary == TransportType.USB || supportedSecondary == TransportType.TCP) {
+ if (!onlyHighBandwidth || supportedSecondary == TransportType.USB || supportedSecondary == TransportType.TCP) {
synchronized (TRANSPORT_MANAGER_LOCK) {
if (transportManager != null && transportManager.isConnected(supportedSecondary, null)) {
//A supported secondary transport is already connected
@@ -476,19 +480,20 @@ public class SdlProtocolBase {
/**
* If the library allows for multiple transports per session this should be handled
*/
- void notifyDevTransportListener (){
+ void notifyDevTransportListener() {
//Does nothing in base class
}
/**
* Retrieves the preferred transport for the given connected transport
- * @param preferredList the list of preferred transports (primary or secondary)
+ *
+ * @param preferredList the list of preferred transports (primary or secondary)
* @param connectedTransports the current list of connected transports
* @return the preferred connected transport
*/
private TransportRecord getPreferredTransport(List<TransportType> preferredList, List<TransportRecord> connectedTransports) {
for (TransportType transportType : preferredList) {
- for(TransportRecord record: connectedTransports) {
+ for (TransportRecord record : connectedTransports) {
if (record.getType().equals(transportType)) {
return record;
}
@@ -497,19 +502,20 @@ public class SdlProtocolBase {
return null;
}
- private void onTransportNotAccepted(String info){
- if(iSdlProtocol != null) {
+ private void onTransportNotAccepted(String info) {
+ if (iSdlProtocol != null) {
iSdlProtocol.shutdown(info);
}
}
- public Version getProtocolVersion(){
+ public Version getProtocolVersion() {
return this.protocolVersion;
}
/**
* This method will set the major protocol version that we should use. It will also set the default MTU based on version.
+ *
* @param version major version to use
*/
protected void setVersion(byte version) {
@@ -521,7 +527,7 @@ public class SdlProtocolBase {
this.protocolVersion = new Version("5.0.0");
headerSize = V2_HEADER_SIZE;
mtus.put(SessionType.RPC, (long) V3_V4_MTU_SIZE);
- }else if (version == 4) {
+ } else if (version == 4) {
this.protocolVersion = new Version("4.0.0");
headerSize = V2_HEADER_SIZE;
mtus.put(SessionType.RPC, (long) V3_V4_MTU_SIZE); //versions 4 supports 128k MTU
@@ -533,7 +539,7 @@ public class SdlProtocolBase {
this.protocolVersion = new Version("2.0.0");
headerSize = V2_HEADER_SIZE;
mtus.put(SessionType.RPC, (long) (V1_V2_MTU_SIZE - headerSize));
- } else if (version == 1){
+ } else if (version == 1) {
this.protocolVersion = new Version("1.0.0");
headerSize = V1_HEADER_SIZE;
mtus.put(SessionType.RPC, (long) (V1_V2_MTU_SIZE - headerSize));
@@ -541,7 +547,7 @@ public class SdlProtocolBase {
}
public void endSession(byte sessionID) {
- SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashID, (byte)protocolVersion.getMajor(), hashID);
+ SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashID, (byte) protocolVersion.getMajor(), hashID);
handlePacketToSend(header);
synchronized (TRANSPORT_MANAGER_LOCK) {
if (transportManager != null) {
@@ -561,11 +567,10 @@ public class SdlProtocolBase {
data = new byte[headerSize + secureData.length];
final BinaryFrameHeader binFrameHeader =
- SdlPacketFactory.createBinaryFrameHeader(protocolMsg.getRPCType(),protocolMsg.getFunctionID(), protocolMsg.getCorrID(), 0);
+ SdlPacketFactory.createBinaryFrameHeader(protocolMsg.getRPCType(), protocolMsg.getFunctionID(), protocolMsg.getCorrID(), 0);
System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, headerSize);
System.arraycopy(secureData, 0, data, headerSize, secureData.length);
- }
- else if (protocolMsg.getBulkData() != null) {
+ } else if (protocolMsg.getBulkData() != null) {
data = new byte[12 + protocolMsg.getJsonSize() + protocolMsg.getBulkData().length];
sessionType = SessionType.BULK_DATA;
} else {
@@ -583,7 +588,7 @@ public class SdlProtocolBase {
data = protocolMsg.getData();
}
- if (iSdlProtocol != null && protocolMsg.getPayloadProtected()){
+ if (iSdlProtocol != null && protocolMsg.getPayloadProtected()) {
if (data != null && data.length > 0) {
byte[] dataToRead = new byte[TLS_MAX_RECORD_SIZE];
@@ -609,7 +614,7 @@ public class SdlProtocolBase {
return;
}
- synchronized(messageLock) {
+ synchronized (messageLock) {
if (data != null && data.length > getMtu(sessionType)) {
messageID++;
@@ -626,8 +631,8 @@ public class SdlProtocolBase {
// Second four bytes are frame count.
System.arraycopy(BitConverter.intToByteArray(frameCount), 0, firstFrameData, 4, 4);
- SdlPacket firstHeader = SdlPacketFactory.createMultiSendDataFirst(sessionType, sessionID, messageID, (byte)protocolVersion.getMajor(),firstFrameData,protocolMsg.getPayloadProtected());
- firstHeader.setPriorityCoefficient(1+protocolMsg.priorityCoefficient);
+ SdlPacket firstHeader = SdlPacketFactory.createMultiSendDataFirst(sessionType, sessionID, messageID, (byte) protocolVersion.getMajor(), firstFrameData, protocolMsg.getPayloadProtected());
+ firstHeader.setPriorityCoefficient(1 + protocolMsg.priorityCoefficient);
firstHeader.setTransportRecord(activeTransports.get(sessionType));
//Send the first frame
handlePacketToSend(firstHeader);
@@ -652,16 +657,16 @@ public class SdlProtocolBase {
if (bytesToWrite > mtu) {
bytesToWrite = mtu.intValue();
}
- SdlPacket consecHeader = SdlPacketFactory.createMultiSendDataRest(sessionType, sessionID, bytesToWrite, frameSequenceNumber , messageID, (byte)protocolVersion.getMajor(),data, currentOffset, bytesToWrite, protocolMsg.getPayloadProtected());
+ SdlPacket consecHeader = SdlPacketFactory.createMultiSendDataRest(sessionType, sessionID, bytesToWrite, frameSequenceNumber, messageID, (byte) protocolVersion.getMajor(), data, currentOffset, bytesToWrite, protocolMsg.getPayloadProtected());
consecHeader.setTransportRecord(activeTransports.get(sessionType));
- consecHeader.setPriorityCoefficient(i+2+protocolMsg.priorityCoefficient);
+ consecHeader.setPriorityCoefficient(i + 2 + protocolMsg.priorityCoefficient);
handlePacketToSend(consecHeader);
currentOffset += bytesToWrite;
}
} else {
messageID++;
int dataLength = data != null ? data.length : 0;
- SdlPacket header = SdlPacketFactory.createSingleSendData(sessionType, sessionID, dataLength, messageID, (byte)protocolVersion.getMajor(),data, protocolMsg.getPayloadProtected());
+ SdlPacket header = SdlPacketFactory.createSingleSendData(sessionType, sessionID, dataLength, messageID, (byte) protocolVersion.getMajor(), data, protocolMsg.getPayloadProtected());
header.setPriorityCoefficient(protocolMsg.priorityCoefficient);
header.setTransportRecord(activeTransports.get(sessionType));
handlePacketToSend(header);
@@ -669,10 +674,10 @@ public class SdlProtocolBase {
}
}
- protected void handlePacketReceived(SdlPacket packet){
+ protected void handlePacketReceived(SdlPacket packet) {
//Check for a version difference
if (protocolVersion == null || protocolVersion.getMajor() == 1) {
- setVersion((byte)packet.version);
+ setVersion((byte) packet.version);
}
SdlProtocolBase.MessageFrameAssembler assembler = getFrameAssemblerForFrame(packet);
@@ -695,27 +700,26 @@ public class SdlProtocolBase {
} // end-method
-
private void registerSecondaryTransport(byte sessionId, TransportRecord transportRecord) {
- SdlPacket header = SdlPacketFactory.createRegisterSecondaryTransport(sessionId, (byte)protocolVersion.getMajor());
+ SdlPacket header = SdlPacketFactory.createRegisterSecondaryTransport(sessionId, (byte) protocolVersion.getMajor());
header.setTransportRecord(transportRecord);
handlePacketToSend(header);
}
public void startService(SessionType serviceType, byte sessionID, boolean isEncrypted) {
- final SdlPacket header = SdlPacketFactory.createStartSession(serviceType, 0x00, (byte)protocolVersion.getMajor(), sessionID, isEncrypted);
- if(SessionType.RPC.equals(serviceType)){
- if(connectedPrimaryTransport != null) {
+ final SdlPacket header = SdlPacketFactory.createStartSession(serviceType, 0x00, (byte) protocolVersion.getMajor(), sessionID, isEncrypted);
+ if (SessionType.RPC.equals(serviceType)) {
+ if (connectedPrimaryTransport != null) {
header.setTransportRecord(connectedPrimaryTransport);
}
//This is going to be our primary transport
header.putTag(ControlFrameTags.RPC.StartService.PROTOCOL_VERSION, MAX_PROTOCOL_VERSION.toString());
handlePacketToSend(header);
return; // We don't need to go any further
- }else if(serviceType.equals(SessionType.NAV)){
- if(iSdlProtocol != null){
+ } else if (serviceType.equals(SessionType.NAV)) {
+ if (iSdlProtocol != null) {
VideoStreamingParameters videoStreamingParameters = iSdlProtocol.getDesiredVideoParams();
- if(videoStreamingParameters != null) {
+ if (videoStreamingParameters != null) {
ImageResolution desiredResolution = videoStreamingParameters.getResolution();
VideoStreamingFormat desiredFormat = videoStreamingParameters.getFormat();
if (desiredResolution != null) {
@@ -729,31 +733,31 @@ public class SdlProtocolBase {
}
}
}
- if(transportPriorityForServiceMap == null
+ if (transportPriorityForServiceMap == null
|| transportPriorityForServiceMap.get(serviceType) == null
- || transportPriorityForServiceMap.get(serviceType).isEmpty()){
+ || transportPriorityForServiceMap.get(serviceType).isEmpty()) {
//If there is no transport priority for this service it can be assumed it's primary
header.setTransportRecord(connectedPrimaryTransport);
handlePacketToSend(header);
return;
}
int transportPriority = transportPriorityForServiceMap.get(serviceType).get(0);
- if(transportPriority == PRIMARY_TRANSPORT_ID){
+ if (transportPriority == PRIMARY_TRANSPORT_ID) {
// Primary is favored, and we're already connected...
header.setTransportRecord(connectedPrimaryTransport);
handlePacketToSend(header);
- }else if(transportPriority == SECONDARY_TRANSPORT_ID) {
+ } else if (transportPriority == SECONDARY_TRANSPORT_ID) {
// Secondary is favored
- for(TransportType secondaryTransportType : supportedSecondaryTransports) {
+ for (TransportType secondaryTransportType : supportedSecondaryTransports) {
- if(!requestedSecondaryTransports.contains(secondaryTransportType)){
+ if (!requestedSecondaryTransports.contains(secondaryTransportType)) {
// Secondary transport is not accepted by the client
continue;
}
- if(activeTransports.get(serviceType) != null
- && activeTransports.get(serviceType).getType() !=null
- && activeTransports.get(serviceType).getType().equals(secondaryTransportType)){
+ if (activeTransports.get(serviceType) != null
+ && activeTransports.get(serviceType).getType() != null
+ && activeTransports.get(serviceType).getType().equals(secondaryTransportType)) {
// Transport is already active and accepted
header.setTransportRecord(activeTransports.get(serviceType));
handlePacketToSend(header);
@@ -761,11 +765,10 @@ public class SdlProtocolBase {
}
-
//If the secondary transport isn't connected yet that will have to be performed first
List<ISecondaryTransportListener> listenerList = secondaryTransportListeners.get(secondaryTransportType);
- if(listenerList == null){
+ if (listenerList == null) {
listenerList = new ArrayList<>();
secondaryTransportListeners.put(secondaryTransportType, listenerList);
}
@@ -782,11 +785,11 @@ public class SdlProtocolBase {
@Override
public void onConnectionFailure() {
- if(primaryTransportBackup) {
+ if (primaryTransportBackup) {
// Primary is also supported as backup
header.setTransportRecord(connectedPrimaryTransport);
handlePacketToSend(header);
- }else{
+ } else {
DebugTool.logInfo(TAG, "Failed to connect secondary transport, threw away StartService");
}
}
@@ -818,18 +821,18 @@ public class SdlProtocolBase {
}
private void sendHeartBeatACK(SessionType sessionType, byte sessionID) {
- final SdlPacket heartbeat = SdlPacketFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, (byte)protocolVersion.getMajor());
+ final SdlPacket heartbeat = SdlPacketFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, (byte) protocolVersion.getMajor());
heartbeat.setTransportRecord(activeTransports.get(sessionType));
handlePacketToSend(heartbeat);
}
public void endService(SessionType serviceType, byte sessionID) {
- if(serviceType.equals(SessionType.RPC)){ //RPC session will close all other sessions so we want to make sure we use the correct EndProtocolSession method
+ if (serviceType.equals(SessionType.RPC)) { //RPC session will close all other sessions so we want to make sure we use the correct EndProtocolSession method
endSession(sessionID);
- }else {
- SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, (byte)protocolVersion.getMajor(), new byte[0]);
+ } else {
+ SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, (byte) protocolVersion.getMajor(), new byte[0]);
TransportRecord transportRecord = activeTransports.get(serviceType);
- if(transportRecord != null){
+ if (transportRecord != null) {
header.setTransportRecord(transportRecord);
handlePacketToSend(header);
}
@@ -842,12 +845,14 @@ public class SdlProtocolBase {
// This method is called whenever a protocol has an entire frame to send
+
/**
* SdlPacket should have included payload at this point.
+ *
* @param packet packet that will be sent to the router service
*/
protected void handlePacketToSend(SdlPacket packet) {
- synchronized(FRAME_LOCK) {
+ synchronized (FRAME_LOCK) {
synchronized (TRANSPORT_MANAGER_LOCK) {
if (packet != null && transportManager != null) {
transportManager.sendPacket(packet);
@@ -856,13 +861,14 @@ public class SdlProtocolBase {
}
}
- /** This method handles the end of a protocol session. A callback is
+ /**
+ * This method handles the end of a protocol session. A callback is
* sent to the protocol listener.
**/
protected void handleServiceEndedNAK(SdlPacket packet, SessionType serviceType) {
String error = "Service ended NAK received for service type " + serviceType.getName();
- if(packet.version >= 5){
- if(DebugTool.isDebugEnabled()) {
+ if (packet.version >= 5) {
+ if (DebugTool.isDebugEnabled()) {
//Currently this is only during a debugging session. Might pass back in the future
String rejectedTag = null;
if (serviceType.equals(SessionType.RPC)) {
@@ -874,12 +880,12 @@ public class SdlProtocolBase {
}
List<String> rejectedParams = (List<String>) packet.getTag(rejectedTag);
- if(rejectedParams != null && rejectedParams.size() > 0){
+ if (rejectedParams != null && rejectedParams.size() > 0) {
StringBuilder builder = new StringBuilder();
builder.append("Rejected params for service type ");
builder.append(serviceType.getName());
builder.append(" :");
- for(String rejectedParam : rejectedParams){
+ for (String rejectedParam : rejectedParams) {
builder.append(rejectedParam);
builder.append(" ");
}
@@ -905,44 +911,45 @@ public class SdlProtocolBase {
/**
* This method handles the startup of a protocol session. A callback is sent
* to the protocol listener.
- * @param packet StarServiceACK packet
+ *
+ * @param packet StarServiceACK packet
* @param serviceType the service type that has just been started
*/
protected void handleStartServiceACK(SdlPacket packet, SessionType serviceType) {
// Use this sessionID to create a message lock
- Object messageLock = _messageLocks.get((byte)packet.getSessionId());
+ Object messageLock = _messageLocks.get((byte) packet.getSessionId());
if (messageLock == null) {
messageLock = new Object();
- _messageLocks.put((byte)packet.getSessionId(), messageLock);
+ _messageLocks.put((byte) packet.getSessionId(), messageLock);
}
- if(packet.version >= 5){
+ if (packet.version >= 5) {
String mtuTag = null;
- if(serviceType.equals(SessionType.RPC)){
+ if (serviceType.equals(SessionType.RPC)) {
mtuTag = ControlFrameTags.RPC.StartServiceACK.MTU;
- }else if(serviceType.equals(SessionType.PCM)){
+ } else if (serviceType.equals(SessionType.PCM)) {
mtuTag = ControlFrameTags.Audio.StartServiceACK.MTU;
- }else if(serviceType.equals(SessionType.NAV)){
+ } else if (serviceType.equals(SessionType.NAV)) {
mtuTag = ControlFrameTags.Video.StartServiceACK.MTU;
}
Object mtu = packet.getTag(mtuTag);
- if(mtu!=null){
- mtus.put(serviceType,(Long) packet.getTag(mtuTag));
+ if (mtu != null) {
+ mtus.put(serviceType, (Long) packet.getTag(mtuTag));
}
- if(serviceType.equals(SessionType.RPC)){
+ if (serviceType.equals(SessionType.RPC)) {
hashID = (Integer) packet.getTag(ControlFrameTags.RPC.StartServiceACK.HASH_ID);
Object version = packet.getTag(ControlFrameTags.RPC.StartServiceACK.PROTOCOL_VERSION);
- if(version!=null) {
+ if (version != null) {
//At this point we have confirmed the negotiated version between the module and the proxy
protocolVersion = new Version((String) version);
- }else{
+ } else {
protocolVersion = new Version("5.0.0");
}
//Check to make sure this is a transport we are willing to accept
TransportRecord transportRecord = packet.getTransportRecord();
- if(transportRecord == null || !requestedPrimaryTransports.contains(transportRecord.getType())){
+ if (transportRecord == null || !requestedPrimaryTransports.contains(transportRecord.getType())) {
onTransportNotAccepted("Transport is not in requested primary transports");
return;
}
@@ -980,10 +987,10 @@ public class SdlProtocolBase {
if (audio == null || audio.contains(PRIMARY_TRANSPORT_ID)) {
activeTransports.put(SessionType.PCM, transportRecord);
}
- }else{
+ } else {
- if(DebugTool.isDebugEnabled()){
- printSecondaryTransportDetails(secondary,audio,video);
+ if (DebugTool.isDebugEnabled()) {
+ printSecondaryTransportDetails(secondary, audio, video);
}
for (String s : secondary) {
switch (s) {
@@ -1012,13 +1019,13 @@ public class SdlProtocolBase {
return;
}
- if(protocolVersion.isNewerThan(new Version(5,2,0)) >= 0){
- String authToken = (String)packet.getTag(ControlFrameTags.RPC.StartServiceACK.AUTH_TOKEN);
- if(authToken != null){
+ if (protocolVersion.isNewerThan(new Version(5, 2, 0)) >= 0) {
+ String authToken = (String) packet.getTag(ControlFrameTags.RPC.StartServiceACK.AUTH_TOKEN);
+ if (authToken != null) {
iSdlProtocol.onAuthTokenReceived(authToken);
}
}
- }else {
+ } else {
//Version is either not included or lower than 5.1.0
if (requiresHighBandwidth
@@ -1039,8 +1046,8 @@ public class SdlProtocolBase {
}
- }else if(serviceType.equals(SessionType.NAV)){
- if(iSdlProtocol != null) {
+ } else if (serviceType.equals(SessionType.NAV)) {
+ if (iSdlProtocol != null) {
ImageResolution acceptedResolution = new ImageResolution();
VideoStreamingFormat acceptedFormat = new VideoStreamingFormat();
acceptedResolution.setResolutionHeight((Integer) packet.getTag(ControlFrameTags.Video.StartServiceACK.HEIGHT));
@@ -1054,7 +1061,7 @@ public class SdlProtocolBase {
}
}
} else {
- if(serviceType.equals(SessionType.RPC)) {
+ if (serviceType.equals(SessionType.RPC)) {
TransportRecord transportRecord = packet.getTransportRecord();
if (transportRecord == null || (requiresHighBandwidth
&& TransportType.BLUETOOTH.equals(transportRecord.getType()))) {
@@ -1074,7 +1081,7 @@ public class SdlProtocolBase {
hashID = BitConverter.intFromByteArray(packet.payload, 0);
}
}
- }else if(serviceType.equals(SessionType.NAV)) {
+ } else if (serviceType.equals(SessionType.NAV)) {
//Protocol versions <5 don't support param negotiation
iSdlProtocol.setAcceptedVideoParams(iSdlProtocol.getDesiredVideoParams());
}
@@ -1087,8 +1094,8 @@ public class SdlProtocolBase {
protected void handleProtocolSessionNAKed(SdlPacket packet, SessionType serviceType) {
String error = "Service start NAK received for service type " + serviceType.getName();
List<String> rejectedParams;
- if(packet.version >= 5){
- if(DebugTool.isDebugEnabled()) {
+ if (packet.version >= 5) {
+ if (DebugTool.isDebugEnabled()) {
//Currently this is only during a debugging session. Might pass back in the future
String rejectedTag = null;
if (serviceType.equals(SessionType.RPC)) {
@@ -1100,12 +1107,12 @@ public class SdlProtocolBase {
}
rejectedParams = (List<String>) packet.getTag(rejectedTag);
- if(rejectedParams != null && rejectedParams.size() > 0){
+ if (rejectedParams != null && rejectedParams.size() > 0) {
StringBuilder builder = new StringBuilder();
builder.append("Rejected params for service type ");
builder.append(serviceType.getName());
builder.append(" :");
- for(String rejectedParam : rejectedParams){
+ for (String rejectedParam : rejectedParams) {
builder.append(rejectedParam);
builder.append(" ");
}
@@ -1116,7 +1123,7 @@ public class SdlProtocolBase {
}
}
if (serviceType.eq(SessionType.NAV) || serviceType.eq(SessionType.PCM)) {
- iSdlProtocol.onServiceError(packet, serviceType, (byte)packet.sessionId, error);
+ iSdlProtocol.onServiceError(packet, serviceType, (byte) packet.sessionId, error);
} else {
//TODO should there be any additional checks here? Or should this be more explicit in
@@ -1132,7 +1139,7 @@ public class SdlProtocolBase {
}
protected void handleProtocolHeartbeat(SessionType sessionType, byte sessionID) {
- sendHeartBeatACK(sessionType,sessionID);
+ sendHeartBeatACK(sessionType, sessionID);
}
@@ -1153,7 +1160,7 @@ public class SdlProtocolBase {
DebugTool.logInfo(TAG, "onTransportConnected");
//In the future we should move this logic into the Protocol Layer
TransportRecord transportRecord = getTransportForSession(SessionType.RPC);
- if(transportRecord == null && !requestedSession){ //There is currently no transport registered
+ if (transportRecord == null && !requestedSession) { //There is currently no transport registered
requestedSession = true;
synchronized (TRANSPORT_MANAGER_LOCK) {
if (transportManager != null) {
@@ -1162,7 +1169,7 @@ public class SdlProtocolBase {
}
}
onTransportsConnectedUpdate(connectedTransports);
- if(DebugTool.isDebugEnabled()){
+ if (DebugTool.isDebugEnabled()) {
printActiveTransports();
}
}
@@ -1185,22 +1192,22 @@ public class SdlProtocolBase {
//In the future we will actually compare the record but at this point we can assume only
//a single transport record per transport.
//TransportType type = disconnectedTransport.getType();
- if(getTransportForSession(SessionType.NAV) != null && disconnectedTransport.equals(getTransportForSession(SessionType.NAV))){
+ if (getTransportForSession(SessionType.NAV) != null && disconnectedTransport.equals(getTransportForSession(SessionType.NAV))) {
iSdlProtocol.onServiceError(null, SessionType.NAV, iSdlProtocol.getSessionId(), "Transport disconnected");
activeTransports.remove(SessionType.NAV);
}
- if(getTransportForSession(SessionType.PCM) != null && disconnectedTransport.equals(getTransportForSession(SessionType.PCM))){
+ if (getTransportForSession(SessionType.PCM) != null && disconnectedTransport.equals(getTransportForSession(SessionType.PCM))) {
iSdlProtocol.onServiceError(null, SessionType.PCM, iSdlProtocol.getSessionId(), "Transport disconnected");
activeTransports.remove(SessionType.PCM);
}
- if((getTransportForSession(SessionType.RPC) != null && disconnectedTransport.equals(getTransportForSession(SessionType.RPC))) || disconnectedTransport.equals(connectedPrimaryTransport)){
+ if ((getTransportForSession(SessionType.RPC) != null && disconnectedTransport.equals(getTransportForSession(SessionType.RPC))) || disconnectedTransport.equals(connectedPrimaryTransport)) {
//Primary transport has been disconnected. Let's check if we can recover.
//transportTypes.remove(type);
boolean primaryTransportAvailable = false;
- if(requestedPrimaryTransports != null && requestedPrimaryTransports.size() > 1){
- for (TransportType transportType: requestedPrimaryTransports){
- DebugTool.logInfo(TAG, "Checking " + transportType.name());
+ if (requestedPrimaryTransports != null && requestedPrimaryTransports.size() > 1) {
+ for (TransportType transportType : requestedPrimaryTransports) {
+ DebugTool.logInfo(TAG, "Checking " + transportType.name());
synchronized (TRANSPORT_MANAGER_LOCK) {
if (!disconnectedTransport.getType().equals(transportType)
@@ -1267,12 +1274,12 @@ public class SdlProtocolBase {
@Override
public boolean onLegacyModeEnabled(String info) {
//Await a connection from the legacy transport
- if(requestedPrimaryTransports!= null && requestedPrimaryTransports.contains(TransportType.BLUETOOTH)
- && !SdlProtocolBase.this.requiresHighBandwidth){
+ if (requestedPrimaryTransports != null && requestedPrimaryTransports.contains(TransportType.BLUETOOTH)
+ && !SdlProtocolBase.this.requiresHighBandwidth) {
DebugTool.logInfo(TAG, "Entering legacy mode; creating new protocol instance");
reset();
return true;
- }else{
+ } else {
DebugTool.logInfo(TAG, "Bluetooth is not an acceptable transport; not moving to legacy mode");
return false;
}
@@ -1293,14 +1300,14 @@ public class SdlProtocolBase {
totalSize = BitConverter.intFromByteArray(packet.payload, 0) - headerSize;
try {
accumulator = new ByteArrayOutputStream(totalSize);
- }catch(OutOfMemoryError e){
+ } catch (OutOfMemoryError e) {
DebugTool.logError(TAG, "OutOfMemory error", e); //Garbled bits were received
accumulator = null;
}
}
protected void handleRemainingFrame(SdlPacket packet) {
- accumulator.write(packet.payload, 0, (int)packet.getDataSize());
+ accumulator.write(packet.payload, 0, (int) packet.getDataSize());
notifyIfFinished(packet);
}
@@ -1308,22 +1315,24 @@ public class SdlProtocolBase {
if (packet.getFrameType() == FrameType.Consecutive && packet.getFrameInfo() == 0x0) {
ProtocolMessage message = new ProtocolMessage();
message.setPayloadProtected(packet.isEncrypted());
- message.setSessionType(SessionType.valueOf((byte)packet.getServiceType()));
- message.setSessionID((byte)packet.getSessionId());
+ message.setSessionType(SessionType.valueOf((byte) packet.getServiceType()));
+ message.setSessionID((byte) packet.getSessionId());
//If it is WiPro 2.0 it must have binary header
if (protocolVersion.getMajor() > 1) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
parseBinaryHeader(accumulator.toByteArray());
- if(binFrameHeader == null) {
+ if (binFrameHeader == null) {
return;
}
- message.setVersion((byte)protocolVersion.getMajor());
+ message.setVersion((byte) protocolVersion.getMajor());
message.setRPCType(binFrameHeader.getRPCType());
message.setFunctionID(binFrameHeader.getFunctionID());
message.setCorrID(binFrameHeader.getCorrID());
- if (binFrameHeader.getJsonSize() > 0) message.setData(binFrameHeader.getJsonData());
- if (binFrameHeader.getBulkData() != null) message.setBulkData(binFrameHeader.getBulkData());
- } else{
+ if (binFrameHeader.getJsonSize() > 0)
+ message.setData(binFrameHeader.getJsonData());
+ if (binFrameHeader.getBulkData() != null)
+ message.setBulkData(binFrameHeader.getBulkData());
+ } else {
message.setData(accumulator.toByteArray());
}
@@ -1342,9 +1351,8 @@ public class SdlProtocolBase {
protected void handleMultiFrameMessageFrame(SdlPacket packet) {
if (packet.getFrameType() == FrameType.First) {
handleFirstDataFrame(packet);
- }
- else{
- if(accumulator != null){
+ } else {
+ if (accumulator != null) {
handleRemainingFrame(packet);
}
}
@@ -1353,13 +1361,13 @@ public class SdlProtocolBase {
protected void handleFrame(SdlPacket packet) {
- if (packet.getPayload() != null && packet.getDataSize() > 0 && packet.isEncrypted() ) {
+ if (packet.getPayload() != null && packet.getDataSize() > 0 && packet.isEncrypted()) {
SdlSecurityBase sdlSec = iSdlProtocol.getSdlSecurity();
byte[] dataToRead = new byte[4096];
Integer iNumBytes = sdlSec.decryptData(packet.getPayload(), dataToRead);
- if ((iNumBytes == null) || (iNumBytes <= 0)){
+ if ((iNumBytes == null) || (iNumBytes <= 0)) {
return;
}
@@ -1372,9 +1380,9 @@ public class SdlProtocolBase {
handleControlFrame(packet);
} else {
// Must be a form of data frame (single, first, consecutive, etc.)
- if ( packet.getFrameType() == FrameType.First
+ if (packet.getFrameType() == FrameType.First
|| packet.getFrameType() == FrameType.Consecutive
- ) {
+ ) {
handleMultiFrameMessageFrame(packet);
} else {
handleSingleFrameMessageFrame(packet);
@@ -1389,28 +1397,29 @@ public class SdlProtocolBase {
}
private void handleProtocolHeartbeat(SdlPacket packet) {
- SdlProtocolBase.this.handleProtocolHeartbeat(SessionType.valueOf((byte)packet.getServiceType()),(byte)packet.getSessionId());
+ SdlProtocolBase.this.handleProtocolHeartbeat(SessionType.valueOf((byte) packet.getServiceType()), (byte) packet.getSessionId());
}
/**
* Directing method that will push the packet to the method that can handle it best
+ *
* @param packet a control frame packet
*/
private void handleControlFrame(SdlPacket packet) {
Integer frameTemp = packet.getFrameInfo();
Byte frameInfo = frameTemp.byteValue();
- SessionType serviceType = SessionType.valueOf((byte)packet.getServiceType());
+ SessionType serviceType = SessionType.valueOf((byte) packet.getServiceType());
if (frameInfo == FrameDataControlFrameType.Heartbeat.getValue()) {
handleProtocolHeartbeat(packet);
- }else if (frameInfo == FrameDataControlFrameType.HeartbeatACK.getValue()) {
+ } else if (frameInfo == FrameDataControlFrameType.HeartbeatACK.getValue()) {
handleProtocolHeartbeatACK(packet);
- }else if (frameInfo == FrameDataControlFrameType.StartSessionACK.getValue()) {
+ } else if (frameInfo == FrameDataControlFrameType.StartSessionACK.getValue()) {
handleStartServiceACK(packet, serviceType);
@@ -1437,13 +1446,13 @@ public class SdlProtocolBase {
} else if (frameInfo == FrameDataControlFrameType.RegisterSecondaryTransportACK.getValue()) {
- handleSecondaryTransportRegistration(packet.getTransportRecord(),true);
+ handleSecondaryTransportRegistration(packet.getTransportRecord(), true);
} else if (frameInfo == FrameDataControlFrameType.RegisterSecondaryTransportNACK.getValue()) {
String reason = (String) packet.getTag(ControlFrameTags.RPC.RegisterSecondaryTransportNAK.REASON);
DebugTool.logWarning(TAG, reason);
- handleSecondaryTransportRegistration(packet.getTransportRecord(),false);
+ handleSecondaryTransportRegistration(packet.getTransportRecord(), false);
} else if (frameInfo == FrameDataControlFrameType.TransportEventUpdate.getValue()) {
@@ -1451,13 +1460,13 @@ public class SdlProtocolBase {
String ipAddr = (String) packet.getTag(ControlFrameTags.RPC.TransportEventUpdate.TCP_IP_ADDRESS);
Integer port = (Integer) packet.getTag(ControlFrameTags.RPC.TransportEventUpdate.TCP_PORT);
- if(secondaryTransportParams == null){
+ if (secondaryTransportParams == null) {
secondaryTransportParams = new HashMap<>();
}
- if(ipAddr != null && port != null) {
+ if (ipAddr != null && port != null) {
String address = (port != null && port > 0) ? ipAddr + ":" + port : ipAddr;
- secondaryTransportParams.put(TransportType.TCP, new TransportRecord(TransportType.TCP,address));
+ secondaryTransportParams.put(TransportType.TCP, new TransportRecord(TransportType.TCP, address));
//A new secondary transport just became available. Notify the developer.
notifyDevTransportListener();
@@ -1472,30 +1481,30 @@ public class SdlProtocolBase {
private void handleSingleFrameMessageFrame(SdlPacket packet) {
ProtocolMessage message = new ProtocolMessage();
message.setPayloadProtected(packet.isEncrypted());
- SessionType serviceType = SessionType.valueOf((byte)packet.getServiceType());
+ SessionType serviceType = SessionType.valueOf((byte) packet.getServiceType());
if (serviceType == SessionType.RPC) {
message.setMessageType(MessageType.RPC);
} else if (serviceType == SessionType.BULK_DATA) {
message.setMessageType(MessageType.BULK);
} // end-if
message.setSessionType(serviceType);
- message.setSessionID((byte)packet.getSessionId());
+ message.setSessionID((byte) packet.getSessionId());
//If it is WiPro 2.0 it must have binary header
boolean isControlService = message.getSessionType().equals(SessionType.CONTROL);
if (protocolVersion.getMajor() > 1 && !isControlService) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
parseBinaryHeader(packet.payload);
- if(binFrameHeader == null) {
+ if (binFrameHeader == null) {
return;
}
- message.setVersion((byte)protocolVersion.getMajor());
+ message.setVersion((byte) protocolVersion.getMajor());
message.setRPCType(binFrameHeader.getRPCType());
message.setFunctionID(binFrameHeader.getFunctionID());
message.setCorrID(binFrameHeader.getCorrID());
- if (binFrameHeader.getJsonSize() > 0){
+ if (binFrameHeader.getJsonSize() > 0) {
message.setData(binFrameHeader.getJsonData());
}
- if (binFrameHeader.getBulkData() != null){
+ if (binFrameHeader.getBulkData() != null) {
message.setBulkData(binFrameHeader.getBulkData());
}
} else {
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java b/base/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
index 1b2595e2a..992dccfb3 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,104 +36,175 @@ package com.smartdevicelink.protocol.enums;
*/
public class ControlFrameTags {
- private static class StartServiceACKBase{
- /** Max transport unit to be used for this service */
- public static final String MTU = "mtu";
- }
-
- private static class NAKBase{
- /** An array of rejected parameters related to the corresponding request*/
- public static final String REJECTED_PARAMS = "rejectedParams";
- public static final String REASON = "reason";
- }
-
- /**
- * Control frame payloads that relate to the Remote Procedure Call (RPC) service.
- */
- public static class RPC {
- public static class StartService {
- /** The max version of the protocol supported by client requesting service to start.<br>
- * Must be in the format "Major.Minor.Patch"
- */
- public static final String PROTOCOL_VERSION = "protocolVersion";
- }
- public static class StartServiceACK extends StartServiceACKBase{
- /** The negotiated version of the protocol. Must be in the format "Major.Minor.Patch"*/
- public static final String PROTOCOL_VERSION = StartService.PROTOCOL_VERSION;
- /** Hash ID to identify this service and used when sending an EndService control frame*/
- public static final String HASH_ID = "hashId";
- /** HU allowed transport for secondary connection */
- public static final String SECONDARY_TRANSPORTS = "secondaryTransports";
- /** HU allowed transports for audio and video services (1 == Primary, 2 == Secondary) */
- public static final String AUDIO_SERVICE_TRANSPORTS = "audioServiceTransports";
- public static final String VIDEO_SERVICE_TRANSPORTS = "videoServiceTransports";
- /** Auth token to be used for log in into services **/
- public static final String AUTH_TOKEN = "authToken";
-
- }
- public static class StartServiceNAK extends NAKBase{}
- public static class EndService {
- /** Hash ID supplied in the StartServiceACK for this service type*/
- public static final String HASH_ID = RPC.StartServiceACK.HASH_ID;
- }
- public static class EndServiceACK {}
- public static class EndServiceNAK extends NAKBase{}
- /** This frame is sent from Core to application to indicate that status or configuration of
- * transport(s) is/are updated. This frame should not be sent prior to Version Negotiation.
- **/
- public static class TransportEventUpdate {
- /** The HU reported IP address and port of TCP connection */
- public static final String TCP_IP_ADDRESS = "tcpIpAddress";
- public static final String TCP_PORT = "tcpPort";
- }
- /**This frame is sent from application to Core to notify that Secondary Transport has been
- * established. This frame should be only sent on Secondary Transport.
- **/
- public static class RegisterSecondaryTransport {}
- public static class RegisterSecondaryTransportACK {}
- public static class RegisterSecondaryTransportNAK extends NAKBase {}
- }
-
- /**
- * Control frame payloads that relate to the Audio streaming service. This service has also been referred to as the PCM service.
- */
- public static class Audio {
- public static class StartService {}
- public static class StartServiceACK extends StartServiceACKBase{}
- public static class StartServiceNAK extends NAKBase{}
- public static class EndService {}
- public static class EndServiceACK {}
- public static class EndServiceNAK extends NAKBase{}
- }
-
- /**
- * Control frame payloads that relate to the Video streaming service. This service has also been referred to as the .h264 service.
- */
- public static class Video {
- public static class StartService {
- /** Desired height in pixels from the client requesting the video service to start*/
- public static final String HEIGHT = "height";
- /** Desired width in pixels from the client requesting the video service to start*/
- public static final String WIDTH = "width";
- /** Desired video protocol to be used*/
- public static final String VIDEO_PROTOCOL = "videoProtocol";
- /** Desired video codec to be used*/
- public static final String VIDEO_CODEC = "videoCodec";
- }
- public static class StartServiceACK extends StartServiceACKBase{
- /** Accepted height in pixels from the client requesting the video service to start*/
- public static final String HEIGHT = StartService.HEIGHT;
- /** Accepted width in pixels from the client requesting the video service to start*/
- public static final String WIDTH = StartService.WIDTH;
- /** Accepted video protocol to be used*/
- public static final String VIDEO_PROTOCOL = StartService.VIDEO_PROTOCOL;
- /** Accepted video codec to be used*/
- public static final String VIDEO_CODEC = StartService.VIDEO_CODEC;
- }
-
- public static class StartServiceNAK extends NAKBase{}
- public static class EndService {}
- public static class EndServiceACK {}
- public static class EndServiceNAK extends NAKBase{}
- }
+ private static class StartServiceACKBase {
+ /**
+ * Max transport unit to be used for this service
+ */
+ public static final String MTU = "mtu";
+ }
+
+ private static class NAKBase {
+ /**
+ * An array of rejected parameters related to the corresponding request
+ */
+ public static final String REJECTED_PARAMS = "rejectedParams";
+ public static final String REASON = "reason";
+ }
+
+ /**
+ * Control frame payloads that relate to the Remote Procedure Call (RPC) service.
+ */
+ public static class RPC {
+ public static class StartService {
+ /**
+ * The max version of the protocol supported by client requesting service to start.<br>
+ * Must be in the format "Major.Minor.Patch"
+ */
+ public static final String PROTOCOL_VERSION = "protocolVersion";
+ }
+
+ public static class StartServiceACK extends StartServiceACKBase {
+ /**
+ * The negotiated version of the protocol. Must be in the format "Major.Minor.Patch"
+ */
+ public static final String PROTOCOL_VERSION = StartService.PROTOCOL_VERSION;
+ /**
+ * Hash ID to identify this service and used when sending an EndService control frame
+ */
+ public static final String HASH_ID = "hashId";
+ /**
+ * HU allowed transport for secondary connection
+ */
+ public static final String SECONDARY_TRANSPORTS = "secondaryTransports";
+ /**
+ * HU allowed transports for audio and video services (1 == Primary, 2 == Secondary)
+ */
+ public static final String AUDIO_SERVICE_TRANSPORTS = "audioServiceTransports";
+ public static final String VIDEO_SERVICE_TRANSPORTS = "videoServiceTransports";
+ /**
+ * Auth token to be used for log in into services
+ **/
+ public static final String AUTH_TOKEN = "authToken";
+
+ }
+
+ public static class StartServiceNAK extends NAKBase {
+ }
+
+ public static class EndService {
+ /**
+ * Hash ID supplied in the StartServiceACK for this service type
+ */
+ public static final String HASH_ID = RPC.StartServiceACK.HASH_ID;
+ }
+
+ public static class EndServiceACK {
+ }
+
+ public static class EndServiceNAK extends NAKBase {
+ }
+
+ /**
+ * This frame is sent from Core to application to indicate that status or configuration of
+ * transport(s) is/are updated. This frame should not be sent prior to Version Negotiation.
+ **/
+ public static class TransportEventUpdate {
+ /**
+ * The HU reported IP address and port of TCP connection
+ */
+ public static final String TCP_IP_ADDRESS = "tcpIpAddress";
+ public static final String TCP_PORT = "tcpPort";
+ }
+
+ /**
+ * This frame is sent from application to Core to notify that Secondary Transport has been
+ * established. This frame should be only sent on Secondary Transport.
+ **/
+ public static class RegisterSecondaryTransport {
+ }
+
+ public static class RegisterSecondaryTransportACK {
+ }
+
+ public static class RegisterSecondaryTransportNAK extends NAKBase {
+ }
+ }
+
+ /**
+ * Control frame payloads that relate to the Audio streaming service. This service has also been referred to as the PCM service.
+ */
+ public static class Audio {
+ public static class StartService {
+ }
+
+ public static class StartServiceACK extends StartServiceACKBase {
+ }
+
+ public static class StartServiceNAK extends NAKBase {
+ }
+
+ public static class EndService {
+ }
+
+ public static class EndServiceACK {
+ }
+
+ public static class EndServiceNAK extends NAKBase {
+ }
+ }
+
+ /**
+ * Control frame payloads that relate to the Video streaming service. This service has also been referred to as the .h264 service.
+ */
+ public static class Video {
+ public static class StartService {
+ /**
+ * Desired height in pixels from the client requesting the video service to start
+ */
+ public static final String HEIGHT = "height";
+ /**
+ * Desired width in pixels from the client requesting the video service to start
+ */
+ public static final String WIDTH = "width";
+ /**
+ * Desired video protocol to be used
+ */
+ public static final String VIDEO_PROTOCOL = "videoProtocol";
+ /**
+ * Desired video codec to be used
+ */
+ public static final String VIDEO_CODEC = "videoCodec";
+ }
+
+ public static class StartServiceACK extends StartServiceACKBase {
+ /**
+ * Accepted height in pixels from the client requesting the video service to start
+ */
+ public static final String HEIGHT = StartService.HEIGHT;
+ /**
+ * Accepted width in pixels from the client requesting the video service to start
+ */
+ public static final String WIDTH = StartService.WIDTH;
+ /**
+ * Accepted video protocol to be used
+ */
+ public static final String VIDEO_PROTOCOL = StartService.VIDEO_PROTOCOL;
+ /**
+ * Accepted video codec to be used
+ */
+ public static final String VIDEO_CODEC = StartService.VIDEO_CODEC;
+ }
+
+ public static class StartServiceNAK extends NAKBase {
+ }
+
+ public static class EndService {
+ }
+
+ public static class EndServiceACK {
+ }
+
+ public static class EndServiceNAK extends NAKBase {
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
index d31e45eac..6b9536488 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,51 +36,54 @@ import com.smartdevicelink.util.ByteEnumer;
import java.util.Vector;
public class FrameDataControlFrameType extends ByteEnumer {
- private static final Vector<FrameDataControlFrameType> theList = new Vector<>();
- public static Vector<FrameDataControlFrameType> getList() { return theList; }
+ private static final Vector<FrameDataControlFrameType> theList = new Vector<>();
- private byte _i = 0x00;
+ public static Vector<FrameDataControlFrameType> getList() {
+ return theList;
+ }
- protected FrameDataControlFrameType(byte value, String name) {
- super(value, name);
- }
-
- public final static FrameDataControlFrameType Heartbeat = new FrameDataControlFrameType((byte)0x0, "Heartbeat");
- public final static FrameDataControlFrameType StartSession = new FrameDataControlFrameType((byte)0x01, "StartSession");
- public final static FrameDataControlFrameType StartSessionACK = new FrameDataControlFrameType((byte)0x02, "StartSessionACK");
- public final static FrameDataControlFrameType StartSessionNACK = new FrameDataControlFrameType((byte)0x03, "StartSessionNACK");
- public final static FrameDataControlFrameType EndSession = new FrameDataControlFrameType((byte)0x04, "EndSession");
- public final static FrameDataControlFrameType EndSessionACK = new FrameDataControlFrameType((byte)0x05, "EndSessionACK");
- public final static FrameDataControlFrameType EndSessionNACK = new FrameDataControlFrameType((byte)0x06, "EndSessionNACK");
- public final static FrameDataControlFrameType RegisterSecondaryTransport = new FrameDataControlFrameType((byte)0x07, "RegisterSecondaryTransport");
- public final static FrameDataControlFrameType RegisterSecondaryTransportACK = new FrameDataControlFrameType((byte)0x08, "RegisterSecondaryTransportACK");
- public final static FrameDataControlFrameType RegisterSecondaryTransportNACK = new FrameDataControlFrameType((byte)0x09, "RegisterSecondaryTransportNACK");
- public final static FrameDataControlFrameType TransportEventUpdate = new FrameDataControlFrameType((byte)0xFD, "TransportEventUpdate");
- public final static FrameDataControlFrameType ServiceDataACK = new FrameDataControlFrameType((byte)0xFE, "ServiceDataACK");
- public final static FrameDataControlFrameType HeartbeatACK = new FrameDataControlFrameType((byte)0xFF, "HeartbeatACK");
+ private byte _i = 0x00;
- static {
- theList.addElement(Heartbeat);
- theList.addElement(StartSession);
- theList.addElement(StartSessionACK);
- theList.addElement(StartSessionNACK);
- theList.addElement(EndSession);
- theList.addElement(EndSessionACK);
- theList.addElement(EndSessionNACK);
- theList.addElement(RegisterSecondaryTransport);
- theList.addElement(RegisterSecondaryTransportACK);
- theList.addElement(RegisterSecondaryTransportNACK);
- theList.addElement(TransportEventUpdate);
- theList.addElement(ServiceDataACK);
- theList.addElement(HeartbeatACK);
- }
+ protected FrameDataControlFrameType(byte value, String name) {
+ super(value, name);
+ }
- public static FrameDataControlFrameType valueOf(String passedButton) {
- return (FrameDataControlFrameType) get(theList, passedButton);
- }
+ public final static FrameDataControlFrameType Heartbeat = new FrameDataControlFrameType((byte) 0x0, "Heartbeat");
+ public final static FrameDataControlFrameType StartSession = new FrameDataControlFrameType((byte) 0x01, "StartSession");
+ public final static FrameDataControlFrameType StartSessionACK = new FrameDataControlFrameType((byte) 0x02, "StartSessionACK");
+ public final static FrameDataControlFrameType StartSessionNACK = new FrameDataControlFrameType((byte) 0x03, "StartSessionNACK");
+ public final static FrameDataControlFrameType EndSession = new FrameDataControlFrameType((byte) 0x04, "EndSession");
+ public final static FrameDataControlFrameType EndSessionACK = new FrameDataControlFrameType((byte) 0x05, "EndSessionACK");
+ public final static FrameDataControlFrameType EndSessionNACK = new FrameDataControlFrameType((byte) 0x06, "EndSessionNACK");
+ public final static FrameDataControlFrameType RegisterSecondaryTransport = new FrameDataControlFrameType((byte) 0x07, "RegisterSecondaryTransport");
+ public final static FrameDataControlFrameType RegisterSecondaryTransportACK = new FrameDataControlFrameType((byte) 0x08, "RegisterSecondaryTransportACK");
+ public final static FrameDataControlFrameType RegisterSecondaryTransportNACK = new FrameDataControlFrameType((byte) 0x09, "RegisterSecondaryTransportNACK");
+ public final static FrameDataControlFrameType TransportEventUpdate = new FrameDataControlFrameType((byte) 0xFD, "TransportEventUpdate");
+ public final static FrameDataControlFrameType ServiceDataACK = new FrameDataControlFrameType((byte) 0xFE, "ServiceDataACK");
+ public final static FrameDataControlFrameType HeartbeatACK = new FrameDataControlFrameType((byte) 0xFF, "HeartbeatACK");
- public static FrameDataControlFrameType[] values() {
- return theList.toArray(new FrameDataControlFrameType[theList.size()]);
- }
+ static {
+ theList.addElement(Heartbeat);
+ theList.addElement(StartSession);
+ theList.addElement(StartSessionACK);
+ theList.addElement(StartSessionNACK);
+ theList.addElement(EndSession);
+ theList.addElement(EndSessionACK);
+ theList.addElement(EndSessionNACK);
+ theList.addElement(RegisterSecondaryTransport);
+ theList.addElement(RegisterSecondaryTransportACK);
+ theList.addElement(RegisterSecondaryTransportNACK);
+ theList.addElement(TransportEventUpdate);
+ theList.addElement(ServiceDataACK);
+ theList.addElement(HeartbeatACK);
+ }
+
+ public static FrameDataControlFrameType valueOf(String passedButton) {
+ return (FrameDataControlFrameType) get(theList, passedButton);
+ }
+
+ public static FrameDataControlFrameType[] values() {
+ return theList.toArray(new FrameDataControlFrameType[theList.size()]);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameType.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FrameType.java
index 500549d3f..188e54fc8 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameType.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FrameType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,32 +37,35 @@ import java.util.Vector;
public class FrameType extends ByteEnumer {
- private static final Vector<FrameType> theList = new Vector<>();
- public static Vector<FrameType> getList() { return theList; }
-
- byte i = 0x00;
-
- protected FrameType(byte value, String name) {
- super(value, name);
- }
-
- public final static FrameType Control = new FrameType((byte)0x00, "Control");
- public final static FrameType Single = new FrameType((byte)0x01, "Single");
- public final static FrameType First = new FrameType((byte)0x02, "First");
- public final static FrameType Consecutive = new FrameType((byte)0x03, "Consecutive");
-
- static {
- theList.addElement(Control);
- theList.addElement(Single);
- theList.addElement(First);
- theList.addElement(Consecutive);
- }
-
- public static FrameType valueOf(byte passed) {
- return (FrameType) get(theList, passed);
- }
-
- public static FrameType[] values() {
- return theList.toArray(new FrameType[theList.size()]);
- }
+ private static final Vector<FrameType> theList = new Vector<>();
+
+ public static Vector<FrameType> getList() {
+ return theList;
+ }
+
+ byte i = 0x00;
+
+ protected FrameType(byte value, String name) {
+ super(value, name);
+ }
+
+ public final static FrameType Control = new FrameType((byte) 0x00, "Control");
+ public final static FrameType Single = new FrameType((byte) 0x01, "Single");
+ public final static FrameType First = new FrameType((byte) 0x02, "First");
+ public final static FrameType Consecutive = new FrameType((byte) 0x03, "Consecutive");
+
+ static {
+ theList.addElement(Control);
+ theList.addElement(Single);
+ theList.addElement(First);
+ theList.addElement(Consecutive);
+ }
+
+ public static FrameType valueOf(byte passed) {
+ return (FrameType) get(theList, passed);
+ }
+
+ public static FrameType[] values() {
+ return theList.toArray(new FrameType[theList.size()]);
+ }
}
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 c7ab5145a..2b80f4d51 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,10 +33,9 @@ package com.smartdevicelink.protocol.enums;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map.Entry;
-public enum FunctionID{
+public enum FunctionID {
// DEPRECATED FUNCTIONS
SYNC_P_DATA(65537, "SyncPData"),
ON_SYNC_P_DATA(98305, "OnSyncPData"),
@@ -95,9 +94,9 @@ public enum FunctionID{
SUBSCRIBE_WAY_POINTS(46, "SubscribeWayPoints"),
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
GET_SYSTEM_CAPABILITY(48, "GetSystemCapability"),
- SEND_HAPTIC_DATA(49, "SendHapticData"),
+ SEND_HAPTIC_DATA(49, "SendHapticData"),
SET_CLOUD_APP_PROPERTIES(50, "SetCloudAppProperties"),
- GET_CLOUD_APP_PROPERTIES(51, "GetCloudAppProperties"),
+ GET_CLOUD_APP_PROPERTIES(51, "GetCloudAppProperties"),
PUBLISH_APP_SERVICE(52, "PublishAppService"),
GET_APP_SERVICE_DATA(53, "GetAppServiceData"),
GET_FILE(54, "GetFile"),
@@ -137,37 +136,37 @@ public enum FunctionID{
ON_UPDATE_SUB_MENU(32790, "OnUpdateSubMenu"),
;
- public static final int INVALID_ID = -1;
+ public static final int INVALID_ID = -1;
private static HashMap<String, Integer> functionMap;
- private final int ID;
- private final String JSON_NAME;
+ private final int ID;
+ private final String JSON_NAME;
- private FunctionID(int id, String jsonName){
+ private FunctionID(int id, String jsonName) {
this.ID = id;
this.JSON_NAME = jsonName;
}
- public int getId(){
+ public int getId() {
return this.ID;
}
@Override
- public String toString(){
+ public String toString() {
return this.JSON_NAME;
}
- private static void initFunctionMap(){
+ private static void initFunctionMap() {
functionMap = new HashMap<>(values().length);
- for(FunctionID value : EnumSet.allOf(FunctionID.class)){
+ for (FunctionID value : EnumSet.allOf(FunctionID.class)) {
functionMap.put(value.toString(), value.getId());
}
}
- public static String getFunctionName(int i){
- if(functionMap == null){
+ public static String getFunctionName(int i) {
+ if (functionMap == null) {
initFunctionMap();
}
@@ -180,23 +179,24 @@ public enum FunctionID{
return null;
}
- public static int getFunctionId(String functionName){
- if(functionMap == null){
+ public static int getFunctionId(String functionName) {
+ if (functionMap == null) {
initFunctionMap();
}
Integer result = functionMap.get(functionName);
- return ( result == null ) ? INVALID_ID : result;
+ return (result == null) ? INVALID_ID : result;
}
/**
- * This method gives the corresponding FunctionID enum value for a string RPC
+ * This method gives the corresponding FunctionID enum value for a string RPC
+ *
* @param name String value represents the name of the RPC
* @return FunctionID represents the equivalent enum value for the provided string
*/
- public static FunctionID getEnumForString(String name){
- for(FunctionID value : EnumSet.allOf(FunctionID.class)) {
- if(value.JSON_NAME.equals(name)){
+ public static FunctionID getEnumForString(String name) {
+ for (FunctionID value : EnumSet.allOf(FunctionID.class)) {
+ if (value.JSON_NAME.equals(name)) {
return value;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/MessageType.java b/base/src/main/java/com/smartdevicelink/protocol/enums/MessageType.java
index 121d922d7..9e7defe79 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/MessageType.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/MessageType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,23 +29,23 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.protocol.enums;
-
-
-public enum MessageType {
-// START_SESSION,
-// START_SESSION_ACK,
-// START_SESSION_NACK,
-// END_SESSION,
- UNDEFINED,
- BULK,
- RPC;
-
- public static MessageType valueForString (String value) {
- try{
- return valueOf(value);
- } catch(Exception e) {
- return null;
- }
- }
-}
+package com.smartdevicelink.protocol.enums;
+
+
+public enum MessageType {
+ // START_SESSION,
+// START_SESSION_ACK,
+// START_SESSION_NACK,
+// END_SESSION,
+ UNDEFINED,
+ BULK,
+ RPC;
+
+ public static MessageType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/SessionType.java b/base/src/main/java/com/smartdevicelink/protocol/enums/SessionType.java
index 5161b10f8..23124cc58 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/SessionType.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/SessionType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,31 +38,37 @@ import java.util.Vector;
public class SessionType extends ByteEnumer {
- private static final Vector<SessionType> theList = new Vector<>();
- public static Vector<SessionType> getList() { return theList; }
-
- byte i = 0x00;
-
- protected SessionType(byte value, String name) {super(value, name);}
- public final static SessionType CONTROL = new SessionType((byte) 0, "CONTROL");
- public final static SessionType RPC = new SessionType((byte)0x07, "RPC");
- public final static SessionType PCM = new SessionType((byte)0x0A, "PCM");
- public final static SessionType NAV = new SessionType((byte)0x0B, "NAV");
- public final static SessionType BULK_DATA = new SessionType((byte)0xF, "BULK_DATA");
+ private static final Vector<SessionType> theList = new Vector<>();
- static {
- theList.addElement(RPC);
- theList.addElement(PCM);
- theList.addElement(NAV);
- theList.addElement(BULK_DATA);
- theList.addElement(CONTROL);
- }
-
- public static SessionType valueOf(byte passedButton) {
- return (SessionType) get(theList, passedButton);
- }
-
- public static SessionType[] values() {
- return theList.toArray(new SessionType[theList.size()]);
- }
+ public static Vector<SessionType> getList() {
+ return theList;
+ }
+
+ byte i = 0x00;
+
+ protected SessionType(byte value, String name) {
+ super(value, name);
+ }
+
+ public final static SessionType CONTROL = new SessionType((byte) 0, "CONTROL");
+ public final static SessionType RPC = new SessionType((byte) 0x07, "RPC");
+ public final static SessionType PCM = new SessionType((byte) 0x0A, "PCM");
+ public final static SessionType NAV = new SessionType((byte) 0x0B, "NAV");
+ public final static SessionType BULK_DATA = new SessionType((byte) 0xF, "BULK_DATA");
+
+ static {
+ theList.addElement(RPC);
+ theList.addElement(PCM);
+ theList.addElement(NAV);
+ theList.addElement(BULK_DATA);
+ theList.addElement(CONTROL);
+ }
+
+ public static SessionType valueOf(byte passedButton) {
+ return (SessionType) get(theList, passedButton);
+ }
+
+ public static SessionType[] values() {
+ return theList.toArray(new SessionType[theList.size()]);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index fd80c6cca..5d2d6094a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,7 +35,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import java.util.Hashtable;
-public class RPCMessage extends RPCStruct {
+public class RPCMessage extends RPCStruct {
public static final String KEY_REQUEST = "request";
public static final String KEY_RESPONSE = "response";
public static final String KEY_NOTIFICATION = "notification";
@@ -43,131 +43,133 @@ public class RPCMessage extends RPCStruct {
public static final String KEY_PARAMETERS = "parameters";
public static final String KEY_CORRELATION_ID = "correlationID";
- public RPCMessage(String functionName) {
- this(functionName, "request");
- }
-
- protected RPCMessage(RPCMessage rpcMessage) {
- this(cloneStore(rpcMessage));
- }
-
- protected RPCMessage(RPCStruct rpcs) {
- this("", "");
- this.parameters = cloneStore(rpcs);
- }
-
- public RPCMessage(String functionName, String messageType) {
- function = new Hashtable<>();
- parameters = new Hashtable<>();
-
- this.messageType = messageType;
- function.put(KEY_PARAMETERS, parameters);
-
- if (messageType != null)
- store.put(messageType, function);
- if (functionName != null)
- function.put(KEY_FUNCTION_NAME, functionName);
- }
-
- @SuppressWarnings("unchecked")
+ public RPCMessage(String functionName) {
+ this(functionName, "request");
+ }
+
+ protected RPCMessage(RPCMessage rpcMessage) {
+ this(cloneStore(rpcMessage));
+ }
+
+ protected RPCMessage(RPCStruct rpcs) {
+ this("", "");
+ this.parameters = cloneStore(rpcs);
+ }
+
+ public RPCMessage(String functionName, String messageType) {
+ function = new Hashtable<>();
+ parameters = new Hashtable<>();
+
+ this.messageType = messageType;
+ function.put(KEY_PARAMETERS, parameters);
+
+ if (messageType != null)
+ store.put(messageType, function);
+ if (functionName != null)
+ function.put(KEY_FUNCTION_NAME, functionName);
+ }
+
+ @SuppressWarnings("unchecked")
public RPCMessage(Hashtable<String, Object> hash) {
store = hash;
messageType = getMessageTypeName(hash.keySet());
function = (Hashtable<String, Object>) hash.get(messageType);
if (function != null) {
- parameters = (Hashtable<String, Object>) function.get(KEY_PARAMETERS);
- }
+ parameters = (Hashtable<String, Object>) function.get(KEY_PARAMETERS);
+ }
if (hasKey(hash.keySet(), RPCStruct.KEY_BULK_DATA)) {
setBulkData((byte[]) hash.get(RPCStruct.KEY_BULK_DATA));
}
if (hasKey(hash.keySet(), RPCStruct.KEY_PROTECTED)) {
- setPayloadProtected((Boolean) hash.get(RPCStruct.KEY_PROTECTED));
+ setPayloadProtected((Boolean) hash.get(RPCStruct.KEY_PROTECTED));
+ }
+ }
+
+ public FunctionID getFunctionID() {
+ if (function.containsKey(KEY_FUNCTION_NAME)) {
+ return FunctionID.getEnumForString((String) function.get(KEY_FUNCTION_NAME));
+ }
+ return null;
+ }
+
+ protected String messageType;
+ protected Hashtable<String, Object> parameters;
+ protected final Hashtable<String, Object> function;
+
+ public String getFunctionName() {
+ return (String) function.get(KEY_FUNCTION_NAME);
+ }
+
+ protected RPCMessage setFunctionName(String functionName) {
+ function.put(KEY_FUNCTION_NAME, functionName);
+ return this;
+ }
+
+ public String getMessageType() {
+ if (messageType.equals(KEY_REQUEST) ||
+ messageType.equals(KEY_RESPONSE) ||
+ messageType.equals(KEY_NOTIFICATION)) {
+ return messageType;
+ }
+ return null;
+ }
+
+ // Generalized Getters and Setters
+
+ public RPCMessage setParameters(String key, Object value) {
+ if (value != null) {
+ parameters.put(key, value);
+ } else {
+ parameters.remove(key);
+ }
+ return this;
+ }
+
+ public Object getParameters(String key) {
+ return parameters.get(key);
+ }
+
+ @Override
+ public Object getObject(Class tClass, String key) {
+ Object obj = parameters.get(key);
+ return formatObject(tClass, obj);
+ }
+
+ // Common Object Getters
+
+ @Override
+ public String getString(String key) {
+ return (String) parameters.get(key);
+ }
+
+ @Override
+ public Integer getInteger(String key) {
+ return (Integer) parameters.get(key);
+ }
+
+ @Override
+ public Float getFloat(String key) {
+ return (Float) parameters.get(key);
+ }
+
+ @Override
+ public Double getDouble(String key) {
+ return (Double) parameters.get(key);
+ }
+
+ @Override
+ public Boolean getBoolean(String key) {
+ return (Boolean) parameters.get(key);
+ }
+
+ @Override
+ public Long getLong(String key) {
+ Object result = parameters.get(key);
+ if (result instanceof Integer) {
+ return ((Integer) result).longValue();
+ } else if (result instanceof Long) {
+ return (Long) result;
}
- }
-
- public FunctionID getFunctionID(){
- if(function.containsKey(KEY_FUNCTION_NAME)){
- return FunctionID.getEnumForString((String)function.get(KEY_FUNCTION_NAME));
- }
- return null;
- }
-
- protected String messageType;
- protected Hashtable<String, Object> parameters;
- protected final Hashtable<String, Object> function;
-
- public String getFunctionName() {
- return (String)function.get(KEY_FUNCTION_NAME);
- }
-
- protected RPCMessage setFunctionName(String functionName) {
- function.put(KEY_FUNCTION_NAME, functionName);
- return this;
- }
-
- public String getMessageType() {
- if (messageType.equals(KEY_REQUEST) ||
- messageType.equals(KEY_RESPONSE) ||
- messageType.equals(KEY_NOTIFICATION)) {
- return messageType;
- }
- return null;
- }
-
- // Generalized Getters and Setters
-
- public RPCMessage setParameters(String key, Object value) {
- if (value != null) {
- parameters.put(key, value);
- } else {
- parameters.remove(key);
- }
- return this;
- }
-
- public Object getParameters(String key) {
- return parameters.get(key);
- }
-
- @Override
- public Object getObject(Class tClass, String key) {
- Object obj = parameters.get(key);
- return formatObject(tClass, obj);
- }
-
- // Common Object Getters
-
- @Override
- public String getString(String key) {
- return (String) parameters.get(key);
- }
-
- @Override
- public Integer getInteger(String key) {
- return (Integer) parameters.get(key);
- }
-
- @Override
- public Float getFloat(String key) {
- return (Float) parameters.get(key);
- }
-
- @Override
- public Double getDouble(String key) {
- return (Double) parameters.get(key);
- }
-
- @Override
- public Boolean getBoolean(String key) { return (Boolean) parameters.get(key); }
-
- @Override
- public Long getLong(String key){
- Object result = parameters.get(key);
- if (result instanceof Integer) {
- return ((Integer) result).longValue();
- }else if(result instanceof Long){
- return (Long) result;
- }
- return null;
- }
+ return null;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java b/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
index dfcd283a6..5fc273969 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,23 +35,23 @@ import java.util.Hashtable;
public class RPCNotification extends RPCMessage {
- public RPCNotification(String functionName) {
- super(functionName, RPCMessage.KEY_NOTIFICATION);
- }
+ public RPCNotification(String functionName) {
+ super(functionName, RPCMessage.KEY_NOTIFICATION);
+ }
- public RPCNotification(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public RPCNotification(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public RPCNotification(RPCMessage rpcMsg) {
- super(preprocessMsg(rpcMsg));
- }
-
- static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
- if (!RPCMessage.KEY_NOTIFICATION.equals(rpcMsg.getMessageType())) {
- rpcMsg.messageType = RPCMessage.KEY_NOTIFICATION;
- }
-
- return rpcMsg;
- }
+ public RPCNotification(RPCMessage rpcMsg) {
+ super(preprocessMsg(rpcMsg));
+ }
+
+ static RPCMessage preprocessMsg(RPCMessage rpcMsg) {
+ if (!RPCMessage.KEY_NOTIFICATION.equals(rpcMsg.getMessageType())) {
+ rpcMsg.messageType = RPCMessage.KEY_NOTIFICATION;
+ }
+
+ return rpcMsg;
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCRequest.java b/base/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
index 7dc9de1d3..fe30ea163 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,46 +38,47 @@ import java.util.Hashtable;
public class RPCRequest extends RPCMessage {
- protected OnRPCResponseListener onResponseListener;
+ protected OnRPCResponseListener onResponseListener;
- public RPCRequest(String functionName) {
- super(functionName, RPCMessage.KEY_REQUEST);
- messageType = RPCMessage.KEY_REQUEST;
- }
+ public RPCRequest(String functionName) {
+ super(functionName, RPCMessage.KEY_REQUEST);
+ messageType = RPCMessage.KEY_REQUEST;
+ }
+
+ public RPCRequest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public RPCRequest(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public RPCRequest(RPCRequest request) {
+ super(request);
+ if (request == null || request.getCorrelationID() == null) {
+ setCorrelationID(CorrelationIdGenerator.generateId());
+ }
+ }
- public RPCRequest(RPCRequest request){
- super(request);
- if (request == null || request.getCorrelationID() == null) {
- setCorrelationID(CorrelationIdGenerator.generateId());
- }
- }
+ public Integer getCorrelationID() {
+ //First we check to see if a correlation ID is set. If not, create one.
+ if (!function.containsKey(RPCMessage.KEY_CORRELATION_ID)) {
+ setCorrelationID(CorrelationIdGenerator.generateId());
+ }
+ return (Integer) function.get(RPCMessage.KEY_CORRELATION_ID);
+ }
- public Integer getCorrelationID() {
- //First we check to see if a correlation ID is set. If not, create one.
- if(!function.containsKey(RPCMessage.KEY_CORRELATION_ID)){
- setCorrelationID(CorrelationIdGenerator.generateId());
- }
- return (Integer)function.get(RPCMessage.KEY_CORRELATION_ID);
- }
-
- public RPCRequest setCorrelationID(Integer correlationID) {
- if (correlationID != null) {
- function.put(RPCMessage.KEY_CORRELATION_ID, correlationID );
+ public RPCRequest setCorrelationID(Integer correlationID) {
+ if (correlationID != null) {
+ function.put(RPCMessage.KEY_CORRELATION_ID, correlationID);
} else {
- function.remove(RPCMessage.KEY_CORRELATION_ID);
+ function.remove(RPCMessage.KEY_CORRELATION_ID);
}
- return this;
- }
- public RPCRequest setOnRPCResponseListener(OnRPCResponseListener listener){
- onResponseListener = listener;
- return this;
+ return this;
}
-
- public OnRPCResponseListener getOnRPCResponseListener(){
- return this.onResponseListener;
+
+ public RPCRequest setOnRPCResponseListener(OnRPCResponseListener listener) {
+ onResponseListener = listener;
+ return this;
+ }
+
+ public OnRPCResponseListener getOnRPCResponseListener() {
+ return this.onResponseListener;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java b/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
index dd56b370f..f85747d58 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,7 +38,7 @@ import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
/**
- * Result sent by SDL after an RPC is processed, consists of four parts:
+ * Result sent by SDL after an RPC is processed, consists of four parts:
* <ul>
* <li>
* CorrelationID:
@@ -51,19 +51,19 @@ import java.util.Hashtable;
* </ul>
* </li> <li>ResultCode:
* <ul>
- *
+ *
* <p>The result code provides additional information about a response returning a
* failed outcome.</p>
- *
- *
+ *
+ *
* <p>Any response can have at least one, or possibly more, of the following result
* code values: SUCCESS, INVALID_DATA, OUT_OF_MEMORY, TOO_MANY_PENDING_REQUESTS,
* APPLICATION_NOT_REGISTERED, GENERIC_ERROR,REJECTED.</p>
- *
- *
+ *
+ *
* <p>Any additional result codes for a given operation can be found in related
* RPCs</p>
- *
+ *
* </ul>
* </li> <li>Info:
* <ul>
@@ -74,97 +74,104 @@ import java.util.Hashtable;
* </ul>
*/
public class RPCResponse extends RPCMessage {
- public static final String KEY_SUCCESS = "success";
- public static final String KEY_INFO = "info";
- public static final String KEY_RESULT_CODE = "resultCode";
- /**
- *<p>Constructs a newly allocated RPCResponse object using function name</p>
- *@param functionName a string that indicates the function's name
- */
- public RPCResponse(String functionName) {
- super(functionName, RPCMessage.KEY_RESPONSE);
- }
- /**
- *<p>Constructs a newly allocated RPCResponse object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
- public RPCResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
- /**
- *<p>Constructs a newly allocated RPCResponse object using a RPCMessage object</p>
- *@param rpcMsg The {@linkplain RPCMessage} to use
- */
- public RPCResponse(RPCMessage rpcMsg) {
- super(preprocessMsg(rpcMsg));
- }
-
- static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
- if (!RPCMessage.KEY_RESPONSE.equals(rpcMsg.getMessageType())) {
- rpcMsg.messageType = RPCMessage.KEY_RESPONSE;
- }
-
- return rpcMsg;
- }
-
- /**
- * <p>
- * Returns correlationID the ID of the request
- * </p>
- *
- * @return int the ID of the request
- */
- public Integer getCorrelationID() {
- return (Integer)function.get(RPCMessage.KEY_CORRELATION_ID);
- }
-
- /**
- * <p>
- * Set the correlationID
- * </p>
- *
- * @param correlationID
- * the ID of the response
- */
- public RPCResponse setCorrelationID(Integer correlationID) {
- if (correlationID != null) {
- function.put(RPCMessage.KEY_CORRELATION_ID, correlationID );
+ public static final String KEY_SUCCESS = "success";
+ public static final String KEY_INFO = "info";
+ public static final String KEY_RESULT_CODE = "resultCode";
+
+ /**
+ * <p>Constructs a newly allocated RPCResponse object using function name</p>
+ *
+ * @param functionName a string that indicates the function's name
+ */
+ public RPCResponse(String functionName) {
+ super(functionName, RPCMessage.KEY_RESPONSE);
+ }
+
+ /**
+ * <p>Constructs a newly allocated RPCResponse object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public RPCResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * <p>Constructs a newly allocated RPCResponse object using a RPCMessage object</p>
+ *
+ * @param rpcMsg The {@linkplain RPCMessage} to use
+ */
+ public RPCResponse(RPCMessage rpcMsg) {
+ super(preprocessMsg(rpcMsg));
+ }
+
+ static RPCMessage preprocessMsg(RPCMessage rpcMsg) {
+ if (!RPCMessage.KEY_RESPONSE.equals(rpcMsg.getMessageType())) {
+ rpcMsg.messageType = RPCMessage.KEY_RESPONSE;
+ }
+
+ return rpcMsg;
+ }
+
+ /**
+ * <p>
+ * Returns correlationID the ID of the request
+ * </p>
+ *
+ * @return int the ID of the request
+ */
+ public Integer getCorrelationID() {
+ return (Integer) function.get(RPCMessage.KEY_CORRELATION_ID);
+ }
+
+ /**
+ * <p>
+ * Set the correlationID
+ * </p>
+ *
+ * @param correlationID the ID of the response
+ */
+ public RPCResponse setCorrelationID(Integer correlationID) {
+ if (correlationID != null) {
+ function.put(RPCMessage.KEY_CORRELATION_ID, correlationID);
} else {
- function.remove(RPCMessage.KEY_CORRELATION_ID);
+ function.remove(RPCMessage.KEY_CORRELATION_ID);
}
- return this;
- }
- /**
- * <p>
- * Returns Success whether the request is successfully processed
- * </p>
- *
- * @return Boolean the status of whether the request is successfully done
- */
- public Boolean getSuccess() {
- return (Boolean) parameters.get( RPCResponse.KEY_SUCCESS );
+ return this;
}
- /**
- * <p>
- * Set the Success status
- * </p>
- *
- * @param success
- * whether the request is successfully processed
- */
- public RPCResponse setSuccess( @NonNull Boolean success ) {
+
+ /**
+ * <p>
+ * Returns Success whether the request is successfully processed
+ * </p>
+ *
+ * @return Boolean the status of whether the request is successfully done
+ */
+ public Boolean getSuccess() {
+ return (Boolean) parameters.get(RPCResponse.KEY_SUCCESS);
+ }
+
+ /**
+ * <p>
+ * Set the Success status
+ * </p>
+ *
+ * @param success whether the request is successfully processed
+ */
+ public RPCResponse setSuccess(@NonNull Boolean success) {
if (success != null) {
- parameters.put(RPCResponse.KEY_SUCCESS, success );
+ parameters.put(RPCResponse.KEY_SUCCESS, success);
}
- return this;
+ return this;
}
- /**
- * <p>
- * Returns ResultCode additional information about a response returning a failed outcome
- * </p>
- *
- * @return {@linkplain Result} the status of whether the request is successfully done
- */
+
+ /**
+ * <p>
+ * Returns ResultCode additional information about a response returning a failed outcome
+ * </p>
+ *
+ * @return {@linkplain Result} the status of whether the request is successfully done
+ */
public Result getResultCode() {
Object obj = parameters.get(RPCResponse.KEY_RESULT_CODE);
if (obj instanceof Result) {
@@ -174,42 +181,43 @@ public class RPCResponse extends RPCMessage {
}
return null;
}
- /**
- * <p>
- * Set the additional information about a response returning a failed outcome
- * </p>
- *
- * @param resultCode
- * whether the request is successfully processed
- */
- public RPCResponse setResultCode( @NonNull Result resultCode ) {
+
+ /**
+ * <p>
+ * Set the additional information about a response returning a failed outcome
+ * </p>
+ *
+ * @param resultCode whether the request is successfully processed
+ */
+ public RPCResponse setResultCode(@NonNull Result resultCode) {
if (resultCode != null) {
- parameters.put(RPCResponse.KEY_RESULT_CODE, resultCode );
+ parameters.put(RPCResponse.KEY_RESULT_CODE, resultCode);
}
- return this;
+ return this;
}
- /**
- * <p>
- * Returns a string of text representing additional information returned from SDL
- * </p>
- *
- * @return String A string of text representing additional information returned from SDL
- */
+
+ /**
+ * <p>
+ * Returns a string of text representing additional information returned from SDL
+ * </p>
+ *
+ * @return String A string of text representing additional information returned from SDL
+ */
public String getInfo() {
- return (String) parameters.get( RPCResponse.KEY_INFO );
+ return (String) parameters.get(RPCResponse.KEY_INFO);
}
- /**
- * <p>
- * Set a string of text representing additional information returned from SDL
- * </p>
- *
- * @param info
- * a string of text representing additional information returned from SDL
- */
- public RPCResponse setInfo( String info ) {
+
+ /**
+ * <p>
+ * Set a string of text representing additional information returned from SDL
+ * </p>
+ *
+ * @param info a string of text representing additional information returned from SDL
+ */
+ public RPCResponse setInfo(String info) {
if (info != null) {
- parameters.put(RPCResponse.KEY_INFO, info );
+ parameters.put(RPCResponse.KEY_INFO, info);
}
- return this;
+ return this;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index e7d915b1e..e99eba1d7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,328 +49,330 @@ import java.util.Set;
public class RPCStruct {
public static final String KEY_BULK_DATA = "bulkData";
public static final String KEY_PROTECTED = "protected";
-
- private byte[] _bulkData = null;
- private Boolean protectedPayload = false;
-
- private boolean formatRequested = false;
- private Version rpcSpecVersion = null;
-
-
- protected Hashtable<String, Object> store;
-
- public boolean getStoreValue(String key) { // for unit testing
- return store.contains(key);
- }
-
- public Hashtable<String,Object> getStore () { // for unit testing
- return store;
- }
-
- public RPCStruct() {
- store = new Hashtable<>();
- }
-
- protected RPCStruct(RPCStruct rpcs) {
- this.store = cloneStore(rpcs);
- }
-
- public RPCStruct(Hashtable<String, Object> hashtable) {
- store = hashtable;
- //store = (Hashtable<String, Object>) ObjectCopier.copy(hashtable);
- }
-
- static Hashtable<String, Object> cloneStore(RPCStruct rpcStruct){
- if(rpcStruct!= null && rpcStruct.store !=null){
- return (Hashtable)rpcStruct.store.clone();
- }
- return null;
- }
-
- public void deserializeJSON(JSONObject jsonObject) throws JSONException {
- store = JsonRPCMarshaller.deserializeJSONObject(jsonObject);
-
- }
-
- public JSONObject serializeJSON() throws JSONException {
- return JsonRPCMarshaller.serializeHashtable(store);
- }
-
- @SuppressWarnings("unchecked")
+
+ private byte[] _bulkData = null;
+ private Boolean protectedPayload = false;
+
+ private boolean formatRequested = false;
+ private Version rpcSpecVersion = null;
+
+
+ protected Hashtable<String, Object> store;
+
+ public boolean getStoreValue(String key) { // for unit testing
+ return store.contains(key);
+ }
+
+ public Hashtable<String, Object> getStore() { // for unit testing
+ return store;
+ }
+
+ public RPCStruct() {
+ store = new Hashtable<>();
+ }
+
+ protected RPCStruct(RPCStruct rpcs) {
+ this.store = cloneStore(rpcs);
+ }
+
+ public RPCStruct(Hashtable<String, Object> hashtable) {
+ store = hashtable;
+ //store = (Hashtable<String, Object>) ObjectCopier.copy(hashtable);
+ }
+
+ static Hashtable<String, Object> cloneStore(RPCStruct rpcStruct) {
+ if (rpcStruct != null && rpcStruct.store != null) {
+ return (Hashtable) rpcStruct.store.clone();
+ }
+ return null;
+ }
+
+ public void deserializeJSON(JSONObject jsonObject) throws JSONException {
+ store = JsonRPCMarshaller.deserializeJSONObject(jsonObject);
+
+ }
+
+ public JSONObject serializeJSON() throws JSONException {
+ return JsonRPCMarshaller.serializeHashtable(store);
+ }
+
+ @SuppressWarnings("unchecked")
public JSONObject serializeJSON(byte protocolVersion) throws JSONException {
- if (protocolVersion > 1) {
- String messageType = getMessageTypeName(store.keySet());
- Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
- if(function != null){
- Hashtable<String, Object> parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
- return JsonRPCMarshaller.serializeHashtable(parameters);
- }else{
- return null;
- }
-
- } else return JsonRPCMarshaller.serializeHashtable(store);
- }
-
- /**
- * This method should clean the the RPC to make sure it is compliant with the spec.
- * <br><br><b> NOTE:</b> Super needs to be called at the END of the method
- *
- * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
- * the max value of RPC spec version this library supports should be used.
- * @param formatParams if true, the format method will be called on subsequent params
- */
- public void format(Version rpcVersion, boolean formatParams){
- formatRequested = true;
- rpcSpecVersion = rpcVersion;
- //Should override this method when breaking changes are made to the RPC spec
- if(formatParams && store != null){
- Hashtable<String, Object> parameters;
-
- if(this instanceof RPCMessage) {
- //If this is a message (request, response, notification) the parameters have to be
- //retrieved from the store object.
- String messageType = getMessageTypeName(store.keySet());
- Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
- if(function != null){
- parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
- }else {
- parameters = null;
- }
- } else {
- //If this is just an RPC struct the store itself should be used
- parameters = store;
- }
-
- if (parameters != null) {
- for(Object value:parameters.values()){
- internalFormat(rpcVersion, value);
- }
- }
- }
- }
-
- /**
- * Cycles through parameters in this RPC to ensure they all get formatted
- * @param rpcVersion version of the rpc spec that should be used to format this rpc
- * @param value the object to investigate if it needs to be formatted
- */
- private void internalFormat(Version rpcVersion, Object value) {
- if(value instanceof RPCStruct) {
- ((RPCStruct)value).format(rpcVersion,true);
- } else if(value instanceof List<?>) {
- List<?> list = (List<?>)value;
- if(list != null && list.size() > 0) {
- for(Object listItem: list){
- internalFormat(rpcVersion, listItem);
- }
- }
- }
- }
-
-
- public byte[] getBulkData() {
- return this._bulkData;
- }
-
- public RPCStruct setBulkData(byte[] bulkData) {
- if (bulkData != null) {
- this._bulkData = new byte[bulkData.length];
- System.arraycopy(bulkData, 0, _bulkData, 0, bulkData.length);
- }
- else{
- this._bulkData = null;
- }
- return this;
- }
-
- public RPCStruct setPayloadProtected(Boolean bVal) {
- protectedPayload = bVal;
- return this;
- }
-
- public Boolean isPayloadProtected() {
- return protectedPayload;
- }
-
- protected String getMessageTypeName(Set<String> keys) {
- for (String key : keys) {
- if (key == null) {
- continue;
- }
- if (key.equals(RPCMessage.KEY_REQUEST) || key.equals(RPCMessage.KEY_RESPONSE) ||
- key.equals(RPCMessage.KEY_NOTIFICATION)) {
- return key;
- }
- }
- return null;
- }
-
- protected boolean hasKey(Set<String> keys, String keyName) {
- for (String key : keys) {
- if (key == null) {
- continue;
- }
- if (key.equals(keyName)) {
- return true;
- }
- }
- return false;
- }
-
- // Generalized Getters and Setters
-
- public RPCStruct setValue(String key, Object value){
- if (value != null) {
- store.put(key, value);
- } else {
- store.remove(key);
- }
- return this;
- }
-
- public Object getValue(String key) {
- return store.get(key);
- }
-
- public Object getObject(Class tClass, String key) {
- Object obj = store.get(key);
- return formatObject(tClass, obj);
- }
-
- // Helper methods
-
- /**
- * @param tClass a Class to cast Objects to
- * @param obj Object returned from a stored hashtable
- * @return A null object if obj is null or if none of the following is true:
- * a) obj is an instance of tClass
- * b) obj is an instance of String and it tClass has a valid `valueForString` method
- * c) obj is an instance of a Hashtable
- * d) obj is an instance of a List
- */
- protected Object formatObject(Class tClass, Object obj){
- if(obj == null){
- return null;
- } else if (tClass.isInstance(obj)) {
- return obj;
- } else if (obj instanceof String) {
- return getValueForString(tClass, (String) obj);
- } else if (obj instanceof Hashtable) {
- try {
- Constructor constructor = tClass.getConstructor(Hashtable.class);
- Object customObject = constructor.newInstance((Hashtable<String, Object>) obj);
- if(formatRequested && customObject instanceof RPCStruct){
- ((RPCStruct)customObject).format(rpcSpecVersion,true);
- }
-
- return customObject;
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else if (obj instanceof List<?>) {
- List<?> list = (List<?>) obj;
- if (list != null && list.size() > 0) {
- Object item = null;
- //Iterate through list to find first non-null object
- for(Object object: list){
- if(object != null) {
- item = object;
- break;
- }
- }
-
- if (item == null) {
- return list;
- } else if (tClass.isInstance(item)) {
- return list;
- } else if (item instanceof Hashtable) {
- List<Object> newList = new ArrayList<>();
- Object customObject;
- for (Object hashObj : list) {
- try {
- Constructor constructor = tClass.getConstructor(Hashtable.class);
- customObject = constructor.newInstance((Hashtable<String, Object>) hashObj);
- if(formatRequested
- && customObject != null
- && customObject instanceof RPCStruct){
- ((RPCStruct)customObject).format(rpcSpecVersion,true);
- }
- newList.add(customObject);
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
- return newList;
- } else if (item instanceof String){
- List<Object> newList = new ArrayList<>();
- for (Object hashObj : list) {
- Object toAdd = getValueForString(tClass, (String) hashObj);
- if (toAdd != null) {
- newList.add(toAdd);
- }
- }
- return newList;
- }
- } else {
- //If the list is either null or empty it should be returned. It will keep the same
- //behavior as it does today with null lists, but empty ones will now also be returned.
- return list;
- }
- }
- return null;
- }
-
- /**
- * @param tClass - a Class with a `valueForString(String s)` method that returns an Object for a given String
- * @param s - a String to be converted to an Object using a `valueForString(String s)` method
- * @return An Object converted using a `valueForString(String s)` method in the Class passed in, or a null object if such method does not exist
- */
- protected Object getValueForString(Class tClass, String s){
- Method valueForString = null;
- try {
- valueForString = tClass.getDeclaredMethod("valueForString", String.class);
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- if(valueForString != null){
- try {
- return valueForString.invoke(null, (String) s);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- // Common Object Getters
- public String getString(String key) {
- return (String) store.get(key);
- }
-
- public Integer getInteger(String key) {
- return (Integer) store.get(key);
- }
-
- public Double getDouble(String key) {
- return SdlDataTypeConverter.objectToDouble(store.get(key));
- }
-
- public Float getFloat(String key) {
- return SdlDataTypeConverter.objectToFloat(store.get(key));
- }
-
- public Boolean getBoolean(String key) { return (Boolean) store.get(key); }
-
- public Long getLong(String key){
- Object result = store.get(key);
- if (result instanceof Integer) {
- return ((Integer) result).longValue();
- }else if(result instanceof Long){
- return (Long) result;
- }
- return null;
- }
+ if (protocolVersion > 1) {
+ String messageType = getMessageTypeName(store.keySet());
+ Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
+ if (function != null) {
+ Hashtable<String, Object> parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ return JsonRPCMarshaller.serializeHashtable(parameters);
+ } else {
+ return null;
+ }
+
+ } else return JsonRPCMarshaller.serializeHashtable(store);
+ }
+
+ /**
+ * This method should clean the the RPC to make sure it is compliant with the spec.
+ * <br><br><b> NOTE:</b> Super needs to be called at the END of the method
+ *
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
+ * @param formatParams if true, the format method will be called on subsequent params
+ */
+ public void format(Version rpcVersion, boolean formatParams) {
+ formatRequested = true;
+ rpcSpecVersion = rpcVersion;
+ //Should override this method when breaking changes are made to the RPC spec
+ if (formatParams && store != null) {
+ Hashtable<String, Object> parameters;
+
+ if (this instanceof RPCMessage) {
+ //If this is a message (request, response, notification) the parameters have to be
+ //retrieved from the store object.
+ String messageType = getMessageTypeName(store.keySet());
+ Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
+ if (function != null) {
+ parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ } else {
+ parameters = null;
+ }
+ } else {
+ //If this is just an RPC struct the store itself should be used
+ parameters = store;
+ }
+
+ if (parameters != null) {
+ for (Object value : parameters.values()) {
+ internalFormat(rpcVersion, value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Cycles through parameters in this RPC to ensure they all get formatted
+ *
+ * @param rpcVersion version of the rpc spec that should be used to format this rpc
+ * @param value the object to investigate if it needs to be formatted
+ */
+ private void internalFormat(Version rpcVersion, Object value) {
+ if (value instanceof RPCStruct) {
+ ((RPCStruct) value).format(rpcVersion, true);
+ } else if (value instanceof List<?>) {
+ List<?> list = (List<?>) value;
+ if (list != null && list.size() > 0) {
+ for (Object listItem : list) {
+ internalFormat(rpcVersion, listItem);
+ }
+ }
+ }
+ }
+
+
+ public byte[] getBulkData() {
+ return this._bulkData;
+ }
+
+ public RPCStruct setBulkData(byte[] bulkData) {
+ if (bulkData != null) {
+ this._bulkData = new byte[bulkData.length];
+ System.arraycopy(bulkData, 0, _bulkData, 0, bulkData.length);
+ } else {
+ this._bulkData = null;
+ }
+ return this;
+ }
+
+ public RPCStruct setPayloadProtected(Boolean bVal) {
+ protectedPayload = bVal;
+ return this;
+ }
+
+ public Boolean isPayloadProtected() {
+ return protectedPayload;
+ }
+
+ protected String getMessageTypeName(Set<String> keys) {
+ for (String key : keys) {
+ if (key == null) {
+ continue;
+ }
+ if (key.equals(RPCMessage.KEY_REQUEST) || key.equals(RPCMessage.KEY_RESPONSE) ||
+ key.equals(RPCMessage.KEY_NOTIFICATION)) {
+ return key;
+ }
+ }
+ return null;
+ }
+
+ protected boolean hasKey(Set<String> keys, String keyName) {
+ for (String key : keys) {
+ if (key == null) {
+ continue;
+ }
+ if (key.equals(keyName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // Generalized Getters and Setters
+
+ public RPCStruct setValue(String key, Object value) {
+ if (value != null) {
+ store.put(key, value);
+ } else {
+ store.remove(key);
+ }
+ return this;
+ }
+
+ public Object getValue(String key) {
+ return store.get(key);
+ }
+
+ public Object getObject(Class tClass, String key) {
+ Object obj = store.get(key);
+ return formatObject(tClass, obj);
+ }
+
+ // Helper methods
+
+ /**
+ * @param tClass a Class to cast Objects to
+ * @param obj Object returned from a stored hashtable
+ * @return A null object if obj is null or if none of the following is true:
+ * a) obj is an instance of tClass
+ * b) obj is an instance of String and it tClass has a valid `valueForString` method
+ * c) obj is an instance of a Hashtable
+ * d) obj is an instance of a List
+ */
+ protected Object formatObject(Class tClass, Object obj) {
+ if (obj == null) {
+ return null;
+ } else if (tClass.isInstance(obj)) {
+ return obj;
+ } else if (obj instanceof String) {
+ return getValueForString(tClass, (String) obj);
+ } else if (obj instanceof Hashtable) {
+ try {
+ Constructor constructor = tClass.getConstructor(Hashtable.class);
+ Object customObject = constructor.newInstance((Hashtable<String, Object>) obj);
+ if (formatRequested && customObject instanceof RPCStruct) {
+ ((RPCStruct) customObject).format(rpcSpecVersion, true);
+ }
+
+ return customObject;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (obj instanceof List<?>) {
+ List<?> list = (List<?>) obj;
+ if (list != null && list.size() > 0) {
+ Object item = null;
+ //Iterate through list to find first non-null object
+ for (Object object : list) {
+ if (object != null) {
+ item = object;
+ break;
+ }
+ }
+
+ if (item == null) {
+ return list;
+ } else if (tClass.isInstance(item)) {
+ return list;
+ } else if (item instanceof Hashtable) {
+ List<Object> newList = new ArrayList<>();
+ Object customObject;
+ for (Object hashObj : list) {
+ try {
+ Constructor constructor = tClass.getConstructor(Hashtable.class);
+ customObject = constructor.newInstance((Hashtable<String, Object>) hashObj);
+ if (formatRequested
+ && customObject != null
+ && customObject instanceof RPCStruct) {
+ ((RPCStruct) customObject).format(rpcSpecVersion, true);
+ }
+ newList.add(customObject);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ return newList;
+ } else if (item instanceof String) {
+ List<Object> newList = new ArrayList<>();
+ for (Object hashObj : list) {
+ Object toAdd = getValueForString(tClass, (String) hashObj);
+ if (toAdd != null) {
+ newList.add(toAdd);
+ }
+ }
+ return newList;
+ }
+ } else {
+ //If the list is either null or empty it should be returned. It will keep the same
+ //behavior as it does today with null lists, but empty ones will now also be returned.
+ return list;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param tClass - a Class with a `valueForString(String s)` method that returns an Object for a given String
+ * @param s - a String to be converted to an Object using a `valueForString(String s)` method
+ * @return An Object converted using a `valueForString(String s)` method in the Class passed in, or a null object if such method does not exist
+ */
+ protected Object getValueForString(Class tClass, String s) {
+ Method valueForString = null;
+ try {
+ valueForString = tClass.getDeclaredMethod("valueForString", String.class);
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ if (valueForString != null) {
+ try {
+ return valueForString.invoke(null, (String) s);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ // Common Object Getters
+ public String getString(String key) {
+ return (String) store.get(key);
+ }
+
+ public Integer getInteger(String key) {
+ return (Integer) store.get(key);
+ }
+
+ public Double getDouble(String key) {
+ return SdlDataTypeConverter.objectToDouble(store.get(key));
+ }
+
+ public Float getFloat(String key) {
+ return SdlDataTypeConverter.objectToFloat(store.get(key));
+ }
+
+ public Boolean getBoolean(String key) {
+ return (Boolean) store.get(key);
+ }
+
+ public Long getLong(String key) {
+ Object result = store.get(key);
+ if (result instanceof Integer) {
+ return ((Integer) result).longValue();
+ } else if (result instanceof Long) {
+ return (Long) result;
+ }
+ return null;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
index b3bb816e2..1af9f8238 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,34 +40,33 @@ import java.util.Hashtable;
import java.util.List;
/**
-*
-* <p>This class will add a command to the application's Command Menu</p>
-*
-*
-* <p><b>Note:</b> A command will be added to the end of the list of elements in
-* the Command Menu under the following conditions:</p>
-*
-* <ul>
-* <li>When a Command is added with no MenuParams value provided</li>
-* <li>When a MenuParams value is provided with a MenuParam.position value
-* greater than or equal to the number of menu items currently defined in the
-* menu specified by the MenuParam.parentID value</li>
-* </ul>
-*
-*
-* <p>The set of choices which the application builds using AddCommand can be a
-* mixture of:</p>
-*
-* <ul>
-* <li>Choices having only VR synonym definitions, but no MenuParams definitions
-* </li>
-* <li>Choices having only MenuParams definitions, but no VR synonym definitions
-* </li>
-* <li>Choices having both MenuParams and VR synonym definitions</li>
-* </ul>
-*
-* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
-*
+ * <p>This class will add a command to the application's Command Menu</p>
+ *
+ *
+ * <p><b>Note:</b> A command will be added to the end of the list of elements in
+ * the Command Menu under the following conditions:</p>
+ *
+ * <ul>
+ * <li>When a Command is added with no MenuParams value provided</li>
+ * <li>When a MenuParams value is provided with a MenuParam.position value
+ * greater than or equal to the number of menu items currently defined in the
+ * menu specified by the MenuParam.parentID value</li>
+ * </ul>
+ *
+ *
+ * <p>The set of choices which the application builds using AddCommand can be a
+ * mixture of:</p>
+ *
+ * <ul>
+ * <li>Choices having only VR synonym definitions, but no MenuParams definitions
+ * </li>
+ * <li>Choices having only MenuParams definitions, but no VR synonym definitions
+ * </li>
+ * <li>Choices having both MenuParams and VR synonym definitions</li>
+ * </ul>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -108,156 +107,159 @@ import java.util.List;
* <td></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
-* </table>
-* <p> <b>Response</b></p><p>Indicates that the corresponding request has failed or succeeded, if the response returns with a SUCCESS result code, this means a command was added to the Command Menu successfully.</p>
-*
-* <p><b>Non-default Result Codes:</b></p> <p>INVALID_ID</p> <p>DUPLICATE_NAME</p>
-* @since SmartDeviceLink 1.0
-* @see DeleteCommand
-* @see AddSubMenu
-* @see DeleteSubMenu
-*/
+ * </table>
+ * <p> <b>Response</b></p><p>Indicates that the corresponding request has failed or succeeded, if the response returns with a SUCCESS result code, this means a command was added to the Command Menu successfully.</p>
+ *
+ * <p><b>Non-default Result Codes:</b></p> <p>INVALID_ID</p> <p>DUPLICATE_NAME</p>
+ *
+ * @see DeleteCommand
+ * @see AddSubMenu
+ * @see DeleteSubMenu
+ * @since SmartDeviceLink 1.0
+ */
public class AddCommand extends RPCRequest {
- public static final String KEY_CMD_ICON = "cmdIcon";
- public static final String KEY_MENU_PARAMS = "menuParams";
- public static final String KEY_CMD_ID = "cmdID";
- public static final String KEY_VR_COMMANDS = "vrCommands";
+ public static final String KEY_CMD_ICON = "cmdIcon";
+ public static final String KEY_MENU_PARAMS = "menuParams";
+ public static final String KEY_CMD_ID = "cmdID";
+ public static final String KEY_VR_COMMANDS = "vrCommands";
- /**
- * Constructs a new AddCommand object
- */
- public AddCommand() {
+ /**
+ * Constructs a new AddCommand object
+ */
+ public AddCommand() {
super(FunctionID.ADD_COMMAND.toString());
}
-
- /**
- * <p>
- * Constructs a new AddCommand object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * <p>
+ * Constructs a new AddCommand object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public AddCommand(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new AddCommand object
- * @param cmdID an integer object representing a Command ID <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
- */
- public AddCommand(@NonNull Integer cmdID) {
- this();
- setCmdID(cmdID);
- }
- /**
- * <p>
- * Returns an <i>Integer</i> object representing the Command ID that you want to add
- * </p>
- *
- * @return Integer -an integer representation a Unique Command ID
- */
+
+ /**
+ * Constructs a new AddCommand object
+ *
+ * @param cmdID an integer object representing a Command ID <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
+ */
+ public AddCommand(@NonNull Integer cmdID) {
+ this();
+ setCmdID(cmdID);
+ }
+
+ /**
+ * <p>
+ * Returns an <i>Integer</i> object representing the Command ID that you want to add
+ * </p>
+ *
+ * @return Integer -an integer representation a Unique Command ID
+ */
public Integer getCmdID() {
- return getInteger(KEY_CMD_ID);
+ return getInteger(KEY_CMD_ID);
}
- /**
- * <p>Sets an Unique Command ID that identifies the command. Is returned in an
- * <i>{@linkplain OnCommand}</i> notification to identify the command
- * selected by the user</p>
- *
- *
- * @param cmdID
- * an integer object representing a Command ID
- * <p>
- * <b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
- */
+
+ /**
+ * <p>Sets an Unique Command ID that identifies the command. Is returned in an
+ * <i>{@linkplain OnCommand}</i> notification to identify the command
+ * selected by the user</p>
+ *
+ * @param cmdID an integer object representing a Command ID
+ * <p>
+ * <b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
+ */
public AddCommand setCmdID(@NonNull Integer cmdID) {
setParameters(KEY_CMD_ID, cmdID);
return this;
}
- /**
- * <p>
- * Returns a <I>MenuParams</I> object which will defined the command and how
- * it is added to the Command Menu
- * </p>
- *
- * @return MenuParams -a MenuParams object
- *
- */
+
+ /**
+ * <p>
+ * Returns a <I>MenuParams</I> object which will defined the command and how
+ * it is added to the Command Menu
+ * </p>
+ *
+ * @return MenuParams -a MenuParams object
+ */
public MenuParams getMenuParams() {
- return (MenuParams) getObject(MenuParams.class, KEY_MENU_PARAMS);
+ return (MenuParams) getObject(MenuParams.class, KEY_MENU_PARAMS);
}
- /**
- * <p>
- * Sets Menu parameters</p>
- * If provided, this will define the command and how it is added to the
- * Command Menu<p>
- * If null, commands will not be accessible through the HMI application menu
- * </p>
- *
- * @param menuParams
- * a menuParams object
- */
- public AddCommand setMenuParams( MenuParams menuParams) {
+
+ /**
+ * <p>
+ * Sets Menu parameters</p>
+ * If provided, this will define the command and how it is added to the
+ * Command Menu<p>
+ * If null, commands will not be accessible through the HMI application menu
+ * </p>
+ *
+ * @param menuParams a menuParams object
+ */
+ public AddCommand setMenuParams(MenuParams menuParams) {
setParameters(KEY_MENU_PARAMS, menuParams);
return this;
}
- /**
- * <p>
- * Gets Voice Recognition Commands
- * </p>
- *
- * @return List<String> -(List<String>) indicating one or more VR phrases
- */
+
+ /**
+ * <p>
+ * Gets Voice Recognition Commands
+ * </p>
+ *
+ * @return List<String> -(List<String>) indicating one or more VR phrases
+ */
@SuppressWarnings("unchecked")
public List<String> getVrCommands() {
- return (List<String>) getObject(String.class, KEY_VR_COMMANDS);
+ return (List<String>) getObject(String.class, KEY_VR_COMMANDS);
}
- /**
- * <p>
- * Sets Voice Recognition Commands </p>
- * <p>If provided, defines one or more VR phrases the recognition of any of
- * which triggers the <i>{@linkplain OnCommand}</i> notification with this
- * cmdID</p>
- * <p>If null, commands will not be accessible by voice commands (when the user
- * hits push-to-talk)
- * </p>
- *
- * @param vrCommands
- * List<String> indicating one or more VR phrases
- * <p>
- * <b>Notes: </b>Optional only if menuParams is provided. If
- * provided, array must contain at least one non-empty (not null,
- * not zero-length, not whitespace only) element</p>
- */
- public AddCommand setVrCommands( List<String> vrCommands) {
+
+ /**
+ * <p>
+ * Sets Voice Recognition Commands </p>
+ * <p>If provided, defines one or more VR phrases the recognition of any of
+ * which triggers the <i>{@linkplain OnCommand}</i> notification with this
+ * cmdID</p>
+ * <p>If null, commands will not be accessible by voice commands (when the user
+ * hits push-to-talk)
+ * </p>
+ *
+ * @param vrCommands List<String> indicating one or more VR phrases
+ * <p>
+ * <b>Notes: </b>Optional only if menuParams is provided. If
+ * provided, array must contain at least one non-empty (not null,
+ * not zero-length, not whitespace only) element</p>
+ */
+ public AddCommand setVrCommands(List<String> vrCommands) {
setParameters(KEY_VR_COMMANDS, vrCommands);
return this;
}
- /**
- * <p>Gets the image to be shown along with a command </p>
- *
- * @return Image -an Image object
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * <p>Gets the image to be shown along with a command </p>
+ *
+ * @return Image -an Image object
+ * @since SmartDeviceLink 2.0
+ */
public Image getCmdIcon() {
- return (Image) getObject(Image.class, KEY_CMD_ICON);
+ return (Image) getObject(Image.class, KEY_CMD_ICON);
}
- /**
- * <p>Sets the Image
- * If provided, defines the image to be be shown along with a command</p>
- * @param cmdIcon
- * <p>an Image obj representing the Image obj shown along with a
- * command</p>
- * <p>
- * <b>Notes: </b>If omitted on supported displays, no (or the
- * default if applicable) icon will be displayed</p>
- * @since SmartDeviceLink 2.0
- */
- public AddCommand setCmdIcon( Image cmdIcon) {
+ /**
+ * <p>Sets the Image
+ * If provided, defines the image to be be shown along with a command</p>
+ *
+ * @param cmdIcon <p>an Image obj representing the Image obj shown along with a
+ * command</p>
+ * <p>
+ * <b>Notes: </b>If omitted on supported displays, no (or the
+ * default if applicable) icon will be displayed</p>
+ * @since SmartDeviceLink 2.0
+ */
+ public AddCommand setCmdIcon(Image cmdIcon) {
setParameters(KEY_CMD_ICON, cmdIcon);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
index 1f5c084bc..991442cea 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.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 androidx.annotation.NonNull;
@@ -41,13 +41,13 @@ import java.util.Hashtable;
/**
* Add Command Response is sent, when AddCommand has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class AddCommandResponse extends RPCResponse {
- /**
- * Constructs a new AddCommandResponse object
- */
+ /**
+ * Constructs a new AddCommandResponse object
+ */
public AddCommandResponse() {
super(FunctionID.ADD_COMMAND.toString());
}
@@ -55,9 +55,11 @@ public class AddCommandResponse extends RPCResponse {
public AddCommandResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new AddCommandResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public AddCommandResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
index d989e8d36..38eed2ed1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
@@ -41,13 +41,13 @@ import java.util.Hashtable;
/**
* <p>Add a SubMenu to the Command Menu</p>
- *
+ *
* <p>A SubMenu can only be added to the Top Level Menu (i.e.a SubMenu cannot be
* added to a SubMenu), and may only contain commands as children</p>
- *
- *
+ *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -109,181 +109,188 @@ import java.util.Hashtable;
* </table>
* <b>Response</b>
* <p>Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the SubMenu was added to the Command Menu successfully</p>
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
* <p>INVALID_ID</p>
* <p>DUPLICATE NAME</p>
- * @since SmartDeviceLink 1.0
+ *
* @see DeleteSubMenu
* @see AddCommand
* @see DeleteCommand
+ * @since SmartDeviceLink 1.0
*/
public class AddSubMenu extends RPCRequest {
- public static final String KEY_POSITION = "position";
- public static final String KEY_MENU_NAME = "menuName";
- public static final String KEY_MENU_ID = "menuID";
- public static final String KEY_MENU_ICON = "menuIcon";
- public static final String KEY_MENU_LAYOUT = "menuLayout";
- public static final String KEY_PARENT_ID = "parentID";
+ public static final String KEY_POSITION = "position";
+ public static final String KEY_MENU_NAME = "menuName";
+ public static final String KEY_MENU_ID = "menuID";
+ public static final String KEY_MENU_ICON = "menuIcon";
+ public static final String KEY_MENU_LAYOUT = "menuLayout";
+ public static final String KEY_PARENT_ID = "parentID";
- /**
- * Constructs a new AddSubMenu object
- */
- public AddSubMenu() {
+ /**
+ * Constructs a new AddSubMenu object
+ */
+ public AddSubMenu() {
super(FunctionID.ADD_SUB_MENU.toString());
}
- /**
- * Constructs a new AddSubMenu object indicated by the Hashtable parameter
- *
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new AddSubMenu object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
public AddSubMenu(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new AddSubMenu object
- * @param menuID an integer object representing a Menu ID
- * <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
- * @param menuName String which will be displayed representing this submenu item
- */
- public AddSubMenu(@NonNull Integer menuID, @NonNull String menuName) {
- this();
- setMenuID(menuID);
- setMenuName(menuName);
- }
- /**
- * Returns an <i>Integer</i> object representing the Menu ID that identifies
- * a sub menu
- *
- * @return Integer -an integer representing the Menu ID that identifies a sub
- * menu
- */
+
+ /**
+ * Constructs a new AddSubMenu object
+ *
+ * @param menuID an integer object representing a Menu ID
+ * <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
+ * @param menuName String which will be displayed representing this submenu item
+ */
+ public AddSubMenu(@NonNull Integer menuID, @NonNull String menuName) {
+ this();
+ setMenuID(menuID);
+ setMenuName(menuName);
+ }
+
+ /**
+ * Returns an <i>Integer</i> object representing the Menu ID that identifies
+ * a sub menu
+ *
+ * @return Integer -an integer representing the Menu ID that identifies a sub
+ * menu
+ */
public Integer getMenuID() {
- return getInteger( KEY_MENU_ID );
+ return getInteger(KEY_MENU_ID);
}
- /**
- * <p>Sets a Menu ID that identifies a sub menu.</p><p> This value is used in
- * {@linkplain AddCommand} to which SubMenu is the parent of the command
- * being added</p>
- *
- *
- * @param menuID
- * an integer object representing a Menu ID
- *
- * <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
- */
+
+ /**
+ * <p>Sets a Menu ID that identifies a sub menu.</p><p> This value is used in
+ * {@linkplain AddCommand} to which SubMenu is the parent of the command
+ * being added</p>
+ *
+ * @param menuID an integer object representing a Menu ID
+ *
+ * <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
+ */
public AddSubMenu setMenuID(@NonNull Integer menuID) {
setParameters(KEY_MENU_ID, menuID);
return this;
}
- /**
- * <p>Returns an <i>Integer</i> object representing the position of menu</p>
- *
- *
- * @return Integer -the value representing the relative position of menus
- */
+
+ /**
+ * <p>Returns an <i>Integer</i> object representing the position of menu</p>
+ *
+ * @return Integer -the value representing the relative position of menus
+ */
public Integer getPosition() {
- return getInteger( KEY_POSITION );
+ return getInteger(KEY_POSITION);
}
- /**
- * Sets a position of menu
- *
- * @param position
- * <p>An Integer object representing the position within the items
- * of the top level Command Menu. 0 will insert at the front, 1
- * will insert after the first existing element, etc. Position of
- * any submenu will always be located before the return and exit
- * options
- * </p>
- * <b>Notes: </b>
- * <ul>
- * <li>
- * Min Value: 0; Max Value: 1000</li>
- * <li>If position is greater than or equal to the number of items
- * on top level, the sub menu will be appended by the end</li>
- * <li>If this parameter is omitted, the entry will be added at
- * the end of the list</li>
- * </ul>
- */
- public AddSubMenu setPosition( Integer position) {
+
+ /**
+ * Sets a position of menu
+ *
+ * @param position <p>An Integer object representing the position within the items
+ * of the top level Command Menu. 0 will insert at the front, 1
+ * will insert after the first existing element, etc. Position of
+ * any submenu will always be located before the return and exit
+ * options
+ * </p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>
+ * Min Value: 0; Max Value: 1000</li>
+ * <li>If position is greater than or equal to the number of items
+ * on top level, the sub menu will be appended by the end</li>
+ * <li>If this parameter is omitted, the entry will be added at
+ * the end of the list</li>
+ * </ul>
+ */
+ public AddSubMenu setPosition(Integer position) {
setParameters(KEY_POSITION, position);
return this;
}
- /**
- * Returns String which is displayed representing this submenu item
- *
- * @return String -a Submenu item's name
- */
+
+ /**
+ * Returns String which is displayed representing this submenu item
+ *
+ * @return String -a Submenu item's name
+ */
public String getMenuName() {
- return getString( KEY_MENU_NAME );
+ return getString(KEY_MENU_NAME);
}
- /**
- * Sets a menuName which is displayed representing this submenu item
- *
- * @param menuName
- * String which will be displayed representing this submenu item
- */
+
+ /**
+ * Sets a menuName which is displayed representing this submenu item
+ *
+ * @param menuName String which will be displayed representing this submenu item
+ */
public AddSubMenu setMenuName(@NonNull String menuName) {
setParameters(KEY_MENU_NAME, menuName);
return this;
}
- /**
- * Returns Image to be be shown along with the submenu item
- *
- * @return Image - the submenu icon
- */
- public Image getMenuIcon() {
- return (Image) getObject(Image.class, KEY_MENU_ICON);
- }
- /**
- * Sets image to be be shown along with the submenu item
- *
- * @param menuIcon
- * Image to be be shown along with the submenu item
- */
- public AddSubMenu setMenuIcon( Image menuIcon) {
+
+ /**
+ * Returns Image to be be shown along with the submenu item
+ *
+ * @return Image - the submenu icon
+ */
+ public Image getMenuIcon() {
+ return (Image) getObject(Image.class, KEY_MENU_ICON);
+ }
+
+ /**
+ * Sets image to be be shown along with the submenu item
+ *
+ * @param menuIcon Image to be be shown along with the submenu item
+ */
+ public AddSubMenu setMenuIcon(Image menuIcon) {
setParameters(KEY_MENU_ICON, menuIcon);
return this;
}
- /**
- * Sets the layout of the submenu screen.
- * @param menuLayout - the menuLayout
- */
- public AddSubMenu setMenuLayout( MenuLayout menuLayout) {
+ /**
+ * Sets the layout of the submenu screen.
+ *
+ * @param menuLayout - the menuLayout
+ */
+ public AddSubMenu setMenuLayout(MenuLayout menuLayout) {
setParameters(KEY_MENU_LAYOUT, menuLayout);
return this;
}
- /**
- * Gets the layout of the submenu screen.
- * @return the MenuLayout
- */
- public MenuLayout getMenuLayout() {
- return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
- }
+ /**
+ * Gets the layout of the submenu screen.
+ *
+ * @return the MenuLayout
+ */
+ public MenuLayout getMenuLayout() {
+ return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
+ }
- /**
- * Sets the parentID.
- *
- * @param parentID unique ID of the sub menu, the command will be added to. If not provided or 0, it will be
- * provided to the top level of the in application menu.
- * @since SmartDeviceLink 7.0.0
- */
- public AddSubMenu setParentID( Integer parentID) {
+ /**
+ * Sets the parentID.
+ *
+ * @param parentID unique ID of the sub menu, the command will be added to. If not provided or 0, it will be
+ * provided to the top level of the in application menu.
+ * @since SmartDeviceLink 7.0.0
+ */
+ public AddSubMenu setParentID(Integer parentID) {
setParameters(KEY_PARENT_ID, parentID);
return this;
}
- /**
- * Gets the parentID.
- *
- * @return Integer unique ID of the sub menu, the command will be added to. If not provided or 0, it will be
- * provided to the top level of the in application menu.
- * @since SmartDeviceLink 7.0.0
- */
- public Integer getParentID() {
- return getInteger(KEY_PARENT_ID);
- }
+ /**
+ * Gets the parentID.
+ *
+ * @return Integer unique ID of the sub menu, the command will be added to. If not provided or 0, it will be
+ * provided to the top level of the in application menu.
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Integer getParentID() {
+ return getInteger(KEY_PARENT_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
index 86893b1b4..29803c746 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.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 androidx.annotation.NonNull;
@@ -41,22 +41,26 @@ import java.util.Hashtable;
/**
* Add SubMenu Response is sent, when AddSubMenu has been called
+ *
* @since SmartDeviceLink 1.0
*/
public class AddSubMenuResponse extends RPCResponse {
- /**
- * Constructs a new AddSubMenuResponse object
- */
+ /**
+ * Constructs a new AddSubMenuResponse object
+ */
public AddSubMenuResponse() {
super(FunctionID.ADD_SUB_MENU.toString());
}
+
public AddSubMenuResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new AddSubMenuResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public AddSubMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
index 55498160a..34930fe4d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -101,18 +101,16 @@ import java.util.Hashtable;
* </tr>
*
* </table>
- *
+ *
* <p><b>Response:</b></p>
- * If a resultCode of "SUCCESS" is returned, the request was accepted by SDL. By the time the corresponding response is received, the Alert will have completed.
- *
+ * If a resultCode of "SUCCESS" is returned, the request was accepted by SDL. By the time the corresponding response is received, the Alert will have completed.
+ *
* <p><b> Non-default Result Codes:</b></p>
* <p>REJECTED</p><p> ABORTED</P>
- *
- *
- * @since SmartDeviceLink 1.0
- *
+ *
* @see Image
* @see SubscribeVehicleData
+ * @since SmartDeviceLink 1.0
*/
public class AirbagStatus extends RPCStruct {
public static final String KEY_DRIVER_AIRBAG_DEPLOYED = "driverAirbagDeployed";
@@ -125,12 +123,15 @@ public class AirbagStatus extends RPCStruct {
public static final String KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED = "passengerKneeAirbagDeployed";
- public AirbagStatus() { }
+ public AirbagStatus() {
+ }
- /** Constructs a new AirbagStatus object indicated by the Hashtable
+ /**
+ * Constructs a new AirbagStatus object indicated by the Hashtable
* parameter
+ *
* @param hash hashtable filled with params to create an instance of this RPC
- * The hash table to use
+ * The hash table to use
*/
public AirbagStatus(Hashtable<String, Object> hash) {
super(hash);
@@ -153,55 +154,70 @@ public class AirbagStatus extends RPCStruct {
setValue(KEY_DRIVER_AIRBAG_DEPLOYED, driverAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getDriverAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setDriverSideAirbagDeployed(@NonNull VehicleDataEventStatus driverSideAirbagDeployed) {
setValue(KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, driverSideAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getDriverSideAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_SIDE_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setDriverCurtainAirbagDeployed(@NonNull VehicleDataEventStatus driverCurtainAirbagDeployed) {
setValue(KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, driverCurtainAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getDriverCurtainAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setPassengerAirbagDeployed(@NonNull VehicleDataEventStatus passengerAirbagDeployed) {
setValue(KEY_PASSENGER_AIRBAG_DEPLOYED, passengerAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getPassengerAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setPassengerCurtainAirbagDeployed(@NonNull VehicleDataEventStatus passengerCurtainAirbagDeployed) {
setValue(KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, passengerCurtainAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getPassengerCurtainAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setDriverKneeAirbagDeployed(@NonNull VehicleDataEventStatus driverKneeAirbagDeployed) {
setValue(KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, driverKneeAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getDriverKneeAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_KNEE_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setPassengerSideAirbagDeployed(@NonNull VehicleDataEventStatus passengerSideAirbagDeployed) {
setValue(KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, passengerSideAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getPassengerSideAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED);
}
+
public AirbagStatus setPassengerKneeAirbagDeployed(@NonNull VehicleDataEventStatus passengerKneeAirbagDeployed) {
setValue(KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, passengerKneeAirbagDeployed);
return this;
}
+
public VehicleDataEventStatus getPassengerKneeAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED);
}
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 10a2039c8..4c55eddcc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,9 +40,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.
- *
+ * <p>
* 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
* specified timeout has elapsed, or the Alert is preempted</li>
@@ -61,7 +61,7 @@ import java.util.List;
* </ul>
* </li>
* </ul>
- *
+ *
* <p><b>HMILevel needs to be FULL or LIMITED.</b></p>
* <b>If the app has been granted function group Notification the HMILevel can
* also be BACKGROUND</b>
@@ -155,311 +155,305 @@ import java.util.List;
* <td>SmartDeviceLink 6.0.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
- *
- *
+ *
* @see GetVehicleData
- * @see OnVehicleData
+ * @see OnVehicleData
* @see Show
* @see Speak
+ * @since SmartDeviceLink 1.0
*/
public class Alert extends RPCRequest {
- public static final String KEY_PLAY_TONE = "playTone";
- public static final String KEY_DURATION = "duration";
- public static final String KEY_ALERT_TEXT_1 = "alertText1";
- public static final String KEY_ALERT_TEXT_2 = "alertText2";
- public static final String KEY_ALERT_TEXT_3 = "alertText3";
+ public static final String KEY_PLAY_TONE = "playTone";
+ public static final String KEY_DURATION = "duration";
+ public static final String KEY_ALERT_TEXT_1 = "alertText1";
+ public static final String KEY_ALERT_TEXT_2 = "alertText2";
+ public static final String KEY_ALERT_TEXT_3 = "alertText3";
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";
+ 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";
- /**
- * Constructs a new Alert object
- */
- public Alert() {
+ /**
+ * Constructs a new Alert object
+ */
+ public Alert() {
super(FunctionID.ALERT.toString());
}
- /**
- * <p>Constructs a new Alert object indicated by the Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a new Alert object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public Alert(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Gets the text which is displayed in the first field of the display during
- * the Alert
- *
- * @return String - a String value representing the text which is displayed
- * in the first field during the Alert
- */
+
+ /**
+ * Gets the text which is displayed in the first field of the display during
+ * the Alert
+ *
+ * @return String - a String value representing the text which is displayed
+ * in the first field during the Alert
+ */
public String getAlertText1() {
return getString(KEY_ALERT_TEXT_1);
}
- /**
- * Sets the String to be displayed in the first field of the display during
- * the Alert
- *
- * @param alertText1
- * String Value
- *
- * <p><b>Notes: </b></p>
- * <ul>
- * <li>Length is limited to what is indicated in <i>
- * {@linkplain RegisterAppInterface}</i> response</li>
- * <li>If omitted, top display line will be cleared</li>
- * <li>Text is always centered</li>
- * </ul>
- */
- public Alert setAlertText1( String alertText1) {
+
+ /**
+ * Sets the String to be displayed in the first field of the display during
+ * the Alert
+ *
+ * @param alertText1 String Value
+ * <p>
+ * : </b></p>
+ * <ul>
+ * <li>Length is limited to what is indicated in <i>
+ * {@linkplain RegisterAppInterface}</i> response</li>
+ * <li>If omitted, top display line will be cleared</li>
+ * <li>Text is always centered</li>
+ * </ul>
+ */
+ public Alert setAlertText1(String alertText1) {
setParameters(KEY_ALERT_TEXT_1, alertText1);
return this;
}
- /**
- * Gets the text which is displayed in the second field of the display
- * during the Alert
- *
- * @return String -a String value representing the text which is displayed
- * in the second field during the Alert
- */
+
+ /**
+ * Gets the text which is displayed in the second field of the display
+ * during the Alert
+ *
+ * @return String -a String value representing the text which is displayed
+ * in the second field during the Alert
+ */
public String getAlertText2() {
- return getString(KEY_ALERT_TEXT_2);
+ return getString(KEY_ALERT_TEXT_2);
}
- /**
- * Sets the String to be displayed in the second field of the display during
- * the Alert
- *
- * @param alertText2
- * String Value
- *
- * <p><b>Notes: </b></p>
- * <ul>
- * <li>Only permitted if HMI supports a second display line</li>
- * <li>Length is limited to what is indicated in <i>
- * {@linkplain RegisterAppInterface}</i> response</li>
- * <li>If omitted, second display line will be cleared</li>
- * <li>Text is always centered</li>
- * </ul>
- */
- public Alert setAlertText2( String alertText2) {
+
+ /**
+ * Sets the String to be displayed in the second field of the display during
+ * the Alert
+ *
+ * @param alertText2 String Value
+ * <p>
+ * : </b></p>
+ * <ul>
+ * <li>Only permitted if HMI supports a second display line</li>
+ * <li>Length is limited to what is indicated in <i>
+ * {@linkplain RegisterAppInterface}</i> response</li>
+ * <li>If omitted, second display line will be cleared</li>
+ * <li>Text is always centered</li>
+ * </ul>
+ */
+ public Alert setAlertText2(String alertText2) {
setParameters(KEY_ALERT_TEXT_2, alertText2);
return this;
}
- /**
- * Gets the text which is displayed in the third field of the display during
- * the Alert
- *
- * @return String -a String value representing the text which is displayed
- * in the third field during the Alert
- *
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets the text which is displayed in the third field of the display during
+ * the Alert
+ *
+ * @return String -a String value representing the text which is displayed
+ * in the third field during the Alert
+ * @since SmartDeviceLink 2.0
+ */
public String getAlertText3() {
- return getString(KEY_ALERT_TEXT_3);
+ return getString(KEY_ALERT_TEXT_3);
}
- /**
- * Sets the String to be displayed in the third field of the display during
- * the Alert
- *
- * @param alertText3
- * String Value
- *
- * <p> <b>Notes: </b></p>
- * <ul>
- * <li>Only permitted if HMI supports a third display line</li>
- * <li>Length is limited to what is indicated in <i>
- * {@linkplain RegisterAppInterface}</i> response</li>
- * <li>If omitted, third display line will be cleared</li>
- * <li>Text is always centered</li>
- * </ul>
- *
- * @since SmartDeviceLink 2.0
- */
- public Alert setAlertText3( String alertText3) {
+ /**
+ * Sets the String to be displayed in the third field of the display during
+ * the Alert
+ *
+ * @param alertText3 String Value
+ * <p>
+ * s: </b></p>
+ * <ul>
+ * <li>Only permitted if HMI supports a third display line</li>
+ * <li>Length is limited to what is indicated in <i>
+ * {@linkplain RegisterAppInterface}</i> response</li>
+ * <li>If omitted, third display line will be cleared</li>
+ * <li>Text is always centered</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Alert setAlertText3(String alertText3) {
setParameters(KEY_ALERT_TEXT_3, alertText3);
return this;
}
- /**
- * Gets TTSChunk[], the Array of type TTSChunk which, taken together,
- * specify what is to be spoken to the user
- *
- * @return List -a List<TTSChunk> value specify what is to be spoken to
- * the user
- */
+
+ /**
+ * Gets TTSChunk[], the Array of type TTSChunk which, taken together,
+ * specify what is to be spoken to the user
+ *
+ * @return List -a List<TTSChunk> value specify what is to be spoken to
+ * the user
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getTtsChunks() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
}
- /**
- * Sets array of type TTSChunk which, taken together, specify what is to be
- * spoken to the user
- *
- * @param ttsChunks
- *
- * <p> <b>Notes: </b>Array must have a least one element</p>
- */
- public Alert setTtsChunks( List<TTSChunk> ttsChunks) {
+
+ /**
+ * Sets array of type TTSChunk which, taken together, specify what is to be
+ * spoken to the user
+ *
+ * @param ttsChunks <p> <b>Notes: </b>Array must have a least one element</p>
+ */
+ public Alert setTtsChunks(List<TTSChunk> ttsChunks) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
return this;
}
- /**
- * Gets the duration of the displayed portion of the alert, in milliseconds
- *
- * @return Integer -an Integer value representing the duration of the
- * displayed portion of the alert, in milliseconds
- */
+
+ /**
+ * Gets the duration of the displayed portion of the alert, in milliseconds
+ *
+ * @return Integer -an Integer value representing the duration of the
+ * displayed portion of the alert, in milliseconds
+ */
public Integer getDuration() {
- return getInteger(KEY_DURATION);
+ return getInteger(KEY_DURATION);
}
- /**
- * <p>Sets 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</p>
- *
- *
- * @param duration
- * the Integer values representing the duration time, in
- * milliseconds
- * <p>
- * <b>Notes: </b></p>
- * <ul>
- * <li>Min Value: 3000; Max Value: 10000</li>
- * <li>If omitted, the default is 5000 milliseconds</li>
- * </ul>
- */
- public Alert setDuration( Integer duration) {
+
+ /**
+ * <p>Sets 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</p>
+ *
+ * @param duration the Integer values representing the duration time, in
+ * milliseconds
+ * <p>
+ * <b>Notes: </b></p>
+ * <ul>
+ * <li>Min Value: 3000; Max Value: 10000</li>
+ * <li>If omitted, the default is 5000 milliseconds</li>
+ * </ul>
+ */
+ public Alert setDuration(Integer duration) {
setParameters(KEY_DURATION, duration);
return this;
}
- /**
- * Gets a Boolean value representing the alert tone
- *
- * @return Boolean -If TRUE, means an alert tone will be played before the
- * TTS (if any) is spoken
- */
+
+ /**
+ * Gets a Boolean value representing the alert tone
+ *
+ * @return Boolean -If TRUE, means an alert tone will be played before the
+ * TTS (if any) is spoken
+ */
public Boolean getPlayTone() {
- return getBoolean(KEY_PLAY_TONE);
+ return getBoolean(KEY_PLAY_TONE);
}
- /**
- * Sets whether the alert tone should be played before the TTS (if any) is
- * spoken
- *
- * @param playTone
- * a Boolean value which specifies whether the alert tone should
- * be played before the TTS (if any) is spoken
- *
- * <p> <b>Notes: </b>If omitted, default is true</p>
- */
- public Alert setPlayTone( Boolean playTone) {
+
+ /**
+ * Sets whether the alert tone should be played before the TTS (if any) is
+ * spoken
+ *
+ * @param playTone a Boolean value which specifies whether the alert tone should
+ * be played before the TTS (if any) is spoken
+ *
+ * <p> <b>Notes: </b>If omitted, default is true</p>
+ */
+ public Alert setPlayTone(Boolean playTone) {
setParameters(KEY_PLAY_TONE, playTone);
return this;
}
- /**
- * Gets the SoftButton List object
- *
- * @return List<SoftButton> -a List<SoftButton> representing the List
- * object
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets the SoftButton List object
+ *
+ * @return List<SoftButton> -a List<SoftButton> representing the List
+ * object
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<SoftButton> getSoftButtons() {
- return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
+ return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
- /**
- * Sets the SoftButtons
- *
- * @param softButtons
- * a List<SoftButton> value
- * <p>
- * <b>Notes: </b></p>
- * <ul>
- * <li>If omitted on supported displays, the alert will not have
- * any SoftButton</li>
- * <li>ArrayMin: 0</li>
- * <li>ArrayMax: 4</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public Alert setSoftButtons( List<SoftButton> softButtons) {
+ /**
+ * Sets the SoftButtons
+ *
+ * @param softButtons a List<SoftButton> value
+ * <p>
+ * <b>Notes: </b></p>
+ * <ul>
+ * <li>If omitted on supported displays, the alert will not have
+ * any SoftButton</li>
+ * <li>ArrayMin: 0</li>
+ * <li>ArrayMax: 4</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Alert setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
- /**
- * 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);
+ /**
+ * 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);
}
- /**
- * 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 Alert 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 Alert setProgressIndicator(Boolean progressIndicator) {
setParameters(KEY_PROGRESS_INDICATOR, progressIndicator);
return this;
}
- /**
- * 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
- */
+ /**
+ * 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);
- }
+ 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 Alert setCancelID( Integer cancelID) {
+ /**
+ * 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 Alert setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
-
- /**
- * <p>Sets the Image
- * If provided, defines the image to be shown along with the alert</p>
- * @param alertIcon
- * <p>an Image object representing the Image shown along with the alert</p>
- * <p>
- * <b>Notes: </b>If omitted on supported displays, no (or the
- * default if applicable) icon will be displayed</p>
- */
- public Alert setAlertIcon( Image alertIcon) {
+
+ /**
+ * <p>Sets the Image
+ * If provided, defines the image to be shown along with the alert</p>
+ *
+ * @param alertIcon <p>an Image object representing the Image shown along with the alert</p>
+ * <p>
+ * <b>Notes: </b>If omitted on supported displays, no (or the
+ * default if applicable) icon will be displayed</p>
+ */
+ public Alert setAlertIcon(Image alertIcon) {
setParameters(KEY_ALERT_ICON, alertIcon);
return this;
}
- /**
- * <p>Gets the image to be shown along with the alert </p>
- * @return Image -an Image object
- */
- public Image getAlertIcon() {
- return (Image) getObject(Image.class, KEY_ALERT_ICON);
- }
+ /**
+ * <p>Gets the image to be shown along with the alert </p>
+ *
+ * @return Image -an Image object
+ */
+ public Image getAlertIcon() {
+ return (Image) getObject(Image.class, KEY_ALERT_ICON);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuver.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuver.java
index 9e5fb32b7..eb1009993 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuver.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuver.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,86 +42,80 @@ import java.util.List;
* navigation instructions. Shown information will be taken from the ShowConstantTBT function
* </p>
* <p>Function Group: Navigation</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
- *
- * @since SmartDeviceLink 2.0
+ *
* @see ShowConstantTbt
+ * @since SmartDeviceLink 2.0
*/
-public class AlertManeuver extends RPCRequest{
+public class AlertManeuver extends RPCRequest {
- public static final String KEY_TTS_CHUNKS = "ttsChunks";
+ public static final String KEY_TTS_CHUNKS = "ttsChunks";
public static final String KEY_SOFT_BUTTONS = "softButtons";
/**
* Constructs a new AlertManeuver object
*/
- public AlertManeuver(){
+ public AlertManeuver() {
super(FunctionID.ALERT_MANEUVER.toString());
}
/**
- *
* <p>Constructs a new AlertManeuver object indicated by the Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @param hash The Hashtable to use
*/
- public AlertManeuver(Hashtable<String, Object> hash){
+ public AlertManeuver(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Gets the SoftButton List object
- *
+ *
* @return List<SoftButton> -a List<SoftButton> representing the List object
* @since SmartDeviceLink 2.0
*/
@SuppressWarnings("unchecked")
- public List<SoftButton> getSoftButtons(){
+ public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
/**
* Sets the SoftButtons
*
- * @param softButtons
- * a List<SoftButton> value
- * <p>
- * <b>Notes: </b></p>
- * <ul>
- * <li>If omitted on supported displays, the alert will not have any SoftButton</li>
- * <li>ArrayMin: 0</li>
- * <li>ArrayMax: 4</li>
- * </ul>
+ * @param softButtons a List<SoftButton> value
+ * <p>
+ * <b>Notes: </b></p>
+ * <ul>
+ * <li>If omitted on supported displays, the alert will not have any SoftButton</li>
+ * <li>ArrayMin: 0</li>
+ * <li>ArrayMax: 4</li>
+ * </ul>
* @since SmartDeviceLink 2.0
*/
- public AlertManeuver setSoftButtons( List<SoftButton> softButtons) {
+ public AlertManeuver setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
/**
* Gets TTSChunk[], the Array of type TTSChunk which, taken together, specify what is to be spoken to the user
- *
+ *
* @return List -a List<TTSChunk> value specify what is to be spoken to the user
*/
@SuppressWarnings("unchecked")
- public List<TTSChunk> getTtsChunks(){
+ public List<TTSChunk> getTtsChunks() {
return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
}
/**
* Sets array of type TTSChunk which, taken together, specify what is to be spoken to the user
*
- * @param ttsChunks
- * <p>
- * <b>Notes: </b></p>Array must have a least one element
+ * @param ttsChunks <p>
+ * <b>Notes: </b></p>Array must have a least one element
*/
- public AlertManeuver setTtsChunks( List<TTSChunk> ttsChunks) {
+ public AlertManeuver setTtsChunks(List<TTSChunk> ttsChunks) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
index 4b4549979..0cebf50c6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,10 +41,10 @@ import java.util.Hashtable;
/**
* Alert Maneuver Response is sent, when AlertManeuver has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
-public class AlertManeuverResponse extends RPCResponse{
+public class AlertManeuverResponse extends RPCResponse {
/**
* Constructs a new AlertManeuverResponse object
@@ -52,22 +52,23 @@ public class AlertManeuverResponse extends RPCResponse{
public AlertManeuverResponse() {
super(FunctionID.ALERT_MANEUVER.toString());
}
-
+
/**
- * <p>
- * Constructs a new AlertManeuverResponse object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new AlertManeuverResponse object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public AlertManeuverResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new AlertManeuverResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public AlertManeuverResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
index 3ad14972b..68b18b7c6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,33 +41,34 @@ import java.util.Hashtable;
/**
* Alert Response is sent, when Alert has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class AlertResponse extends RPCResponse {
- public static final String KEY_TRY_AGAIN_TIME = "tryAgainTime";
+ public static final String KEY_TRY_AGAIN_TIME = "tryAgainTime";
- /**
- * Constructs a new AlertResponse object
- */
+ /**
+ * Constructs a new AlertResponse object
+ */
public AlertResponse() {
super(FunctionID.ALERT.toString());
}
- /**
- * <p>Constructs a new AlertResponse object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new AlertResponse object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public AlertResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new AlertResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public AlertResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -75,10 +76,12 @@ public class AlertResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
+
public Integer getTryAgainTime() {
return getInteger(KEY_TRY_AGAIN_TIME);
}
- public AlertResponse setTryAgainTime( Integer tryAgainTime) {
+
+ public AlertResponse setTryAgainTime(Integer tryAgainTime) {
setParameters(KEY_TRY_AGAIN_TIME, tryAgainTime);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java
index b07e918d1..7d33b9b50 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppInfo.java
@@ -39,94 +39,113 @@ import java.util.Hashtable;
public class AppInfo extends RPCStruct {
- public static final String KEY_APP_DISPLAY_NAME = "appDisplayName";
- public static final String KEY_APP_BUNDLE_ID = "appBundleID";
- public static final String KEY_APP_VERSION = "appVersion";
- public static final String KEY_APP_ICON = "appIcon";
-
- /**
- * Constructs a new AppInfo object
- */
- public AppInfo() { }
-
- /**
- * Constructs a new AppInfo object indicated by the Hashtable parameter
- * @param hash The Hashtable to use
- */
- public AppInfo(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a new AppInfo object
- * @param appDisplayName - name displayed for the mobile application on the mobile device
- * @param appBundleID - package name of the application.
- * @param appVersion - build version number of this particular mobile app.
- */
- public AppInfo(@NonNull String appDisplayName, String appBundleID, String appVersion){
- this();
- setAppDisplayName(appDisplayName);
- setAppBundleID(appBundleID);
- setAppVersion(appVersion);
- }
-
- /** Sets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
- * @param appDisplayName - name displayed for the mobile application on the mobile device.
- */
- public AppInfo setAppDisplayName(@NonNull String appDisplayName) {
+ public static final String KEY_APP_DISPLAY_NAME = "appDisplayName";
+ public static final String KEY_APP_BUNDLE_ID = "appBundleID";
+ public static final String KEY_APP_VERSION = "appVersion";
+ public static final String KEY_APP_ICON = "appIcon";
+
+ /**
+ * Constructs a new AppInfo object
+ */
+ public AppInfo() {
+ }
+
+ /**
+ * Constructs a new AppInfo object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public AppInfo(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new AppInfo object
+ *
+ * @param appDisplayName - name displayed for the mobile application on the mobile device
+ * @param appBundleID - package name of the application.
+ * @param appVersion - build version number of this particular mobile app.
+ */
+ public AppInfo(@NonNull String appDisplayName, String appBundleID, String appVersion) {
+ this();
+ setAppDisplayName(appDisplayName);
+ setAppBundleID(appBundleID);
+ setAppVersion(appVersion);
+ }
+
+ /**
+ * Sets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
+ *
+ * @param appDisplayName - name displayed for the mobile application on the mobile device.
+ */
+ public AppInfo setAppDisplayName(@NonNull String appDisplayName) {
setValue(KEY_APP_DISPLAY_NAME, appDisplayName);
return this;
}
- /** Gets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
- * @return appDisplayName - name displayed for the mobile application on the mobile device.
- */
- public String getAppDisplayName() {
- return getString(KEY_APP_DISPLAY_NAME);
- }
-
- /** Sets package name of the Android application. This supports App Launch strategies for each platform.
- * @param appBundleID - package name of the application
- */
- public AppInfo setAppBundleID(@NonNull String appBundleID) {
+ /**
+ * Gets the name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).
+ *
+ * @return appDisplayName - name displayed for the mobile application on the mobile device.
+ */
+ public String getAppDisplayName() {
+ return getString(KEY_APP_DISPLAY_NAME);
+ }
+
+ /**
+ * Sets package name of the Android application. This supports App Launch strategies for each platform.
+ *
+ * @param appBundleID - package name of the application
+ */
+ public AppInfo setAppBundleID(@NonNull String appBundleID) {
setValue(KEY_APP_BUNDLE_ID, appBundleID);
return this;
}
- /** Gets package name of the Android application. This supports App Launch strategies for each platform.
- * @return appBundleID - package name of the application.
- */
- public String getAppBundleID() {
- return getString(KEY_APP_BUNDLE_ID);
- }
-
- /** Sets build version number of this particular mobile app.
- * @param appVersion - build version number of this particular mobile app.
- */
- public AppInfo setAppVersion(@NonNull String appVersion) {
+ /**
+ * Gets package name of the Android application. This supports App Launch strategies for each platform.
+ *
+ * @return appBundleID - package name of the application.
+ */
+ public String getAppBundleID() {
+ return getString(KEY_APP_BUNDLE_ID);
+ }
+
+ /**
+ * Sets build version number of this particular mobile app.
+ *
+ * @param appVersion - build version number of this particular mobile app.
+ */
+ public AppInfo setAppVersion(@NonNull String appVersion) {
setValue(KEY_APP_VERSION, appVersion);
return this;
}
- /** Gets build version number of this particular mobile app.
- * @return appVersion - build version number of this particular mobile app.
- */
- public String getAppVersion() {
- return getString(KEY_APP_VERSION);
- }
-
- /** Sets file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration).
- * @param appIcon - file reference to the icon utilized by this app
- */
- public AppInfo setAppIcon( String appIcon) {
+ /**
+ * Gets build version number of this particular mobile app.
+ *
+ * @return appVersion - build version number of this particular mobile app.
+ */
+ public String getAppVersion() {
+ return getString(KEY_APP_VERSION);
+ }
+
+ /**
+ * Sets file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration).
+ *
+ * @param appIcon - file reference to the icon utilized by this app
+ */
+ public AppInfo setAppIcon(String appIcon) {
setValue(KEY_APP_ICON, appIcon);
return this;
}
- /** Gets build version number of this particular mobile app.
- * @return appIcon - build version number of this particular mobile app.
- */
- public String getAppIcon() {
- return getString(KEY_APP_ICON);
- }
+ /**
+ * Gets build version number of this particular mobile app.
+ *
+ * @return appIcon - build version number of this particular mobile app.
+ */
+ public String getAppIcon() {
+ return getString(KEY_APP_ICON);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java
index 3f46cbb7a..b592e1414 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceCapability.java
@@ -40,93 +40,99 @@ import java.util.Hashtable;
public class AppServiceCapability extends RPCStruct {
- public static final String KEY_UPDATE_REASON = "updateReason";
- public static final String KEY_UPDATED_APP_SERVICE_RECORD = "updatedAppServiceRecord";
+ public static final String KEY_UPDATE_REASON = "updateReason";
+ public static final String KEY_UPDATED_APP_SERVICE_RECORD = "updatedAppServiceRecord";
- // Constructors
+ // Constructors
- public AppServiceCapability(){}
+ public AppServiceCapability() {
+ }
- /**
- * @param hash of parameters
- */
- public AppServiceCapability(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * @param hash of parameters
+ */
+ public AppServiceCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * @param updatedAppServiceRecord -
- */
- public AppServiceCapability(@NonNull AppServiceRecord updatedAppServiceRecord){
- this();
- setUpdatedAppServiceRecord(updatedAppServiceRecord);
- }
+ /**
+ * @param updatedAppServiceRecord -
+ */
+ public AppServiceCapability(@NonNull AppServiceRecord updatedAppServiceRecord) {
+ this();
+ setUpdatedAppServiceRecord(updatedAppServiceRecord);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
- * @param updateReason -
- */
- public AppServiceCapability setUpdateReason( ServiceUpdateReason updateReason) {
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ *
+ * @param updateReason -
+ */
+ public AppServiceCapability setUpdateReason(ServiceUpdateReason updateReason) {
setValue(KEY_UPDATE_REASON, updateReason);
return this;
}
- /**
- * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
- * @return updateReason - The updateReason
- */
- public ServiceUpdateReason getUpdateReason(){
- return (ServiceUpdateReason) getObject(ServiceUpdateReason.class, KEY_UPDATE_REASON);
- }
-
- /**
- * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
- * @param updatedAppServiceRecord -
- */
- public AppServiceCapability setUpdatedAppServiceRecord( AppServiceRecord updatedAppServiceRecord) {
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ *
+ * @return updateReason - The updateReason
+ */
+ public ServiceUpdateReason getUpdateReason() {
+ return (ServiceUpdateReason) getObject(ServiceUpdateReason.class, KEY_UPDATE_REASON);
+ }
+
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ *
+ * @param updatedAppServiceRecord -
+ */
+ public AppServiceCapability setUpdatedAppServiceRecord(AppServiceRecord updatedAppServiceRecord) {
setValue(KEY_UPDATED_APP_SERVICE_RECORD, updatedAppServiceRecord);
return this;
}
- /**
- * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
- * @return updateReason - The updateReason
- */
- public AppServiceRecord getUpdatedAppServiceRecord(){
- return (AppServiceRecord) getObject(AppServiceRecord.class, KEY_UPDATED_APP_SERVICE_RECORD);
- }
-
- /**
- * Helper method to compare an AppServiceCapability to this instance.
- * @param capability the AppServiceCapability to compare to this one
- * @return if both AppServiceCapability objects refer to the same service
- */
- public boolean matchesAppService(AppServiceCapability capability){
- if(capability != null){
- AppServiceRecord appServiceRecord = getUpdatedAppServiceRecord();
- AppServiceRecord otherASR = capability.getUpdatedAppServiceRecord();
-
- if(appServiceRecord != null && otherASR != null) {
- // If both service IDs exists we can compare them. If either is null we can't use
- // only this check.
- if(appServiceRecord.getServiceID() != null && otherASR.getServiceID() != null){
- //return whether the app service IDs are equal or not
- return appServiceRecord.getServiceID().equalsIgnoreCase(otherASR.getServiceID());
- }else{
- AppServiceManifest manifest = appServiceRecord.getServiceManifest();
- AppServiceManifest otherManifest = otherASR.getServiceManifest();
- if(manifest != null && otherManifest != null){
- //Check the service names, if they are the same it can be assumed they are the same service
- return (manifest.getServiceName() != null && manifest.getServiceName().equalsIgnoreCase(otherManifest.getServiceName()));
- }
- }
- }
- }
- // If it got to this point it was not the same
- return false;
- }
+ /**
+ * Only included in OnSystemCapabilityUpdated. Update reason for this service record.
+ *
+ * @return updateReason - The updateReason
+ */
+ public AppServiceRecord getUpdatedAppServiceRecord() {
+ return (AppServiceRecord) getObject(AppServiceRecord.class, KEY_UPDATED_APP_SERVICE_RECORD);
+ }
+
+ /**
+ * Helper method to compare an AppServiceCapability to this instance.
+ *
+ * @param capability the AppServiceCapability to compare to this one
+ * @return if both AppServiceCapability objects refer to the same service
+ */
+ public boolean matchesAppService(AppServiceCapability capability) {
+ if (capability != null) {
+ AppServiceRecord appServiceRecord = getUpdatedAppServiceRecord();
+ AppServiceRecord otherASR = capability.getUpdatedAppServiceRecord();
+
+ if (appServiceRecord != null && otherASR != null) {
+ // If both service IDs exists we can compare them. If either is null we can't use
+ // only this check.
+ if (appServiceRecord.getServiceID() != null && otherASR.getServiceID() != null) {
+ //return whether the app service IDs are equal or not
+ return appServiceRecord.getServiceID().equalsIgnoreCase(otherASR.getServiceID());
+ } else {
+ AppServiceManifest manifest = appServiceRecord.getServiceManifest();
+ AppServiceManifest otherManifest = otherASR.getServiceManifest();
+ if (manifest != null && otherManifest != null) {
+ //Check the service names, if they are the same it can be assumed they are the same service
+ return (manifest.getServiceName() != null && manifest.getServiceName().equalsIgnoreCase(otherManifest.getServiceName()));
+ }
+ }
+ }
+ }
+ // If it got to this point it was not the same
+ return false;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java
index 529815cfc..d0a33f716 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceData.java
@@ -38,106 +38,107 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- Contains all the current data of the app service. The serviceType will link to which of the service data objects are
- included in this object (e.g. if the service type is MEDIA, the mediaServiceData param should be included).
+ * Contains all the current data of the app service. The serviceType will link to which of the service data objects are
+ * included in this object (e.g. if the service type is MEDIA, the mediaServiceData param should be included).
*/
public class AppServiceData extends RPCStruct {
- public static final String KEY_SERVICE_TYPE = "serviceType";
- public static final String KEY_SERVICE_ID = "serviceID";
- public static final String KEY_MEDIA_SERVICE_DATA = "mediaServiceData";
- public static final String KEY_WEATHER_SERVICE_DATA = "weatherServiceData";
- public static final String KEY_NAVIGATION_SERVICE_DATA = "navigationServiceData";
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_MEDIA_SERVICE_DATA = "mediaServiceData";
+ public static final String KEY_WEATHER_SERVICE_DATA = "weatherServiceData";
+ public static final String KEY_NAVIGATION_SERVICE_DATA = "navigationServiceData";
- // Constructors
- public AppServiceData() { }
+ // Constructors
+ public AppServiceData() {
+ }
- public AppServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public AppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public AppServiceData(@NonNull String serviceType, @NonNull String serviceId) {
- this();
- setServiceType(serviceType);
- setServiceID(serviceId);
- }
+ public AppServiceData(@NonNull String serviceType, @NonNull String serviceId) {
+ this();
+ setServiceType(serviceType);
+ setServiceID(serviceId);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param serviceType -
- */
- public AppServiceData setServiceType(@NonNull String serviceType) {
+ /**
+ * @param serviceType -
+ */
+ public AppServiceData setServiceType(@NonNull String serviceType) {
setValue(KEY_SERVICE_TYPE, serviceType);
return this;
}
- /**
- * @return serviceType -
- */
- public String getServiceType() {
- return getString(KEY_SERVICE_TYPE);
- }
-
- /**
- * @param serviceId -
- */
- public AppServiceData setServiceID(@NonNull String serviceId) {
+ /**
+ * @return serviceType -
+ */
+ public String getServiceType() {
+ return getString(KEY_SERVICE_TYPE);
+ }
+
+ /**
+ * @param serviceId -
+ */
+ public AppServiceData setServiceID(@NonNull String serviceId) {
setValue(KEY_SERVICE_ID, serviceId);
return this;
}
- /**
- * @return serviceId -
- */
- public String getServiceID() {
- return getString(KEY_SERVICE_ID);
- }
-
- /**
- * @param mediaServiceData -
- */
- public AppServiceData setMediaServiceData( MediaServiceData mediaServiceData) {
+ /**
+ * @return serviceId -
+ */
+ public String getServiceID() {
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * @param mediaServiceData -
+ */
+ public AppServiceData setMediaServiceData(MediaServiceData mediaServiceData) {
setValue(KEY_MEDIA_SERVICE_DATA, mediaServiceData);
return this;
}
- /**
- * @return mediaServiceData -
- */
- public MediaServiceData getMediaServiceData() {
- return (MediaServiceData) getObject(MediaServiceData.class,KEY_MEDIA_SERVICE_DATA);
- }
-
- /**
- * @param weatherServiceData -
- */
- public AppServiceData setWeatherServiceData( WeatherServiceData weatherServiceData) {
+ /**
+ * @return mediaServiceData -
+ */
+ public MediaServiceData getMediaServiceData() {
+ return (MediaServiceData) getObject(MediaServiceData.class, KEY_MEDIA_SERVICE_DATA);
+ }
+
+ /**
+ * @param weatherServiceData -
+ */
+ public AppServiceData setWeatherServiceData(WeatherServiceData weatherServiceData) {
setValue(KEY_WEATHER_SERVICE_DATA, weatherServiceData);
return this;
}
- /**
- * @return weatherServiceData -
- */
- public WeatherServiceData getWeatherServiceData() {
- return (WeatherServiceData) getObject(WeatherServiceData.class,KEY_WEATHER_SERVICE_DATA);
- }
-
- /**
- * @param navigationServiceData -
- */
- public AppServiceData setNavigationServiceData( NavigationServiceData navigationServiceData) {
+ /**
+ * @return weatherServiceData -
+ */
+ public WeatherServiceData getWeatherServiceData() {
+ return (WeatherServiceData) getObject(WeatherServiceData.class, KEY_WEATHER_SERVICE_DATA);
+ }
+
+ /**
+ * @param navigationServiceData -
+ */
+ public AppServiceData setNavigationServiceData(NavigationServiceData navigationServiceData) {
setValue(KEY_NAVIGATION_SERVICE_DATA, navigationServiceData);
return this;
}
- /**
- * @return navigationServiceData -
- */
- public NavigationServiceData getNavigationServiceData() {
- return (NavigationServiceData) getObject(NavigationServiceData.class, KEY_NAVIGATION_SERVICE_DATA);
- }
+ /**
+ * @return navigationServiceData -
+ */
+ public NavigationServiceData getNavigationServiceData() {
+ return (NavigationServiceData) getObject(NavigationServiceData.class, KEY_NAVIGATION_SERVICE_DATA);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java
index 9de0201b9..4ee8b517f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceManifest.java
@@ -42,228 +42,253 @@ import java.util.Hashtable;
import java.util.List;
/**
- * This manifest contains all the information necessary for the service to be
- * published, activated, and allow consumers to interact with it
+ * This manifest contains all the information necessary for the service to be
+ * published, activated, and allow consumers to interact with it
*/
public class AppServiceManifest extends RPCStruct {
- public static final String KEY_SERVICE_NAME = "serviceName";
- public static final String KEY_SERVICE_TYPE = "serviceType";
- public static final String KEY_SERVICE_ICON = "serviceIcon";
- public static final String KEY_ALLOW_APP_CONSUMERS = "allowAppConsumers";
- public static final String KEY_RPC_SPEC_VERSION = "rpcSpecVersion";
- public static final String KEY_HANDLED_RPCS = "handledRPCs";
- public static final String KEY_MEDIA_SERVICE_MANIFEST = "mediaServiceManifest";
- public static final String KEY_WEATHER_SERVICE_MANIFEST = "weatherServiceManifest";
- public static final String KEY_NAVIGATION_SERVICE_MANIFEST = "navigationServiceManifest";
+ public static final String KEY_SERVICE_NAME = "serviceName";
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SERVICE_ICON = "serviceIcon";
+ public static final String KEY_ALLOW_APP_CONSUMERS = "allowAppConsumers";
+ public static final String KEY_RPC_SPEC_VERSION = "rpcSpecVersion";
+ public static final String KEY_HANDLED_RPCS = "handledRPCs";
+ public static final String KEY_MEDIA_SERVICE_MANIFEST = "mediaServiceManifest";
+ public static final String KEY_WEATHER_SERVICE_MANIFEST = "weatherServiceManifest";
+ public static final String KEY_NAVIGATION_SERVICE_MANIFEST = "navigationServiceManifest";
- // Constructors
- public AppServiceManifest() { }
+ // Constructors
+ public AppServiceManifest() {
+ }
+
+ public AppServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructor that takes in the mandatory parameters.
+ *
+ * @param serviceType the type of service this is, use {@link com.smartdevicelink.proxy.rpc.enums.AppServiceType}
+ * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
+ */
+ public AppServiceManifest(@NonNull String serviceType) {
+ this();
+ setServiceType(serviceType);
+ }
- public AppServiceManifest(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructor that takes in the mandatory parameters.
+ *
+ * @param serviceType the type of service this is
+ * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
+ */
+ public AppServiceManifest(@NonNull AppServiceType serviceType) {
+ this();
+ setServiceType(serviceType.name());
+ }
- /**
- * Constructor that takes in the mandatory parameters.
- * @param serviceType the type of service this is, use {@link com.smartdevicelink.proxy.rpc.enums.AppServiceType}
- * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
- */
- public AppServiceManifest(@NonNull String serviceType) {
- this();
- setServiceType(serviceType);
- }
- /**
- * Constructor that takes in the mandatory parameters.
- * @param serviceType the type of service this is
- * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
- */
- public AppServiceManifest(@NonNull AppServiceType serviceType) {
- this();
- setServiceType(serviceType.name());
- }
+ // Setters and Getters
- // Setters and Getters
- /**
- * Unique name of this service
- * @param serviceName - the service name
- */
- public AppServiceManifest setServiceName( String serviceName) {
+ /**
+ * Unique name of this service
+ *
+ * @param serviceName - the service name
+ */
+ public AppServiceManifest setServiceName(String serviceName) {
setValue(KEY_SERVICE_NAME, serviceName);
return this;
}
- /**
- * Unique name of this service
- * @return ServiceName
- */
- public String getServiceName(){
- return getString(KEY_SERVICE_NAME);
- }
+ /**
+ * Unique name of this service
+ *
+ * @return ServiceName
+ */
+ public String getServiceName() {
+ return getString(KEY_SERVICE_NAME);
+ }
- /**
- * The type of service that is to be offered by this app
- * @param serviceType - the serviceType use {@link AppServiceType}
- * @see AppServiceType
- */
- public AppServiceManifest setServiceType(@NonNull String serviceType) {
+ /**
+ * The type of service that is to be offered by this app
+ *
+ * @param serviceType - the serviceType use {@link AppServiceType}
+ * @see AppServiceType
+ */
+ public AppServiceManifest setServiceType(@NonNull String serviceType) {
setValue(KEY_SERVICE_TYPE, serviceType);
return this;
}
- /**
- * The type of service that is to be offered by this app
- * @return the AppServiceType
- * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
- */
- public String getServiceType(){
- return getString(KEY_SERVICE_TYPE);
- }
+ /**
+ * The type of service that is to be offered by this app
+ *
+ * @return the AppServiceType
+ * @see com.smartdevicelink.proxy.rpc.enums.AppServiceType
+ */
+ public String getServiceType() {
+ return getString(KEY_SERVICE_TYPE);
+ }
- /**
- * The icon to be associated with this service Most likely the same as the appIcon.
- * @param serviceIcon - The Service Icon Image
- */
- public AppServiceManifest setServiceIcon( Image serviceIcon) {
+ /**
+ * The icon to be associated with this service Most likely the same as the appIcon.
+ *
+ * @param serviceIcon - The Service Icon Image
+ */
+ public AppServiceManifest setServiceIcon(Image serviceIcon) {
setValue(KEY_SERVICE_ICON, serviceIcon);
return this;
}
- /**
- * The icon to be associated with this service Most likely the same as the appIcon.
- * @return serviceIcon Image
- */
- public Image getServiceIcon(){
- return (Image) getObject(Image.class, KEY_SERVICE_ICON);
- }
+ /**
+ * The icon to be associated with this service Most likely the same as the appIcon.
+ *
+ * @return serviceIcon Image
+ */
+ public Image getServiceIcon() {
+ return (Image) getObject(Image.class, KEY_SERVICE_ICON);
+ }
- /**
- * If true, app service consumers beyond the IVI system will be able to access this service. If false,
- * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
- * @param allowAppConsumers - boolean
- */
- public AppServiceManifest setAllowAppConsumers( Boolean allowAppConsumers) {
+ /**
+ * If true, app service consumers beyond the IVI system will be able to access this service. If false,
+ * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
+ *
+ * @param allowAppConsumers - boolean
+ */
+ public AppServiceManifest setAllowAppConsumers(Boolean allowAppConsumers) {
setValue(KEY_ALLOW_APP_CONSUMERS, allowAppConsumers);
return this;
}
- /**
- * If true, app service consumers beyond the IVI system will be able to access this service. If false,
- * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
- * @return allowAppConsumers - boolean
- */
- public Boolean getAllowAppConsumers(){
- return getBoolean(KEY_ALLOW_APP_CONSUMERS);
- }
+ /**
+ * If true, app service consumers beyond the IVI system will be able to access this service. If false,
+ * only the IVI system will be able consume the service. If not provided, it is assumed to be false.
+ *
+ * @return allowAppConsumers - boolean
+ */
+ public Boolean getAllowAppConsumers() {
+ return getBoolean(KEY_ALLOW_APP_CONSUMERS);
+ }
- /**
- * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
- * If not included, it is assumed the max version of the module is acceptable.
- * @param rpcSpecVersion - The rpcSpecVersion
- */
- public AppServiceManifest setRpcSpecVersion( SdlMsgVersion rpcSpecVersion) {
+ /**
+ * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
+ * If not included, it is assumed the max version of the module is acceptable.
+ *
+ * @param rpcSpecVersion - The rpcSpecVersion
+ */
+ public AppServiceManifest setRpcSpecVersion(SdlMsgVersion rpcSpecVersion) {
setValue(KEY_RPC_SPEC_VERSION, rpcSpecVersion);
return this;
}
- /**
- * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
- * If not included, it is assumed the max version of the module is acceptable.
- * @return rpcSpecVersion - The rpcSpecVersion
- */
- public SdlMsgVersion getRpcSpecVersion(){
- return (SdlMsgVersion) getObject(SdlMsgVersion.class,KEY_RPC_SPEC_VERSION);
- }
+ /**
+ * This is the max RPC Spec version the app service understands. This is important during the RPC pass through functionality.
+ * If not included, it is assumed the max version of the module is acceptable.
+ *
+ * @return rpcSpecVersion - The rpcSpecVersion
+ */
+ public SdlMsgVersion getRpcSpecVersion() {
+ return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_RPC_SPEC_VERSION);
+ }
- /**
- * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
- * This means the service will provide meaningful responses.
- * @param handledRPCs - The List of Handled RPCs using their ID value from the FunctionID enum
- * @see FunctionID
- * @see #setHandledRpcsUsingFunctionIDs( List )
- */
- public AppServiceManifest setHandledRpcs( List<Integer> handledRPCs) {
+ /**
+ * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
+ * This means the service will provide meaningful responses.
+ *
+ * @param handledRPCs - The List of Handled RPCs using their ID value from the FunctionID enum
+ * @see FunctionID
+ * @see #setHandledRpcsUsingFunctionIDs(List)
+ */
+ public AppServiceManifest setHandledRpcs(List<Integer> handledRPCs) {
setValue(KEY_HANDLED_RPCS, handledRPCs);
return this;
}
- /**
- * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
- * This means the service will provide meaningful responses.
- * @param handledRPCs - The List of Handled RPCs using the FunctionID enum
- * @see #setHandledRpcs( List )
- */
- public AppServiceManifest setHandledRpcsUsingFunctionIDs( List<FunctionID> handledRPCs) {
- if(handledRPCs != null){
- List<Integer> rpcIds = new ArrayList<>();
- for(FunctionID functionID : handledRPCs){
- rpcIds.add(functionID.getId());
- }
- setHandledRpcs(rpcIds);
- }else{
- setValue(KEY_HANDLED_RPCS, null);
- }
+
+ /**
+ * This field contains the Function IDs for the RPCs that this service intends to handle correctly.
+ * This means the service will provide meaningful responses.
+ *
+ * @param handledRPCs - The List of Handled RPCs using the FunctionID enum
+ * @see #setHandledRpcs(List)
+ */
+ public AppServiceManifest setHandledRpcsUsingFunctionIDs(List<FunctionID> handledRPCs) {
+ if (handledRPCs != null) {
+ List<Integer> rpcIds = new ArrayList<>();
+ for (FunctionID functionID : handledRPCs) {
+ rpcIds.add(functionID.getId());
+ }
+ setHandledRpcs(rpcIds);
+ } else {
+ setValue(KEY_HANDLED_RPCS, null);
+ }
return this;
}
- /**
- * This field contains the FunctionID integer ID values for the RPCs that this service intends to handle correctly.
- * This means the service will provide meaningful responses.
- * @return handledRPCs - The List of Handled RPC IDs obtained through the FunctionID enum
- * @see com.smartdevicelink.protocol.enums.FunctionID
- */
- @SuppressWarnings("unchecked")
- public List<Integer> getHandledRpcs(){
- return (List<Integer>) getObject(Integer.class,KEY_HANDLED_RPCS);
- }
+ /**
+ * This field contains the FunctionID integer ID values for the RPCs that this service intends to handle correctly.
+ * This means the service will provide meaningful responses.
+ *
+ * @return handledRPCs - The List of Handled RPC IDs obtained through the FunctionID enum
+ * @see com.smartdevicelink.protocol.enums.FunctionID
+ */
+ @SuppressWarnings("unchecked")
+ public List<Integer> getHandledRpcs() {
+ return (List<Integer>) getObject(Integer.class, KEY_HANDLED_RPCS);
+ }
- /**
- * The MediaServiceManifest
- * @param mediaServiceManifest - The mediaServiceManifest
- */
- public AppServiceManifest setMediaServiceManifest( MediaServiceManifest mediaServiceManifest) {
+ /**
+ * The MediaServiceManifest
+ *
+ * @param mediaServiceManifest - The mediaServiceManifest
+ */
+ public AppServiceManifest setMediaServiceManifest(MediaServiceManifest mediaServiceManifest) {
setValue(KEY_MEDIA_SERVICE_MANIFEST, mediaServiceManifest);
return this;
}
- /**
- * The MediaServiceManifest
- * @return mediaServiceManifest - The mediaServiceManifest
- */
- public MediaServiceManifest getMediaServiceManifest(){
- return (MediaServiceManifest) getObject(MediaServiceManifest.class,KEY_MEDIA_SERVICE_MANIFEST);
- }
+ /**
+ * The MediaServiceManifest
+ *
+ * @return mediaServiceManifest - The mediaServiceManifest
+ */
+ public MediaServiceManifest getMediaServiceManifest() {
+ return (MediaServiceManifest) getObject(MediaServiceManifest.class, KEY_MEDIA_SERVICE_MANIFEST);
+ }
- /**
- * The WeatherServiceManifest
- * @param weatherServiceManifest - The weatherServiceManifest
- */
- public AppServiceManifest setWeatherServiceManifest( WeatherServiceManifest weatherServiceManifest) {
+ /**
+ * The WeatherServiceManifest
+ *
+ * @param weatherServiceManifest - The weatherServiceManifest
+ */
+ public AppServiceManifest setWeatherServiceManifest(WeatherServiceManifest weatherServiceManifest) {
setValue(KEY_WEATHER_SERVICE_MANIFEST, weatherServiceManifest);
return this;
}
- /**
- * The WeatherServiceManifest
- * @return weatherServiceManifest - The weatherServiceManifest
- */
- public WeatherServiceManifest getWeatherServiceManifest(){
- return (WeatherServiceManifest) getObject(WeatherServiceManifest.class,KEY_WEATHER_SERVICE_MANIFEST);
- }
+ /**
+ * The WeatherServiceManifest
+ *
+ * @return weatherServiceManifest - The weatherServiceManifest
+ */
+ public WeatherServiceManifest getWeatherServiceManifest() {
+ return (WeatherServiceManifest) getObject(WeatherServiceManifest.class, KEY_WEATHER_SERVICE_MANIFEST);
+ }
- /**
- * The NavigationServiceManifest
- * @param navigationServiceManifest - The navigationServiceManifest
- */
- public AppServiceManifest setNavigationServiceManifest( NavigationServiceManifest navigationServiceManifest) {
+ /**
+ * The NavigationServiceManifest
+ *
+ * @param navigationServiceManifest - The navigationServiceManifest
+ */
+ public AppServiceManifest setNavigationServiceManifest(NavigationServiceManifest navigationServiceManifest) {
setValue(KEY_NAVIGATION_SERVICE_MANIFEST, navigationServiceManifest);
return this;
}
- /**
- * The NavigationServiceManifest
- * @return navigationServiceManifest - The navigationServiceManifest
- */
- public NavigationServiceManifest getNavigationServiceManifest(){
- return (NavigationServiceManifest) getObject(NavigationServiceManifest.class,KEY_NAVIGATION_SERVICE_MANIFEST);
- }
+ /**
+ * The NavigationServiceManifest
+ *
+ * @return navigationServiceManifest - The navigationServiceManifest
+ */
+ public NavigationServiceManifest getNavigationServiceManifest() {
+ return (NavigationServiceManifest) getObject(NavigationServiceManifest.class, KEY_NAVIGATION_SERVICE_MANIFEST);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java
index d59cb8fe0..79a5f1617 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServiceRecord.java
@@ -38,106 +38,116 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- * This manifest contains all the information necessary for the
- * service to be published, activated, and consumers able to interact with it
+ * This manifest contains all the information necessary for the
+ * service to be published, activated, and consumers able to interact with it
*/
public class AppServiceRecord extends RPCStruct {
- public static final String KEY_SERVICE_ID = "serviceID";
- public static final String KEY_SERVICE_MANIFEST = "serviceManifest";
- public static final String KEY_SERVICE_PUBLISHED = "servicePublished";
- public static final String KEY_SERVICE_ACTIVE = "serviceActive";
-
-
- // Constructors
- public AppServiceRecord() { }
-
- public AppServiceRecord(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public AppServiceRecord(@NonNull String serviceID, @NonNull AppServiceManifest serviceManifest,
- @NonNull Boolean servicePublished, @NonNull Boolean serviceActive) {
- this();
- setServiceID(serviceID);
- setServiceManifest(serviceManifest);
- setServicePublished(servicePublished);
- setServiceActive(serviceActive);
- }
-
- // Setters and Getters
- /**
- * ID of this service
- * @param serviceID - the service ID
- */
- public AppServiceRecord setServiceID(@NonNull String serviceID) {
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_SERVICE_MANIFEST = "serviceManifest";
+ public static final String KEY_SERVICE_PUBLISHED = "servicePublished";
+ public static final String KEY_SERVICE_ACTIVE = "serviceActive";
+
+
+ // Constructors
+ public AppServiceRecord() {
+ }
+
+ public AppServiceRecord(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public AppServiceRecord(@NonNull String serviceID, @NonNull AppServiceManifest serviceManifest,
+ @NonNull Boolean servicePublished, @NonNull Boolean serviceActive) {
+ this();
+ setServiceID(serviceID);
+ setServiceManifest(serviceManifest);
+ setServicePublished(servicePublished);
+ setServiceActive(serviceActive);
+ }
+
+ // Setters and Getters
+
+ /**
+ * ID of this service
+ *
+ * @param serviceID - the service ID
+ */
+ public AppServiceRecord setServiceID(@NonNull String serviceID) {
setValue(KEY_SERVICE_ID, serviceID);
return this;
}
- /**
- * ID of this service
- * @return serviceId
- */
- public String getServiceID(){
- return getString(KEY_SERVICE_ID);
- }
-
- /**
- * the App Service Manifest
- * @param serviceManifest - the App Service Manifest
- */
- public AppServiceRecord setServiceManifest(@NonNull AppServiceManifest serviceManifest) {
+ /**
+ * ID of this service
+ *
+ * @return serviceId
+ */
+ public String getServiceID() {
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * the App Service Manifest
+ *
+ * @param serviceManifest - the App Service Manifest
+ */
+ public AppServiceRecord setServiceManifest(@NonNull AppServiceManifest serviceManifest) {
setValue(KEY_SERVICE_MANIFEST, serviceManifest);
return this;
}
- /**
- * the App Service Manifest
- * @return serviceManifest - the App Service Manifest
- */
- public AppServiceManifest getServiceManifest(){
- return (AppServiceManifest) getObject(AppServiceManifest.class,KEY_SERVICE_MANIFEST);
- }
-
- /**
- * If true, the service is published and available. If false, the service has likely just been
- * unpublished, and should be considered unavailable.
- * @param servicePublished - boolean
- */
- public AppServiceRecord setServicePublished(@NonNull Boolean servicePublished) {
+ /**
+ * the App Service Manifest
+ *
+ * @return serviceManifest - the App Service Manifest
+ */
+ public AppServiceManifest getServiceManifest() {
+ return (AppServiceManifest) getObject(AppServiceManifest.class, KEY_SERVICE_MANIFEST);
+ }
+
+ /**
+ * If true, the service is published and available. If false, the service has likely just been
+ * unpublished, and should be considered unavailable.
+ *
+ * @param servicePublished - boolean
+ */
+ public AppServiceRecord setServicePublished(@NonNull Boolean servicePublished) {
setValue(KEY_SERVICE_PUBLISHED, servicePublished);
return this;
}
- /**
- * If true, the service is published and available. If false, the service has likely just been
- * unpublished, and should be considered unavailable.
- * @return servicePublished - boolean
- */
- public Boolean getServicePublished(){
- return getBoolean(KEY_SERVICE_PUBLISHED);
- }
-
- /**
- * If true, the service is the active primary service of the supplied service type. It will receive
- * all potential RPCs that are passed through to that service type. If false, it is not the primary
- * service of the supplied type. See servicePublished for its availability.
- * @param serviceActive - boolean
- */
- public AppServiceRecord setServiceActive(@NonNull Boolean serviceActive) {
+ /**
+ * If true, the service is published and available. If false, the service has likely just been
+ * unpublished, and should be considered unavailable.
+ *
+ * @return servicePublished - boolean
+ */
+ public Boolean getServicePublished() {
+ return getBoolean(KEY_SERVICE_PUBLISHED);
+ }
+
+ /**
+ * If true, the service is the active primary service of the supplied service type. It will receive
+ * all potential RPCs that are passed through to that service type. If false, it is not the primary
+ * service of the supplied type. See servicePublished for its availability.
+ *
+ * @param serviceActive - boolean
+ */
+ public AppServiceRecord setServiceActive(@NonNull Boolean serviceActive) {
setValue(KEY_SERVICE_ACTIVE, serviceActive);
return this;
}
- /**
- * If true, the service is the active primary service of the supplied service type. It will receive
- * all potential RPCs that are passed through to that service type. If false, it is not the primary
- * service of the supplied type. See servicePublished for its availability.
- * @return serviceActive - boolean
- */
- public Boolean getServiceActive(){
- return getBoolean(KEY_SERVICE_ACTIVE);
- }
+ /**
+ * If true, the service is the active primary service of the supplied service type. It will receive
+ * all potential RPCs that are passed through to that service type. If false, it is not the primary
+ * service of the supplied type. See servicePublished for its availability.
+ *
+ * @return serviceActive - boolean
+ */
+ public Boolean getServiceActive() {
+ return getBoolean(KEY_SERVICE_ACTIVE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java
index 30cac40fa..5eebaaf21 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AppServicesCapabilities.java
@@ -46,90 +46,95 @@ import java.util.List;
*/
public class AppServicesCapabilities extends RPCStruct {
- public static final String KEY_APP_SERVICES = "appServices";
-
- // Constructors
-
- /**
- * Capabilities of app services including what service types are supported
- * and the current state of services.
- */
- public AppServicesCapabilities(){}
-
- /**
- * Capabilities of app services including what service types are supported
- * and the current state of services.
- * @param hash of parameters
- */
- public AppServicesCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- // Setters and Getters
-
- /**
- * An array of currently available services. If this is an update to the
- * capability the affected services will include an update reason in that item
- * @param appServices -
- */
- public AppServicesCapabilities setAppServices( List<AppServiceCapability> appServices) {
+ public static final String KEY_APP_SERVICES = "appServices";
+
+ // Constructors
+
+ /**
+ * Capabilities of app services including what service types are supported
+ * and the current state of services.
+ */
+ public AppServicesCapabilities() {
+ }
+
+ /**
+ * Capabilities of app services including what service types are supported
+ * and the current state of services.
+ *
+ * @param hash of parameters
+ */
+ public AppServicesCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * An array of currently available services. If this is an update to the
+ * capability the affected services will include an update reason in that item
+ *
+ * @param appServices -
+ */
+ public AppServicesCapabilities setAppServices(List<AppServiceCapability> appServices) {
setValue(KEY_APP_SERVICES, appServices);
return this;
}
- /**
- * An array of currently available services. If this is an update to the
- * capability the affected services will include an update reason in that item
- * @return appServices
- */
- @SuppressWarnings("unchecked")
- public List<AppServiceCapability> getAppServices(){
- return (List<AppServiceCapability>) getObject(AppServiceCapability.class,KEY_APP_SERVICES);
- }
-
- /**
- * This method will update the current List<AppServiceCapability> with the updated items. If the
- * items don't exist in the original ist they will be added. If the original list is null or
- * empty, the new list will simply be set as the list.
- * @param updatedAppServiceCapabilities the List<AppServiceCapability> that have been updated
- * @return if the list was updated
- */
- public boolean updateAppServices(@NonNull List<AppServiceCapability> updatedAppServiceCapabilities){
- if(updatedAppServiceCapabilities == null){
- return false;
- }
-
- List<AppServiceCapability> appServiceCapabilities = getAppServices();
-
- if(appServiceCapabilities == null){
- //If there are currently no app services, create one to iterate over with no entries
- appServiceCapabilities = new ArrayList<>(0);
- }
-
- //Create a shallow copy for us to alter while iterating through the original list
- List<AppServiceCapability> tempList = new ArrayList<>(appServiceCapabilities);
-
- for(AppServiceCapability updatedAppServiceCapability: updatedAppServiceCapabilities){
- if(updatedAppServiceCapability != null) {
- //First search if the record exists in the current list and remove it if so
- for (AppServiceCapability appServiceCapability : appServiceCapabilities) {
- if (updatedAppServiceCapability.matchesAppService(appServiceCapability)) {
- tempList.remove(appServiceCapability); //Remove the old entry
- break;
- }
- }
-
- if(!ServiceUpdateReason.REMOVED.equals(updatedAppServiceCapability.getUpdateReason())){
- //If the app service was anything but removed, we can add the updated
- //record back into the temp list. If it was REMOVED as the update reason
- //it will not be added back.
- tempList.add(updatedAppServiceCapability);
- }
- }
- }
-
- setAppServices(tempList);
- return !tempList.equals(appServiceCapabilities); //Return if the list is not equal to the original
- }
+ /**
+ * An array of currently available services. If this is an update to the
+ * capability the affected services will include an update reason in that item
+ *
+ * @return appServices
+ */
+ @SuppressWarnings("unchecked")
+ public List<AppServiceCapability> getAppServices() {
+ return (List<AppServiceCapability>) getObject(AppServiceCapability.class, KEY_APP_SERVICES);
+ }
+
+ /**
+ * This method will update the current List<AppServiceCapability> with the updated items. If the
+ * items don't exist in the original ist they will be added. If the original list is null or
+ * empty, the new list will simply be set as the list.
+ *
+ * @param updatedAppServiceCapabilities the List<AppServiceCapability> that have been updated
+ * @return if the list was updated
+ */
+ public boolean updateAppServices(@NonNull List<AppServiceCapability> updatedAppServiceCapabilities) {
+ if (updatedAppServiceCapabilities == null) {
+ return false;
+ }
+
+ List<AppServiceCapability> appServiceCapabilities = getAppServices();
+
+ if (appServiceCapabilities == null) {
+ //If there are currently no app services, create one to iterate over with no entries
+ appServiceCapabilities = new ArrayList<>(0);
+ }
+
+ //Create a shallow copy for us to alter while iterating through the original list
+ List<AppServiceCapability> tempList = new ArrayList<>(appServiceCapabilities);
+
+ for (AppServiceCapability updatedAppServiceCapability : updatedAppServiceCapabilities) {
+ if (updatedAppServiceCapability != null) {
+ //First search if the record exists in the current list and remove it if so
+ for (AppServiceCapability appServiceCapability : appServiceCapabilities) {
+ if (updatedAppServiceCapability.matchesAppService(appServiceCapability)) {
+ tempList.remove(appServiceCapability); //Remove the old entry
+ break;
+ }
+ }
+
+ if (!ServiceUpdateReason.REMOVED.equals(updatedAppServiceCapability.getUpdateReason())) {
+ //If the app service was anything but removed, we can add the updated
+ //record back into the temp list. If it was REMOVED as the update reason
+ //it will not be added back.
+ tempList.add(updatedAppServiceCapability);
+ }
+ }
+ }
+
+ setAppServices(tempList);
+ return !tempList.equals(appServiceCapabilities); //Return if the list is not equal to the original
+ }
}
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 ecb6daef8..7ead85fef 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,167 +38,169 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
public class AudioControlCapabilities extends RPCStruct {
- public static final String KEY_MODULE_NAME = "moduleName";
- public static final String KEY_SOURCE_AVAILABLE = "sourceAvailable";
- public static final String KEY_KEEP_CONTEXT_AVAILABLE = "keepContextAvailable";
- 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
- */
- public AudioControlCapabilities() {
- }
-
- /**
- * Constructs a newly allocated AudioControlCapabilities object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public AudioControlCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a newly allocated AudioControlCapabilities object
- *
- * @param moduleName short friendly name of the light control module.
- */
- public AudioControlCapabilities(@NonNull String moduleName) {
- this();
- setModuleName(moduleName);
- }
-
- /**
- * Sets the moduleName portion of the AudioControlCapabilities class
- *
- * @param moduleName The short friendly name of the light control module. It should not be used to identify a module by mobile application.
- */
- public AudioControlCapabilities setModuleName(@NonNull String moduleName) {
+ public static final String KEY_MODULE_NAME = "moduleName";
+ public static final String KEY_SOURCE_AVAILABLE = "sourceAvailable";
+ public static final String KEY_KEEP_CONTEXT_AVAILABLE = "keepContextAvailable";
+ 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
+ */
+ public AudioControlCapabilities() {
+ }
+
+ /**
+ * Constructs a newly allocated AudioControlCapabilities object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public AudioControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated AudioControlCapabilities object
+ *
+ * @param moduleName short friendly name of the light control module.
+ */
+ public AudioControlCapabilities(@NonNull String moduleName) {
+ this();
+ setModuleName(moduleName);
+ }
+
+ /**
+ * Sets the moduleName portion of the AudioControlCapabilities class
+ *
+ * @param moduleName The short friendly name of the light control module. It should not be used to identify a module by mobile application.
+ */
+ public AudioControlCapabilities setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
return this;
}
- /**
- * Gets the moduleName portion of the AudioControlCapabilities class
- *
- * @return String - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
- */
- public String getModuleName() {
- return getString(KEY_MODULE_NAME);
- }
-
- /**
- * Sets the keepContextAvailable portion of the AudioControlCapabilities class
- *
- * @param keepContextAvailable Availability of the keepContext parameter.
- */
- public AudioControlCapabilities setKeepContextAvailable( Boolean keepContextAvailable) {
+ /**
+ * Gets the moduleName portion of the AudioControlCapabilities class
+ *
+ * @return String - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
+
+ /**
+ * Sets the keepContextAvailable portion of the AudioControlCapabilities class
+ *
+ * @param keepContextAvailable Availability of the keepContext parameter.
+ */
+ public AudioControlCapabilities setKeepContextAvailable(Boolean keepContextAvailable) {
setValue(KEY_KEEP_CONTEXT_AVAILABLE, keepContextAvailable);
return this;
}
- /**
- * Gets the keepContextAvailable portion of the AudioControlCapabilities class
- *
- * @return Boolean - Availability of the keepContext parameter.
- */
- public Boolean getKeepContextAvailable() {
- return getBoolean(KEY_KEEP_CONTEXT_AVAILABLE);
- }
-
- /**
- * Sets the sourceAvailable portion of the AudioControlCapabilities class
- *
- * @param sourceAvailable Availability of the control of audio source.
- */
- public AudioControlCapabilities setSourceAvailable( Boolean sourceAvailable) {
+ /**
+ * Gets the keepContextAvailable portion of the AudioControlCapabilities class
+ *
+ * @return Boolean - Availability of the keepContext parameter.
+ */
+ public Boolean getKeepContextAvailable() {
+ return getBoolean(KEY_KEEP_CONTEXT_AVAILABLE);
+ }
+
+ /**
+ * Sets the sourceAvailable portion of the AudioControlCapabilities class
+ *
+ * @param sourceAvailable Availability of the control of audio source.
+ */
+ public AudioControlCapabilities setSourceAvailable(Boolean sourceAvailable) {
setValue(KEY_SOURCE_AVAILABLE, sourceAvailable);
return this;
}
- /**
- * Gets the sourceAvailable portion of the AudioControlCapabilities class
- *
- * @return Boolean - Availability of the control of audio source.
- */
- public Boolean getSourceAvailable() {
- return getBoolean(KEY_SOURCE_AVAILABLE);
- }
-
- /**
- * Sets the volumeAvailable portion of the AudioControlCapabilities class
- *
- * @param volumeAvailable Availability of the control of audio volume.
- */
- public AudioControlCapabilities setVolumeAvailable( Boolean volumeAvailable) {
+ /**
+ * Gets the sourceAvailable portion of the AudioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of audio source.
+ */
+ public Boolean getSourceAvailable() {
+ return getBoolean(KEY_SOURCE_AVAILABLE);
+ }
+
+ /**
+ * Sets the volumeAvailable portion of the AudioControlCapabilities class
+ *
+ * @param volumeAvailable Availability of the control of audio volume.
+ */
+ public AudioControlCapabilities setVolumeAvailable(Boolean volumeAvailable) {
setValue(KEY_VOLUME_AVAILABLE, volumeAvailable);
return this;
}
- /**
- * Gets the volumeAvailable portion of the AudioControlCapabilities class
- *
- * @return Boolean - Availability of the control of audio volume.
- */
- public Boolean getVolumeAvailable() {
- return getBoolean(KEY_VOLUME_AVAILABLE);
- }
-
- /**
- * Sets the equalizerAvailable portion of the AudioControlCapabilities class
- *
- * @param equalizerAvailable Availability of the control of Equalizer Settings.
- */
- public AudioControlCapabilities setEqualizerAvailable( Boolean equalizerAvailable) {
+ /**
+ * Gets the volumeAvailable portion of the AudioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of audio volume.
+ */
+ public Boolean getVolumeAvailable() {
+ return getBoolean(KEY_VOLUME_AVAILABLE);
+ }
+
+ /**
+ * Sets the equalizerAvailable portion of the AudioControlCapabilities class
+ *
+ * @param equalizerAvailable Availability of the control of Equalizer Settings.
+ */
+ public AudioControlCapabilities setEqualizerAvailable(Boolean equalizerAvailable) {
setValue(KEY_EQUALIZER_AVAILABLE, equalizerAvailable);
return this;
}
- /**
- * Gets the equalizerAvailable portion of the AudioControlCapabilities class
- *
- * @return Boolean - Availability of the control of Equalizer Settings.
- */
- public Boolean getEqualizerAvailable() {
- return getBoolean(KEY_EQUALIZER_AVAILABLE);
- }
-
- /**
- * Sets the equalizerMaxChannelId portion of the AudioControlCapabilities class
- *
- * @param equalizerMaxChannelId Must be included if equalizerAvailable=true, and assume all IDs starting from 1 to this value are valid.
- */
- public AudioControlCapabilities setEqualizerMaxChannelId( Integer equalizerMaxChannelId) {
+ /**
+ * Gets the equalizerAvailable portion of the AudioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of Equalizer Settings.
+ */
+ public Boolean getEqualizerAvailable() {
+ return getBoolean(KEY_EQUALIZER_AVAILABLE);
+ }
+
+ /**
+ * Sets the equalizerMaxChannelId portion of the AudioControlCapabilities class
+ *
+ * @param equalizerMaxChannelId Must be included if equalizerAvailable=true, and assume all IDs starting from 1 to this value are valid.
+ */
+ public AudioControlCapabilities setEqualizerMaxChannelId(Integer equalizerMaxChannelId) {
setValue(KEY_EQUALIZER_MAX_CHANNEL_ID, equalizerMaxChannelId);
return this;
}
- /**
- * Gets the equalizerMaxChannelId portion of the AudioControlCapabilities class
- *
- * @return Integer - Must be included if equalizerAvailable=true, and assume all IDs starting from 1 to this value are valid.
- */
- public Integer getEqualizerMaxChannelId() {
- return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID);
- }
-
- /**
- * Sets ModuleInfo for this capability
- * @param info the ModuleInfo to be set
- */
- public AudioControlCapabilities setModuleInfo( ModuleInfo info) {
+ /**
+ * Gets the equalizerMaxChannelId portion of the AudioControlCapabilities class
+ *
+ * @return Integer - Must be included if equalizerAvailable=true, and assume all IDs starting from 1 to this value are valid.
+ */
+ public Integer getEqualizerMaxChannelId() {
+ return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID);
+ }
+
+ /**
+ * Sets ModuleInfo for this capability
+ *
+ * @param info the ModuleInfo to be set
+ */
+ public AudioControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
- /**
- * Gets a ModuleInfo of this capability
- * @return module info of this capability
- */
- public ModuleInfo getModuleInfo() {
- return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_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/AudioControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlData.java
index 2de646ff6..da665b9ec 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,111 +38,111 @@ import java.util.Hashtable;
import java.util.List;
public class AudioControlData extends RPCStruct {
- public static final String KEY_SOURCE = "source";
- public static final String KEY_KEEP_CONTEXT = "keepContext";
- public static final String KEY_VOLUME = "volume";
- public static final String KEY_EQUALIZER_SETTINGS = "equalizerSettings";
+ public static final String KEY_SOURCE = "source";
+ public static final String KEY_KEEP_CONTEXT = "keepContext";
+ public static final String KEY_VOLUME = "volume";
+ public static final String KEY_EQUALIZER_SETTINGS = "equalizerSettings";
- /**
- * Constructs a newly allocated AudioControlData object
- */
- public AudioControlData() {
- }
+ /**
+ * Constructs a newly allocated AudioControlData object
+ */
+ public AudioControlData() {
+ }
- /**
- * Constructs a newly allocated AudioControlData object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public AudioControlData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a newly allocated AudioControlData object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public AudioControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Sets the source portion of the AudioControlData class
- *
- * @param source In a getter response or a notification, it is the current primary audio source of the system.
- * In a setter request, it is the target audio source that the system shall switch to.
- * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
- */
- public AudioControlData setSource( PrimaryAudioSource source) {
+ /**
+ * Sets the source portion of the AudioControlData class
+ *
+ * @param source In a getter response or a notification, it is the current primary audio source of the system.
+ * In a setter request, it is the target audio source that the system shall switch to.
+ * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
+ */
+ public AudioControlData setSource(PrimaryAudioSource source) {
setValue(KEY_SOURCE, source);
return this;
}
- /**
- * Gets the source portion of the AudioControlData class
- *
- * @return PrimaryAudioSource - In a getter response or a notification, it is the current primary audio source of the system.
- * In a setter request, it is the target audio source that the system shall switch to.
- * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
- */
- public PrimaryAudioSource getSource() {
- return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_SOURCE);
- }
+ /**
+ * Gets the source portion of the AudioControlData class
+ *
+ * @return PrimaryAudioSource - In a getter response or a notification, it is the current primary audio source of the system.
+ * In a setter request, it is the target audio source that the system shall switch to.
+ * If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
+ */
+ public PrimaryAudioSource getSource() {
+ return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_SOURCE);
+ }
- /**
- * Sets the keepContext portion of the AudioControlData class
- *
- * @param keepContext This parameter shall not be present in any getter responses or notifications.
- * This parameter is optional in a setter request. The default value is false if it is not included.
- * If it is false, the system not only changes the audio source but also brings the default application or
- * system UI associated with the audio source to foreground.
- * If it is true, the system only changes the audio source, but keeps the current application in foreground.
- */
- public AudioControlData setKeepContext( Boolean keepContext) {
+ /**
+ * Sets the keepContext portion of the AudioControlData class
+ *
+ * @param keepContext This parameter shall not be present in any getter responses or notifications.
+ * This parameter is optional in a setter request. The default value is false if it is not included.
+ * If it is false, the system not only changes the audio source but also brings the default application or
+ * system UI associated with the audio source to foreground.
+ * If it is true, the system only changes the audio source, but keeps the current application in foreground.
+ */
+ public AudioControlData setKeepContext(Boolean keepContext) {
setValue(KEY_KEEP_CONTEXT, keepContext);
return this;
}
- /**
- * Gets the keepContext portion of the AudioControlData class
- *
- * @return Boolean - This parameter shall not be present in any getter responses or notifications.
- * This parameter is optional in a setter request. The default value is false if it is not included.
- * If it is false, the system not only changes the audio source but also brings the default application or
- * system UI associated with the audio source to foreground.
- * If it is true, the system only changes the audio source, but keeps the current application in foreground.
- */
- public Boolean getKeepContext() {
- return getBoolean(KEY_KEEP_CONTEXT);
- }
+ /**
+ * Gets the keepContext portion of the AudioControlData class
+ *
+ * @return Boolean - This parameter shall not be present in any getter responses or notifications.
+ * This parameter is optional in a setter request. The default value is false if it is not included.
+ * If it is false, the system not only changes the audio source but also brings the default application or
+ * system UI associated with the audio source to foreground.
+ * If it is true, the system only changes the audio source, but keeps the current application in foreground.
+ */
+ public Boolean getKeepContext() {
+ return getBoolean(KEY_KEEP_CONTEXT);
+ }
- /**
- * Sets the volume portion of the AudioControlData class
- *
- * @param volume Reflects the volume of audio, from 0%-100%.
- */
- public AudioControlData setVolume( Integer volume) {
+ /**
+ * Sets the volume portion of the AudioControlData class
+ *
+ * @param volume Reflects the volume of audio, from 0%-100%.
+ */
+ public AudioControlData setVolume(Integer volume) {
setValue(KEY_VOLUME, volume);
return this;
}
- /**
- * Gets the volume portion of the AudioControlData class
- *
- * @return Integer - Reflects the volume of audio, from 0%-100%.
- */
- public Integer getVolume() {
- return getInteger(KEY_VOLUME);
- }
+ /**
+ * Gets the volume portion of the AudioControlData class
+ *
+ * @return Integer - Reflects the volume of audio, from 0%-100%.
+ */
+ public Integer getVolume() {
+ return getInteger(KEY_VOLUME);
+ }
- /**
- * Gets the equalizerSettings portion of the AudioControlData class
- *
- * @return List<EqualizerSettings> - Defines the list of supported channels (band) and their current/desired settings on HMI.
- */
- @SuppressWarnings("unchecked")
- public List<EqualizerSettings> getEqualizerSettings() {
- return (List<EqualizerSettings>) getObject(EqualizerSettings.class, KEY_EQUALIZER_SETTINGS);
- }
+ /**
+ * Gets the equalizerSettings portion of the AudioControlData class
+ *
+ * @return List<EqualizerSettings> - Defines the list of supported channels (band) and their current/desired settings on HMI.
+ */
+ @SuppressWarnings("unchecked")
+ public List<EqualizerSettings> getEqualizerSettings() {
+ return (List<EqualizerSettings>) getObject(EqualizerSettings.class, KEY_EQUALIZER_SETTINGS);
+ }
- /**
- * Sets the equalizerSettings portion of the AudioControlData class
- *
- * @param equalizerSettings Defines the list of supported channels (band) and their current/desired settings on HMI.
- */
- public AudioControlData setEqualizerSettings( List<EqualizerSettings> equalizerSettings) {
+ /**
+ * Sets the equalizerSettings portion of the AudioControlData class
+ *
+ * @param equalizerSettings Defines the list of supported channels (band) and their current/desired settings on HMI.
+ */
+ public AudioControlData setEqualizerSettings(List<EqualizerSettings> equalizerSettings) {
setValue(KEY_EQUALIZER_SETTINGS, equalizerSettings);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
index 8311de9ac..701057d35 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,9 +41,9 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import java.util.Hashtable;
/**
- *<p> Describes different audio type configurations for PerformAudioPassThru, e.g. {8kHz,8-bit,PCM}
+ * <p> Describes different audio type configurations for PerformAudioPassThru, e.g. {8kHz,8-bit,PCM}
* Specifies the capabilities of audio capturing: sampling rate, bits per sample, audio type.</p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -74,30 +74,35 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class AudioPassThruCapabilities extends RPCStruct {
- public static final String KEY_SAMPLING_RATE = "samplingRate";
- public static final String KEY_AUDIO_TYPE = "audioType";
- public static final String KEY_BITS_PER_SAMPLE = "bitsPerSample";
-
- /**
- * Constructs a newly allocated AudioPassThruCapabilities object
- */
- public AudioPassThruCapabilities() {}
-
+ public static final String KEY_SAMPLING_RATE = "samplingRate";
+ public static final String KEY_AUDIO_TYPE = "audioType";
+ public static final String KEY_BITS_PER_SAMPLE = "bitsPerSample";
+
+ /**
+ * Constructs a newly allocated AudioPassThruCapabilities object
+ */
+ public AudioPassThruCapabilities() {
+ }
+
/**
* Constructs a newly allocated AudioPassThruCapabilities object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public AudioPassThruCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a newly allocated AudioPassThruCapabilities object
- * @param samplingRate the sampling rate for AudioPassThru
+ *
+ * @param samplingRate the sampling rate for AudioPassThru
* @param bitsPerSample the sample depth in bit for AudioPassThru
- * @param audioType the audioType for AudioPassThru
+ * @param audioType the audioType for AudioPassThru
*/
public AudioPassThruCapabilities(@NonNull SamplingRate samplingRate, @NonNull BitsPerSample bitsPerSample, @NonNull AudioType audioType) {
this();
@@ -108,49 +113,55 @@ public class AudioPassThruCapabilities extends RPCStruct {
/**
* set the sampling rate for AudioPassThru
+ *
* @param samplingRate the sampling rate for AudioPassThru
*/
public AudioPassThruCapabilities setSamplingRate(@NonNull SamplingRate samplingRate) {
setValue(KEY_SAMPLING_RATE, samplingRate);
return this;
}
-
+
/**
* get the sampling rate for AudioPassThru
- * @return the sampling rate for AudioPassThru
+ *
+ * @return the sampling rate for AudioPassThru
*/
public SamplingRate getSamplingRate() {
return (SamplingRate) getObject(SamplingRate.class, KEY_SAMPLING_RATE);
}
-
+
/**
* set the sample depth in bit for AudioPassThru
+ *
* @param bitsPerSample the sample depth in bit for AudioPassThru
*/
public AudioPassThruCapabilities setBitsPerSample(@NonNull BitsPerSample bitsPerSample) {
setValue(KEY_BITS_PER_SAMPLE, bitsPerSample);
return this;
}
-
+
/**
* get the sample depth in bit for AudioPassThru
+ *
* @return the sample depth in bit for AudioPassThru
*/
public BitsPerSample getBitsPerSample() {
return (BitsPerSample) getObject(BitsPerSample.class, KEY_BITS_PER_SAMPLE);
}
-
+
/**
* set the audioType for AudioPassThru
+ *
* @param audioType the audioType for AudioPassThru
*/
public AudioPassThruCapabilities setAudioType(@NonNull AudioType audioType) {
setValue(KEY_AUDIO_TYPE, audioType);
return this;
}
-
+
/**
* get the audioType for AudioPassThru
+ *
* @return the audioType for AudioPassThru
*/
public AudioType getAudioType() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
index faa10d607..9c8060ea4 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,10 +38,11 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import java.util.Hashtable;
-/** The status of the seat belts.
+/**
+ * The status of the seat belts.
*
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -140,11 +141,12 @@ import java.util.Hashtable;
* <td>The seat belt of the middle row is buckled.</td>
* </tr>
* </table>
-* @since SmartDeviceLink 2.0
-* @see VehicleDataEventStatus
-* @see GetVehicleData
-* @see OnVehicleData
+ *
+ * @see VehicleDataEventStatus
+ * @see GetVehicleData
+ * @see OnVehicleData
* @see SubscribeVehicleData
+ * @since SmartDeviceLink 2.0
*/
public class BeltStatus extends RPCStruct {
@@ -165,13 +167,16 @@ public class BeltStatus extends RPCStruct {
public static final String KEY_MIDDLE_ROW_1_BELT_DEPLOYED = "middleRow1BeltDeployed";
public static final String KEY_MIDDLE_ROW_1_BUCKLE_BELTED = "middleRow1BuckleBelted";
- public BeltStatus() { }
+ public BeltStatus() {
+ }
- /** Constructs a new BeltStatus object indicated by the Hashtable
- * parameter
- * @param hash hashtable filled with params to create an instance of this RPC
- * The hash table to use
- */
+ /**
+ * Constructs a new BeltStatus object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash hashtable filled with params to create an instance of this RPC
+ * The hash table to use
+ */
public BeltStatus(Hashtable<String, Object> hash) {
super(hash);
}
@@ -204,104 +209,133 @@ public class BeltStatus extends RPCStruct {
setValue(KEY_DRIVER_BELT_DEPLOYED, driverBeltDeployed);
return this;
}
+
public VehicleDataEventStatus getDriverBeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_BELT_DEPLOYED);
}
+
public BeltStatus setPassengerBeltDeployed(@NonNull VehicleDataEventStatus passengerBeltDeployed) {
setValue(KEY_PASSENGER_BELT_DEPLOYED, passengerBeltDeployed);
return this;
}
+
public VehicleDataEventStatus getPassengerBeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_BELT_DEPLOYED);
}
+
public BeltStatus setPassengerBuckleBelted(@NonNull VehicleDataEventStatus passengerBuckleBelted) {
setValue(KEY_PASSENGER_BUCKLE_BELTED, passengerBuckleBelted);
return this;
}
+
public VehicleDataEventStatus getPassengerBuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_BUCKLE_BELTED);
}
- public BeltStatus setDriverBuckleBelted( VehicleDataEventStatus driverBuckleBelted) {
+
+ public BeltStatus setDriverBuckleBelted(VehicleDataEventStatus driverBuckleBelted) {
setValue(KEY_DRIVER_BUCKLE_BELTED, driverBuckleBelted);
return this;
}
+
public VehicleDataEventStatus getDriverBuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_BUCKLE_BELTED);
}
- public BeltStatus setLeftRow2BuckleBelted( VehicleDataEventStatus leftRow2BuckleBelted) {
+
+ public BeltStatus setLeftRow2BuckleBelted(VehicleDataEventStatus leftRow2BuckleBelted) {
setValue(KEY_LEFT_ROW_2_BUCKLE_BELTED, leftRow2BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getLeftRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_LEFT_ROW_2_BUCKLE_BELTED);
}
+
public BeltStatus setPassengerChildDetected(@NonNull VehicleDataEventStatus passengerChildDetected) {
setValue(KEY_PASSENGER_CHILD_DETECTED, passengerChildDetected);
return this;
}
+
public VehicleDataEventStatus getPassengerChildDetected() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_CHILD_DETECTED);
}
+
public BeltStatus setRightRow2BuckleBelted(@NonNull VehicleDataEventStatus rightRow2BuckleBelted) {
setValue(KEY_RIGHT_ROW_2_BUCKLE_BELTED, rightRow2BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getRightRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_ROW_2_BUCKLE_BELTED);
}
+
public BeltStatus setMiddleRow2BuckleBelted(@NonNull VehicleDataEventStatus middleRow2BuckleBelted) {
setValue(KEY_MIDDLE_ROW_2_BUCKLE_BELTED, middleRow2BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getMiddleRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_2_BUCKLE_BELTED);
}
+
public BeltStatus setMiddleRow3BuckleBelted(@NonNull VehicleDataEventStatus middleRow3BuckleBelted) {
setValue(KEY_MIDDLE_ROW_3_BUCKLE_BELTED, middleRow3BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getMiddleRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_3_BUCKLE_BELTED);
}
+
public BeltStatus setLeftRow3BuckleBelted(@NonNull VehicleDataEventStatus leftRow3BuckleBelted) {
setValue(KEY_LEFT_ROW_3_BUCKLE_BELTED, leftRow3BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getLeftRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_LEFT_ROW_3_BUCKLE_BELTED);
}
+
public BeltStatus setRightRow3BuckleBelted(@NonNull VehicleDataEventStatus rightRow3BuckleBelted) {
setValue(KEY_RIGHT_ROW_3_BUCKLE_BELTED, rightRow3BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getRightRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_ROW_3_BUCKLE_BELTED);
}
+
public BeltStatus setLeftRearInflatableBelted(@NonNull VehicleDataEventStatus rearInflatableBelted) {
setValue(KEY_LEFT_REAR_INFLATABLE_BELTED, rearInflatableBelted);
return this;
}
+
public VehicleDataEventStatus getLeftRearInflatableBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_LEFT_REAR_INFLATABLE_BELTED);
}
+
public BeltStatus setRightRearInflatableBelted(@NonNull VehicleDataEventStatus rightRearInflatableBelted) {
setValue(KEY_RIGHT_REAR_INFLATABLE_BELTED, rightRearInflatableBelted);
return this;
}
+
public VehicleDataEventStatus getRightRearInflatableBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_REAR_INFLATABLE_BELTED);
}
+
public BeltStatus setMiddleRow1BeltDeployed(@NonNull VehicleDataEventStatus middleRow1BeltDeployed) {
setValue(KEY_MIDDLE_ROW_1_BELT_DEPLOYED, middleRow1BeltDeployed);
return this;
}
+
public VehicleDataEventStatus getMiddleRow1BeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_1_BELT_DEPLOYED);
}
+
public BeltStatus setMiddleRow1BuckleBelted(@NonNull VehicleDataEventStatus middleRow1BuckleBelted) {
setValue(KEY_MIDDLE_ROW_1_BUCKLE_BELTED, middleRow1BuckleBelted);
return this;
}
+
public VehicleDataEventStatus getMiddleRow1BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_1_BUCKLE_BELTED);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
index 391d2928d..fcb5c8d70 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,10 +39,11 @@ import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
import java.util.Hashtable;
-/** The body information including power modes.
- *
+/**
+ * The body information including power modes.
+ *
* <p><b>Note:</b> The structure defines the information about the park brake and ignition.</p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -108,13 +109,13 @@ import java.util.Hashtable;
* <td>References signal "DrStatRr_B_Actl".</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
- *
+ *
* </table>
- * @since SmartDeviceLink 2.0
- * @see SubscribeVehicleData
- * @see GetVehicleData
- * @see OnVehicleData
*
+ * @see SubscribeVehicleData
+ * @see GetVehicleData
+ * @see OnVehicleData
+ * @since SmartDeviceLink 2.0
*/
public class BodyInformation extends RPCStruct {
@@ -126,75 +127,89 @@ public class BodyInformation extends RPCStruct {
public static final String KEY_REAR_LEFT_DOOR_AJAR = "rearLeftDoorAjar";
public static final String KEY_REAR_RIGHT_DOOR_AJAR = "rearRightDoorAjar";
- public BodyInformation() { }
+ public BodyInformation() {
+ }
- /** Constructs a new BodyInformation object indicated by the Hashtable
- * parameter
+ /**
+ * Constructs a new BodyInformation object indicated by the Hashtable
+ * parameter
+ *
* @param hash hashtable filled with params to create an instance of this RPC
- * The hash table to use
- */
+ * The hash table to use
+ */
public BodyInformation(Hashtable<String, Object> hash) {
super(hash);
}
+
public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) {
this();
setParkBrakeActive(parkBrakeActive);
setIgnitionStableStatus(ignitionStableStatus);
setIgnitionStatus(ignitionStatus);
}
+
public BodyInformation setParkBrakeActive(@NonNull Boolean parkBrakeActive) {
setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive);
return this;
}
+
public Boolean getParkBrakeActive() {
return getBoolean(KEY_PARK_BRAKE_ACTIVE);
}
+
public BodyInformation setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) {
setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus);
return this;
}
+
public IgnitionStableStatus getIgnitionStableStatus() {
return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS);
}
+
public BodyInformation setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) {
setValue(KEY_IGNITION_STATUS, ignitionStatus);
return this;
}
+
public IgnitionStatus getIgnitionStatus() {
return (IgnitionStatus) getObject(IgnitionStatus.class, KEY_IGNITION_STATUS);
}
-
- public BodyInformation setDriverDoorAjar( Boolean driverDoorAjar) {
+
+ public BodyInformation setDriverDoorAjar(Boolean driverDoorAjar) {
setValue(KEY_DRIVER_DOOR_AJAR, driverDoorAjar);
return this;
}
+
public Boolean getDriverDoorAjar() {
return getBoolean(KEY_DRIVER_DOOR_AJAR);
}
-
-
- public BodyInformation setPassengerDoorAjar( Boolean passengerDoorAjar) {
+
+
+ public BodyInformation setPassengerDoorAjar(Boolean passengerDoorAjar) {
setValue(KEY_PASSENGER_DOOR_AJAR, passengerDoorAjar);
return this;
}
+
public Boolean getPassengerDoorAjar() {
return getBoolean(KEY_PASSENGER_DOOR_AJAR);
}
-
- public BodyInformation setRearLeftDoorAjar( Boolean rearLeftDoorAjar) {
+
+ public BodyInformation setRearLeftDoorAjar(Boolean rearLeftDoorAjar) {
setValue(KEY_REAR_LEFT_DOOR_AJAR, rearLeftDoorAjar);
return this;
}
+
public Boolean getRearLeftDoorAjar() {
return getBoolean(KEY_REAR_LEFT_DOOR_AJAR);
}
- public BodyInformation setRearRightDoorAjar( Boolean rearRightDoorAjar) {
+ public BodyInformation setRearRightDoorAjar(Boolean rearRightDoorAjar) {
setValue(KEY_REAR_RIGHT_DOOR_AJAR, rearRightDoorAjar);
return this;
}
+
public Boolean getRearRightDoorAjar() {
return getBoolean(KEY_REAR_RIGHT_DOOR_AJAR);
- }
-
+ }
+
}
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 d2d5246be..8895528af 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -74,47 +74,48 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- *
+ *
* <p>Upon the request HMI must provide the list of the following information:</p>
* <p>The names of all existing/supported hardware buttons.</p>
* <p>The availability of LONG/SHORT press for each existing/supported hardware button correspondingly</p>
* <p>The availability of UP/DOWN events for each existing/supported hardware button correspondingly.</p>
- *
- * @since SmartDeviceLink 1.0
- *
+ *
* @see ButtonName
* @see com.smartdevicelink.proxy.rpc.enums.ButtonEventMode
* @see com.smartdevicelink.proxy.rpc.enums.ButtonPressMode
- *
- *
- *
* @see OnButtonEvent
* @see OnButtonPress
- *
+ * @since SmartDeviceLink 1.0
*/
public class ButtonCapabilities extends RPCStruct {
- public static final String KEY_NAME = "name";
- 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
- */
- public ButtonCapabilities() { }
+ public static final String KEY_NAME = "name";
+ 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
+ */
+ public ButtonCapabilities() {
+ }
+
/**
* Constructs a newly allocated ButtonCapabilities object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public ButtonCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a newly allocated ButtonCapabilities object
- * @param name the name of button
+ *
+ * @param name the name of button
* @param shortPressAvailable True if support otherwise False.
- * @param longPressAvailable True if support otherwise False.
- * @param upDownAvailable True if support otherwise False.
+ * @param longPressAvailable True if support otherwise False.
+ * @param upDownAvailable True if support otherwise False.
*/
public ButtonCapabilities(@NonNull ButtonName name, @NonNull Boolean shortPressAvailable, @NonNull Boolean longPressAvailable, @NonNull Boolean upDownAvailable) {
this();
@@ -123,60 +124,76 @@ public class ButtonCapabilities extends RPCStruct {
setLongPressAvailable(longPressAvailable);
setUpDownAvailable(upDownAvailable);
}
+
/**
* Get the name of theSDL HMI button.
+ *
* @return ButtonName the name of the Button
- */
+ */
public ButtonName getName() {
return (ButtonName) getObject(ButtonName.class, KEY_NAME);
}
+
/**
* Set the name of theSDL HMI button.
+ *
* @param name the name of button
*/
public ButtonCapabilities setName(@NonNull ButtonName name) {
setValue(KEY_NAME, name);
return this;
}
+
/**
* Whether the button supports a SHORT press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
+ *
* @return True if support otherwise False.
- */
+ */
public Boolean getShortPressAvailable() {
- return getBoolean( KEY_SHORT_PRESS_AVAILABLE );
+ return getBoolean(KEY_SHORT_PRESS_AVAILABLE);
}
+
/**
* Set the button supports a SHORT press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
+ *
* @param shortPressAvailable True if support otherwise False.
*/
public ButtonCapabilities setShortPressAvailable(@NonNull Boolean shortPressAvailable) {
setValue(KEY_SHORT_PRESS_AVAILABLE, shortPressAvailable);
return this;
}
+
/**
* Whether the button supports a LONG press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
+ *
* @return True if support otherwise False.
*/
public Boolean getLongPressAvailable() {
- return getBoolean( KEY_LONG_PRESS_AVAILABLE );
+ return getBoolean(KEY_LONG_PRESS_AVAILABLE);
}
+
/**
* Set the button supports a LONG press. See <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonPressMode}</i> for more information.
+ *
* @param longPressAvailable True if support otherwise False.
*/
public ButtonCapabilities setLongPressAvailable(@NonNull Boolean longPressAvailable) {
setValue(KEY_LONG_PRESS_AVAILABLE, longPressAvailable);
return this;
}
+
/**
* Whether the button supports "button down" and "button up". When the button is depressed, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONDOWN.
+ *
* @return True if support otherwise False.
- */
+ */
public Boolean getUpDownAvailable() {
- return getBoolean( KEY_UP_DOWN_AVAILABLE );
+ return getBoolean(KEY_UP_DOWN_AVAILABLE);
}
+
/**
* Set the button supports "button down" and "button up". When the button is depressed, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONDOWN.
+ *
* @param upDownAvailable True if support otherwise False.
*/
public ButtonCapabilities setUpDownAvailable(@NonNull Boolean upDownAvailable) {
@@ -186,15 +203,17 @@ public class ButtonCapabilities extends RPCStruct {
/**
* Sets ModuleInfo for this capability
+ *
* @param info the ModuleInfo to be set
*/
- public ButtonCapabilities setModuleInfo( ModuleInfo info) {
+ public ButtonCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
/**
* Gets a ModuleInfo of this capability
+ *
* @return module info of this capability
*/
public ModuleInfo getModuleInfo() {
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 ecdac7b95..d52f1e242 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -46,7 +46,7 @@ import java.util.Hashtable;
* simulate a hardware button press event.
*/
public class ButtonPress extends RPCRequest {
- public static final String KEY_MODULE_TYPE = "moduleType";
+ 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";
@@ -70,8 +70,9 @@ public class ButtonPress extends RPCRequest {
/**
* Constructs a new ButtonPress object
- * @param moduleType Represents module where the button should be pressed
- * @param buttonName Represents name of supported RC climate or radio button
+ *
+ * @param moduleType Represents module where the button should be pressed
+ * @param buttonName Represents name of supported RC climate or radio button
* @param buttonPressMode Indicates whether this is a LONG or SHORT button press event.
*/
public ButtonPress(@NonNull ModuleType moduleType, @NonNull ButtonName buttonName, @NonNull ButtonPressMode buttonPressMode) {
@@ -93,8 +94,7 @@ public class ButtonPress extends RPCRequest {
/**
* Sets a ModuleType
*
- * @param moduleType
- * Represents module where the button should be pressed
+ * @param moduleType Represents module where the button should be pressed
*/
public ButtonPress setModuleType(@NonNull ModuleType moduleType) {
setParameters(KEY_MODULE_TYPE, moduleType);
@@ -113,8 +113,7 @@ public class ButtonPress extends RPCRequest {
/**
* Sets a ButtonName
*
- * @param buttonName
- * Represents name of supported RC climate or radio button
+ * @param buttonName Represents name of supported RC climate or radio button
*/
public ButtonPress setButtonName(@NonNull ButtonName buttonName) {
setParameters(KEY_BUTTON_NAME, buttonName);
@@ -133,8 +132,7 @@ public class ButtonPress extends RPCRequest {
/**
* Sets a ButtonPressMode
*
- * @param buttonPressMode
- * Indicates whether this is a LONG or SHORT button press event.
+ * @param buttonPressMode Indicates whether this is a LONG or SHORT button press event.
*/
public ButtonPress setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
@@ -143,15 +141,17 @@ public class ButtonPress extends RPCRequest {
/**
* Sets the module id for this object
+ *
* @param id the id to be set
*/
- public ButtonPress setModuleId( String id) {
+ public ButtonPress setModuleId(String id) {
setParameters(KEY_MODULE_ID, id);
return this;
}
/**
* Gets the module id of this object
+ *
* @return the module id of this object
*/
public String getModuleId() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java
index 9611760a6..8e7a3fc00 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -52,17 +52,17 @@ public class ButtonPressResponse extends RPCResponse {
* <p>Constructs a new ButtonPressResponse object indicated by the
* Hashtable parameter</p>
*
- *
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public ButtonPressResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new ButtonPressResponse object
+ *
* @param resultCode whether the request is successfully processed
- * @param success whether the request is successfully processed
+ * @param success whether the request is successfully processed
*/
public ButtonPressResponse(@NonNull Result resultCode, @NonNull Boolean success) {
this();
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
index 16de2d9f7..224eff640 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
@@ -70,6 +70,7 @@ public class CancelInteraction extends RPCRequest {
/**
* Convenience init for dismissing an interaction type.
+ *
* @param functionID - The ID of the type of interaction to dismiss
*/
public CancelInteraction(@NonNull Integer functionID) {
@@ -79,8 +80,9 @@ public class CancelInteraction extends RPCRequest {
/**
* 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
+ * @param cancelID - The ID of the specific interaction to dismiss
*/
public CancelInteraction(@NonNull Integer functionID, Integer cancelID) {
this();
@@ -93,6 +95,7 @@ public class CancelInteraction extends RPCRequest {
/**
* Gets the ID of the type of interaction the developer wants to dismiss.
* Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), 26 (SliderID), and 64 (SubtleAlertID) are permitted.
+ *
* @return - the functionID
*/
public Integer getInteractionFunctionID() {
@@ -102,6 +105,7 @@ public class CancelInteraction extends RPCRequest {
/**
* Sets the ID of the type of interaction the developer wants to dismiss.
* Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), 26 (SliderID), and 64 (SubtleAlertID) are permitted.
+ *
* @param functionID - the functionID
*/
public CancelInteraction setInteractionFunctionID(@NonNull Integer functionID) {
@@ -111,6 +115,7 @@ public class CancelInteraction extends RPCRequest {
/**
* 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() {
@@ -119,9 +124,10 @@ public class CancelInteraction extends RPCRequest {
/**
* 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 CancelInteraction setCancelID( Integer cancelID) {
+ public CancelInteraction setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
index 508185534..f5d79f32b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
@@ -49,7 +49,9 @@ public class CancelInteractionResponse extends RPCResponse {
/**
* Constructs a new CancelInteractionResponse object
*/
- public CancelInteractionResponse() { super(FunctionID.CANCEL_INTERACTION.toString()); }
+ public CancelInteractionResponse() {
+ super(FunctionID.CANCEL_INTERACTION.toString());
+ }
/**
* Constructs a new CancelInteractionResponse object indicated by the Hashtable parameter
@@ -62,7 +64,8 @@ public class CancelInteractionResponse extends RPCResponse {
/**
* Constructs a new CancelInteractionResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public CancelInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
index 41dbe6f78..bccb69908 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -45,16 +45,16 @@ import java.util.List;
* (voice/TTS and/or display) does not match the app language, the app will be
* able (but does not need) to change this registration with changeRegistration
* prior to app being brought into focus.
- *
+ *
* <p>Function Group: Base</p>
- *
+ *
* <p><b>HMILevel can by any</b></p>
- *
+ *
* <b>Note:</b>
- *
+ *
* <p>SDL will send the language value confirmed to be supported by HMI via UI.GetCapabilities.</p>
* <p><b> Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -114,9 +114,9 @@ import java.util.List;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ *
* <p><b>Response </b></p>
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
@@ -126,40 +126,39 @@ import java.util.List;
* <p>GENERIC_ERROR</p>
* <p>REJECTED</p>
* <p>DISALLOWED</p>
- *
- * @since SmartDeviceLink 2.0
+ *
* @see RegisterAppInterface
+ * @since SmartDeviceLink 2.0
*/
public class ChangeRegistration extends RPCRequest {
- public static final String KEY_LANGUAGE = "language";
+ public static final String KEY_LANGUAGE = "language";
public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
public static final String KEY_APP_NAME = "appName";
public static final String KEY_TTS_NAME = "ttsName";
public static final String KEY_NGN_MEDIA_SCREEN_NAME = "ngnMediaScreenAppName";
public static final String KEY_VR_SYNONYMS = "vrSynonyms";
- /**
- * Constructs a new ChangeRegistration object
- */
+ /**
+ * Constructs a new ChangeRegistration object
+ */
public ChangeRegistration() {
super(FunctionID.CHANGE_REGISTRATION.toString());
}
- /**
- * <p>Constructs a new ChangeRegistration object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new ChangeRegistration object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public ChangeRegistration(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new ChangeRegistration object
- * @param language a language value
+ *
+ * @param language a language value
* @param hmiDisplayLanguage a Language value
*/
public ChangeRegistration(@NonNull Language language, @NonNull Language hmiDisplayLanguage) {
@@ -168,135 +167,132 @@ public class ChangeRegistration extends RPCRequest {
setHmiDisplayLanguage(hmiDisplayLanguage);
}
- /**
- * Sets language
- *
- * @param language
- * a language value
- */
+ /**
+ * Sets language
+ *
+ * @param language a language value
+ */
public ChangeRegistration setLanguage(@NonNull Language language) {
setParameters(KEY_LANGUAGE, language);
return this;
}
- /**
- * Gets language
- *
- * @return Language -a Language value
- */
+ /**
+ * Gets language
+ *
+ * @return Language -a Language value
+ */
public Language getLanguage() {
return (Language) getObject(Language.class, KEY_LANGUAGE);
}
- /**
- * Sets HMI display language
- *
- * @param hmiDisplayLanguage
- * a Language value
- */
+ /**
+ * Sets HMI display language
+ *
+ * @param hmiDisplayLanguage a Language value
+ */
public ChangeRegistration setHmiDisplayLanguage(@NonNull Language hmiDisplayLanguage) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE, hmiDisplayLanguage);
return this;
}
- /**
- * Gets HMI display language
- *
- * @return Language -a Language value
- */
+ /**
+ * Gets HMI display language
+ *
+ * @return Language -a Language value
+ */
public Language getHmiDisplayLanguage() {
- return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE);
+ return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE);
}
-
+
/**
* Sets app name
*
* @param appName App name to set
*/
- public ChangeRegistration setAppName( String appName) {
+ public ChangeRegistration setAppName(String appName) {
setParameters(KEY_APP_NAME, appName);
return this;
}
-
+
/**
* Gets app name
- *
+ *
* @return The app name
*/
- public String getAppName(){
+ public String getAppName() {
return getString(KEY_APP_NAME);
}
-
+
/**
* Sets NGN media screen app name
*
* @param ngnAppName The NGN app name
*/
- public ChangeRegistration setNgnMediaScreenAppName( String ngnAppName) {
+ public ChangeRegistration setNgnMediaScreenAppName(String ngnAppName) {
setParameters(KEY_NGN_MEDIA_SCREEN_NAME, ngnAppName);
return this;
}
-
+
/**
* Gets NGN media screen app name
- *
+ *
* @return The NGN app name
*/
- public String getNgnMediaScreenAppName(){
+ public String getNgnMediaScreenAppName() {
return getString(KEY_NGN_MEDIA_SCREEN_NAME);
}
-
+
/**
* Sets the TTS name
*
* @param ttsName The TTS name to set
*/
- public ChangeRegistration setTtsName( List<TTSChunk> ttsName) {
+ public ChangeRegistration setTtsName(List<TTSChunk> ttsName) {
setParameters(KEY_TTS_NAME, ttsName);
return this;
}
-
+
/**
* Gets the TTS name
- *
+ *
* @return The TTS name
*/
@SuppressWarnings("unchecked")
- public List<TTSChunk> getTtsName(){
+ public List<TTSChunk> getTtsName() {
return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_NAME);
}
-
+
/**
* Gets the List<String> representing the an array of 1-100 elements, each
* element containing a voice-recognition synonym
- *
+ *
* @return List<String> -a List value representing the an array of
- * 1-100 elements, each element containing a voice-recognition
- * synonym
- */
+ * 1-100 elements, each element containing a voice-recognition
+ * synonym
+ */
@SuppressWarnings("unchecked")
public List<String> getVrSynonyms() {
return (List<String>) getObject(String.class, KEY_VR_SYNONYMS);
}
-
+
/**
* Sets a vrSynonyms representing the an array of 1-100 elements, each
* element containing a voice-recognition synonym
*
- * @param vrSynonyms
- * a List<String> value representing the an array of 1-100
- * elements
- * <p>
- * <b>Notes: </b></p>
- * <ul>
- * <li>Each vr synonym is limited to 40 characters, and there can
- * be 1-100 synonyms in array</li>
- * <li>May not be the same (by case insensitive comparison) as
- * the name or any synonym of any currently-registered
- * application</li>
- * </ul>
+ * @param vrSynonyms a List<String> value representing the an array of 1-100
+ * elements
+ * <p>
+ * <b>Notes: </b></p>
+ * <ul>
+ * <li>Each vr synonym is limited to 40 characters, and there can
+ * be 1-100 synonyms in array</li>
+ * <li>May not be the same (by case insensitive comparison) as
+ * the name or any synonym of any currently-registered
+ * application</li>
+ * </ul>
*/
- public ChangeRegistration setVrSynonyms( List<String> vrSynonyms) {
+ public ChangeRegistration setVrSynonyms(List<String> vrSynonyms) {
setParameters(KEY_VR_SYNONYMS, vrSynonyms);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
index 8658dabba..85e3f3c60 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,37 @@ import java.util.Hashtable;
/**
* Change Registration Response is sent, when ChangeRegistration has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class ChangeRegistrationResponse extends RPCResponse {
- /**
- * Constructs a new ChangeRegistrationResponse object
- */
+ /**
+ * Constructs a new ChangeRegistrationResponse object
+ */
public ChangeRegistrationResponse() {
super(FunctionID.CHANGE_REGISTRATION.toString());
}
- /**
- * <p>Constructs a new ChangeRegistrationResponse object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new ChangeRegistrationResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public ChangeRegistrationResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ChangeRegistrationResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public ChangeRegistrationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new ChangeRegistrationResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ChangeRegistrationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
index 819cb7c63..30e00e663 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,7 +42,7 @@ import java.util.List;
/**
* A choice is an option which a user can select either via the menu or via voice recognition (VR) during an application initiated interaction.
- * For example, the application may request for the user`s choice among several suggested ones: Yes, No, Skip.
+ * For example, the application may request for the user`s choice among several suggested ones: Yes, No, Skip.
* <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -56,16 +56,16 @@ import java.util.List;
* <td>Integer</td>
* <td>Application-scoped identifier that uniquely identifies this choice.
* Min: 0;
- * Max: 65535
- * </td>
+ * Max: 65535
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>menuName</td>
* <td>String</td>
* <td>Text which appears in menu, representing this choice.
- * Min: 1;
- * Max: 100
+ * Min: 1;
+ * Max: 100
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -82,43 +82,45 @@ import java.util.List;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
- * @since SmartDeviceLink 1.0
- *
- * @see AddCommand
- * @see PerformInteraction
- * @see Image
+ *
+ * @see AddCommand
+ * @see PerformInteraction
+ * @see Image
+ * @since SmartDeviceLink 1.0
*/
public class Choice extends RPCStruct {
- public static final String KEY_SECONDARY_TEXT = "secondaryText";
- public static final String KEY_TERTIARY_TEXT = "tertiaryText";
- public static final String KEY_SECONDARY_IMAGE = "secondaryImage";
- public static final String KEY_MENU_NAME = "menuName";
- public static final String KEY_VR_COMMANDS = "vrCommands";
- public static final String KEY_CHOICE_ID = "choiceID";
- public static final String KEY_IMAGE = "image";
+ public static final String KEY_SECONDARY_TEXT = "secondaryText";
+ public static final String KEY_TERTIARY_TEXT = "tertiaryText";
+ public static final String KEY_SECONDARY_IMAGE = "secondaryImage";
+ public static final String KEY_MENU_NAME = "menuName";
+ public static final String KEY_VR_COMMANDS = "vrCommands";
+ public static final String KEY_CHOICE_ID = "choiceID";
+ public static final String KEY_IMAGE = "image";
/**
* Used to bypass the format() method that adds VR items based on RPC version. This is used by the
* choiceSetManager, which has a more in-depth approach as to whether or not it should add VR items
*/
- private boolean ignoreAddingVRItems;
+ private boolean ignoreAddingVRItems;
- /**
- * Constructs a newly allocated Choice object
- */
- public Choice() { }
+ /**
+ * Constructs a newly allocated Choice object
+ */
+ public Choice() {
+ }
/**
* Constructs a newly allocated Choice object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public Choice(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a newly allocated Choice object
+ *
* @param choiceID Min: 0 Max: 65535
* @param menuName the menu name
*/
@@ -131,17 +133,17 @@ public class Choice extends RPCStruct {
/**
* VrCommands became optional as of RPC Spec 5.0. On legacy systems, we must still set VrCommands, as
* they are expected, even though the developer may not specify them. <br>
- *
+ * <p>
* Additionally, VrCommands must be unique, therefore we will use the string value of the command's ID
*
- * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
- * the max value of RPC spec version this library supports should be used.
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
* @param formatParams if true, the format method will be called on subsequent params
*/
@Override
- public void format(Version rpcVersion, boolean formatParams){
+ public void format(Version rpcVersion, boolean formatParams) {
- if (rpcVersion == null || rpcVersion.getMajor() < 5){
+ if (rpcVersion == null || rpcVersion.getMajor() < 5) {
// this is added to allow the choice set manager to disable this functionality
if (!ignoreAddingVRItems) {
@@ -163,77 +165,92 @@ public class Choice extends RPCStruct {
/**
* Get the application-scoped identifier that uniquely identifies this choice.
+ *
* @return choiceID Min: 0; Max: 65535
*/
public Integer getChoiceID() {
return getInteger(KEY_CHOICE_ID);
}
+
/**
* Set the application-scoped identifier that uniquely identifies this choice.
+ *
* @param choiceID Min: 0 Max: 65535
*/
public Choice setChoiceID(@NonNull Integer choiceID) {
setValue(KEY_CHOICE_ID, choiceID);
return this;
}
+
/**
* Text which appears in menu, representing this choice.
- * Min: 1;
- * Max: 100
+ * Min: 1;
+ * Max: 100
+ *
* @return menuName the menu name
- */
+ */
public String getMenuName() {
return getString(KEY_MENU_NAME);
}
+
/**
* Text which appears in menu, representing this choice.
- * Min: 1;
- * Max: 100
+ * Min: 1;
+ * Max: 100
+ *
* @param menuName the menu name
*/
public Choice setMenuName(@NonNull String menuName) {
setValue(KEY_MENU_NAME, menuName);
return this;
}
+
/**
* Get an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element
+ *
* @return vrCommands List
* @since SmartDeviceLink 2.0
- */
+ */
@SuppressWarnings("unchecked")
public List<String> getVrCommands() {
return (List<String>) getObject(String.class, KEY_VR_COMMANDS);
}
+
/**
* Set an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element
+ *
* @param vrCommands the List of vrCommands
* @since SmartDeviceLink 2.0
*/
- public Choice setVrCommands( List<String> vrCommands) {
+ public Choice setVrCommands(List<String> vrCommands) {
setValue(KEY_VR_COMMANDS, vrCommands);
return this;
}
+
/**
* Set the image
+ *
* @param image the image of the choice
*/
- public Choice setImage( Image image) {
+ public Choice setImage(Image image) {
setValue(KEY_IMAGE, image);
return this;
}
+
/**
* Get the image
+ *
* @return the image of the choice
- */
+ */
public Image getImage() {
return (Image) getObject(Image.class, KEY_IMAGE);
}
-
+
public String getSecondaryText() {
return getString(KEY_SECONDARY_TEXT);
}
- public Choice setSecondaryText( String secondaryText) {
+ public Choice setSecondaryText(String secondaryText) {
setValue(KEY_SECONDARY_TEXT, secondaryText);
return this;
}
@@ -242,12 +259,12 @@ public class Choice extends RPCStruct {
return getString(KEY_TERTIARY_TEXT);
}
- public Choice setTertiaryText( String tertiaryText) {
+ public Choice setTertiaryText(String tertiaryText) {
setValue(KEY_TERTIARY_TEXT, tertiaryText);
return this;
}
- public Choice setSecondaryImage( Image image) {
+ public Choice setSecondaryImage(Image image) {
setValue(KEY_SECONDARY_IMAGE, image);
return this;
}
@@ -258,9 +275,10 @@ public class Choice extends RPCStruct {
/**
* This prevents the @{link Choice#format} method from adding VR commands if set to true
+ *
* @param ignoreAddingVRItems - whether or not to let the format method add vr commands
*/
- public Choice setIgnoreAddingVRItems( boolean ignoreAddingVRItems) {
+ public Choice setIgnoreAddingVRItems(boolean ignoreAddingVRItems) {
this.ignoreAddingVRItems = ignoreAddingVRItems;
return this;
}
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 5bb554158..23a198b0c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,20 +44,20 @@ import java.util.List;
* Contains information about a climate control module's capabilities.
*/
-public class ClimateControlCapabilities extends RPCStruct{
- public static final String KEY_MODULE_NAME= "moduleName";
- public static final String KEY_FAN_SPEED_AVAILABLE= "fanSpeedAvailable";
- public static final String KEY_DESIRED_TEMPERATURE_AVAILABLE= "desiredTemperatureAvailable";
- public static final String KEY_CURRENT_TEMPERATURE_AVAILABLE= "currentTemperatureAvailable";
- public static final String KEY_AC_ENABLE_AVAILABLE= "acEnableAvailable";
- public static final String KEY_AC_MAX_ENABLE_AVAILABLE= "acMaxEnableAvailable";
- public static final String KEY_CIRCULATE_AIR_ENABLE_AVAILABLE= "circulateAirEnableAvailable";
- public static final String KEY_AUTO_MODE_ENABLE_AVAILABLE= "autoModeEnableAvailable";
- public static final String KEY_DUAL_MODE_ENABLE_AVAILABLE= "dualModeEnableAvailable";
- public static final String KEY_DEFROST_ZONE_AVAILABLE= "defrostZoneAvailable";
- public static final String KEY_DEFROST_ZONE= "defrostZone";
- public static final String KEY_VENTILATION_MODE_AVAILABLE= "ventilationModeAvailable";
- public static final String KEY_VENTILATION_MODE= "ventilationMode";
+public class ClimateControlCapabilities extends RPCStruct {
+ public static final String KEY_MODULE_NAME = "moduleName";
+ public static final String KEY_FAN_SPEED_AVAILABLE = "fanSpeedAvailable";
+ public static final String KEY_DESIRED_TEMPERATURE_AVAILABLE = "desiredTemperatureAvailable";
+ public static final String KEY_CURRENT_TEMPERATURE_AVAILABLE = "currentTemperatureAvailable";
+ public static final String KEY_AC_ENABLE_AVAILABLE = "acEnableAvailable";
+ public static final String KEY_AC_MAX_ENABLE_AVAILABLE = "acMaxEnableAvailable";
+ public static final String KEY_CIRCULATE_AIR_ENABLE_AVAILABLE = "circulateAirEnableAvailable";
+ public static final String KEY_AUTO_MODE_ENABLE_AVAILABLE = "autoModeEnableAvailable";
+ public static final String KEY_DUAL_MODE_ENABLE_AVAILABLE = "dualModeEnableAvailable";
+ public static final String KEY_DEFROST_ZONE_AVAILABLE = "defrostZoneAvailable";
+ public static final String KEY_DEFROST_ZONE = "defrostZone";
+ public static final String KEY_VENTILATION_MODE_AVAILABLE = "ventilationModeAvailable";
+ public static final String KEY_VENTILATION_MODE = "ventilationMode";
public static final String KEY_HEATED_STEERING_WHEEL_AVAILABLE = "heatedSteeringWheelAvailable";
public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable";
public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable";
@@ -74,7 +74,7 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Constructs a newly allocated ClimateControlCapabilities
- *
+ *
* @param moduleName The short friendly name of the climate control module. It should not be used to identify a module by mobile application.
*/
public ClimateControlCapabilities(@NonNull String moduleName) {
@@ -104,11 +104,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the fanSpeedAvailable portion of the ClimateControlCapabilities class
*
- * @param fanSpeedAvailable
- * Availability of the control of fan speed.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param fanSpeedAvailable Availability of the control of fan speed.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setFanSpeedAvailable( Boolean fanSpeedAvailable) {
+ public ClimateControlCapabilities setFanSpeedAvailable(Boolean fanSpeedAvailable) {
setValue(KEY_FAN_SPEED_AVAILABLE, fanSpeedAvailable);
return this;
}
@@ -126,11 +125,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class
*
- * @param desiredTemperatureAvailable
- * Availability of the control of desired temperature.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param desiredTemperatureAvailable Availability of the control of desired temperature.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setDesiredTemperatureAvailable( Boolean desiredTemperatureAvailable) {
+ public ClimateControlCapabilities setDesiredTemperatureAvailable(Boolean desiredTemperatureAvailable) {
setValue(KEY_DESIRED_TEMPERATURE_AVAILABLE, desiredTemperatureAvailable);
return this;
}
@@ -148,9 +146,8 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the currentTemperatureAvailable portion of the ClimateControlCapabilities class
*
- * @param currentTemperatureAvailable
- * Availability of the reading of current temperature.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param currentTemperatureAvailable Availability of the reading of current temperature.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
public ClimateControlCapabilities setCurrentTemperatureAvailable(Boolean currentTemperatureAvailable) {
setValue(KEY_CURRENT_TEMPERATURE_AVAILABLE, currentTemperatureAvailable);
@@ -170,11 +167,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the acEnableAvailable portion of the ClimateControlCapabilities class
*
- * @param acEnableAvailable
- * Availability of the control of turn on/off AC.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param acEnableAvailable Availability of the control of turn on/off AC.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setAcEnableAvailable( Boolean acEnableAvailable) {
+ public ClimateControlCapabilities setAcEnableAvailable(Boolean acEnableAvailable) {
setValue(KEY_AC_ENABLE_AVAILABLE, acEnableAvailable);
return this;
}
@@ -192,11 +188,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the acMaxEnableAvailable portion of the ClimateControlCapabilities class
*
- * @param acMaxEnableAvailable
- * Availability of the control of enable/disable air conditioning is ON on the maximum level.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param acMaxEnableAvailable Availability of the control of enable/disable air conditioning is ON on the maximum level.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setAcMaxEnableAvailable( Boolean acMaxEnableAvailable) {
+ public ClimateControlCapabilities setAcMaxEnableAvailable(Boolean acMaxEnableAvailable) {
setValue(KEY_AC_MAX_ENABLE_AVAILABLE, acMaxEnableAvailable);
return this;
}
@@ -214,11 +209,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class
*
- * @param circulateAirEnableAvailable
- * Availability of the control of enable/disable circulate Air mode.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param circulateAirEnableAvailable Availability of the control of enable/disable circulate Air mode.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setCirculateAirEnableAvailable( Boolean circulateAirEnableAvailable) {
+ public ClimateControlCapabilities setCirculateAirEnableAvailable(Boolean circulateAirEnableAvailable) {
setValue(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, circulateAirEnableAvailable);
return this;
}
@@ -236,11 +230,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the autoModeEnableAvailable portion of the ClimateControlCapabilities class
*
- * @param autoModeEnableAvailable
- * Availability of the control of enable/disable auto mode.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param autoModeEnableAvailable Availability of the control of enable/disable auto mode.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setAutoModeEnableAvailable( Boolean autoModeEnableAvailable) {
+ public ClimateControlCapabilities setAutoModeEnableAvailable(Boolean autoModeEnableAvailable) {
setValue(KEY_AUTO_MODE_ENABLE_AVAILABLE, autoModeEnableAvailable);
return this;
}
@@ -258,11 +251,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the dualModeEnableAvailable portion of the ClimateControlCapabilities class
*
- * @param dualModeEnableAvailable
- * Availability of the control of enable/disable dual mode.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param dualModeEnableAvailable Availability of the control of enable/disable dual mode.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setDualModeEnableAvailable( Boolean dualModeEnableAvailable) {
+ public ClimateControlCapabilities setDualModeEnableAvailable(Boolean dualModeEnableAvailable) {
setValue(KEY_DUAL_MODE_ENABLE_AVAILABLE, dualModeEnableAvailable);
return this;
}
@@ -280,11 +272,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the defrostZoneAvailable portion of the ClimateControlCapabilities class
*
- * @param defrostZoneAvailable
- * Availability of the control of defrost zones.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param defrostZoneAvailable Availability of the control of defrost zones.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setDefrostZoneAvailable( Boolean defrostZoneAvailable) {
+ public ClimateControlCapabilities setDefrostZoneAvailable(Boolean defrostZoneAvailable) {
setValue(KEY_DEFROST_ZONE_AVAILABLE, defrostZoneAvailable);
return this;
}
@@ -311,10 +302,9 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the defrostZone portion of the ClimateControlCapabilities class
*
- * @param defrostZone
- * A set of all defrost zones that are controllable.
+ * @param defrostZone A set of all defrost zones that are controllable.
*/
- public ClimateControlCapabilities setDefrostZone( List<DefrostZone> defrostZone) {
+ public ClimateControlCapabilities setDefrostZone(List<DefrostZone> defrostZone) {
setValue(KEY_DEFROST_ZONE, defrostZone);
return this;
}
@@ -322,11 +312,10 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the ventilationModeAvailable portion of the ClimateControlCapabilities class
*
- * @param ventilationModeAvailable
- * Availability of the control of air ventilation mode.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param ventilationModeAvailable Availability of the control of air ventilation mode.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setVentilationModeAvailable( Boolean ventilationModeAvailable) {
+ public ClimateControlCapabilities setVentilationModeAvailable(Boolean ventilationModeAvailable) {
setValue(KEY_VENTILATION_MODE_AVAILABLE, ventilationModeAvailable);
return this;
}
@@ -353,10 +342,9 @@ public class ClimateControlCapabilities extends RPCStruct{
/**
* Sets the ventilationMode portion of the ClimateControlCapabilities class
*
- * @param ventilationMode
- * A set of all ventilation modes that are controllable.
+ * @param ventilationMode A set of all ventilation modes that are controllable.
*/
- public ClimateControlCapabilities setVentilationMode( List<VentilationMode> ventilationMode) {
+ public ClimateControlCapabilities setVentilationMode(List<VentilationMode> ventilationMode) {
setValue(KEY_VENTILATION_MODE, ventilationMode);
return this;
}
@@ -367,7 +355,7 @@ public class ClimateControlCapabilities extends RPCStruct{
* @param heatedSteeringWheelAvailable Availability of the control (enable/disable) of heated Steering Wheel.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setHeatedSteeringWheelAvailable( Boolean heatedSteeringWheelAvailable) {
+ public ClimateControlCapabilities setHeatedSteeringWheelAvailable(Boolean heatedSteeringWheelAvailable) {
setValue(KEY_HEATED_STEERING_WHEEL_AVAILABLE, heatedSteeringWheelAvailable);
return this;
}
@@ -388,7 +376,7 @@ public class ClimateControlCapabilities extends RPCStruct{
* @param heatedWindshieldAvailable Availability of the control (enable/disable) of heated Windshield.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setHeatedWindshieldAvailable( Boolean heatedWindshieldAvailable) {
+ public ClimateControlCapabilities setHeatedWindshieldAvailable(Boolean heatedWindshieldAvailable) {
setValue(KEY_HEATED_WIND_SHIELD_AVAILABLE, heatedWindshieldAvailable);
return this;
}
@@ -409,7 +397,7 @@ public class ClimateControlCapabilities extends RPCStruct{
* @param heatedRearWindowAvailable Availability of the control (enable/disable) of heated Rear Window.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setHeatedRearWindowAvailable( Boolean heatedRearWindowAvailable) {
+ public ClimateControlCapabilities setHeatedRearWindowAvailable(Boolean heatedRearWindowAvailable) {
setValue(KEY_HEATED_REAR_WINDOW_AVAILABLE, heatedRearWindowAvailable);
return this;
}
@@ -430,7 +418,7 @@ public class ClimateControlCapabilities extends RPCStruct{
* @param heatedMirrorsAvailable Availability of the control (enable/disable) of heated Mirrors.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setHeatedMirrorsAvailable( Boolean heatedMirrorsAvailable) {
+ public ClimateControlCapabilities setHeatedMirrorsAvailable(Boolean heatedMirrorsAvailable) {
setValue(KEY_HEATED_MIRRORS_AVAILABLE, heatedMirrorsAvailable);
return this;
}
@@ -442,32 +430,35 @@ public class ClimateControlCapabilities extends RPCStruct{
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getHeatedMirrorsAvailable() {
- return getBoolean(KEY_HEATED_MIRRORS_AVAILABLE);
+ return getBoolean(KEY_HEATED_MIRRORS_AVAILABLE);
}
/**
* Sets ModuleInfo for this capability
+ *
* @param info the ModuleInfo to be set
*/
- public ClimateControlCapabilities setModuleInfo( ModuleInfo info) {
+ public ClimateControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
/**
* 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.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public ClimateControlCapabilities setClimateEnableAvailable( Boolean climateEnableAvailable) {
+ public ClimateControlCapabilities setClimateEnableAvailable(Boolean climateEnableAvailable) {
setValue(KEY_CLIMATE_ENABLE_AVAILABLE, climateEnableAvailable);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
index de243bc8d..b4aae1ec1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,17 +37,17 @@ import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import java.util.Hashtable;
-public class ClimateControlData extends RPCStruct{
- public static final String KEY_FAN_SPEED= "fanSpeed";
- public static final String KEY_CURRENT_TEMPERATURE= "currentTemperature";
- public static final String KEY_DESIRED_TEMPERATURE= "desiredTemperature";
- public static final String KEY_AC_ENABLE= "acEnable";
- public static final String KEY_CIRCULATE_AIR_ENABLE= "circulateAirEnable";
- public static final String KEY_AUTO_MODE_ENABLE= "autoModeEnable";
- public static final String KEY_DEFROST_ZONE= "defrostZone";
- public static final String KEY_DUAL_MODE_ENABLE= "dualModeEnable";
- public static final String KEY_AC_MAX_ENABLE= "acMaxEnable";
- public static final String KEY_VENTILATION_MODE= "ventilationMode";
+public class ClimateControlData extends RPCStruct {
+ public static final String KEY_FAN_SPEED = "fanSpeed";
+ public static final String KEY_CURRENT_TEMPERATURE = "currentTemperature";
+ public static final String KEY_DESIRED_TEMPERATURE = "desiredTemperature";
+ public static final String KEY_AC_ENABLE = "acEnable";
+ public static final String KEY_CIRCULATE_AIR_ENABLE = "circulateAirEnable";
+ public static final String KEY_AUTO_MODE_ENABLE = "autoModeEnable";
+ public static final String KEY_DEFROST_ZONE = "defrostZone";
+ public static final String KEY_DUAL_MODE_ENABLE = "dualModeEnable";
+ public static final String KEY_AC_MAX_ENABLE = "acMaxEnable";
+ public static final String KEY_VENTILATION_MODE = "ventilationMode";
public static final String KEY_HEATED_STEERING_WHEEL_ENABLE = "heatedSteeringWheelEnable";
public static final String KEY_HEATED_WIND_SHIELD_ENABLE = "heatedWindshieldEnable";
public static final String KEY_HEATED_REAR_WINDOW_ENABLE = "heatedRearWindowEnable";
@@ -61,7 +61,7 @@ public class ClimateControlData extends RPCStruct{
super(hash);
}
- public ClimateControlData setFanSpeed( Integer fanSpeed) {
+ public ClimateControlData setFanSpeed(Integer fanSpeed) {
setValue(KEY_FAN_SPEED, fanSpeed);
return this;
}
@@ -70,7 +70,7 @@ public class ClimateControlData extends RPCStruct{
return getInteger(KEY_FAN_SPEED);
}
- public ClimateControlData setCurrentTemperature( Temperature currentTemperature) {
+ public ClimateControlData setCurrentTemperature(Temperature currentTemperature) {
setValue(KEY_CURRENT_TEMPERATURE, currentTemperature);
return this;
}
@@ -79,7 +79,7 @@ public class ClimateControlData extends RPCStruct{
return (Temperature) getObject(Temperature.class, KEY_CURRENT_TEMPERATURE);
}
- public ClimateControlData setDesiredTemperature( Temperature desiredTemperature) {
+ public ClimateControlData setDesiredTemperature(Temperature desiredTemperature) {
setValue(KEY_DESIRED_TEMPERATURE, desiredTemperature);
return this;
}
@@ -88,7 +88,7 @@ public class ClimateControlData extends RPCStruct{
return (Temperature) getObject(Temperature.class, KEY_DESIRED_TEMPERATURE);
}
- public ClimateControlData setAcEnable( Boolean acEnable) {
+ public ClimateControlData setAcEnable(Boolean acEnable) {
setValue(KEY_AC_ENABLE, acEnable);
return this;
}
@@ -97,7 +97,7 @@ public class ClimateControlData extends RPCStruct{
return getBoolean(KEY_AC_ENABLE);
}
- public ClimateControlData setCirculateAirEnable( Boolean circulateAirEnable) {
+ public ClimateControlData setCirculateAirEnable(Boolean circulateAirEnable) {
setValue(KEY_CIRCULATE_AIR_ENABLE, circulateAirEnable);
return this;
}
@@ -106,7 +106,7 @@ public class ClimateControlData extends RPCStruct{
return getBoolean(KEY_CIRCULATE_AIR_ENABLE);
}
- public ClimateControlData setAutoModeEnable( Boolean autoModeEnable) {
+ public ClimateControlData setAutoModeEnable(Boolean autoModeEnable) {
setValue(KEY_AUTO_MODE_ENABLE, autoModeEnable);
return this;
}
@@ -115,7 +115,7 @@ public class ClimateControlData extends RPCStruct{
return getBoolean(KEY_AUTO_MODE_ENABLE);
}
- public ClimateControlData setDefrostZone( DefrostZone defrostZone) {
+ public ClimateControlData setDefrostZone(DefrostZone defrostZone) {
setValue(KEY_DEFROST_ZONE, defrostZone);
return this;
}
@@ -124,7 +124,7 @@ public class ClimateControlData extends RPCStruct{
return (DefrostZone) getObject(DefrostZone.class, KEY_DEFROST_ZONE);
}
- public ClimateControlData setDualModeEnable( Boolean dualModeEnable) {
+ public ClimateControlData setDualModeEnable(Boolean dualModeEnable) {
setValue(KEY_DUAL_MODE_ENABLE, dualModeEnable);
return this;
}
@@ -133,7 +133,7 @@ public class ClimateControlData extends RPCStruct{
return getBoolean(KEY_DUAL_MODE_ENABLE);
}
- public ClimateControlData setAcMaxEnable( Boolean acMaxEnable) {
+ public ClimateControlData setAcMaxEnable(Boolean acMaxEnable) {
setValue(KEY_AC_MAX_ENABLE, acMaxEnable);
return this;
}
@@ -142,7 +142,7 @@ public class ClimateControlData extends RPCStruct{
return getBoolean(KEY_AC_MAX_ENABLE);
}
- public ClimateControlData setVentilationMode( VentilationMode ventilationMode) {
+ public ClimateControlData setVentilationMode(VentilationMode ventilationMode) {
setValue(KEY_VENTILATION_MODE, ventilationMode);
return this;
}
@@ -156,7 +156,7 @@ public class ClimateControlData extends RPCStruct{
*
* @param heatedSteeringWheelEnable Value false means disabled/turn off, value true means enabled/turn on.
*/
- public ClimateControlData setHeatedSteeringWheelEnable( Boolean heatedSteeringWheelEnable) {
+ public ClimateControlData setHeatedSteeringWheelEnable(Boolean heatedSteeringWheelEnable) {
setValue(KEY_HEATED_STEERING_WHEEL_ENABLE, heatedSteeringWheelEnable);
return this;
}
@@ -175,7 +175,7 @@ public class ClimateControlData extends RPCStruct{
*
* @param heatedWindshieldEnable Value false means disabled, value true means enabled.
*/
- public ClimateControlData setHeatedWindshieldEnable( Boolean heatedWindshieldEnable) {
+ public ClimateControlData setHeatedWindshieldEnable(Boolean heatedWindshieldEnable) {
setValue(KEY_HEATED_WIND_SHIELD_ENABLE, heatedWindshieldEnable);
return this;
}
@@ -194,7 +194,7 @@ public class ClimateControlData extends RPCStruct{
*
* @param heatedRearWindowEnable Value false means disabled, value true means enabled.
*/
- public ClimateControlData setHeatedRearWindowEnable( Boolean heatedRearWindowEnable) {
+ public ClimateControlData setHeatedRearWindowEnable(Boolean heatedRearWindowEnable) {
setValue(KEY_HEATED_REAR_WINDOW_ENABLE, heatedRearWindowEnable);
return this;
}
@@ -213,7 +213,7 @@ public class ClimateControlData extends RPCStruct{
*
* @param heatedMirrorsEnable Value false means disabled, value true means enabled.
*/
- public ClimateControlData setHeatedMirrorsEnable( Boolean heatedMirrorsEnable) {
+ public ClimateControlData setHeatedMirrorsEnable(Boolean heatedMirrorsEnable) {
setValue(KEY_HEATED_MIRRORS_ENABLE, heatedMirrorsEnable);
return this;
}
@@ -232,7 +232,7 @@ public class ClimateControlData extends RPCStruct{
*
* @param climateEnable Value false means disabled, value true means enabled.
*/
- public ClimateControlData setClimateEnable( Boolean climateEnable) {
+ public ClimateControlData setClimateEnable(Boolean climateEnable) {
setValue(KEY_CLIMATE_ENABLE, climateEnable);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java
index 5fc5729e2..2e7170cdd 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java
@@ -64,7 +64,8 @@ public class CloseApplicationResponse extends RPCResponse {
/**
* Constructs a new CloseApplicationResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public CloseApplicationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
index 59035fc27..ce959b1bc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
@@ -43,33 +43,34 @@ import java.util.List;
* Properties that relate to a a cloud app entry.
*/
public class CloudAppProperties extends RPCStruct {
- public static final String KEY_NICKNAMES = "nicknames";
- public static final String KEY_APP_ID = "appID";
- public static final String KEY_ENABLED = "enabled";
- public static final String KEY_AUTH_TOKEN = "authToken";
- public static final String KEY_CLOUD_TRANSPORT_TYPE = "cloudTransportType";
- public static final String KEY_HYBRID_APP_PREFERENCE = "hybridAppPreference";
- public static final String KEY_ENDPOINT = "endpoint";
+ public static final String KEY_NICKNAMES = "nicknames";
+ public static final String KEY_APP_ID = "appID";
+ public static final String KEY_ENABLED = "enabled";
+ public static final String KEY_AUTH_TOKEN = "authToken";
+ public static final String KEY_CLOUD_TRANSPORT_TYPE = "cloudTransportType";
+ public static final String KEY_HYBRID_APP_PREFERENCE = "hybridAppPreference";
+ public static final String KEY_ENDPOINT = "endpoint";
- public CloudAppProperties(){}
+ public CloudAppProperties() {
+ }
public CloudAppProperties(Hashtable<String, Object> hash) {
super(hash);
}
- public CloudAppProperties(@NonNull String appID){
+ public CloudAppProperties(@NonNull String appID) {
this();
setValue(KEY_APP_ID, appID);
}
- public CloudAppProperties setNicknames( List<String> nicknames) {
+ public CloudAppProperties setNicknames(List<String> nicknames) {
setValue(KEY_NICKNAMES, nicknames);
return this;
}
@SuppressWarnings("unchecked")
- public List<String> getNicknames(){
+ public List<String> getNicknames() {
return (List<String>) getObject(String.class, KEY_NICKNAMES);
}
@@ -78,15 +79,16 @@ public class CloudAppProperties extends RPCStruct {
return this;
}
- public String getAppID(){
+ public String getAppID() {
return getString(KEY_APP_ID);
}
/**
* If true, this cloud app entry will designate it should appear in the HMI
+ *
* @param enabled if the app should be
*/
- public CloudAppProperties setEnabled( boolean enabled) {
+ public CloudAppProperties setEnabled(boolean enabled) {
setValue(KEY_ENABLED, enabled);
return this;
}
@@ -94,41 +96,41 @@ public class CloudAppProperties extends RPCStruct {
/**
* @return if this cloud app entry will designate it should appear in the HMI
*/
- public Boolean isEnabled(){
+ public Boolean isEnabled() {
return getBoolean(KEY_ENABLED);
}
- public CloudAppProperties setAuthToken( String token) {
+ public CloudAppProperties setAuthToken(String token) {
setValue(KEY_AUTH_TOKEN, token);
return this;
}
- public String getAuthToken(){
+ public String getAuthToken() {
return getString(KEY_AUTH_TOKEN);
}
- public CloudAppProperties setCloudTransportType( String transportType) {
+ public CloudAppProperties setCloudTransportType(String transportType) {
setValue(KEY_CLOUD_TRANSPORT_TYPE, transportType);
return this;
}
- public String getCloudTransportType(){
+ public String getCloudTransportType() {
return getString(KEY_CLOUD_TRANSPORT_TYPE);
}
- public CloudAppProperties setHybridAppPreference( HybridAppPreference hybridAppPreference) {
+ public CloudAppProperties setHybridAppPreference(HybridAppPreference hybridAppPreference) {
setValue(KEY_HYBRID_APP_PREFERENCE, hybridAppPreference);
return this;
}
- public HybridAppPreference getHybridAppPreference(){
- return (HybridAppPreference)getObject(HybridAppPreference.class, KEY_HYBRID_APP_PREFERENCE);
+ public HybridAppPreference getHybridAppPreference() {
+ return (HybridAppPreference) getObject(HybridAppPreference.class, KEY_HYBRID_APP_PREFERENCE);
}
/**
* @param token - max length ="65535"
*/
- public CloudAppProperties setEndpoint( String token) {
+ public CloudAppProperties setEndpoint(String token) {
setValue(KEY_ENDPOINT, token);
return this;
}
@@ -136,7 +138,7 @@ public class CloudAppProperties extends RPCStruct {
/**
* @return token - max length ="65535"
*/
- public String getEndpoint(){
+ public String getEndpoint() {
return getString(KEY_ENDPOINT);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
index f3113de0b..883c84153 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,10 +40,11 @@ import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
import java.util.Hashtable;
-/** <p>The status modes of the instrument panel cluster.</p>
- *
- *
- * <p><b>Parameter List</b></p>
+/**
+ * <p>The status modes of the instrument panel cluster.</p>
+ *
+ *
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -75,14 +76,13 @@ import java.util.Hashtable;
* <td>true</td>
* <td>Describes the different power modes</td>
* </tr>
- *
+ *
* </table>
- * @since SmartDeviceLink 1.0
- *
+ *
+ * @see SubscribeVehicleData
* @see SubscribeVehicleData
- * @see SubscribeVehicleData
* @see Image
- *
+ * @since SmartDeviceLink 1.0
*/
public class ClusterModeStatus extends RPCStruct {
@@ -91,50 +91,60 @@ public class ClusterModeStatus extends RPCStruct {
public static final String KEY_CAR_MODE_STATUS = "carModeStatus";
public static final String KEY_POWER_MODE_STATUS = "powerModeStatus";
- public ClusterModeStatus() { }
-
- /** <p>Constructs a new ClusterModeStatus object indicated by the Hashtable
- * parameter</p>
- * @param hash The hash table to use to create an instance of this RPC
- *
- */
- public ClusterModeStatus(Hashtable<String, Object> hash) {
- super(hash);
- }
- public ClusterModeStatus(@NonNull Boolean powerModeActive, @NonNull PowerModeQualificationStatus powerModeQualificationStatus, @NonNull CarModeStatus carModeStatus, @NonNull PowerModeStatus powerModeStatus) {
- this();
- setPowerModeActive(powerModeActive);
- setPowerModeQualificationStatus(powerModeQualificationStatus);
- setCarModeStatus(carModeStatus);
- setPowerModeStatus(powerModeStatus);
- }
-
- public ClusterModeStatus setPowerModeActive(@NonNull Boolean powerModeActive) {
+ public ClusterModeStatus() {
+ }
+
+ /**
+ * <p>Constructs a new ClusterModeStatus object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The hash table to use to create an instance of this RPC
+ */
+ public ClusterModeStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public ClusterModeStatus(@NonNull Boolean powerModeActive, @NonNull PowerModeQualificationStatus powerModeQualificationStatus, @NonNull CarModeStatus carModeStatus, @NonNull PowerModeStatus powerModeStatus) {
+ this();
+ setPowerModeActive(powerModeActive);
+ setPowerModeQualificationStatus(powerModeQualificationStatus);
+ setCarModeStatus(carModeStatus);
+ setPowerModeStatus(powerModeStatus);
+ }
+
+ public ClusterModeStatus setPowerModeActive(@NonNull Boolean powerModeActive) {
setValue(KEY_POWER_MODE_ACTIVE, powerModeActive);
return this;
}
- public Boolean getPowerModeActive() {
- return getBoolean(KEY_POWER_MODE_ACTIVE);
- }
- public ClusterModeStatus setPowerModeQualificationStatus(@NonNull PowerModeQualificationStatus powerModeQualificationStatus) {
+
+ public Boolean getPowerModeActive() {
+ return getBoolean(KEY_POWER_MODE_ACTIVE);
+ }
+
+ public ClusterModeStatus setPowerModeQualificationStatus(@NonNull PowerModeQualificationStatus powerModeQualificationStatus) {
setValue(KEY_POWER_MODE_QUALIFICATION_STATUS, powerModeQualificationStatus);
return this;
}
- public PowerModeQualificationStatus getPowerModeQualificationStatus() {
- return (PowerModeQualificationStatus) getObject(PowerModeQualificationStatus.class, KEY_POWER_MODE_QUALIFICATION_STATUS);
- }
- public ClusterModeStatus setCarModeStatus(@NonNull CarModeStatus carModeStatus) {
+
+ public PowerModeQualificationStatus getPowerModeQualificationStatus() {
+ return (PowerModeQualificationStatus) getObject(PowerModeQualificationStatus.class, KEY_POWER_MODE_QUALIFICATION_STATUS);
+ }
+
+ public ClusterModeStatus setCarModeStatus(@NonNull CarModeStatus carModeStatus) {
setValue(KEY_CAR_MODE_STATUS, carModeStatus);
return this;
}
- public CarModeStatus getCarModeStatus() {
- return (CarModeStatus) getObject(CarModeStatus.class, KEY_CAR_MODE_STATUS);
- }
- public ClusterModeStatus setPowerModeStatus(@NonNull PowerModeStatus powerModeStatus) {
+
+ public CarModeStatus getCarModeStatus() {
+ return (CarModeStatus) getObject(CarModeStatus.class, KEY_CAR_MODE_STATUS);
+ }
+
+ public ClusterModeStatus setPowerModeStatus(@NonNull PowerModeStatus powerModeStatus) {
setValue(KEY_POWER_MODE_STATUS, powerModeStatus);
return this;
}
- public PowerModeStatus getPowerModeStatus() {
- return (PowerModeStatus) getObject(PowerModeStatus.class, KEY_POWER_MODE_STATUS);
- }
+
+ public PowerModeStatus getPowerModeStatus() {
+ return (PowerModeStatus) getObject(PowerModeStatus.class, KEY_POWER_MODE_STATUS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
index bc41103d5..25a87c172 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,7 +38,7 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
-public class Coordinate extends RPCStruct{
+public class Coordinate extends RPCStruct {
public static final String KEY_LATITUDE_DEGREES = "latitudeDegrees";
public static final String KEY_LONGITUDE_DEGREES = "longitudeDegrees";
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
index 32e09dde3..59790154d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,15 +42,15 @@ import java.util.List;
/**
* Creates a Choice Set which can be used in subsequent <i>
* {@linkplain PerformInteraction}</i> Operations.
- *
+ *
* <p>Function Group: Base </p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p>AudioStreamingState : ANY</p>
- *
+ *
* <p>SystemContext: MAIN, MENU, VR</p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -78,16 +78,16 @@ import java.util.List;
* <td>SmartDeviceLink 1.0 </td>
* </tr>
* </table>
- *
- *
+ *
+ *
* <p> <b>Note:</b></p>Second Utterance issue with CreateInteractionChoiceSet RPC. Before a perform interaction
* is sent you MUST wait for the success from the CreateInteractionChoiceSet RPC.
* If you do not wait the system may not recognize the first utterance from the user.
- *
+ *
* <p><b>Response</b></p>
+ * <p>
+ * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the Choice Set was created.
*
- * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the Choice Set was created.
- *
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
@@ -95,88 +95,90 @@ import java.util.List;
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
* <p>GENERIC_ERROR</p>
- * <p> REJECTED</p>
+ * <p> REJECTED</p>
* <p> INVALID_ID</p>
* <p> DUPLICATE_NAME</p>
- * <p>UNSUPPORTED_RESOURCE </p>
- *
- *
- * @since SmartDeviceLink 1.0
+ * <p>UNSUPPORTED_RESOURCE </p>
+ *
* @see DeleteInteractionChoiceSet
* @see PerformInteraction
+ * @since SmartDeviceLink 1.0
*/
public class CreateInteractionChoiceSet extends RPCRequest {
- public static final String KEY_CHOICE_SET = "choiceSet";
- public static final String KEY_INTERACTION_CHOICE_SET_ID = "interactionChoiceSetID";
+ public static final String KEY_CHOICE_SET = "choiceSet";
+ public static final String KEY_INTERACTION_CHOICE_SET_ID = "interactionChoiceSetID";
- /**
- * Constructs a new CreateInteractionChoiceSet object
- */
- public CreateInteractionChoiceSet() {
+ /**
+ * Constructs a new CreateInteractionChoiceSet object
+ */
+ public CreateInteractionChoiceSet() {
super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
}
- /**
- * <p>Constructs a new CreateInteractionChoiceSet object indicated by the
- * Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a new CreateInteractionChoiceSet object indicated by the
+ * Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public CreateInteractionChoiceSet(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new CreateInteractionChoiceSet object
- * @param interactionChoiceSetID: an Integer value representing the Choice Set ID
- * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
- * @param choiceSet: a List<Choice> representing the array of one or more elements
- * <b>Notes: </b>Min Value: 1; Max Value: 100
- */
- public CreateInteractionChoiceSet(@NonNull Integer interactionChoiceSetID, @NonNull List<Choice> choiceSet) {
- this();
- setInteractionChoiceSetID(interactionChoiceSetID);
- setChoiceSet(choiceSet);
- }
- /**
- * Gets the Choice Set unique ID
- *
- * @return Integer -an Integer representing the Choice Set ID
- */
+
+ /**
+ * Constructs a new CreateInteractionChoiceSet object
+ *
+ * @param interactionChoiceSetID: an Integer value representing the Choice Set ID
+ * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
+ * @param choiceSet: a List<Choice> representing the array of one or more elements
+ * <b>Notes: </b>Min Value: 1; Max Value: 100
+ */
+ public CreateInteractionChoiceSet(@NonNull Integer interactionChoiceSetID, @NonNull List<Choice> choiceSet) {
+ this();
+ setInteractionChoiceSetID(interactionChoiceSetID);
+ setChoiceSet(choiceSet);
+ }
+
+ /**
+ * Gets the Choice Set unique ID
+ *
+ * @return Integer -an Integer representing the Choice Set ID
+ */
public Integer getInteractionChoiceSetID() {
- return getInteger( KEY_INTERACTION_CHOICE_SET_ID );
+ return getInteger(KEY_INTERACTION_CHOICE_SET_ID);
}
- /**
- * Sets a unique ID that identifies the Choice Set
- *
- * @param interactionChoiceSetID
- * an Integer value representing the Choice Set ID
- *
- * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
- */
+
+ /**
+ * Sets a unique ID that identifies the Choice Set
+ *
+ * @param interactionChoiceSetID an Integer value representing the Choice Set ID
+ *
+ * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
+ */
public CreateInteractionChoiceSet setInteractionChoiceSetID(@NonNull Integer interactionChoiceSetID) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID, interactionChoiceSetID);
return this;
}
- /**
- * Gets Choice Set Array of one or more elements
- *
- * @return List<Choice> -a List<Choice> representing the array of one or
- * more elements
- */
- @SuppressWarnings("unchecked")
+
+ /**
+ * Gets Choice Set Array of one or more elements
+ *
+ * @return List<Choice> -a List<Choice> representing the array of one or
+ * more elements
+ */
+ @SuppressWarnings("unchecked")
public List<Choice> getChoiceSet() {
- return (List<Choice>) getObject(Choice.class, KEY_CHOICE_SET);
+ return (List<Choice>) getObject(Choice.class, KEY_CHOICE_SET);
}
- /**
- * Sets a Choice Set that is an Array of one or more elements
- *
- * @param choiceSet
- * a List<Choice> representing the array of one or more
- * elements
- *
- * <b>Notes: </b>Min Value: 1; Max Value: 100
- */
+
+ /**
+ * Sets a Choice Set that is an Array of one or more elements
+ *
+ * @param choiceSet a List<Choice> representing the array of one or more
+ * elements
+ *
+ * <b>Notes: </b>Min Value: 1; Max Value: 100
+ */
public CreateInteractionChoiceSet setChoiceSet(@NonNull List<Choice> choiceSet) {
setParameters(KEY_CHOICE_SET, choiceSet);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
index b7d89228f..455dfed9c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.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 androidx.annotation.NonNull;
@@ -42,24 +42,26 @@ import java.util.Hashtable;
/**
* Create Interaction ChoiceSet Response is sent, when CreateInteractionChoiceSet
* has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class CreateInteractionChoiceSetResponse extends RPCResponse {
- /**
- * Constructs a new CreateInteractionChoiceSetResponse object
- */
+ /**
+ * Constructs a new CreateInteractionChoiceSetResponse object
+ */
public CreateInteractionChoiceSetResponse() {
super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
}
+
public CreateInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new CreateInteractionChoiceSetResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public CreateInteractionChoiceSetResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
index 976d00f9e..d028af5c0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
@@ -11,6 +11,7 @@ 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 {
@@ -39,11 +40,12 @@ public class CreateWindow extends RPCRequest {
/**
* 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 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.
+ * 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();
@@ -81,8 +83,8 @@ public class CreateWindow extends RPCRequest {
* 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}
+ * Multiple apps can share the same window name except for the default main window.
+ * {@code windowName.length() <= 100}
*/
public CreateWindow setWindowName(@NonNull String windowName) {
setParameters(KEY_WINDOW_NAME, windowName);
@@ -130,7 +132,7 @@ public class CreateWindow extends RPCRequest {
* @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 CreateWindow setAssociatedServiceType( String associatedServiceType) {
+ public CreateWindow setAssociatedServiceType(String associatedServiceType) {
setParameters(KEY_ASSOCIATED_SERVICE_TYPE, associatedServiceType);
return this;
}
@@ -152,7 +154,7 @@ public class CreateWindow extends RPCRequest {
*
* @param duplicateUpdatesFromWindowID Specify whether the content sent to an existing window should be duplicated to the created window.
*/
- public CreateWindow setDuplicateUpdatesFromWindowID( Integer duplicateUpdatesFromWindowID) {
+ public CreateWindow setDuplicateUpdatesFromWindowID(Integer duplicateUpdatesFromWindowID) {
setParameters(KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, duplicateUpdatesFromWindowID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
index bac8b6d4b..cd1731be2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
@@ -10,6 +10,7 @@ import java.util.Hashtable;
/**
* This RCP creates a window, by default the main is 0.
+ *
* @since 6.0
*/
public class CreateWindowResponse extends RPCResponse {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
index 73d45282d..a9d14e0b3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,8 +37,10 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import java.util.Hashtable;
-/** Individual requested DID result and data.
- *
+
+/**
+ * Individual requested DID result and data.
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -71,50 +73,60 @@ import java.util.Hashtable;
* <td>The DID data which is the hex byte string of however many bytes are stored at that location</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
- *
+ *
* @see VehicleDataResultCode
* @see ReadDID
+ * @since SmartDeviceLink 1.0
*/
public class DIDResult extends RPCStruct {
- public static final String KEY_RESULT_CODE = "resultCode";
- public static final String KEY_DATA = "data";
- public static final String KEY_DID_LOCATION = "didLocation";
+ public static final String KEY_RESULT_CODE = "resultCode";
+ public static final String KEY_DATA = "data";
+ public static final String KEY_DID_LOCATION = "didLocation";
- public DIDResult() {}
+ public DIDResult() {
+ }
- /** <p>Constructs a new DIDResult object indicated by the Hashtable
- * parameter</p>
- * @param hash The hash table to use to create an instance of this RPC
- */
+ /**
+ * <p>Constructs a new DIDResult object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The hash table to use to create an instance of this RPC
+ */
public DIDResult(Hashtable<String, Object> hash) {
super(hash);
}
+
public DIDResult(@NonNull VehicleDataResultCode resultCode, @NonNull Integer didLocation) {
this();
setResultCode(resultCode);
setDidLocation(didLocation);
}
+
public DIDResult setResultCode(@NonNull VehicleDataResultCode resultCode) {
setValue(KEY_RESULT_CODE, resultCode);
return this;
}
+
public VehicleDataResultCode getResultCode() {
- return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
+ return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
}
+
public DIDResult setDidLocation(@NonNull Integer didLocation) {
setValue(KEY_DID_LOCATION, didLocation);
return this;
}
+
public Integer getDidLocation() {
- return getInteger(KEY_DID_LOCATION);
- }
- public DIDResult setData( String data) {
+ return getInteger(KEY_DID_LOCATION);
+ }
+
+ public DIDResult setData(String data) {
setValue(KEY_DATA, data);
return this;
}
+
public String getData() {
- return getString(KEY_DATA);
+ return getString(KEY_DATA);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DTC.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DTC.java
index 9b7623129..8872f0649 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DTC.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DTC.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,62 +49,70 @@ import java.util.Hashtable;
* <td>statusByte</td>
* <td>String</td>
* <td>Hexadecimal byte string
- * <ul>
- * <li>Maxlength = 500</li>
- * </ul>
+ * <ul>
+ * <li>Maxlength = 500</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class DTC extends RPCStruct {
- public static final String KEY_IDENTIFIER = "identifier";
- public static final String KEY_STATUS_BYTE = "statusByte";
- /**
- * Constructs a newly allocated DTC object
- */
- public DTC() { }
-
+ public static final String KEY_IDENTIFIER = "identifier";
+ public static final String KEY_STATUS_BYTE = "statusByte";
+
+ /**
+ * Constructs a newly allocated DTC object
+ */
+ public DTC() {
+ }
+
/**
* Constructs a newly allocated DTC object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public DTC(Hashtable<String, Object> hash) {
super(hash);
}
-
+
/**
* set identifier
+ *
* @param identifier the hexadecimal id of the DTC
*/
- public DTC setIdentifier( String identifier) {
+ public DTC setIdentifier(String identifier) {
setValue(KEY_IDENTIFIER, identifier);
return this;
}
-
+
/**
* get identifier
+ *
* @return identifier
*/
public String getIdentifier() {
- return getString(KEY_IDENTIFIER);
+ return getString(KEY_IDENTIFIER);
}
-
+
/**
* set Hexadecimal byte string
+ *
* @param statusByte Hexadecimal byte string
*/
- public DTC setStatusByte( String statusByte) {
+ public DTC setStatusByte(String statusByte) {
setValue(KEY_STATUS_BYTE, statusByte);
return this;
}
-
+
/**
* get Hexadecimal byte string
+ *
* @return Hexadecimal byte string
*/
public String getStatusByte() {
- return getString(KEY_STATUS_BYTE);
+ return getString(KEY_STATUS_BYTE);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DateTime.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DateTime.java
index ab3f61140..373e51314 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DateTime.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DateTime.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,7 +35,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-public class DateTime extends RPCStruct{
+public class DateTime extends RPCStruct {
public static final String KEY_MILLISECOND = "millisecond";
public static final String KEY_SECOND = "second";
public static final String KEY_MINUTE = "minute";
@@ -53,202 +53,176 @@ public class DateTime extends RPCStruct{
super(hash);
}
-
+
/**
- * Gets the Milliseconds portion of the DateTime class
- *
- * @return Integer - Milliseconds associated with this DateTime class
- *
- */
+ * Gets the Milliseconds portion of the DateTime class
+ *
+ * @return Integer - Milliseconds associated with this DateTime class
+ */
public Integer getMilliSecond() {
return getInteger(KEY_MILLISECOND);
}
- /**
- * Sets the Milliseconds portion of the DateTime class
- *
- * @param milliSecond
- * The milliseconds associated with this DateTime class
- *
- */
- public DateTime setMilliSecond( Integer milliSecond) {
+ /**
+ * Sets the Milliseconds portion of the DateTime class
+ *
+ * @param milliSecond The milliseconds associated with this DateTime class
+ */
+ public DateTime setMilliSecond(Integer milliSecond) {
setValue(KEY_MILLISECOND, milliSecond);
return this;
}
-
+
/**
- * Gets the Seconds portion of the DateTime class
- *
- * @return Integer - Seconds associated with this DateTime class
- *
- */
+ * Gets the Seconds portion of the DateTime class
+ *
+ * @return Integer - Seconds associated with this DateTime class
+ */
public Integer getSecond() {
return getInteger(KEY_SECOND);
}
-
- /**
- * Sets the Seconds portion of the DateTime class
- *
- * @param second
- * The Seconds associated with this DateTime class
- *
- */
- public DateTime setSecond( Integer second) {
+
+ /**
+ * Sets the Seconds portion of the DateTime class
+ *
+ * @param second The Seconds associated with this DateTime class
+ */
+ public DateTime setSecond(Integer second) {
setValue(KEY_SECOND, second);
return this;
}
-
+
/**
- * Gets the Minutes portion of the DateTime class
- *
- * @return Integer - Minutes associated with this DateTime class
- *
- */
+ * Gets the Minutes portion of the DateTime class
+ *
+ * @return Integer - Minutes associated with this DateTime class
+ */
public Integer getMinute() {
return getInteger(KEY_MINUTE);
}
-
- /**
- * Sets the Minutes portion of the DateTime class
- *
- * @param minute
- * The Minutes associated with this DateTime class
- *
- */
- public DateTime setMinute( Integer minute) {
+
+ /**
+ * Sets the Minutes portion of the DateTime class
+ *
+ * @param minute The Minutes associated with this DateTime class
+ */
+ public DateTime setMinute(Integer minute) {
setValue(KEY_MINUTE, minute);
return this;
}
/**
- * Gets the Hours portion of the DateTime class.
- *
- * @return Integer - Hours associated with this DateTime class.
- *
- */
+ * Gets the Hours portion of the DateTime class.
+ *
+ * @return Integer - Hours associated with this DateTime class.
+ */
public Integer getHour() {
return getInteger(KEY_HOUR);
}
- /**
- * Sets the Hours portion of the DateTime class.
- *
- * @param hour
- * The Hours associated with this DateTime class. This structure is used to store hours in a 24 hour format.
- *
- */
- public DateTime setHour( Integer hour) {
+ /**
+ * Sets the Hours portion of the DateTime class.
+ *
+ * @param hour The Hours associated with this DateTime class. This structure is used to store hours in a 24 hour format.
+ */
+ public DateTime setHour(Integer hour) {
setValue(KEY_HOUR, hour);
return this;
}
/**
- * Gets the Day portion of the DateTime class.
- *
- * @return Integer - Day of the month associated with this DateTime class
- *
- */
+ * Gets the Day portion of the DateTime class.
+ *
+ * @return Integer - Day of the month associated with this DateTime class
+ */
public Integer getDay() {
return getInteger(KEY_DAY);
}
- /**
- * Sets the Day portion of the DateTime class
- *
- * @param day
- * The Day of the month associated with this DateTime class
- *
- */
- public DateTime setDay( Integer day) {
+ /**
+ * Sets the Day portion of the DateTime class
+ *
+ * @param day The Day of the month associated with this DateTime class
+ */
+ public DateTime setDay(Integer day) {
setValue(KEY_DAY, day);
return this;
}
/**
- * Gets the Month portion of the DateTime class.
- *
- * @return Integer - Month of the year associated with this DateTime class
- *
- */
+ * Gets the Month portion of the DateTime class.
+ *
+ * @return Integer - Month of the year associated with this DateTime class
+ */
public Integer getMonth() {
return getInteger(KEY_MONTH);
}
- /**
- * Sets the Month portion of the DateTime class
- *
- * @param month
- * The Month of the year associate with this DateTime class
- *
- */
- public DateTime setMonth( Integer month) {
+ /**
+ * Sets the Month portion of the DateTime class
+ *
+ * @param month The Month of the year associate with this DateTime class
+ */
+ public DateTime setMonth(Integer month) {
setValue(KEY_MONTH, month);
return this;
}
/**
- * Gets the Year portion of the DateTime class.
- *
- * @return Integer - The year in YYYY format associated with this DateTime class
- *
- */
+ * Gets the Year portion of the DateTime class.
+ *
+ * @return Integer - The year in YYYY format associated with this DateTime class
+ */
public Integer getYear() {
return getInteger(KEY_YEAR);
}
- /**
- * Sets the Year portion of the DateTime class
- *
- * @param year
- * The Year in YYYY format associated with this DateTime class
- *
- */
- public DateTime setYear( Integer year) {
+ /**
+ * Sets the Year portion of the DateTime class
+ *
+ * @param year The Year in YYYY format associated with this DateTime class
+ */
+ public DateTime setYear(Integer year) {
setValue(KEY_YEAR, year);
return this;
}
/**
- * Gets the Time Zone Hours portion of the DateTime class.
- *
- * @return Integer - The time zone offset in Hours with regard to UTC time associated with this DateTime class
- *
- */
+ * Gets the Time Zone Hours portion of the DateTime class.
+ *
+ * @return Integer - The time zone offset in Hours with regard to UTC time associated with this DateTime class
+ */
public Integer getTzHour() {
return getInteger(KEY_TZ_HOUR);
}
- /**
- * Sets the Time Zone Hours portion of the DateTime class
- *
- * @param tzHour
- * The time zone offset in Hours with regard to UTC time associated with this DateTime class
- *
- */
- public DateTime setTzHour( Integer tzHour) {
+ /**
+ * Sets the Time Zone Hours portion of the DateTime class
+ *
+ * @param tzHour The time zone offset in Hours with regard to UTC time associated with this DateTime class
+ */
+ public DateTime setTzHour(Integer tzHour) {
setValue(KEY_TZ_HOUR, tzHour);
return this;
}
-
+
/**
- * Gets the Time Zone Minutes portion of the DateTime class.
- *
- * @return Integer - The time zone offset in minutes with regard to UTC associated with this DateTime class
- *
- */
+ * Gets the Time Zone Minutes portion of the DateTime class.
+ *
+ * @return Integer - The time zone offset in minutes with regard to UTC associated with this DateTime class
+ */
public Integer getTzMinute() {
return getInteger(KEY_TZ_MINUTE);
}
- /**
- * Sets the Time Zone Minutes portion of the DateTime class
- *
- * @param tzMinute
- * The time zone offset in Minutes with regard to UTC associated with this DateTime class
- */
- public DateTime setTzMinute( Integer tzMinute) {
+ /**
+ * Sets the Time Zone Minutes portion of the DateTime class
+ *
+ * @param tzMinute The time zone offset in Minutes with regard to UTC associated with this DateTime class
+ */
+ public DateTime setTzMinute(Integer tzMinute) {
setValue(KEY_TZ_MINUTE, tzMinute);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
index 35b96387f..aa28ade48 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,12 +40,12 @@ import java.util.Hashtable;
/**
* Removes a command from the Command Menu.
- *
+ *
* <p><b>HMI Status Requirements:</b></p>
* <p>HMILevel: FULL, LIMITED or BACKGROUND</p>
* AudioStreamingState: N/A
* <p>SystemContext: Should not be attempted when VRSESSION or MENU</p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -65,72 +65,75 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- *
- *<p><b> Response:</b></p>
*
- * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code,this means a command was removed from the Command Menu successfully.
- *
- *<p><b> Non-default Result Codes:</b></p>
+ * <p><b> Response:</b></p>
+ * <p>
+ * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code,this means a command was removed from the Command Menu successfully.
+ *
+ * <p><b> Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
* <p>OUT_OF_MEMORY</p>
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
- * <p>REJECTED</p>
+ * <p>REJECTED</p>
* <p> INVALID_ID</p>
- * <p> IN_USER</p>
- * @since SmartDeviceLink 1.0
+ * <p> IN_USER</p>
+ *
* @see AddCommand
* @see AddSubMenu
* @see DeleteSubMenu
+ * @since SmartDeviceLink 1.0
*/
public class DeleteCommand extends RPCRequest {
- public static final String KEY_CMD_ID = "cmdID";
+ public static final String KEY_CMD_ID = "cmdID";
- /**
- * Constructs a new DeleteCommand object
- */
- public DeleteCommand() {
+ /**
+ * Constructs a new DeleteCommand object
+ */
+ public DeleteCommand() {
super(FunctionID.DELETE_COMMAND.toString());
}
- /**
- * Constructs a new DeleteCommand object indicated by the Hashtable
- * parameter
- *
- *
- * @param hash
- * The Hashtable to use
- */
- public DeleteCommand(Hashtable<String, Object> hash) {
+
+ /**
+ * Constructs a new DeleteCommand object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public DeleteCommand(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new DeleteCommand object
- * @param cmdID: an Integer value representing Command ID
- */
- public DeleteCommand(@NonNull Integer cmdID) {
- this();
- setCmdID(cmdID);
- }
- /**
- * Gets the Command ID that identifies the Command to be deleted from
- * Command Menu
- *
- * @return Integer - Integer value representing Command ID that identifies
- * the Command to be deleted from Command Menu
- */
+
+ /**
+ * Constructs a new DeleteCommand object
+ *
+ * @param cmdID: an Integer value representing Command ID
+ */
+ public DeleteCommand(@NonNull Integer cmdID) {
+ this();
+ setCmdID(cmdID);
+ }
+
+ /**
+ * Gets the Command ID that identifies the Command to be deleted from
+ * Command Menu
+ *
+ * @return Integer - Integer value representing Command ID that identifies
+ * the Command to be deleted from Command Menu
+ */
public Integer getCmdID() {
- return getInteger( KEY_CMD_ID );
+ return getInteger(KEY_CMD_ID);
}
- /**
- * Sets the Command ID that identifies the Command to be deleted from Command Menu
- *
- * @param cmdID
- * an Integer value representing Command ID
- *
- * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
- */
+
+ /**
+ * Sets the Command ID that identifies the Command to be deleted from Command Menu
+ *
+ * @param cmdID an Integer value representing Command ID
+ *
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
+ */
public DeleteCommand setCmdID(@NonNull Integer cmdID) {
setParameters(KEY_CMD_ID, cmdID);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
index 3d6d94917..899efb4ad 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.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 androidx.annotation.NonNull;
@@ -41,23 +41,26 @@ import java.util.Hashtable;
/**
* Delete Command Response is sent, when DeleteCommand has been called.
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class DeleteCommandResponse extends RPCResponse {
- /** Constructs a new DeleteCommandResponse object
- *
- */
+ /**
+ * Constructs a new DeleteCommandResponse object
+ */
public DeleteCommandResponse() {
super(FunctionID.DELETE_COMMAND.toString());
}
+
public DeleteCommandResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new DeleteCommandResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DeleteCommandResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
index b855f1bbf..dc5ad1ea9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,7 +41,7 @@ import java.util.Hashtable;
/**
* Used to delete a file resident on the SDL module in the app's local cache.
* Not supported on first generation SDL vehicles
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -61,9 +61,9 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ *
* <p><b>Response </b></p>
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
* <p> SUCCESS</p>
* <p> INVALID_DATA</p>
@@ -71,54 +71,56 @@ import java.util.Hashtable;
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
* <p>GENERIC_ERROR</p>
- * <p>REJECTED</p>
- * @since SmartDeviceLink 2.0
+ * <p>REJECTED</p>
+ *
* @see PutFile
* @see ListFiles
+ * @since SmartDeviceLink 2.0
*/
public class DeleteFile extends RPCRequest {
- public static final String KEY_SDL_FILE_NAME = "syncFileName";
+ public static final String KEY_SDL_FILE_NAME = "syncFileName";
- /**
- * Constructs a new DeleteFile object
- */
+ /**
+ * Constructs a new DeleteFile object
+ */
public DeleteFile() {
super(FunctionID.DELETE_FILE.toString());
}
- /**
- * <p>Constructs a new DeleteFile object indicated by the Hashtable parameter</p>
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new DeleteFile object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public DeleteFile(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new DeleteFile object
- * @param sdlFileName a String value representing a file reference name
- */
- public DeleteFile(@NonNull String sdlFileName) {
- this();
- setSdlFileName(sdlFileName);
- }
+ /**
+ * Constructs a new DeleteFile object
+ *
+ * @param sdlFileName a String value representing a file reference name
+ */
+ public DeleteFile(@NonNull String sdlFileName) {
+ this();
+ setSdlFileName(sdlFileName);
+ }
- /**
- * Sets a file reference name
- *
- * @param sdlFileName
- * a String value representing a file reference name
- */
+ /**
+ * Sets a file reference name
+ *
+ * @param sdlFileName a String value representing a file reference name
+ */
public DeleteFile setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
return this;
}
- /**
- * Gets a file reference name
- *
- * @return String -a String value representing a file reference name
- */
+ /**
+ * Gets a file reference name
+ *
+ * @return String -a String value representing a file reference name
+ */
public String getSdlFileName() {
return getString(KEY_SDL_FILE_NAME);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
index bea9a1b65..68b32ff53 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,12 +42,12 @@ import java.util.Hashtable;
/**
* Delete File Response is sent, when DeleteFile has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class DeleteFileResponse extends RPCResponse {
- public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
- private static final Integer MAX_VALUE = 2000000000;
+ public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
+ private static final Integer MAX_VALUE = 2000000000;
/**
* Constructs a new DeleteFileResponse object
@@ -62,7 +62,8 @@ public class DeleteFileResponse extends RPCResponse {
/**
* Constructs a new DeleteFileResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DeleteFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -76,21 +77,21 @@ public class DeleteFileResponse extends RPCResponse {
* always have a value connects to such a system, it could return null. Check to see if there
* is a value, and if not, set it to MAX_VALUE as defined by the RPC Spec
*
- * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
- * the max value of RPC spec version this library supports should be used.
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
* @param formatParams if true, the format method will be called on subsequent params
*/
@Override
- public void format(Version rpcVersion, boolean formatParams){
- if (rpcVersion == null || rpcVersion.getMajor() >= 5){
- if (getSpaceAvailable() == null){
+ public void format(Version rpcVersion, boolean formatParams) {
+ if (rpcVersion == null || rpcVersion.getMajor() >= 5) {
+ if (getSpaceAvailable() == null) {
setSpaceAvailable(MAX_VALUE);
}
}
super.format(rpcVersion, formatParams);
}
- public DeleteFileResponse setSpaceAvailable( Integer spaceAvailable) {
+ public DeleteFileResponse setSpaceAvailable(Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
index 06c36e1de..eac6fc6f5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,17 +43,17 @@ import java.util.Hashtable;
* interactionChoiceSetID. If the specified interactionChoiceSetID is currently
* in use by an active <i> {@linkplain PerformInteraction}</i> this call to
* delete the Choice Set will fail returning an IN_USE resultCode
- *
+ *
* <p>Function Group: Base</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p>AudioStreamingState: Any</p>
- *
+ *
* <p>SystemContext: MAIN, MENU, VR </p>
- *
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -74,9 +74,9 @@ import java.util.Hashtable;
* </table>
*
* <p><b>Response </b></p>
- *
+ * <p>
* If a resultCode of "SUCCESS" is returned, the requested choice set has been created and can now be referenced by the application using the value of interactionChoiceSetID provided by the application.
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
@@ -84,54 +84,59 @@ import java.util.Hashtable;
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
* <p>GENERIC_ERROR</p>
- * <p>REJECTED</p>
+ * <p>REJECTED</p>
* <p>INVALID_ID</p>
-
- * @since SmartDeviceLink 1.0
+ *
* @see CreateInteractionChoiceSet
* @see PerformInteraction
+ * @since SmartDeviceLink 1.0
*/
public class DeleteInteractionChoiceSet extends RPCRequest {
- public static final String KEY_INTERACTION_CHOICE_SET_ID = "interactionChoiceSetID";
+ public static final String KEY_INTERACTION_CHOICE_SET_ID = "interactionChoiceSetID";
- /**
- * Constructs a new DeleteInteractionChoiceSet object
- */
+ /**
+ * Constructs a new DeleteInteractionChoiceSet object
+ */
public DeleteInteractionChoiceSet() {
super(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString());
}
- /**
- * <p>Constructs a new DeleteInteractionChoiceSet object indicated by the
- * Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a new DeleteInteractionChoiceSet object indicated by the
+ * Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public DeleteInteractionChoiceSet(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new DeleteInteractionChoiceSet object
- * @param interactionChoiceSetID a unique ID that identifies the Choice Set
- * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
- */
- public DeleteInteractionChoiceSet(@NonNull Integer interactionChoiceSetID) {
- this();
- setInteractionChoiceSetID(interactionChoiceSetID);
- }
+
+ /**
+ * Constructs a new DeleteInteractionChoiceSet object
+ *
+ * @param interactionChoiceSetID a unique ID that identifies the Choice Set
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
+ */
+ public DeleteInteractionChoiceSet(@NonNull Integer interactionChoiceSetID) {
+ this();
+ setInteractionChoiceSetID(interactionChoiceSetID);
+ }
+
/**
- * Gets a unique ID that identifies the Choice Set
- * @return Integer -an Integer value representing the unique Choice Set ID
- */
+ * Gets a unique ID that identifies the Choice Set
+ *
+ * @return Integer -an Integer value representing the unique Choice Set ID
+ */
public Integer getInteractionChoiceSetID() {
- return getInteger( KEY_INTERACTION_CHOICE_SET_ID );
+ return getInteger(KEY_INTERACTION_CHOICE_SET_ID);
}
- /**
- * Sets a unique ID that identifies the Choice Set
- * @param interactionChoiceSetID a unique ID that identifies the Choice Set
- * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
- */
+
+ /**
+ * Sets a unique ID that identifies the Choice Set
+ *
+ * @param interactionChoiceSetID a unique ID that identifies the Choice Set
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
+ */
public DeleteInteractionChoiceSet setInteractionChoiceSetID(@NonNull Integer interactionChoiceSetID) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID, interactionChoiceSetID);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
index 34cc5fcd8..77a720920 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.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 androidx.annotation.NonNull;
@@ -41,7 +41,7 @@ import java.util.Hashtable;
/**
* Delete Interaction ChoiceSet Response is sent, when DeleteInteractionChoiceSet has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class DeleteInteractionChoiceSetResponse extends RPCResponse {
@@ -49,12 +49,15 @@ public class DeleteInteractionChoiceSetResponse extends RPCResponse {
public DeleteInteractionChoiceSetResponse() {
super(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString());
}
+
public DeleteInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new DeleteInteractionChoiceSetResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DeleteInteractionChoiceSetResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
index 22306a668..078504bd0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,13 +40,13 @@ import java.util.Hashtable;
/**
* Deletes a submenu from the Command Menu.
- *
+ *
* <p><b>Notes: </b>When an app deletes a submenu that has child commands, those
* child commands are also deleted</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
- *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -67,61 +67,70 @@ import java.util.Hashtable;
* </tr>
* </table>
*
- *<p> <b>Response </b></p>
- *
+ * <p> <b>Response </b></p>
+ *
* <p><b>Non-default Result Codes:</b></p>
- *<p>SUCCESS</p>
- *<p> INVALID_DATA</p>
+ * <p>SUCCESS</p>
+ * <p> INVALID_DATA</p>
* <p> OUT_OF_MEMORY</p>
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
* <p> REJECTED</p>
* <p> INVALID_ID</p>
- * <p> IN_USE </p>
- *
- * @since SmartDeviceLink 1.0
+ * <p> IN_USE </p>
+ *
* @see AddCommand
* @see AddSubMenu
* @see DeleteCommand
+ * @since SmartDeviceLink 1.0
*/
public class DeleteSubMenu extends RPCRequest {
- public static final String KEY_MENU_ID = "menuID";
- /**
- * Constructs a new DeleteSubMenu object
- */
- public DeleteSubMenu() {
+ public static final String KEY_MENU_ID = "menuID";
+
+ /**
+ * Constructs a new DeleteSubMenu object
+ */
+ public DeleteSubMenu() {
super(FunctionID.DELETE_SUB_MENU.toString());
}
+
/**
- * Constructs a new DeleteSubMenu object indicated by the Hashtable parameter
+ * Constructs a new DeleteSubMenu object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public DeleteSubMenu(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new DeleteSubMenu object
+ *
* @param menuID an Integer value representing menuID that identifies the SubMenu to be delete
*
- * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
public DeleteSubMenu(@NonNull Integer menuID) {
this();
setMenuID(menuID);
}
+
/**
* Gets the Menu ID that identifies the SubMenu to be delete
+ *
* @return Integer -an Integer value representing menuID that identifies the SubMenu to be delete
- */
+ */
public Integer getMenuID() {
- return getInteger( KEY_MENU_ID );
+ return getInteger(KEY_MENU_ID);
}
+
/**
* Sets the MenuID that identifies the SubMenu to be delete
+ *
* @param menuID an Integer value representing menuID that identifies the SubMenu to be delete
*
- * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
public DeleteSubMenu setMenuID(@NonNull Integer menuID) {
setParameters(KEY_MENU_ID, menuID);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
index 88190cb13..f509e5feb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.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 androidx.annotation.NonNull;
@@ -41,23 +41,26 @@ import java.util.Hashtable;
/**
* Delete SubMenu Response is sent, when DeleteSubMenu has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class DeleteSubMenuResponse extends RPCResponse {
- /**
- * Constructs a new DeleteSubMenuResponse object
- */
+ /**
+ * Constructs a new DeleteSubMenuResponse object
+ */
public DeleteSubMenuResponse() {
super(FunctionID.DELETE_SUB_MENU.toString());
}
+
public DeleteSubMenuResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new DeleteSubMenuResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DeleteSubMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
index 06c00736a..f8247d6d7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
@@ -9,6 +9,7 @@ import java.util.Hashtable;
/**
* This RPC deletes the window created by the CreateWindow RPC
+ *
* @see CreateWindow
* @since 6.0
*/
@@ -36,7 +37,7 @@ public class DeleteWindow extends RPCRequest {
* 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.
+ * See PredefinedWindows enum.
*/
public DeleteWindow(@NonNull Integer windowID) {
this();
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
index fee588426..4c1551300 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
@@ -10,6 +10,7 @@ import java.util.Hashtable;
/**
* This RPC is the response of the DeleteWindow RPC
+ *
* @see DeleteWindow
* @since 6.0
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
index 7c98b1e84..9a98a997b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,13 +34,14 @@ package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
* Various information about connecting device.
- *
- *
- *
+ *
+ *
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -99,9 +100,8 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- *
*/
-public class DeviceInfo extends RPCStruct{
+public class DeviceInfo extends RPCStruct {
public static final String KEY_HARDWARE = "hardware";
public static final String KEY_FIRMWARE_REV = "firmwareRev";
public static final String KEY_OS = "os";
@@ -109,66 +109,69 @@ public class DeviceInfo extends RPCStruct{
public static final String KEY_CARRIER = "carrier";
public static final String KEY_MAX_NUMBER_RFCOMM_PORTS = "maxNumberRFCOMMPorts";
- public DeviceInfo() { }
+ public DeviceInfo() {
+ }
- /** Constructs a new DeviceInfo object indicated by the Hashtable
- * parameter
- * @param hash The hash table to use to create an instance of this RPC
- */
- public DeviceInfo(Hashtable<String, Object> hash) {
+ /**
+ * Constructs a new DeviceInfo object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The hash table to use to create an instance of this RPC
+ */
+ public DeviceInfo(Hashtable<String, Object> hash) {
super(hash);
}
- public DeviceInfo setHardware( String hardware) {
+ public DeviceInfo setHardware(String hardware) {
setValue(KEY_HARDWARE, hardware);
return this;
}
- public String getHardware() {
- return getString(KEY_HARDWARE);
- }
-
- public DeviceInfo setFirmwareRev( String firmwareRev) {
+ public String getHardware() {
+ return getString(KEY_HARDWARE);
+ }
+
+ public DeviceInfo setFirmwareRev(String firmwareRev) {
setValue(KEY_FIRMWARE_REV, firmwareRev);
return this;
}
- public String getFirmwareRev() {
- return getString(KEY_FIRMWARE_REV);
- }
+ public String getFirmwareRev() {
+ return getString(KEY_FIRMWARE_REV);
+ }
- public DeviceInfo setOs( String os) {
+ public DeviceInfo setOs(String os) {
setValue(KEY_OS, os);
return this;
}
- public String getOs() {
- return getString(KEY_OS);
- }
+ public String getOs() {
+ return getString(KEY_OS);
+ }
- public DeviceInfo setOsVersion( String osVersion) {
+ public DeviceInfo setOsVersion(String osVersion) {
setValue(KEY_OS_VERSION, osVersion);
return this;
}
-public String getOsVersion() {
- return getString(KEY_OS_VERSION);
-}
-
-public DeviceInfo setCarrier( String carrier) {
+ public String getOsVersion() {
+ return getString(KEY_OS_VERSION);
+ }
+
+ public DeviceInfo setCarrier(String carrier) {
setValue(KEY_CARRIER, carrier);
return this;
}
-public String getCarrier() {
- return getString(KEY_CARRIER);
-}
+ public String getCarrier() {
+ return getString(KEY_CARRIER);
+ }
-public Integer getMaxNumberRFCOMMPorts() {
- return getInteger( KEY_MAX_NUMBER_RFCOMM_PORTS );
-}
+ public Integer getMaxNumberRFCOMMPorts() {
+ return getInteger(KEY_MAX_NUMBER_RFCOMM_PORTS);
+ }
-public DeviceInfo setMaxNumberRFCOMMPorts( Integer maxNumberRFCOMMPorts) {
+ public DeviceInfo setMaxNumberRFCOMMPorts(Integer maxNumberRFCOMMPorts) {
setValue(KEY_MAX_NUMBER_RFCOMM_PORTS, maxNumberRFCOMMPorts);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
index e3459f002..a857a50e9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -127,12 +127,11 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 2.0
- *
+ *
* @see DeviceLevelStatus
* @see GetVehicleData
* @see OnVehicleData
- *
+ * @since SmartDeviceLink 2.0
*/
public class DeviceStatus extends RPCStruct {
public static final String KEY_VOICE_REC_ON = "voiceRecOn";
@@ -147,13 +146,15 @@ public class DeviceStatus extends RPCStruct {
public static final String KEY_PRIMARY_AUDIO_SOURCE = "primaryAudioSource";
public static final String KEY_E_CALL_EVENT_ACTIVE = "eCallEventActive";
- /**
- * Constructs a newly allocated DeviceStatus object
- */
- public DeviceStatus() {}
-
+ /**
+ * Constructs a newly allocated DeviceStatus object
+ */
+ public DeviceStatus() {
+ }
+
/**
* Constructs a newly allocated DeviceStatus object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public DeviceStatus(Hashtable<String, Object> hash) {
@@ -162,16 +163,17 @@ public class DeviceStatus extends RPCStruct {
/**
* Constructs a newly allocated DeviceStatus object
+ *
* @param voiceRecOn
- * @param btIconOn the bluetooth connection established
- * @param callActive a call is being active
- * @param phoneRoaming the phone is in roaming mode
- * @param textMsgAvailable a text message is available
- * @param battLevelStatus battery level status
+ * @param btIconOn the bluetooth connection established
+ * @param callActive a call is being active
+ * @param phoneRoaming the phone is in roaming mode
+ * @param textMsgAvailable a text message is available
+ * @param battLevelStatus battery level status
* @param stereoAudioOutputMuted the status of the stereo audio output channel
- * @param monoAudioOutputMuted the status of the mono audio output channel
- * @param signalLevelStatus signal level status
- * @param primaryAudioSource the current primary audio source of SDL (if selected
+ * @param monoAudioOutputMuted the status of the mono audio output channel
+ * @param signalLevelStatus signal level status
+ * @param primaryAudioSource the current primary audio source of SDL (if selected
* @param eCallEventActive
*/
public DeviceStatus(@NonNull Boolean voiceRecOn, @NonNull Boolean btIconOn, @NonNull Boolean callActive, @NonNull Boolean phoneRoaming, @NonNull Boolean textMsgAvailable, @NonNull DeviceLevelStatus battLevelStatus,
@@ -192,172 +194,194 @@ public class DeviceStatus extends RPCStruct {
/**
* set the voice recognition on or off
+ *
* @param voiceRecOn
*/
public DeviceStatus setVoiceRecOn(@NonNull Boolean voiceRecOn) {
setValue(KEY_VOICE_REC_ON, voiceRecOn);
return this;
}
-
+
/**
* get whether the voice recognition is on
+ *
* @return whether the voice recognition is on
*/
public Boolean getVoiceRecOn() {
return getBoolean(KEY_VOICE_REC_ON);
}
-
+
/**
* set the bluetooth connection established
+ *
* @param btIconOn the bluetooth connection established
*/
public DeviceStatus setBtIconOn(@NonNull Boolean btIconOn) {
setValue(KEY_BT_ICON_ON, btIconOn);
return this;
}
-
+
/**
* get the bluetooth connection established
+ *
* @return the bluetooth connection established
*/
public Boolean getBtIconOn() {
return getBoolean(KEY_BT_ICON_ON);
}
-
+
/**
* set a call is being active
+ *
* @param callActive a call is being active
*/
public DeviceStatus setCallActive(@NonNull Boolean callActive) {
setValue(KEY_CALL_ACTIVE, callActive);
return this;
}
-
+
/**
* get a call is being active
- * @return a call is being active
+ *
+ * @return a call is being active
*/
public Boolean getCallActive() {
return getBoolean(KEY_CALL_ACTIVE);
}
-
+
/**
* set the phone is in roaming mode
- * @param phoneRoaming the phone is in roaming mode
+ *
+ * @param phoneRoaming the phone is in roaming mode
*/
public DeviceStatus setPhoneRoaming(@NonNull Boolean phoneRoaming) {
setValue(KEY_PHONE_ROAMING, phoneRoaming);
return this;
}
-
+
/**
* get the phone is in roaming mode
- * @return the phone is in roaming mode
+ *
+ * @return the phone is in roaming mode
*/
public Boolean getPhoneRoaming() {
return getBoolean(KEY_PHONE_ROAMING);
}
+
public DeviceStatus setTextMsgAvailable(@NonNull Boolean textMsgAvailable) {
setValue(KEY_TEXT_MSG_AVAILABLE, textMsgAvailable);
return this;
}
-
+
/**
* get a text message is available
+ *
* @return a text message is available
*/
public Boolean getTextMsgAvailable() {
return getBoolean(KEY_TEXT_MSG_AVAILABLE);
}
-
+
/**
* set battery level status
+ *
* @param battLevelStatus battery level status
*/
public DeviceStatus setBattLevelStatus(@NonNull DeviceLevelStatus battLevelStatus) {
setValue(KEY_BATT_LEVEL_STATUS, battLevelStatus);
return this;
}
-
+
/**
* get battery level status
+ *
* @return battery level status
*/
public DeviceLevelStatus getBattLevelStatus() {
return (DeviceLevelStatus) getObject(DeviceLevelStatus.class, KEY_BATT_LEVEL_STATUS);
}
-
+
/**
* set the status of the stereo audio output channel
+ *
* @param stereoAudioOutputMuted the status of the stereo audio output channel
*/
public DeviceStatus setStereoAudioOutputMuted(@NonNull Boolean stereoAudioOutputMuted) {
setValue(KEY_STEREO_AUDIO_OUTPUT_MUTED, stereoAudioOutputMuted);
return this;
}
-
+
/**
* get the status of the stereo audio output channel
+ *
* @return the status of the stereo audio output channel
*/
public Boolean getStereoAudioOutputMuted() {
return getBoolean(KEY_STEREO_AUDIO_OUTPUT_MUTED);
}
-
+
/**
* set the status of the mono audio output channel
+ *
* @param monoAudioOutputMuted the status of the mono audio output channel
*/
public DeviceStatus setMonoAudioOutputMuted(@NonNull Boolean monoAudioOutputMuted) {
setValue(KEY_MONO_AUDIO_OUTPUT_MUTED, monoAudioOutputMuted);
return this;
}
-
+
/**
* get the status of the mono audio output channel
+ *
* @return the status of the mono audio output channel
*/
public Boolean getMonoAudioOutputMuted() {
return getBoolean(KEY_MONO_AUDIO_OUTPUT_MUTED);
}
-
+
/**
* set signal level status
+ *
* @param signalLevelStatus signal level status
*/
public DeviceStatus setSignalLevelStatus(@NonNull DeviceLevelStatus signalLevelStatus) {
setValue(KEY_SIGNAL_LEVEL_STATUS, signalLevelStatus);
return this;
}
-
+
/**
* get signal level status
+ *
* @return signal level status
*/
public DeviceLevelStatus getSignalLevelStatus() {
return (DeviceLevelStatus) getObject(DeviceLevelStatus.class, KEY_SIGNAL_LEVEL_STATUS);
}
-
+
/**
* set the current primary audio source of SDL (if selected).
+ *
* @param primaryAudioSource the current primary audio source of SDL (if selected).
*/
public DeviceStatus setPrimaryAudioSource(@NonNull PrimaryAudioSource primaryAudioSource) {
setValue(KEY_PRIMARY_AUDIO_SOURCE, primaryAudioSource);
return this;
}
-
+
/**
* get the current primary audio source of SDL (if selected).
- * @return the current primary audio source of SDL (if selected).
+ *
+ * @return the current primary audio source of SDL (if selected).
*/
public PrimaryAudioSource getPrimaryAudioSource() {
return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_PRIMARY_AUDIO_SOURCE);
}
+
public DeviceStatus setECallEventActive(@NonNull Boolean eCallEventActive) {
setValue(KEY_E_CALL_EVENT_ACTIVE, eCallEventActive);
return this;
}
+
public Boolean getECallEventActive() {
return getBoolean(KEY_E_CALL_EVENT_ACTIVE);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
index ddfcccf7c..bceb32de3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,8 +39,9 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
import java.util.List;
-/** Non periodic vehicle diagnostic request.
- *
+/**
+ * Non periodic vehicle diagnostic request.
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -77,81 +78,82 @@ import java.util.List;
* </tr>
* </table>
* <p><b>HMI must:</b> </p>
- *
+ *
* <p>1. Check the requested data using provided information of targetID (name of ECU),messageLength and messageData.</p>
* <p> 2. Respond with one of the appropriate result codes.And in case of SUCCESS return messageDataResult which is an array of bytes comprising CAN message result.</p>
- * @since SmartDeviceLink 3.0
*
+ * @since SmartDeviceLink 3.0
*/
public class DiagnosticMessage extends RPCRequest {
- public static final String KEY_TARGET_ID = "targetID";
- public static final String KEY_MESSAGE_LENGTH = "messageLength";
- public static final String KEY_MESSAGE_DATA = "messageData";
+ public static final String KEY_TARGET_ID = "targetID";
+ public static final String KEY_MESSAGE_LENGTH = "messageLength";
+ public static final String KEY_MESSAGE_DATA = "messageData";
- /**
- * Constructs a new DiagnosticMessage object
- */
+ /**
+ * Constructs a new DiagnosticMessage object
+ */
public DiagnosticMessage() {
super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
}
/**
- * <p>
- * Constructs a new DiagnosticMessage object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash The Hashtable to use to create this RPC
- *
- */
+ * <p>
+ * Constructs a new DiagnosticMessage object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use to create this RPC
+ */
public DiagnosticMessage(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new DiagnosticMessage object
- */
- public DiagnosticMessage(@NonNull Integer targetID, @NonNull Integer messageLength, @NonNull List<Integer> messageData) {
- this();
- setTargetID(targetID);
- setMessageLength(messageLength);
- setMessageData(messageData);
- }
+ /**
+ * Constructs a new DiagnosticMessage object
+ */
+ public DiagnosticMessage(@NonNull Integer targetID, @NonNull Integer messageLength, @NonNull List<Integer> messageData) {
+ this();
+ setTargetID(targetID);
+ setMessageLength(messageLength);
+ setMessageData(messageData);
+ }
- /** Sets TargetID
- *
- * @param targetID the target for this Diagnostic Message
- */
+ /**
+ * Sets TargetID
+ *
+ * @param targetID the target for this Diagnostic Message
+ */
public DiagnosticMessage setTargetID(@NonNull Integer targetID) {
setParameters(KEY_TARGET_ID, targetID);
return this;
}
/**
- * <p>
- * Returns an <i>Integer</i> object representing the Target ID that you want to add
- * </p>
- *
- * @return Integer -an integer representation a Unique Target ID
- */
+ * <p>
+ * Returns an <i>Integer</i> object representing the Target ID that you want to add
+ * </p>
+ *
+ * @return Integer -an integer representation a Unique Target ID
+ */
public Integer getTargetID() {
- return getInteger(KEY_TARGET_ID);
- }
+ return getInteger(KEY_TARGET_ID);
+ }
public DiagnosticMessage setMessageLength(@NonNull Integer messageLength) {
setParameters(KEY_MESSAGE_LENGTH, messageLength);
return this;
}
+
public Integer getMessageLength() {
- return getInteger(KEY_MESSAGE_LENGTH);
+ return getInteger(KEY_MESSAGE_LENGTH);
}
@SuppressWarnings("unchecked")
public List<Integer> getMessageData() {
return (List<Integer>) getObject(Integer.class, KEY_MESSAGE_DATA);
}
-
+
public DiagnosticMessage setMessageData(@NonNull List<Integer> messageData) {
setParameters(KEY_MESSAGE_DATA, messageData);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
index 38aee38b0..edf4a7e87 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,25 +42,28 @@ import java.util.List;
/**
* Diagnostic Message Response is sent, when DiagnosticMessage has been called.
- *
+ *
* @since SmartDeviceLink 3.0
*/
public class DiagnosticMessageResponse extends RPCResponse {
- public static final String KEY_MESSAGE_DATA_RESULT = "messageDataResult";
- /**
- * Constructs a new DiagnosticMessageResponse object
- */
+ public static final String KEY_MESSAGE_DATA_RESULT = "messageDataResult";
+
+ /**
+ * Constructs a new DiagnosticMessageResponse object
+ */
public DiagnosticMessageResponse() {
super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
}
+
public DiagnosticMessageResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new DiagnosticMessageResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DiagnosticMessageResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -73,8 +76,8 @@ public class DiagnosticMessageResponse extends RPCResponse {
public List<Integer> getMessageDataResult() {
return (List<Integer>) getObject(Integer.class, KEY_MESSAGE_DATA_RESULT);
}
-
- public DiagnosticMessageResponse setMessageDataResult( List<Integer> messageDataResult) {
+
+ public DiagnosticMessageResponse setMessageDataResult(List<Integer> messageDataResult) {
setParameters(KEY_MESSAGE_DATA_RESULT, messageDataResult);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
index 472bca08d..b7ccdfaac 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,43 +44,43 @@ import java.util.Hashtable;
* @since SmartDeviceLink 4.0
*/
public class DialNumber extends RPCRequest {
- public static final String KEY_NUMBER = "number";
+ public static final String KEY_NUMBER = "number";
- public DialNumber(){
+ public DialNumber() {
super(FunctionID.DIAL_NUMBER.toString());
- }
-
- public DialNumber(Hashtable<String, Object> hash) {
- super(hash);
- }
+ }
+
+ public DialNumber(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public DialNumber(@NonNull String number) {
+ this();
+ setNumber(number);
+ }
- public DialNumber(@NonNull String number){
- this();
- setNumber(number);
- }
- /**
- * Sets a number to dial
- *
- * @param number
- * a phone number is a string, which can be up to 40 chars.
- * <p>
- * <b>Notes: </b>Maxlength=40</p>
- * All characters shall be stripped from string except digits 0-9 and * # , ; +
- */
+ /**
+ * Sets a number to dial
+ *
+ * @param number a phone number is a string, which can be up to 40 chars.
+ * <p>
+ * <b>Notes: </b>Maxlength=40</p>
+ * All characters shall be stripped from string except digits 0-9 and * # , ; +
+ */
public DialNumber setNumber(@NonNull String number) {
if (number != null) {
- number = number.replaceAll("[^0-9*#,;+]", ""); //This will sanitize the input
+ number = number.replaceAll("[^0-9*#,;+]", ""); //This will sanitize the input
}
- setParameters(KEY_NUMBER, number);
+ setParameters(KEY_NUMBER, number);
return this;
}
- /**
- * Gets a number to dial
- *
- * @return String - a String value representing a number to dial
- */
+ /**
+ * Gets a number to dial
+ *
+ * @return String - a String value representing a number to dial
+ */
public String getNumber() {
return getString(KEY_NUMBER);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
index 057c4d02b..4a64a8b3f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,7 +41,7 @@ import java.util.Hashtable;
/**
* Dial Number Response is sent, when DialNumber has been called
- *
+ *
* @since SmartDeviceLink 4.0
*/
public class DialNumberResponse extends RPCResponse {
@@ -49,14 +49,15 @@ public class DialNumberResponse extends RPCResponse {
public DialNumberResponse() {
super(FunctionID.DIAL_NUMBER.toString());
}
-
- public DialNumberResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
+
+ public DialNumberResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
/**
* Constructs a new DialNumberResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public DialNumberResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
index 4fdc65560..e5757c3d2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -55,21 +55,21 @@ import java.util.List;
* <td>@Deprecated <s>displayType</s></td>
* <td><s>DisplayType</s></td>
* <td><s>The type of display</s>
- * </td>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>displayName</td>
* <td>String</td>
* <td>The name of the display
- * </td>
+ * </td>
* <td>SmartDeviceLink 5.0</td>
* </tr>
* <tr>
* <td>textField</td>
* <td>TextField[]</td>
- * <td>An array of TextField structures, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
- * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
+ * <td>An array of TextField structures, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
+ * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -86,40 +86,47 @@ import java.util.List;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
+ *
* @see DisplayType
* @see MediaClockFormat
* @see TextField
* @see ImageField
- *
+ * @since SmartDeviceLink 1.0
*/
public class DisplayCapabilities extends RPCStruct {
- @Deprecated public static final String KEY_DISPLAY_TYPE = "displayType";
- public static final String KEY_DISPLAY_NAME = "displayName";
- public static final String KEY_MEDIA_CLOCK_FORMATS = "mediaClockFormats";
- public static final String KEY_TEXT_FIELDS = "textFields";
- public static final String KEY_IMAGE_FIELDS = "imageFields";
+ @Deprecated
+ public static final String KEY_DISPLAY_TYPE = "displayType";
+ public static final String KEY_DISPLAY_NAME = "displayName";
+ public static final String KEY_MEDIA_CLOCK_FORMATS = "mediaClockFormats";
+ public static final String KEY_TEXT_FIELDS = "textFields";
+ public static final String KEY_IMAGE_FIELDS = "imageFields";
public static final String KEY_GRAPHIC_SUPPORTED = "graphicSupported";
public static final String KEY_SCREEN_PARAMS = "screenParams";
public static final String KEY_TEMPLATES_AVAILABLE = "templatesAvailable";
public static final String KEY_NUM_CUSTOM_PRESETS_AVAILABLE = "numCustomPresetsAvailable";
- /**
- * Constructs a newly allocated DisplayCapabilities object
- */
- public DisplayCapabilities() { }
+
+ /**
+ * Constructs a newly allocated DisplayCapabilities object
+ */
+ public DisplayCapabilities() {
+ }
+
/**
* Constructs a newly allocated DisplayCapabilities object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public DisplayCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a newly allocated DisplayCapabilities object
- * @param displayType the display type
- * @param textFields the List of textFields
+ *
+ * @param displayType the display type
+ * @param textFields the List of textFields
* @param mediaClockFormats the List of MediaClockFormat
- * @param graphicSupported true if the display supports graphics, false if it does not
+ * @param graphicSupported true if the display supports graphics, false if it does not
*/
@Deprecated
public DisplayCapabilities(@NonNull DisplayType displayType, @NonNull List<TextField> textFields, @NonNull List<MediaClockFormat> mediaClockFormats, @NonNull Boolean graphicSupported) {
@@ -129,12 +136,14 @@ public class DisplayCapabilities extends RPCStruct {
setMediaClockFormats(mediaClockFormats);
setGraphicSupported(graphicSupported);
}
+
/**
* Constructs a newly allocated DisplayCapabilities object
- * @param displayName the display name (String)
- * @param textFields the List of textFields
+ *
+ * @param displayName the display name (String)
+ * @param textFields the List of textFields
* @param mediaClockFormats the List of MediaClockFormat
- * @param graphicSupported true if the display supports graphics, false if it does not
+ * @param graphicSupported true if the display supports graphics, false if it does not
*/
public DisplayCapabilities(String displayName, @NonNull List<TextField> textFields, @NonNull List<MediaClockFormat> mediaClockFormats, @NonNull Boolean graphicSupported) {
this();
@@ -147,7 +156,7 @@ public class DisplayCapabilities extends RPCStruct {
@Override
public void format(Version rpcVersion, boolean formatParams) {
super.format(rpcVersion, formatParams);
- if(!store.containsKey(KEY_GRAPHIC_SUPPORTED)){
+ if (!store.containsKey(KEY_GRAPHIC_SUPPORTED)) {
// At some point this was added to the RPC spec as mandatory but at least in v1.0.0
// it was not included.
store.put(KEY_GRAPHIC_SUPPORTED, Boolean.FALSE);
@@ -156,14 +165,17 @@ public class DisplayCapabilities extends RPCStruct {
/**
* Get the type of display
+ *
* @return the type of display
*/
@Deprecated
public DisplayType getDisplayType() {
return (DisplayType) getObject(DisplayType.class, KEY_DISPLAY_TYPE);
}
+
/**
* Set the type of display
+ *
* @param displayType the display type
*/
@Deprecated
@@ -171,79 +183,91 @@ public class DisplayCapabilities extends RPCStruct {
setValue(KEY_DISPLAY_TYPE, displayType);
return this;
}
- /** Get the name of the display
+
+ /**
+ * 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
+ *
* @param displayName the name of the display
*/
- public DisplayCapabilities setDisplayName( String displayName) {
+ public DisplayCapabilities setDisplayName(String displayName) {
setValue(KEY_DISPLAY_NAME, displayName);
return this;
}
+
/**
- *Get an array of TextField structures, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
- * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
+ * Get an array of TextField structures, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
+ * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
+ *
* @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, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
- * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
+ * This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
+ *
* @param textFields the List of textFields
*/
public DisplayCapabilities setTextFields(@NonNull List<TextField> textFields) {
setValue(KEY_TEXT_FIELDS, textFields);
return this;
}
-
-
-
+
+
@SuppressWarnings("unchecked")
public List<ImageField> getImageFields() {
return (List<ImageField>) getObject(ImageField.class, KEY_IMAGE_FIELDS);
}
-
- public DisplayCapabilities setImageFields( List<ImageField> imageFields) {
+
+ public DisplayCapabilities setImageFields(List<ImageField> imageFields) {
setValue(KEY_IMAGE_FIELDS, imageFields);
return this;
}
-
+
public Integer getNumCustomPresetsAvailable() {
return getInteger(KEY_NUM_CUSTOM_PRESETS_AVAILABLE);
}
-
- public DisplayCapabilities setNumCustomPresetsAvailable( Integer numCustomPresetsAvailable) {
+
+ public DisplayCapabilities setNumCustomPresetsAvailable(Integer numCustomPresetsAvailable) {
setValue(KEY_NUM_CUSTOM_PRESETS_AVAILABLE, numCustomPresetsAvailable);
return this;
}
-
+
/**
* Get an array of MediaClockFormat elements, defining the valid string formats used in specifying the contents of the media clock field
+ *
* @return the Vector of mediaClockFormat
- */
+ */
@SuppressWarnings("unchecked")
public List<MediaClockFormat> getMediaClockFormats() {
return (List<MediaClockFormat>) getObject(MediaClockFormat.class, KEY_MEDIA_CLOCK_FORMATS);
}
+
/**
* Set an array of MediaClockFormat elements, defining the valid string formats used in specifying the contents of the media clock field
+ *
* @param mediaClockFormats the List of MediaClockFormat
*/
public DisplayCapabilities setMediaClockFormats(@NonNull List<MediaClockFormat> mediaClockFormats) {
setValue(KEY_MEDIA_CLOCK_FORMATS, mediaClockFormats);
return this;
}
-
+
/**
* set the display's persistent screen supports.
+ *
* @param graphicSupported true if the display supports graphics, false if it does not
* @since SmartDeviceLink 2.0
*/
@@ -251,27 +275,28 @@ public class DisplayCapabilities extends RPCStruct {
setValue(KEY_GRAPHIC_SUPPORTED, graphicSupported);
return this;
}
-
+
/**
* Get the display's persistent screen supports.
+ *
* @return true if the display supports graphics, false if it does not
* @since SmartDeviceLink 2.0
*/
public Boolean getGraphicSupported() {
- return getBoolean(KEY_GRAPHIC_SUPPORTED);
+ return getBoolean(KEY_GRAPHIC_SUPPORTED);
}
-
+
@SuppressWarnings("unchecked")
public List<String> getTemplatesAvailable() {
return (List<String>) getObject(String.class, KEY_TEMPLATES_AVAILABLE);
- }
-
- public DisplayCapabilities setTemplatesAvailable( List<String> templatesAvailable) {
+ }
+
+ public DisplayCapabilities setTemplatesAvailable(List<String> templatesAvailable) {
setValue(KEY_TEMPLATES_AVAILABLE, templatesAvailable);
return this;
}
-
- public DisplayCapabilities setScreenParams( ScreenParams screenParams) {
+
+ public DisplayCapabilities setScreenParams(ScreenParams screenParams) {
setValue(KEY_SCREEN_PARAMS, screenParams);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
index 10b740cae..f2868a7ec 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
@@ -7,6 +7,7 @@ import java.util.List;
/**
* Contain the display related information and all windows related to that display.
+ *
* @since 6.0
*/
public class DisplayCapability extends RPCStruct {
@@ -36,7 +37,7 @@ public class DisplayCapability extends RPCStruct {
*
* @param displayName the name of the display
*/
- public DisplayCapability setDisplayName( String displayName) {
+ public DisplayCapability setDisplayName(String displayName) {
setValue(KEY_DISPLAY_NAME, displayName);
return this;
}
@@ -47,7 +48,7 @@ public class DisplayCapability extends RPCStruct {
*
* @param windowTypeSupported It informs the application how many windows the app is allowed to create per type.
*/
- public DisplayCapability setWindowTypeSupported( List<WindowTypeCapabilities> windowTypeSupported) {
+ public DisplayCapability setWindowTypeSupported(List<WindowTypeCapabilities> windowTypeSupported) {
setValue(KEY_WINDOW_TYPE_SUPPORTED, windowTypeSupported);
return this;
}
@@ -74,7 +75,7 @@ public class DisplayCapability extends RPCStruct {
* 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 capabilities. The notification will reflect those changes to the single window.
*/
- public DisplayCapability setWindowCapabilities( List<WindowCapability> windowCapabilities) {
+ public DisplayCapability setWindowCapabilities(List<WindowCapability> windowCapabilities) {
setValue(KEY_WINDOW_CAPABILITIES, windowCapabilities);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DriverDistractionCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DriverDistractionCapability.java
index 67d9bb434..8f27106a2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DriverDistractionCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DriverDistractionCapability.java
@@ -36,7 +36,6 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -62,6 +61,7 @@ import java.util.Hashtable;
* <td></td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 7.0.0
*/
public class DriverDistractionCapability extends RPCStruct {
@@ -71,7 +71,8 @@ public class DriverDistractionCapability extends RPCStruct {
/**
* Constructs a new DriverDistractionCapability object
*/
- public DriverDistractionCapability() { }
+ public DriverDistractionCapability() {
+ }
/**
* Constructs a new DriverDistractionCapability object indicated by the Hashtable parameter
@@ -87,7 +88,7 @@ public class DriverDistractionCapability extends RPCStruct {
*
* @param menuLength The number of items allowed in a Choice Set or Command menu while the driver is distracted
*/
- public DriverDistractionCapability setMenuLength( Integer menuLength) {
+ public DriverDistractionCapability setMenuLength(Integer menuLength) {
setValue(KEY_MENU_LENGTH, menuLength);
return this;
}
@@ -105,9 +106,9 @@ public class DriverDistractionCapability extends RPCStruct {
* Sets the subMenuDepth.
*
* @param subMenuDepth The depth of submenus allowed when the driver is distracted. e.g. 3 == top level menu ->
- * submenu -> submenu; 1 == top level menu only
+ * submenu -> submenu; 1 == top level menu only
*/
- public DriverDistractionCapability setSubMenuDepth( Integer subMenuDepth) {
+ public DriverDistractionCapability setSubMenuDepth(Integer subMenuDepth) {
setValue(KEY_SUB_MENU_DEPTH, subMenuDepth);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DynamicUpdateCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DynamicUpdateCapabilities.java
index 2468d369a..8e74ae17a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DynamicUpdateCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DynamicUpdateCapabilities.java
@@ -38,7 +38,6 @@ import java.util.Hashtable;
import java.util.List;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -64,6 +63,7 @@ import java.util.List;
* <td></td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 7.0.0
*/
public class DynamicUpdateCapabilities extends RPCStruct {
@@ -73,7 +73,8 @@ public class DynamicUpdateCapabilities extends RPCStruct {
/**
* Constructs a new DynamicUpdateCapabilities object
*/
- public DynamicUpdateCapabilities() { }
+ public DynamicUpdateCapabilities() {
+ }
/**
* Constructs a new DynamicUpdateCapabilities object indicated by the Hashtable parameter
@@ -88,12 +89,12 @@ public class DynamicUpdateCapabilities extends RPCStruct {
* Sets the supportedDynamicImageFieldNames.
*
* @param supportedDynamicImageFieldNames An array of ImageFieldName values for which the system supports sending OnFileUpdate
- * notifications. If you send an Image struct for that image field with a name without having
- * uploaded the image data using PutFile that matches that name, the system will request that
- * you upload the data with PutFile at a later point when the HMI needs it. The HMI will then
- * display the image in the appropriate field. If not sent, assume false.
+ * notifications. If you send an Image struct for that image field with a name without having
+ * uploaded the image data using PutFile that matches that name, the system will request that
+ * you upload the data with PutFile at a later point when the HMI needs it. The HMI will then
+ * display the image in the appropriate field. If not sent, assume false.
*/
- public DynamicUpdateCapabilities setSupportedDynamicImageFieldNames( List<ImageFieldName> supportedDynamicImageFieldNames) {
+ public DynamicUpdateCapabilities setSupportedDynamicImageFieldNames(List<ImageFieldName> supportedDynamicImageFieldNames) {
setValue(KEY_SUPPORTED_DYNAMIC_IMAGE_FIELD_NAMES, supportedDynamicImageFieldNames);
return this;
}
@@ -116,11 +117,11 @@ public class DynamicUpdateCapabilities extends RPCStruct {
* Sets the supportsDynamicSubMenus.
*
* @param supportsDynamicSubMenus If true, the head unit supports dynamic sub-menus by sending OnUpdateSubMenu
- * notifications. If true, you should not send AddCommands that attach to a parentID for an
- * AddSubMenu until OnUpdateSubMenu is received with the menuID. At that point, you should
- * send all AddCommands with a parentID that match the menuID. If not set, assume false.
+ * notifications. If true, you should not send AddCommands that attach to a parentID for an
+ * AddSubMenu until OnUpdateSubMenu is received with the menuID. At that point, you should
+ * send all AddCommands with a parentID that match the menuID. If not set, assume false.
*/
- public DynamicUpdateCapabilities setSupportsDynamicSubMenus( Boolean supportsDynamicSubMenus) {
+ public DynamicUpdateCapabilities setSupportsDynamicSubMenus(Boolean supportsDynamicSubMenus) {
setValue(KEY_SUPPORTS_DYNAMIC_SUB_MENUS, supportsDynamicSubMenus);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
index e4f6fbd38..1858748d6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,8 +39,9 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
import java.util.Hashtable;
-/** Emergency Call notification and confirmation data.
- *
+/**
+ * Emergency Call notification and confirmation data.
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -76,29 +77,34 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 2.0
- * @see SubscribeVehicleData
- *
- *
*
+ * @see SubscribeVehicleData
+ * @since SmartDeviceLink 2.0
*/
public class ECallInfo extends RPCStruct {
public static final String KEY_E_CALL_NOTIFICATION_STATUS = "eCallNotificationStatus";
public static final String KEY_AUX_E_CALL_NOTIFICATION_STATUS = "auxECallNotificationStatus";
public static final String KEY_E_CALL_CONFIRMATION_STATUS = "eCallConfirmationStatus";
- /** Constructs a new ECallInfo object
- */
- public ECallInfo() { }
- /** Constructs a new ECallInfo object indicated by the Hashtable
+
+ /**
+ * Constructs a new ECallInfo object
+ */
+ public ECallInfo() {
+ }
+
+ /**
+ * Constructs a new ECallInfo object indicated by the Hashtable
* parameter
+ *
* @param hash <p>The hash table to use</p>
*/
public ECallInfo(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- * Constructs a new ECallInfo object
+ * Constructs a new ECallInfo object
*/
public ECallInfo(@NonNull VehicleDataNotificationStatus eCallNotificationStatus, @NonNull VehicleDataNotificationStatus auxECallNotificationStatus, @NonNull ECallConfirmationStatus eCallConfirmationStatus) {
this();
@@ -111,20 +117,25 @@ public class ECallInfo extends RPCStruct {
setValue(KEY_E_CALL_NOTIFICATION_STATUS, eCallNotificationStatus);
return this;
}
+
public VehicleDataNotificationStatus getECallNotificationStatus() {
return (VehicleDataNotificationStatus) getObject(VehicleDataNotificationStatus.class, KEY_E_CALL_NOTIFICATION_STATUS);
}
+
public ECallInfo setAuxECallNotificationStatus(@NonNull VehicleDataNotificationStatus auxECallNotificationStatus) {
setValue(KEY_AUX_E_CALL_NOTIFICATION_STATUS, auxECallNotificationStatus);
return this;
}
+
public VehicleDataNotificationStatus getAuxECallNotificationStatus() {
return (VehicleDataNotificationStatus) getObject(VehicleDataNotificationStatus.class, KEY_AUX_E_CALL_NOTIFICATION_STATUS);
}
+
public ECallInfo setECallConfirmationStatus(@NonNull ECallConfirmationStatus eCallConfirmationStatus) {
setValue(KEY_E_CALL_CONFIRMATION_STATUS, eCallConfirmationStatus);
return this;
}
+
public ECallConfirmationStatus getECallConfirmationStatus() {
return (ECallConfirmationStatus) getObject(ECallConfirmationStatus.class, KEY_E_CALL_CONFIRMATION_STATUS);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
index 923ad39fd..621cca031 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,8 +40,9 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import java.util.Hashtable;
-/** Information related to an emergency event (and if it occurred).
- *
+/**
+ * Information related to an emergency event (and if it occurred).
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -95,11 +96,10 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ *
* @see Image
* @see SubscribeVehicleData
* @since SmartDeviceLink 2.0
- *
*/
public class EmergencyEvent extends RPCStruct {
@@ -109,19 +109,24 @@ public class EmergencyEvent extends RPCStruct {
public static final String KEY_MAXIMUM_CHANGE_VELOCITY = "maximumChangeVelocity";
public static final String KEY_MULTIPLE_EVENTS = "multipleEvents";
- /** Constructs a new EmergencyEvent object
- *
+ /**
+ * Constructs a new EmergencyEvent object
*/
- public EmergencyEvent() { }
- /** Constructs a new EmergencyEvent object indicated by the Hashtable
+ public EmergencyEvent() {
+ }
+
+ /**
+ * Constructs a new EmergencyEvent object indicated by the Hashtable
* parameter
+ *
* @param hash <p>The hash table to use</p>
*/
public EmergencyEvent(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- * Constructs a new EmergencyEvent object
+ * Constructs a new EmergencyEvent object
*/
public EmergencyEvent(@NonNull EmergencyEventType emergencyEventType, @NonNull FuelCutoffStatus fuelCutoffStatus, @NonNull VehicleDataEventStatus rolloverEvent, @NonNull Integer maximumChangeVelocity, @NonNull VehicleDataEventStatus multipleEvents) {
this();
@@ -136,34 +141,43 @@ public class EmergencyEvent extends RPCStruct {
setValue(KEY_EMERGENCY_EVENT_TYPE, emergencyEventType);
return this;
}
+
public EmergencyEventType getEmergencyEventType() {
return (EmergencyEventType) getObject(EmergencyEventType.class, KEY_EMERGENCY_EVENT_TYPE);
}
+
public EmergencyEvent setFuelCutoffStatus(@NonNull FuelCutoffStatus fuelCutoffStatus) {
setValue(KEY_FUEL_CUTOFF_STATUS, fuelCutoffStatus);
return this;
}
+
public FuelCutoffStatus getFuelCutoffStatus() {
return (FuelCutoffStatus) getObject(FuelCutoffStatus.class, KEY_FUEL_CUTOFF_STATUS);
}
+
public EmergencyEvent setRolloverEvent(@NonNull VehicleDataEventStatus rolloverEvent) {
setValue(KEY_ROLLOVER_EVENT, rolloverEvent);
return this;
}
+
public VehicleDataEventStatus getRolloverEvent() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_ROLLOVER_EVENT);
}
+
public EmergencyEvent setMaximumChangeVelocity(@NonNull Integer maximumChangeVelocity) {
setValue(KEY_MAXIMUM_CHANGE_VELOCITY, maximumChangeVelocity);
return this;
}
+
public Integer getMaximumChangeVelocity() {
- return getInteger(KEY_MAXIMUM_CHANGE_VELOCITY);
+ return getInteger(KEY_MAXIMUM_CHANGE_VELOCITY);
}
+
public EmergencyEvent setMultipleEvents(@NonNull VehicleDataEventStatus multipleEvents) {
setValue(KEY_MULTIPLE_EVENTS, multipleEvents);
return this;
}
+
public VehicleDataEventStatus getMultipleEvents() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MULTIPLE_EVENTS);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
index a51ef4672..18e1e41ae 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThru.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 com.smartdevicelink.protocol.enums.FunctionID;
@@ -38,43 +38,42 @@ import java.util.Hashtable;
/**
* When this request is invoked, the audio capture stops
- *
+ *
* <p>Function Group: AudioPassThru</p>
- *
+ *
* <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- *
- * <p><b>Request</b></p>
- *
- * <p>No parameters.</p>
- * <p><b>Response</b> </p>
- * <p><b>Non-default Result Codes:</b></p>
- * <p>SUCCESS</p>
- * <p>INVALID_DATA</p>
- * <p>OUT_OF_MEMORY</p>
- * <p>TOO_MANY_PENDING_REQUESTS</p>
- * <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR</p>
- * <p>REJECTED</p>
- * <p>DISALLOWED</p>
- * @since SmartDeviceLink 2.0
+ *
+ * <p><b>Request</b></p>
+ *
+ * <p>No parameters.</p>
+ * <p><b>Response</b> </p>
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED</p>
+ *
* @see PerformAudioPassThru
+ * @since SmartDeviceLink 2.0
*/
public class EndAudioPassThru extends RPCRequest {
- /**
- * Constructs a new EndAudioPassThru object
- */
+ /**
+ * Constructs a new EndAudioPassThru object
+ */
public EndAudioPassThru() {
super(FunctionID.END_AUDIO_PASS_THRU.toString());
}
-
+
/**
- * <p>Constructs a new EndAudioPassThru object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
+ * <p>Constructs a new EndAudioPassThru object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
*/
public EndAudioPassThru(Hashtable<String, Object> hash) {
super(hash);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
index 008530b3a..3538d326f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.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 androidx.annotation.NonNull;
@@ -41,23 +41,26 @@ import java.util.Hashtable;
/**
* End Audio Pass Thru Response is sent, when EndAudioPassThru has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class EndAudioPassThruResponse extends RPCResponse {
- /**
- * Constructs a new EndAudioPassThruResponse object
- */
+ /**
+ * Constructs a new EndAudioPassThruResponse object
+ */
public EndAudioPassThruResponse() {
super(FunctionID.END_AUDIO_PASS_THRU.toString());
}
+
public EndAudioPassThruResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new EndAudioPassThruResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public EndAudioPassThruResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java
index 430341342..808b17cdf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/EqualizerSettings.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,91 +41,91 @@ import java.util.Hashtable;
* Defines the each Equalizer channel settings.
*/
public class EqualizerSettings extends RPCStruct {
- public static final String KEY_CHANNEL_ID = "channelId";
- public static final String KEY_CHANNEL_NAME = "channelName";
- public static final String KEY_CHANNEL_SETTING = "channelSetting";
+ public static final String KEY_CHANNEL_ID = "channelId";
+ public static final String KEY_CHANNEL_NAME = "channelName";
+ public static final String KEY_CHANNEL_SETTING = "channelSetting";
- /**
- * Constructs a newly allocated EqualizerSettings object
- */
- public EqualizerSettings() {
- }
+ /**
+ * Constructs a newly allocated EqualizerSettings object
+ */
+ public EqualizerSettings() {
+ }
- /**
- * Constructs a newly allocated EqualizerSettings object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public EqualizerSettings(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a newly allocated EqualizerSettings object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public EqualizerSettings(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated EqualizerSettings object
- *
- * @param channelId Min: 0 Max: 100
- * @param channelSetting Min: 0 Max: 100
- */
- public EqualizerSettings(@NonNull Integer channelId, @NonNull Integer channelSetting) {
- this();
- setChannelId(channelId);
- setChannelSetting(channelSetting);
- }
+ /**
+ * Constructs a newly allocated EqualizerSettings object
+ *
+ * @param channelId Min: 0 Max: 100
+ * @param channelSetting Min: 0 Max: 100
+ */
+ public EqualizerSettings(@NonNull Integer channelId, @NonNull Integer channelSetting) {
+ this();
+ setChannelId(channelId);
+ setChannelSetting(channelSetting);
+ }
- /**
- * Sets the channelId portion of the EqualizerSettings class
- *
- * @param channelId ID that represents the channel these settings should be applied
- */
- public EqualizerSettings setChannelId(@NonNull Integer channelId) {
+ /**
+ * Sets the channelId portion of the EqualizerSettings class
+ *
+ * @param channelId ID that represents the channel these settings should be applied
+ */
+ public EqualizerSettings setChannelId(@NonNull Integer channelId) {
setValue(KEY_CHANNEL_ID, channelId);
return this;
}
- /**
- * Gets the channelId portion of the EqualizerSettings class
- *
- * @return Integer
- */
- public Integer getChannelId() {
- return getInteger(KEY_CHANNEL_ID);
- }
+ /**
+ * Gets the channelId portion of the EqualizerSettings class
+ *
+ * @return Integer
+ */
+ public Integer getChannelId() {
+ return getInteger(KEY_CHANNEL_ID);
+ }
- /**
- * Sets the channelName portion of the EqualizerSettings class
- *
- * @param channelName Read-only channel / frequency name (e.i. "Treble, MidRange, Bass" or "125 Hz").
- */
- public EqualizerSettings setChannelName( String channelName) {
+ /**
+ * Sets the channelName portion of the EqualizerSettings class
+ *
+ * @param channelName Read-only channel / frequency name (e.i. "Treble, MidRange, Bass" or "125 Hz").
+ */
+ public EqualizerSettings setChannelName(String channelName) {
setValue(KEY_CHANNEL_NAME, channelName);
return this;
}
- /**
- * Gets the channelName portion of the EqualizerSettings class
- *
- * @return String - Read-only channel / frequency name (e.i. "Treble, MidRange, Bass" or "125 Hz").
- */
- public String getChannelName() {
- return getString(KEY_CHANNEL_NAME);
- }
+ /**
+ * Gets the channelName portion of the EqualizerSettings class
+ *
+ * @return String - Read-only channel / frequency name (e.i. "Treble, MidRange, Bass" or "125 Hz").
+ */
+ public String getChannelName() {
+ return getString(KEY_CHANNEL_NAME);
+ }
- /**
- * Sets the channelSetting portion of the EqualizerSettings class
- *
- * @param channelSetting Reflects the setting, from 0%-100%.
- */
- public EqualizerSettings setChannelSetting(@NonNull Integer channelSetting) {
+ /**
+ * Sets the channelSetting portion of the EqualizerSettings class
+ *
+ * @param channelSetting Reflects the setting, from 0%-100%.
+ */
+ public EqualizerSettings setChannelSetting(@NonNull Integer channelSetting) {
setValue(KEY_CHANNEL_SETTING, channelSetting);
return this;
}
- /**
- * Gets the channelSetting portion of the EqualizerSettings class
- *
- * @return Integer - Reflects the setting, from 0%-100%.
- */
- public Integer getChannelSetting() {
- return getInteger(KEY_CHANNEL_SETTING);
- }
+ /**
+ * Gets the channelSetting portion of the EqualizerSettings class
+ *
+ * @return Integer - Reflects the setting, from 0%-100%.
+ */
+ public Integer getChannelSetting() {
+ return getInteger(KEY_CHANNEL_SETTING);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
index 1c6885649..53c768baf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,7 +40,6 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -49,7 +48,7 @@ import java.util.Hashtable;
* <th>Type</th>
* <th>Description</th>
* <th>Required</th>
- * <th>Notes</th>
+ * <th>Notes</th>
* <th>Version Available</th>
* </tr>
* <tr>
@@ -101,6 +100,7 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 5.0.0
*/
public class FuelRange extends RPCStruct {
@@ -114,14 +114,14 @@ public class FuelRange extends RPCStruct {
/**
* Constructs a new FuelRange object
*/
- public FuelRange() { }
+ public FuelRange() {
+ }
/**
* <p>Constructs a new FuelRange object indicated by the Hashtable parameter
* </p>
*
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public FuelRange(Hashtable<String, Object> hash) {
super(hash);
@@ -131,10 +131,9 @@ public class FuelRange extends RPCStruct {
* Sets the type portion of the FuelRange class
*
* @param fuelType the type of fuel related to this FuelRange object.
- *
* @see FuelType
*/
- public FuelRange setType( FuelType fuelType) {
+ public FuelRange setType(FuelType fuelType) {
setValue(KEY_TYPE, fuelType);
return this;
}
@@ -161,10 +160,9 @@ public class FuelRange extends RPCStruct {
/**
* Sets the range portion of the FuelRange class
*
- * @param range
- * The estimate range in KM the vehicle can travel based on fuel level and consumption.
+ * @param range The estimate range in KM the vehicle can travel based on fuel level and consumption.
*/
- public FuelRange setRange( Float range) {
+ public FuelRange setRange(Float range) {
setValue(KEY_RANGE, range);
return this;
}
@@ -173,10 +171,10 @@ public class FuelRange extends RPCStruct {
* Sets the level.
*
* @param level The relative remaining capacity of this fuel type (percentage).
- * {"num_min_value": -6.0, "num_max_value": 1000000.0}
+ * {"num_min_value": -6.0, "num_max_value": 1000000.0}
* @since SmartDeviceLink 7.0.0
*/
- public FuelRange setLevel( Float level) {
+ public FuelRange setLevel(Float level) {
setValue(KEY_LEVEL, level);
return this;
}
@@ -199,7 +197,7 @@ public class FuelRange extends RPCStruct {
* @param levelState The fuel level state
* @since SmartDeviceLink 7.0.0
*/
- public FuelRange setLevelState( ComponentVolumeStatus levelState) {
+ public FuelRange setLevelState(ComponentVolumeStatus levelState) {
setValue(KEY_LEVEL_STATE, levelState);
return this;
}
@@ -218,10 +216,10 @@ public class FuelRange extends RPCStruct {
* Sets the capacity.
*
* @param capacity The absolute capacity of this fuel type.
- * {"num_min_value": 0.0, "num_max_value": 1000000.0}
+ * {"num_min_value": 0.0, "num_max_value": 1000000.0}
* @since SmartDeviceLink 7.0.0
*/
- public FuelRange setCapacity( Float capacity) {
+ public FuelRange setCapacity(Float capacity) {
setValue(KEY_CAPACITY, capacity);
return this;
}
@@ -242,10 +240,10 @@ public class FuelRange extends RPCStruct {
* Sets the capacityUnit.
*
* @param capacityUnit The unit of the capacity of this fuel type such as liters for gasoline or kWh for
- * batteries.
+ * batteries.
* @since SmartDeviceLink 7.0.0
*/
- public FuelRange setCapacityUnit( CapacityUnit capacityUnit) {
+ public FuelRange setCapacityUnit(CapacityUnit capacityUnit) {
setValue(KEY_CAPACITY_UNIT, capacityUnit);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
index e259636e6..d199be5e2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -99,113 +99,116 @@ import java.util.Hashtable;
* <td>Minvalue: 0<b>Maxvalue: 59
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>utcSeconds</td>
* <td>Integer</td>
* <td>Minvalue: 0<b>Maxvalue: 59
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>pdop</td>
* <td>Integer</td>
* <td>Positional Dilution of Precision. If undefined or unavailable, then value shall be set to 0.<b>Minvalue: 0<b>Maxvalue: 1000
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>hdop</td>
* <td>Integer</td>
* <td>Horizontal Dilution of Precision. If value is unknown, value shall be set to 0.<b>Minvalue: 0<b>Maxvalue: 1000
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>vdop</td>
* <td>Integer</td>
* <td>Vertical Dilution of Precision. If value is unknown, value shall be set to 0.<b>Minvalue: 0<b>Maxvalue: 1000
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>actual</td>
* <td>Boolean</td>
* <td>True, if coordinates are based on satellites.
- * False, if based on dead reckoning
+ * False, if based on dead reckoning
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>satellites</td>
* <td>Integer</td>
* <td>Number of satellites in view
- * <b>Minvalue: 0
- * <b>Maxvalue: 31
+ * <b>Minvalue: 0
+ * <b>Maxvalue: 31
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>altitude</td>
* <td>Integer</td>
* <td>Altitude in meters
- * <b>Minvalue: -10000</b>
- * <b>Maxvalue: 10000</b>
+ * <b>Minvalue: -10000</b>
+ * <b>Maxvalue: 10000</b>
* <b>Note:</b> SYNC uses Mean Sea Level for calculating GPS. </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>heading</td>
* <td>Double</td>
* <td>The heading. North is 0, East is 90, etc.
- * <b>Minvalue: 0
- * <b>Maxvalue: 359.99
- * <b>Resolution is 0.01
+ * <b>Minvalue: 0
+ * <b>Maxvalue: 359.99
+ * <b>Resolution is 0.01
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* <tr>
* <td>speed</td>
* <td>Integer</td>
* <td>The speed in KPH
- * <b>Minvalue: 0
- * <b>Maxvalue: 500
+ * <b>Minvalue: 0
+ * <b>Maxvalue: 500
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class GPSData extends RPCStruct {
- public static final String KEY_LONGITUDE_DEGREES = "longitudeDegrees";
- public static final String KEY_LATITUDE_DEGREES = "latitudeDegrees";
- public static final String KEY_UTC_YEAR = "utcYear";
- public static final String KEY_UTC_MONTH = "utcMonth";
- public static final String KEY_UTC_DAY = "utcDay";
- public static final String KEY_UTC_HOURS = "utcHours";
- public static final String KEY_UTC_MINUTES = "utcMinutes";
- public static final String KEY_UTC_SECONDS = "utcSeconds";
- public static final String KEY_COMPASS_DIRECTION = "compassDirection";
- public static final String KEY_PDOP = "pdop";
- public static final String KEY_VDOP = "vdop";
- public static final String KEY_HDOP = "hdop";
- public static final String KEY_ACTUAL = "actual";
- public static final String KEY_SATELLITES = "satellites";
- public static final String KEY_DIMENSION = "dimension";
- public static final String KEY_ALTITUDE = "altitude";
- public static final String KEY_HEADING = "heading";
- public static final String KEY_SPEED = "speed";
- public static final String KEY_SHIFTED = "shifted";
-
- /**
- * Constructs a newly allocated GPSData object
- */
- public GPSData() { }
-
- /**
- * Constructs a newly allocated GPSData object indicated by the Hashtable parameter
+ public static final String KEY_LONGITUDE_DEGREES = "longitudeDegrees";
+ public static final String KEY_LATITUDE_DEGREES = "latitudeDegrees";
+ public static final String KEY_UTC_YEAR = "utcYear";
+ public static final String KEY_UTC_MONTH = "utcMonth";
+ public static final String KEY_UTC_DAY = "utcDay";
+ public static final String KEY_UTC_HOURS = "utcHours";
+ public static final String KEY_UTC_MINUTES = "utcMinutes";
+ public static final String KEY_UTC_SECONDS = "utcSeconds";
+ public static final String KEY_COMPASS_DIRECTION = "compassDirection";
+ public static final String KEY_PDOP = "pdop";
+ public static final String KEY_VDOP = "vdop";
+ public static final String KEY_HDOP = "hdop";
+ public static final String KEY_ACTUAL = "actual";
+ public static final String KEY_SATELLITES = "satellites";
+ public static final String KEY_DIMENSION = "dimension";
+ public static final String KEY_ALTITUDE = "altitude";
+ public static final String KEY_HEADING = "heading";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_SHIFTED = "shifted";
+
+ /**
+ * Constructs a newly allocated GPSData object
+ */
+ public GPSData() {
+ }
+
+ /**
+ * Constructs a newly allocated GPSData object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public GPSData(Hashtable<String, Object> hash) {
super(hash);
}
@@ -218,311 +221,348 @@ public class GPSData extends RPCStruct {
setLongitudeDegrees(longitudeDegrees);
setLatitudeDegrees(latitudeDegrees);
}
+
/**
* set longitude degrees
+ *
* @param longitudeDegrees degrees of the longitudinal position
*/
public GPSData setLongitudeDegrees(@NonNull Double longitudeDegrees) {
setValue(KEY_LONGITUDE_DEGREES, longitudeDegrees);
return this;
}
-
+
/**
- * get longitude degrees
+ * get longitude degrees
+ *
* @return longitude degrees
*/
public Double getLongitudeDegrees() {
- Object object = getValue(KEY_LONGITUDE_DEGREES);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_LONGITUDE_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set latitude degrees
+ *
* @param latitudeDegrees degrees of the latitudinal position
*/
public GPSData setLatitudeDegrees(@NonNull Double latitudeDegrees) {
setValue(KEY_LATITUDE_DEGREES, latitudeDegrees);
return this;
}
-
+
/**
* get latitude degrees
+ *
* @return latitude degrees
*/
public Double getLatitudeDegrees() {
- Object object = getValue(KEY_LATITUDE_DEGREES);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_LATITUDE_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set utc year
+ *
* @param utcYear utc year
*/
- public GPSData setUtcYear( Integer utcYear) {
+ public GPSData setUtcYear(Integer utcYear) {
setValue(KEY_UTC_YEAR, utcYear);
return this;
}
-
+
/**
* get utc year
+ *
* @return utc year
*/
public Integer getUtcYear() {
- return getInteger(KEY_UTC_YEAR);
+ return getInteger(KEY_UTC_YEAR);
}
-
+
/**
* set utc month
+ *
* @param utcMonth utc month
*/
- public GPSData setUtcMonth( Integer utcMonth) {
+ public GPSData setUtcMonth(Integer utcMonth) {
setValue(KEY_UTC_MONTH, utcMonth);
return this;
}
-
+
/**
* get utc month
+ *
* @return utc month
*/
public Integer getUtcMonth() {
- return getInteger(KEY_UTC_MONTH);
+ return getInteger(KEY_UTC_MONTH);
}
-
+
/**
* set utc day
+ *
* @param utcDay utc day
*/
- public GPSData setUtcDay( Integer utcDay) {
+ public GPSData setUtcDay(Integer utcDay) {
setValue(KEY_UTC_DAY, utcDay);
return this;
}
-
+
/**
* get utc day
+ *
* @return utc day
*/
public Integer getUtcDay() {
- return getInteger(KEY_UTC_DAY);
+ return getInteger(KEY_UTC_DAY);
}
-
+
/**
* set utc hours
+ *
* @param utcHours utc hours
*/
- public GPSData setUtcHours( Integer utcHours) {
+ public GPSData setUtcHours(Integer utcHours) {
setValue(KEY_UTC_HOURS, utcHours);
return this;
}
-
+
/**
* get utc hours
+ *
* @return utc hours
*/
public Integer getUtcHours() {
- return getInteger(KEY_UTC_HOURS);
+ return getInteger(KEY_UTC_HOURS);
}
-
+
/**
* set utc minutes
+ *
* @param utcMinutes utc minutes
*/
- public GPSData setUtcMinutes( Integer utcMinutes) {
+ public GPSData setUtcMinutes(Integer utcMinutes) {
setValue(KEY_UTC_MINUTES, utcMinutes);
return this;
}
-
+
/**
* get utc minutes
+ *
* @return utc minutes
*/
public Integer getUtcMinutes() {
- return getInteger(KEY_UTC_MINUTES);
+ return getInteger(KEY_UTC_MINUTES);
}
-
+
/**
* set utc seconds
+ *
* @param utcSeconds utc seconds
*/
- public GPSData setUtcSeconds( Integer utcSeconds) {
+ public GPSData setUtcSeconds(Integer utcSeconds) {
setValue(KEY_UTC_SECONDS, utcSeconds);
return this;
}
-
+
/**
* get utc seconds
+ *
* @return utc seconds
*/
public Integer getUtcSeconds() {
- return getInteger(KEY_UTC_SECONDS);
+ return getInteger(KEY_UTC_SECONDS);
}
- public GPSData setCompassDirection( CompassDirection compassDirection) {
+
+ public GPSData setCompassDirection(CompassDirection compassDirection) {
setValue(KEY_COMPASS_DIRECTION, compassDirection);
return this;
}
+
public CompassDirection getCompassDirection() {
- return (CompassDirection) getObject(CompassDirection.class, KEY_COMPASS_DIRECTION);
+ return (CompassDirection) getObject(CompassDirection.class, KEY_COMPASS_DIRECTION);
}
-
+
/**
* set the positional dilution of precision
+ *
* @param pdop the positional dilution of precision
*/
- public GPSData setPdop( Double pdop) {
+ public GPSData setPdop(Double pdop) {
setValue(KEY_PDOP, pdop);
return this;
}
-
+
/**
* get the positional dilution of precision
*/
public Double getPdop() {
- Object object = getValue(KEY_PDOP);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_PDOP);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set the horizontal dilution of precision
+ *
* @param hdop the horizontal dilution of precision
*/
- public GPSData setHdop( Double hdop) {
+ public GPSData setHdop(Double hdop) {
setValue(KEY_HDOP, hdop);
return this;
}
-
+
/**
* get the horizontal dilution of precision
+ *
* @return the horizontal dilution of precision
*/
public Double getHdop() {
- Object object = getValue(KEY_HDOP);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_HDOP);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set the vertical dilution of precision
+ *
* @param vdop the vertical dilution of precision
*/
- public GPSData setVdop( Double vdop) {
+ public GPSData setVdop(Double vdop) {
setValue(KEY_VDOP, vdop);
return this;
}
-
+
/**
* get the vertical dilution of precision
+ *
* @return the vertical dilution of precision
*/
public Double getVdop() {
- Object object = getValue(KEY_VDOP);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_VDOP);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set what coordinates based on
+ *
* @param actual True, if coordinates are based on satellites.False, if based on dead reckoning
*/
- public GPSData setActual( Boolean actual) {
+ public GPSData setActual(Boolean actual) {
setValue(KEY_ACTUAL, actual);
return this;
}
-
+
/**
- * get what coordinates based on
+ * get what coordinates based on
+ *
* @return True, if coordinates are based on satellites.False, if based on dead reckoning
*/
public Boolean getActual() {
- return getBoolean(KEY_ACTUAL);
+ return getBoolean(KEY_ACTUAL);
}
-
+
/**
* set the number of satellites in view
+ *
* @param satellites the number of satellites in view
*/
- public GPSData setSatellites( Integer satellites) {
+ public GPSData setSatellites(Integer satellites) {
setValue(KEY_SATELLITES, satellites);
return this;
}
-
+
/**
* get the number of satellites in view
+ *
* @return the number of satellites in view
*/
public Integer getSatellites() {
- return getInteger(KEY_SATELLITES);
+ return getInteger(KEY_SATELLITES);
}
- public GPSData setDimension( Dimension dimension) {
+
+ public GPSData setDimension(Dimension dimension) {
setValue(KEY_DIMENSION, dimension);
return this;
}
+
public Dimension getDimension() {
- return (Dimension) getObject(Dimension.class, KEY_DIMENSION);
+ return (Dimension) getObject(Dimension.class, KEY_DIMENSION);
}
-
+
/**
* set altitude in meters
+ *
* @param altitude altitude in meters
*/
- public GPSData setAltitude( Double altitude) {
+ public GPSData setAltitude(Double altitude) {
setValue(KEY_ALTITUDE, altitude);
return this;
}
-
+
/**
* get altitude in meters
+ *
* @return altitude in meters
*/
public Double getAltitude() {
- Object object = getValue(KEY_ALTITUDE);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_ALTITUDE);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set the heading.North is 0, East is 90, etc.
+ *
* @param heading the heading.
*/
- public GPSData setHeading( Double heading) {
+ public GPSData setHeading(Double heading) {
setValue(KEY_HEADING, heading);
return this;
}
-
+
/**
* get the heading
*/
public Double getHeading() {
- Object object = getValue(KEY_HEADING);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_HEADING);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
+
/**
* set speed in KPH
+ *
* @param speed the speed
*/
- public GPSData setSpeed( Double speed) {
+ public GPSData setSpeed(Double speed) {
setValue(KEY_SPEED, speed);
return this;
}
-
+
/**
* get the speed in KPH
+ *
* @return the speed in KPH
*/
public Double getSpeed() {
- Object object = getValue(KEY_SPEED);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getValue(KEY_SPEED);
+ return SdlDataTypeConverter.objectToDouble(object);
}
/**
* Sets the shifted param for GPSData.
+ *
* @param shifted True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
* False, if the GPS data is raw and un-shifted.
* If not provided, then value is assumed False.
*/
- public GPSData setShifted( Boolean shifted) {
+ public GPSData setShifted(Boolean shifted) {
setValue(KEY_SHIFTED, shifted);
return this;
}
/**
* Gets the shifted param for GPSData.
+ *
* @return Boolean - True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
*/
public Boolean getShifted() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GearStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GearStatus.java
index b1dac965c..a96870d25 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GearStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GearStatus.java
@@ -38,7 +38,6 @@ import com.smartdevicelink.proxy.rpc.enums.TransmissionType;
import java.util.Hashtable;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -71,6 +70,7 @@ import java.util.Hashtable;
* <td></td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 7.0.0
*/
public class GearStatus extends RPCStruct {
@@ -81,7 +81,8 @@ public class GearStatus extends RPCStruct {
/**
* Constructs a newly allocated GearStatus object
*/
- public GearStatus() {}
+ public GearStatus() {
+ }
/**
* Constructs a new GearStatus object indicated by the Hashtable parameter
@@ -97,7 +98,7 @@ public class GearStatus extends RPCStruct {
*
* @param selectedGear Gear position selected by the user i.e. Park, Drive, Reverse
*/
- public GearStatus setUserSelectedGear( PRNDL selectedGear) {
+ public GearStatus setUserSelectedGear(PRNDL selectedGear) {
setValue(KEY_USER_SELECTED_GEAR, selectedGear);
return this;
}
@@ -107,8 +108,8 @@ public class GearStatus extends RPCStruct {
*
* @return PRNDL Gear position selected by the user i.e. Park, Drive, Reverse
*/
- public PRNDL getUserSelectedGear(){
- return (PRNDL)getObject(PRNDL.class, KEY_USER_SELECTED_GEAR);
+ public PRNDL getUserSelectedGear() {
+ return (PRNDL) getObject(PRNDL.class, KEY_USER_SELECTED_GEAR);
}
/**
@@ -116,7 +117,7 @@ public class GearStatus extends RPCStruct {
*
* @param actualGear Actual Gear in use by the transmission
*/
- public GearStatus setActualGear( PRNDL actualGear) {
+ public GearStatus setActualGear(PRNDL actualGear) {
setValue(KEY_ACTUAL_GEAR, actualGear);
return this;
}
@@ -126,8 +127,8 @@ public class GearStatus extends RPCStruct {
*
* @return PRNDL Actual Gear in use by the transmission
*/
- public PRNDL getActualGear(){
- return (PRNDL)getObject(PRNDL.class, KEY_ACTUAL_GEAR);
+ public PRNDL getActualGear() {
+ return (PRNDL) getObject(PRNDL.class, KEY_ACTUAL_GEAR);
}
/**
@@ -135,7 +136,7 @@ public class GearStatus extends RPCStruct {
*
* @param transmissionType Tells the transmission type
*/
- public GearStatus setTransmissionType( TransmissionType transmissionType) {
+ public GearStatus setTransmissionType(TransmissionType transmissionType) {
setValue(KEY_TRANSMISSION_TYPE, transmissionType);
return this;
}
@@ -145,7 +146,7 @@ public class GearStatus extends RPCStruct {
*
* @return TransmissionType Tells the transmission type
*/
- public TransmissionType getTransmissionType(){
- return (TransmissionType)getObject(TransmissionType.class, KEY_TRANSMISSION_TYPE);
+ public TransmissionType getTransmissionType() {
+ return (TransmissionType) getObject(TransmissionType.class, KEY_TRANSMISSION_TYPE);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java
index aae6e3517..0c3c70ee6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.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 androidx.annotation.NonNull;
@@ -85,12 +85,15 @@ public class GenericResponse extends RPCResponse {
public GenericResponse() {
super(FunctionID.GENERIC_RESPONSE.toString());
}
+
public GenericResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new GenericResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public GenericResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java
index 77a423af9..523b8c168 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceData.java
@@ -44,72 +44,76 @@ import java.util.Hashtable;
*/
public class GetAppServiceData extends RPCRequest {
- public static final String KEY_SERVICE_TYPE = "serviceType";
- public static final String KEY_SUBSCRIBE = "subscribe";
-
- // Constructors
- /**
- * Constructs a new GetAppServiceData object
- */
- public GetAppServiceData() {
- super(FunctionID.GET_APP_SERVICE_DATA.toString());
- }
-
- /**
- * Constructs a new GetAppServiceData object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public GetAppServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a new GetAppServiceData object with the mandatory appServiceType parameter
- * @param appServiceType - The appServiceType
- */
- public GetAppServiceData(@NonNull String appServiceType) {
- this();
- setServiceType(appServiceType);
- }
-
- // Getters / Setters
-
- /**
- * @param appServiceType - the appServiceType
- */
- public GetAppServiceData setServiceType(@NonNull String appServiceType) {
+ public static final String KEY_SERVICE_TYPE = "serviceType";
+ public static final String KEY_SUBSCRIBE = "subscribe";
+
+ // Constructors
+
+ /**
+ * Constructs a new GetAppServiceData object
+ */
+ public GetAppServiceData() {
+ super(FunctionID.GET_APP_SERVICE_DATA.toString());
+ }
+
+ /**
+ * Constructs a new GetAppServiceData object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public GetAppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetAppServiceData object with the mandatory appServiceType parameter
+ *
+ * @param appServiceType - The appServiceType
+ */
+ public GetAppServiceData(@NonNull String appServiceType) {
+ this();
+ setServiceType(appServiceType);
+ }
+
+ // Getters / Setters
+
+ /**
+ * @param appServiceType - the appServiceType
+ */
+ public GetAppServiceData setServiceType(@NonNull String appServiceType) {
setParameters(KEY_SERVICE_TYPE, appServiceType);
return this;
}
- /**
- * @return appServiceType
- */
- public String getServiceType(){
- return getString(KEY_SERVICE_TYPE);
- }
-
- /**
- * If true, the consumer is requesting to subscribe to all future updates from the service
- * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
- * if it was previously subscribed.
- * @param subscribe -
- */
- public GetAppServiceData setSubscribe( Boolean subscribe) {
+ /**
+ * @return appServiceType
+ */
+ public String getServiceType() {
+ return getString(KEY_SERVICE_TYPE);
+ }
+
+ /**
+ * If true, the consumer is requesting to subscribe to all future updates from the service
+ * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
+ * if it was previously subscribed.
+ *
+ * @param subscribe -
+ */
+ public GetAppServiceData setSubscribe(Boolean subscribe) {
setParameters(KEY_SUBSCRIBE, subscribe);
return this;
}
- /**
- * If true, the consumer is requesting to subscribe to all future updates from the service
- * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
- * if it was previously subscribed.
- * @return subscribe
- */
- public Boolean getSubscribe(){
- return getBoolean(KEY_SUBSCRIBE);
- }
+ /**
+ * If true, the consumer is requesting to subscribe to all future updates from the service
+ * publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed
+ * if it was previously subscribed.
+ *
+ * @return subscribe
+ */
+ public Boolean getSubscribe() {
+ return getBoolean(KEY_SUBSCRIBE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java
index 0739e9e58..9cdba9976 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetAppServiceDataResponse.java
@@ -44,39 +44,39 @@ import java.util.Hashtable;
*/
public class GetAppServiceDataResponse extends RPCResponse {
- public static final String KEY_SERVICE_DATA = "serviceData";
+ public static final String KEY_SERVICE_DATA = "serviceData";
- // Constructors
+ // Constructors
- public GetAppServiceDataResponse(){
- super(FunctionID.GET_APP_SERVICE_DATA.toString());
- }
+ public GetAppServiceDataResponse() {
+ super(FunctionID.GET_APP_SERVICE_DATA.toString());
+ }
- public GetAppServiceDataResponse(Hashtable<String, Object> hash){
- super(hash);
- }
+ public GetAppServiceDataResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public GetAppServiceDataResponse(@NonNull Boolean success, @NonNull Result resultCode){
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ public GetAppServiceDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param serviceData -
- */
- public GetAppServiceDataResponse setServiceData( AppServiceData serviceData) {
+ /**
+ * @param serviceData -
+ */
+ public GetAppServiceDataResponse setServiceData(AppServiceData serviceData) {
setParameters(KEY_SERVICE_DATA, serviceData);
return this;
}
- /**
- * @return serviceData
- */
- public AppServiceData getServiceData(){
- return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
- }
+ /**
+ * @return serviceData
+ */
+ public AppServiceData getServiceData() {
+ return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java
index 11913954b..60b182904 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java
@@ -50,17 +50,17 @@ public class GetCloudAppProperties extends RPCRequest {
super(hash);
}
- public GetCloudAppProperties(@NonNull String appID){
+ public GetCloudAppProperties(@NonNull String appID) {
this();
setParameters(KEY_APP_ID, appID);
}
- public GetCloudAppProperties setAppID( String appId) {
+ public GetCloudAppProperties setAppID(String appId) {
setParameters(KEY_APP_ID, appId);
return this;
}
- public String getAppID(){
+ public String getAppID() {
return getString((KEY_APP_ID));
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java
index 04e576353..2a7c8b636 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java
@@ -53,7 +53,8 @@ public class GetCloudAppPropertiesResponse extends RPCResponse {
/**
* Constructs a new GetCloudAppPropertiesResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public GetCloudAppPropertiesResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -62,12 +63,12 @@ public class GetCloudAppPropertiesResponse extends RPCResponse {
setResultCode(resultCode);
}
- public GetCloudAppPropertiesResponse setCloudAppProperties( CloudAppProperties cloudAppProperties) {
+ public GetCloudAppPropertiesResponse setCloudAppProperties(CloudAppProperties cloudAppProperties) {
setParameters(KEY_PROPERTIES, cloudAppProperties);
return this;
}
- public CloudAppProperties getCloudAppProperties(){
+ public CloudAppProperties getCloudAppProperties() {
return (CloudAppProperties) getObject(CloudAppProperties.class, KEY_PROPERTIES);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
index 63b0d716b..dc8b4828f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,11 +41,11 @@ import java.util.Hashtable;
/**
* This RPC allows to request diagnostic module trouble codes from a certain
* vehicle module.
- *
- *<p> Function Group: ProprietaryData</p>
- *
- *<p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
+ * <p> Function Group: ProprietaryData</p>
+ *
+ * <p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -74,78 +74,81 @@ import java.util.Hashtable;
* </tr>
* </table>
* <p><b>Response</b></p>
- *
- * <p><b>Non-default Result Codes:</b></p>
- *<p> SUCCESS</p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p> SUCCESS</p>
* <p>INVALID_DATA</p>
- *<p> OUT_OF_MEMORY</p>
+ * <p> OUT_OF_MEMORY</p>
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
- *<p>GENERIC_ERROR</p>
- * <p>REJECTED</p>
- * <p>DISALLOWED </p>
- * <p>USER_DISALLOWED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED </p>
+ * <p>USER_DISALLOWED</p>
+ *
* @since SmartDeviceLink 2.0
*/
public class GetDTCs extends RPCRequest {
- public static final String KEY_DTC_MASK = "dtcMask";
- public static final String KEY_ECU_NAME = "ecuName";
+ public static final String KEY_DTC_MASK = "dtcMask";
+ public static final String KEY_ECU_NAME = "ecuName";
- /**
- * Constructs a new GetDTCs object
- */
+ /**
+ * Constructs a new GetDTCs object
+ */
public GetDTCs() {
super(FunctionID.GET_DTCS.toString());
}
- /**
- * <p>Constructs a new GetDTCs object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new GetDTCs object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public GetDTCs(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new GetDTCs object
- * @param ecuName an Integer value representing a name of the module to receive the DTC form <br>
- * <b>Notes: </b>Minvalue:0; Maxvalue:65535
- */
- public GetDTCs(@NonNull Integer ecuName) {
- this();
- setEcuName(ecuName);
- }
+ /**
+ * Constructs a new GetDTCs object
+ *
+ * @param ecuName an Integer value representing a name of the module to receive the DTC form <br>
+ * <b>Notes: </b>Minvalue:0; Maxvalue:65535
+ */
+ public GetDTCs(@NonNull Integer ecuName) {
+ this();
+ setEcuName(ecuName);
+ }
- /**
- * Sets a name of the module to receive the DTC form
- *
- * @param ecuName
- * an Integer value representing a name of the module to receive
- * the DTC form
- * <p>
- * <b>Notes:</p> </b>Minvalue:0; Maxvalue:65535
- */
+ /**
+ * Sets a name of the module to receive the DTC form
+ *
+ * @param ecuName an Integer value representing a name of the module to receive
+ * the DTC form
+ * <p>
+ * <b>Notes:</p> </b>Minvalue:0; Maxvalue:65535
+ */
public GetDTCs setEcuName(@NonNull Integer ecuName) {
setParameters(KEY_ECU_NAME, ecuName);
return this;
}
- /**
- * Gets a name of the module to receive the DTC form
- *
- * @return Integer -an Integer value representing a name of the module to
- * receive the DTC form
- */
+ /**
+ * Gets a name of the module to receive the DTC form
+ *
+ * @return Integer -an Integer value representing a name of the module to
+ * receive the DTC form
+ */
public Integer getEcuName() {
- return getInteger(KEY_ECU_NAME);
+ return getInteger(KEY_ECU_NAME);
}
- public GetDTCs setDtcMask( Integer dtcMask) {
+
+ public GetDTCs setDtcMask(Integer dtcMask) {
setParameters(KEY_DTC_MASK, dtcMask);
return this;
}
+
public Integer getDtcMask() {
- return getInteger(KEY_DTC_MASK);
+ return getInteger(KEY_DTC_MASK);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
index 87ae47ab8..be25ac53e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,25 +42,26 @@ import java.util.List;
/**
* Get DTCs Response is sent, when GetDTCs has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
-public class GetDTCsResponse extends RPCResponse{
+public class GetDTCsResponse extends RPCResponse {
public static final String KEY_ECU_HEADER = "ecuHeader";
public static final String KEY_DTC = "dtc";
- public GetDTCsResponse(){
+ public GetDTCsResponse() {
super(FunctionID.GET_DTCS.toString());
}
- public GetDTCsResponse(Hashtable<String, Object> hash){
+ public GetDTCsResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new GetDTCsResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public GetDTCsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -70,20 +71,20 @@ public class GetDTCsResponse extends RPCResponse{
}
@SuppressWarnings("unchecked")
- public List<String> getDtc(){
+ public List<String> getDtc() {
return (List<String>) getObject(String.class, KEY_DTC);
}
- public GetDTCsResponse setDtc( List<String> dtc) {
+ public GetDTCsResponse setDtc(List<String> dtc) {
setParameters(KEY_DTC, dtc);
return this;
}
-
- public Integer getEcuHeader(){
+
+ public Integer getEcuHeader() {
return getInteger(KEY_ECU_HEADER);
}
-
- public GetDTCsResponse setEcuHeader( Integer ecuHeader) {
+
+ public GetDTCsResponse setEcuHeader(Integer ecuHeader) {
setParameters(KEY_ECU_HEADER, ecuHeader);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java
index ea8d41c04..ce8099631 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFile.java
@@ -44,120 +44,130 @@ import java.util.Hashtable;
*/
public class GetFile extends RPCRequest {
- public static final String KEY_FILE_NAME = "fileName";
- public static final String KEY_APP_SERVICE_ID = "appServiceId";
- public static final String KEY_FILE_TYPE = "fileType";
- public static final String KEY_OFFSET = "offset";
- public static final String KEY_LENGTH = "length";
-
- // Constructors
-
- public GetFile() {
- super(FunctionID.GET_FILE.toString());
- }
-
- public GetFile(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public GetFile(@NonNull String fileName) {
- this();
- setFileName(fileName);
- }
-
- // Setters and Getters
-
- /**
- * File name that should be retrieved.
- * maxlength="255"
- * @param fileName -
- */
- public GetFile setFileName(@NonNull String fileName) {
+ public static final String KEY_FILE_NAME = "fileName";
+ public static final String KEY_APP_SERVICE_ID = "appServiceId";
+ public static final String KEY_FILE_TYPE = "fileType";
+ public static final String KEY_OFFSET = "offset";
+ public static final String KEY_LENGTH = "length";
+
+ // Constructors
+
+ public GetFile() {
+ super(FunctionID.GET_FILE.toString());
+ }
+
+ public GetFile(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetFile(@NonNull String fileName) {
+ this();
+ setFileName(fileName);
+ }
+
+ // Setters and Getters
+
+ /**
+ * File name that should be retrieved.
+ * maxlength="255"
+ *
+ * @param fileName -
+ */
+ public GetFile setFileName(@NonNull String fileName) {
setParameters(KEY_FILE_NAME, fileName);
return this;
}
- /**
- * File name that should be retrieved.
- * maxlength="255"
- * @return fileName
- */
- public String getFileName(){
- return getString(KEY_FILE_NAME);
- }
-
- /**
- * ID of the service that should have uploaded the requested file
- * @param appServiceId -
- */
- public GetFile setAppServiceId( String appServiceId) {
+ /**
+ * File name that should be retrieved.
+ * maxlength="255"
+ *
+ * @return fileName
+ */
+ public String getFileName() {
+ return getString(KEY_FILE_NAME);
+ }
+
+ /**
+ * ID of the service that should have uploaded the requested file
+ *
+ * @param appServiceId -
+ */
+ public GetFile setAppServiceId(String appServiceId) {
setParameters(KEY_APP_SERVICE_ID, appServiceId);
return this;
}
- /**
- * ID of the service that should have uploaded the requested file
- * @return appServiceId
- */
- public String getAppServiceId(){
- return getString(KEY_APP_SERVICE_ID);
- }
-
- /**
- * Selected file type.
- * @param fileType -
- */
- public GetFile setFileType( FileType fileType) {
+ /**
+ * ID of the service that should have uploaded the requested file
+ *
+ * @return appServiceId
+ */
+ public String getAppServiceId() {
+ return getString(KEY_APP_SERVICE_ID);
+ }
+
+ /**
+ * Selected file type.
+ *
+ * @param fileType -
+ */
+ public GetFile setFileType(FileType fileType) {
setParameters(KEY_FILE_TYPE, fileType);
return this;
}
- /**
- * Selected file type.
- * @return fileType
- */
- public FileType getFileType(){
- return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
- }
-
- /**
- * Optional offset in bytes for resuming partial data chunks
- * minvalue="0" maxvalue="2000000000"
- * @param offset -
- */
- public GetFile setOffset( Integer offset) {
+ /**
+ * Selected file type.
+ *
+ * @return fileType
+ */
+ public FileType getFileType() {
+ return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @param offset -
+ */
+ public GetFile setOffset(Integer offset) {
setParameters(KEY_OFFSET, offset);
return this;
}
- /**
- * Optional offset in bytes for resuming partial data chunks
- * minvalue="0" maxvalue="2000000000"
- * @return offset
- */
- public Integer getOffset(){
- return getInteger(KEY_OFFSET);
- }
-
- /**
- * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
- * is the total length of the file to be downloaded
- * minvalue="0" maxvalue="2000000000"
- * @param length -
- */
- public GetFile setLength( Integer length) {
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @return offset
+ */
+ public Integer getOffset() {
+ return getInteger(KEY_OFFSET);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @param length -
+ */
+ public GetFile setLength(Integer length) {
setParameters(KEY_LENGTH, length);
return this;
}
- /**
- * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
- * is the total length of the file to be downloaded
- * minvalue="0" maxvalue="2000000000"
- * @return length
- */
- public Integer getLength(){
- return getInteger(KEY_LENGTH);
- }
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @return length
+ */
+ public Integer getLength() {
+ return getInteger(KEY_LENGTH);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java
index 17b5473c4..d584d9c45 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetFileResponse.java
@@ -42,106 +42,117 @@ import java.util.Hashtable;
public class GetFileResponse extends RPCResponse {
- public static final String KEY_OFFSET = "offset";
- public static final String KEY_LENGTH = "length";
- public static final String KEY_FILE_TYPE = "fileType";
- public static final String KEY_CRC = "crc";
- /**
- * Constructs a new PublishAppServiceResponse object
- */
- public GetFileResponse() {
- super(FunctionID.GET_FILE.toString());
- }
-
- public GetFileResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
- /**
- * Constructs a new PublishAppServiceResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public GetFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
-
- // Custom Getters / Setters
-
- /**
- * File type that is being sent in response
- * @param fileType -
- */
- public GetFileResponse setFileType( FileType fileType) {
+ public static final String KEY_OFFSET = "offset";
+ public static final String KEY_LENGTH = "length";
+ public static final String KEY_FILE_TYPE = "fileType";
+ public static final String KEY_CRC = "crc";
+
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ */
+ public GetFileResponse() {
+ super(FunctionID.GET_FILE.toString());
+ }
+
+ public GetFileResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GetFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * File type that is being sent in response
+ *
+ * @param fileType -
+ */
+ public GetFileResponse setFileType(FileType fileType) {
setParameters(KEY_FILE_TYPE, fileType);
return this;
}
- /**
- * File type that is being sent in response
- * @return fileType
- */
- public FileType getFileType(){
- return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
- }
-
- /**
- * Optional offset in bytes for resuming partial data chunks
- * minvalue="0" maxvalue="2000000000"
- * @param offset -
- */
- public GetFileResponse setOffset( Integer offset) {
+ /**
+ * File type that is being sent in response
+ *
+ * @return fileType
+ */
+ public FileType getFileType() {
+ return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
+ }
+
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @param offset -
+ */
+ public GetFileResponse setOffset(Integer offset) {
setParameters(KEY_OFFSET, offset);
return this;
}
- /**
- * Optional offset in bytes for resuming partial data chunks
- * minvalue="0" maxvalue="2000000000"
- * @return offset
- */
- public Integer getOffset(){
- return getInteger(KEY_OFFSET);
- }
-
- /**
- * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
- * is the total length of the file to be downloaded
- * minvalue="0" maxvalue="2000000000"
- * @param length -
- */
- public GetFileResponse setLength( Integer length) {
+ /**
+ * Optional offset in bytes for resuming partial data chunks
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @return offset
+ */
+ public Integer getOffset() {
+ return getInteger(KEY_OFFSET);
+ }
+
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @param length -
+ */
+ public GetFileResponse setLength(Integer length) {
setParameters(KEY_LENGTH, length);
return this;
}
- /**
- * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
- * is the total length of the file to be downloaded
- * minvalue="0" maxvalue="2000000000"
- * @return length
- */
- public Integer getLength(){
- return getInteger(KEY_LENGTH);
- }
-
- /**
- * Additional CRC32 checksum to protect data integrity up to 512 Mbits
- * minvalue="0" maxvalue="4294967295"
- * @param crc -
- */
- public GetFileResponse setCRC( Integer crc) {
+ /**
+ * Optional length in bytes for resuming partial data chunks if offset is set to 0, then length
+ * is the total length of the file to be downloaded
+ * minvalue="0" maxvalue="2000000000"
+ *
+ * @return length
+ */
+ public Integer getLength() {
+ return getInteger(KEY_LENGTH);
+ }
+
+ /**
+ * Additional CRC32 checksum to protect data integrity up to 512 Mbits
+ * minvalue="0" maxvalue="4294967295"
+ *
+ * @param crc -
+ */
+ public GetFileResponse setCRC(Integer crc) {
setParameters(KEY_CRC, crc);
return this;
}
- /**
- * Additional CRC32 checksum to protect data integrity up to 512 Mbits
- * minvalue="0" maxvalue="4294967295"
- * @return crc
- */
- public Integer getCRC(){
- return getInteger(KEY_CRC);
- }
+ /**
+ * Additional CRC32 checksum to protect data integrity up to 512 Mbits
+ * minvalue="0" maxvalue="4294967295"
+ *
+ * @return crc
+ */
+ public Integer getCRC() {
+ return getInteger(KEY_CRC);
+ }
} \ No newline at end of file
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 f5bc028ff..97ab4e99e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -47,7 +47,7 @@ import java.util.Hashtable;
* whenever new data is available for the module.
*/
public class GetInteriorVehicleData extends RPCRequest {
- public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_SUBSCRIBE = "subscribe";
public static final String KEY_MODULE_ID = "moduleId";
@@ -62,9 +62,7 @@ public class GetInteriorVehicleData extends RPCRequest {
* <p>Constructs a new GetInteriorVehicleData object indicated by the
* Hashtable parameter</p>
*
- *
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public GetInteriorVehicleData(Hashtable<String, Object> hash) {
super(hash);
@@ -91,9 +89,8 @@ public class GetInteriorVehicleData extends RPCRequest {
/**
* Sets a ModuleType
*
- * @param moduleType
- * The type of a RC module to retrieve module data from the vehicle.
- * In the future, this should be the Identification of a module.
+ * @param moduleType The type of a RC module to retrieve module data from the vehicle.
+ * In the future, this should be the Identification of a module.
*/
public GetInteriorVehicleData setModuleType(@NonNull ModuleType moduleType) {
setParameters(KEY_MODULE_TYPE, moduleType);
@@ -103,11 +100,10 @@ public class GetInteriorVehicleData extends RPCRequest {
/**
* Sets subscribe parameter
*
- * @param subscribe
- * If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduleType.
- * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduleType.
+ * @param subscribe If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduleType.
+ * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduleType.
*/
- public GetInteriorVehicleData setSubscribe( Boolean subscribe) {
+ public GetInteriorVehicleData setSubscribe(Boolean subscribe) {
setParameters(KEY_SUBSCRIBE, subscribe);
return this;
}
@@ -124,15 +120,17 @@ public class GetInteriorVehicleData extends RPCRequest {
/**
* Sets the Module ID for this class
+ *
* @param id the id to be set
*/
- public GetInteriorVehicleData setModuleId( String id) {
+ public GetInteriorVehicleData setModuleId(String id) {
setParameters(KEY_MODULE_ID, id);
return this;
}
/**
* Gets the Module ID of this class
+ *
* @return the Module ID of this class
*/
public String getModuleId() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
index 46a40b5dd..a2dd2c410 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
@@ -23,9 +23,9 @@ public class GetInteriorVehicleDataConsent extends RPCRequest {
/**
* @param moduleType Sets the Module Type for this class
- * @param moduleIds Sets the Module Ids for this class
+ * @param moduleIds Sets the Module Ids for this class
*/
- public GetInteriorVehicleDataConsent(@NonNull ModuleType moduleType, @NonNull List<String> moduleIds){
+ public GetInteriorVehicleDataConsent(@NonNull ModuleType moduleType, @NonNull List<String> moduleIds) {
this();
setModuleType(moduleType);
setModuleIds(moduleIds);
@@ -33,6 +33,7 @@ public class GetInteriorVehicleDataConsent extends RPCRequest {
/**
* Sets the Module Type for this class
+ *
* @param type the Module Type to be set
*/
public GetInteriorVehicleDataConsent setModuleType(@NonNull ModuleType type) {
@@ -42,6 +43,7 @@ public class GetInteriorVehicleDataConsent extends RPCRequest {
/**
* Gets the Module Type of this class
+ *
* @return the Module Type of this class
*/
public ModuleType getModuleType() {
@@ -50,6 +52,7 @@ public class GetInteriorVehicleDataConsent extends RPCRequest {
/**
* Sets the Module Ids for this class
+ *
* @param ids the ids to be set
*/
public GetInteriorVehicleDataConsent setModuleIds(@NonNull List<String> ids) {
@@ -59,6 +62,7 @@ public class GetInteriorVehicleDataConsent extends RPCRequest {
/**
* Gets the Module Ids of this class
+ *
* @return the Module Ids
*/
@SuppressWarnings("unchecked")
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
index 91df49d4a..0a5d661b0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
@@ -29,6 +29,7 @@ public class GetInteriorVehicleDataConsentResponse extends RPCResponse {
/**
* Sets the list of allowances for this class
+ *
* @param allowances the allowances to be set
*/
public GetInteriorVehicleDataConsentResponse setAllowances(@NonNull List<Boolean> allowances) {
@@ -38,6 +39,7 @@ public class GetInteriorVehicleDataConsentResponse extends RPCResponse {
/**
* Gets the list of allowances of this class
+ *
* @return the list of allowances of this class
*/
@SuppressWarnings("unchecked")
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
index 7fb081f30..0532bcb1e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,79 +40,77 @@ import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
public class GetInteriorVehicleDataResponse extends RPCResponse {
- public static final String KEY_MODULE_DATA = "moduleData";
- public static final String KEY_IS_SUBSCRIBED = "isSubscribed";
+ public static final String KEY_MODULE_DATA = "moduleData";
+ public static final String KEY_IS_SUBSCRIBED = "isSubscribed";
- /**
- * Constructs a new GetInteriorVehicleDataResponse object
- */
+ /**
+ * Constructs a new GetInteriorVehicleDataResponse object
+ */
public GetInteriorVehicleDataResponse() {
super(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString());
}
- /**
- * <p>Constructs a new GetInteriorVehicleDataResponse object indicated by the
- * Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new GetInteriorVehicleDataResponse object indicated by the
+ * Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public GetInteriorVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new GetInteriorVehicleDataResponse object
- * @param resultCode whether the request is successfully processed
- * @param success whether the request is successfully processed
- */
- public GetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
- this();
- setResultCode(resultCode);
- setSuccess(success);
- }
+ /**
+ * Constructs a new GetInteriorVehicleDataResponse object
+ *
+ * @param resultCode whether the request is successfully processed
+ * @param success whether the request is successfully processed
+ */
+ public GetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
- /**
- * Gets the moduleData
- *
- * @return ModuleData
- */
- public ModuleData getModuleData() {
- return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
- }
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
- /**
- * Sets the moduleData
- *
- * @param moduleData specific data for the module that was requested
- */
- public GetInteriorVehicleDataResponse setModuleData( ModuleData moduleData) {
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData specific data for the module that was requested
+ */
+ public GetInteriorVehicleDataResponse setModuleData(ModuleData moduleData) {
setParameters(KEY_MODULE_DATA, moduleData);
return this;
}
- /**
- * Sets isSubscribed parameter
- *
- * @param isSubscribed
- * It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
- * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
- * */
- public GetInteriorVehicleDataResponse setIsSubscribed( Boolean isSubscribed) {
+ /**
+ * Sets isSubscribed parameter
+ *
+ * @param isSubscribed It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
+ * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
+ * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
+ */
+ public GetInteriorVehicleDataResponse setIsSubscribed(Boolean isSubscribed) {
setParameters(KEY_IS_SUBSCRIBED, isSubscribed);
return this;
}
- /**
- * Gets isSubscribed parameter
- *
- * @return Boolean - It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
- * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
- * */
- public Boolean getIsSubscribed() {
- return getBoolean(KEY_IS_SUBSCRIBED);
- }
+ /**
+ * Gets isSubscribed parameter
+ *
+ * @return Boolean - It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
+ * If "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
+ * If "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
+ */
+ public Boolean getIsSubscribed() {
+ return getBoolean(KEY_IS_SUBSCRIBED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
index 173360d64..f56745327 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -50,7 +50,7 @@ public class GetSystemCapability extends RPCRequest {
/**
* Constructs a new GetSystemCapability object
*/
- public GetSystemCapability(){
+ public GetSystemCapability() {
super(FunctionID.GET_SYSTEM_CAPABILITY.toString());
}
@@ -65,23 +65,26 @@ public class GetSystemCapability extends RPCRequest {
/**
* Constructs a new GetSystemCapability object
+ *
* @param systemCapabilityType SystemCapabilityType being requested
*/
- public GetSystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ public GetSystemCapability(@NonNull SystemCapabilityType systemCapabilityType) {
this();
setSystemCapabilityType(systemCapabilityType);
}
/**
* Used to get the SystemCapabilityType being requested
+ *
* @return the SystemCapabilityType being requested
*/
- public SystemCapabilityType getSystemCapabilityType(){
+ public SystemCapabilityType getSystemCapabilityType() {
return (SystemCapabilityType) getObject(SystemCapabilityType.class, KEY_SYSTEM_CAPABILITY_TYPE);
}
/**
* Used to set the SystemCapabilityType being requested
+ *
* @param value SystemCapabilityType being requested
*/
public GetSystemCapability setSystemCapabilityType(@NonNull SystemCapabilityType value) {
@@ -93,9 +96,10 @@ public class GetSystemCapability extends RPCRequest {
* Flag to subscribe to updates of the supplied service capability type. If true, the requester
* will be subscribed. If false, the requester will not be subscribed and be removed as a
* subscriber if it was previously subscribed.
+ *
* @return if the SystemCapabilityType is subscribed to
*/
- public Boolean getSubscribe(){
+ public Boolean getSubscribe() {
return getBoolean(KEY_SUBSCRIBE);
}
@@ -103,9 +107,10 @@ public class GetSystemCapability extends RPCRequest {
* Flag to subscribe to updates of the supplied service capability type. If true, the requester
* will be subscribed. If false, the requester will not be subscribed and be removed as a
* subscriber if it was previously subscribed.
+ *
* @param subscribe to changes in the SystemCapabilityType
*/
- public GetSystemCapability setSubscribe( Boolean subscribe) {
+ public GetSystemCapability setSubscribe(Boolean subscribe) {
setParameters(KEY_SUBSCRIBE, subscribe);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
index f48e095e7..6b4c21c03 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,16 +49,14 @@ public class GetSystemCapabilityResponse extends RPCResponse {
/**
* Constructs a new GetSystemCapability object
*/
- public GetSystemCapabilityResponse(){
+ public GetSystemCapabilityResponse() {
super(FunctionID.GET_SYSTEM_CAPABILITY.toString());
}
/**
* <p>Constructs a new GetSystemCapability object indicated by the Hashtable parameter</p>
*
- *
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public GetSystemCapabilityResponse(Hashtable<String, Object> hash) {
super(hash);
@@ -66,8 +64,9 @@ public class GetSystemCapabilityResponse extends RPCResponse {
/**
* Constructs a new GetSystemCapabilityResponse object
+ *
* @param resultCode whether the request is successfully processed
- * @param success whether the request is successfully processed
+ * @param success whether the request is successfully processed
*/
public GetSystemCapabilityResponse(@NonNull Result resultCode, @NonNull Boolean success) {
this();
@@ -77,17 +76,19 @@ public class GetSystemCapabilityResponse extends RPCResponse {
/**
* Get the SystemCapability object returned after a GetSystemCapability call
+ *
* @return SystemCapability object
*/
- public SystemCapability getSystemCapability(){
+ public SystemCapability getSystemCapability() {
return (SystemCapability) getObject(SystemCapability.class, KEY_SYSTEM_CAPABILITY);
}
/**
* Set a SystemCapability object in the response
+ *
* @param value SystemCapability object
*/
- public GetSystemCapabilityResponse setSystemCapability( SystemCapability value) {
+ public GetSystemCapabilityResponse setSystemCapability(SystemCapability value) {
setParameters(KEY_SYSTEM_CAPABILITY, value);
return this;
}
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 654089853..37545d140 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,7 +38,7 @@ import java.util.Hashtable;
/**
* Non periodic vehicle data read request.
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -244,8 +244,8 @@ import java.util.Hashtable;
* <td>cloudAppVehicleID</td>
* <td>Boolean</td>
* <td>ID for the vehicle when connecting to cloud applications</td>
- * <td>N</td>
- * <td>Subscribable</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
* <td>SmartDeviceLink 5.1 </td>
* <tr>
* <td>stabilityControlsStatus</td>
@@ -270,10 +270,10 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
* </table>
- *
- *
+ *
+ *
* <p><b>Response</b></p>
- *
+ *
* <p> <b>Non-default Result Codes:</b></p>
* <p> SUCCESS</p>
* <p> INVALID_DATA</p>
@@ -285,41 +285,39 @@ import java.util.Hashtable;
* <p> VEHICLE_DATA_NOT_ALLOWED</p>
* <p>VEHICLE_DATA_NOT_AVAILABLE</p>
* <p> USER_DISALLOWED</p>
- *
+ *
* @see SubscribeVehicleData
* @see UnsubscribeVehicleData
* @since SmartDeviceLink 2.0
- *
- *
*/
public class GetVehicleData extends RPCRequest {
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_VIN = "vin";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_VIN = "vin";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
@@ -337,44 +335,50 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new GetVehicleData object
- */
+ /**
+ * Constructs a new GetVehicleData object
+ */
public GetVehicleData() {
super(FunctionID.GET_VEHICLE_DATA.toString());
}
+
/**
- * <p>
- * Constructs a new GetVehicleDta object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new GetVehicleDta object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public GetVehicleData(Hashtable<String, Object> hash) {
super(hash);
}
- public GetVehicleData setGps( Boolean gps) {
+
+ public GetVehicleData setGps(Boolean gps) {
setParameters(KEY_GPS, gps);
return this;
}
+
public Boolean getGps() {
return getBoolean(KEY_GPS);
}
- public GetVehicleData setSpeed( Boolean speed) {
+
+ public GetVehicleData setSpeed(Boolean speed) {
setParameters(KEY_SPEED, speed);
return this;
}
+
public Boolean getSpeed() {
return getBoolean(KEY_SPEED);
}
- public GetVehicleData setRpm( Boolean rpm) {
+
+ public GetVehicleData setRpm(Boolean rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
+
public Boolean getRpm() {
return getBoolean(KEY_RPM);
}
@@ -383,10 +387,10 @@ public class GetVehicleData extends RPCRequest {
* Sets the fuelLevel.
*
* @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
+ * 7.0, please see fuelRange.
*/
@Deprecated
- public GetVehicleData setFuelLevel( Boolean fuelLevel) {
+ public GetVehicleData setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
@@ -403,7 +407,7 @@ public class GetVehicleData extends RPCRequest {
}
@Deprecated
- public GetVehicleData setFuelLevelState( Boolean fuelLevelState) {
+ public GetVehicleData setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
@@ -412,15 +416,17 @@ public class GetVehicleData extends RPCRequest {
public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
- public GetVehicleData setInstantFuelConsumption( Boolean instantFuelConsumption) {
+
+ public GetVehicleData setInstantFuelConsumption(Boolean instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
+
public Boolean getInstantFuelConsumption() {
return getBoolean(KEY_INSTANT_FUEL_CONSUMPTION);
}
- public GetVehicleData setFuelRange( Boolean fuelRange) {
+ public GetVehicleData setFuelRange(Boolean fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
@@ -429,22 +435,24 @@ public class GetVehicleData extends RPCRequest {
return getBoolean(KEY_FUEL_RANGE);
}
- public GetVehicleData setExternalTemperature( Boolean externalTemperature) {
+ public GetVehicleData setExternalTemperature(Boolean externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
+
public Boolean getExternalTemperature() {
return getBoolean(KEY_EXTERNAL_TEMPERATURE);
}
-
- public GetVehicleData setVin( Boolean vin) {
+
+ public GetVehicleData setVin(Boolean vin) {
setParameters(KEY_VIN, vin);
return this;
}
+
public Boolean getVin() {
return getBoolean(KEY_VIN);
}
-
+
/**
* Sets the prndl.
*
@@ -452,7 +460,7 @@ public class GetVehicleData extends RPCRequest {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public GetVehicleData setPrndl( Boolean prndl) {
+ public GetVehicleData setPrndl(Boolean prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
@@ -467,193 +475,235 @@ public class GetVehicleData extends RPCRequest {
public Boolean getPrndl() {
return getBoolean(KEY_PRNDL);
}
- public GetVehicleData setTirePressure( Boolean tirePressure) {
+
+ public GetVehicleData setTirePressure(Boolean tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
+
public Boolean getTirePressure() {
return getBoolean(KEY_TIRE_PRESSURE);
}
- public GetVehicleData setOdometer( Boolean odometer) {
+
+ public GetVehicleData setOdometer(Boolean odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
+
public Boolean getOdometer() {
return getBoolean(KEY_ODOMETER);
}
- public GetVehicleData setBeltStatus( Boolean beltStatus) {
+
+ public GetVehicleData setBeltStatus(Boolean beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
+
public Boolean getBeltStatus() {
return getBoolean(KEY_BELT_STATUS);
}
- public GetVehicleData setBodyInformation( Boolean bodyInformation) {
+
+ public GetVehicleData setBodyInformation(Boolean bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
+
public Boolean getBodyInformation() {
return getBoolean(KEY_BODY_INFORMATION);
}
- public GetVehicleData setDeviceStatus( Boolean deviceStatus) {
+
+ public GetVehicleData setDeviceStatus(Boolean deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
+
public Boolean getDeviceStatus() {
return getBoolean(KEY_DEVICE_STATUS);
}
- public GetVehicleData setDriverBraking( Boolean driverBraking) {
+
+ public GetVehicleData setDriverBraking(Boolean driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
+
public Boolean getDriverBraking() {
return getBoolean(KEY_DRIVER_BRAKING);
}
- public GetVehicleData setWiperStatus( Boolean wiperStatus) {
+
+ public GetVehicleData setWiperStatus(Boolean wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
+
public Boolean getWiperStatus() {
return getBoolean(KEY_WIPER_STATUS);
}
- public GetVehicleData setHeadLampStatus( Boolean headLampStatus) {
+
+ public GetVehicleData setHeadLampStatus(Boolean headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
+
public Boolean getHeadLampStatus() {
return getBoolean(KEY_HEAD_LAMP_STATUS);
}
- public GetVehicleData setEngineTorque( Boolean engineTorque) {
+
+ public GetVehicleData setEngineTorque(Boolean engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
+
public Boolean getEngineTorque() {
return getBoolean(KEY_ENGINE_TORQUE);
}
- public GetVehicleData setEngineOilLife( Boolean engineOilLife) {
+
+ public GetVehicleData setEngineOilLife(Boolean engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
+
public Boolean getEngineOilLife() {
return getBoolean(KEY_ENGINE_OIL_LIFE);
}
- public GetVehicleData setAccPedalPosition( Boolean accPedalPosition) {
+
+ public GetVehicleData setAccPedalPosition(Boolean accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
+
public Boolean getAccPedalPosition() {
return getBoolean(KEY_ACC_PEDAL_POSITION);
}
-
- public GetVehicleData setSteeringWheelAngle( Boolean steeringWheelAngle) {
+
+ public GetVehicleData setSteeringWheelAngle(Boolean steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
+
public Boolean getSteeringWheelAngle() {
return getBoolean(KEY_STEERING_WHEEL_ANGLE);
- }
- public GetVehicleData setECallInfo( Boolean eCallInfo) {
+ }
+
+ public GetVehicleData setECallInfo(Boolean eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public Boolean getECallInfo() {
return getBoolean(KEY_E_CALL_INFO);
- }
-
-
- public GetVehicleData setAirbagStatus( Boolean airbagStatus) {
+ }
+
+
+ public GetVehicleData setAirbagStatus(Boolean airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public Boolean getAirbagStatus() {
return getBoolean(KEY_AIRBAG_STATUS);
}
- public GetVehicleData setEmergencyEvent( Boolean emergencyEvent) {
+
+ public GetVehicleData setEmergencyEvent(Boolean emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public Boolean getEmergencyEvent() {
return getBoolean(KEY_EMERGENCY_EVENT);
}
- public GetVehicleData setClusterModeStatus( Boolean clusterModeStatus) {
+
+ public GetVehicleData setClusterModeStatus(Boolean clusterModeStatus) {
setParameters(KEY_CLUSTER_MODE_STATUS, clusterModeStatus);
return this;
}
+
public Boolean getClusterModeStatus() {
return getBoolean(KEY_CLUSTER_MODE_STATUS);
}
- public GetVehicleData setMyKey( Boolean myKey) {
+
+ public GetVehicleData setMyKey(Boolean myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public Boolean getMyKey() {
return getBoolean(KEY_MY_KEY);
}
/**
* Sets a boolean value. If true, subscribes turnSignal data
+ *
* @param turnSignal a boolean value
*/
- public GetVehicleData setTurnSignal( Boolean turnSignal) {
+ public GetVehicleData setTurnSignal(Boolean turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
/**
* Gets a boolean value. If true, means the turnSignal data has been subscribed.
+ *
* @return a Boolean value.
*/
- public Boolean getTurnSignal() { return getBoolean(KEY_TURN_SIGNAL); }
+ public Boolean getTurnSignal() {
+ return getBoolean(KEY_TURN_SIGNAL);
+ }
/**
* Sets a boolean value. If true, subscribes electronicParkBrakeStatus data
+ *
* @param electronicParkBrakeStatus a boolean value
*/
- public GetVehicleData setElectronicParkBrakeStatus( Boolean electronicParkBrakeStatus) {
+ public GetVehicleData setElectronicParkBrakeStatus(Boolean electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
/**
* Gets a boolean value. If true, means the electronicParkBrakeStatus data has been subscribed.
+ *
* @return a Boolean value.
*/
- public Boolean getElectronicParkBrakeStatus(){
+ public Boolean getElectronicParkBrakeStatus() {
return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
/**
* Sets a boolean value. If true, gets the cloudAppVehicleID data
+ *
* @param cloudAppVehicleID a boolean value
*/
- public GetVehicleData setCloudAppVehicleID( boolean cloudAppVehicleID) {
+ public GetVehicleData setCloudAppVehicleID(boolean cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
/**
* Gets a boolean value. If true, means the cloudAppVehicleDataID data has been set to retrieve.
+ *
* @return a Boolean value.
*/
- public Boolean getCloudAppVehicleID(){
+ public Boolean getCloudAppVehicleID() {
return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
}
/**
* Sets a boolean value for OEM Custom VehicleData.
- * @param vehicleDataName a String value
+ *
+ * @param vehicleDataName a String value
* @param vehicleDataState a boolean value
*/
- public GetVehicleData setOEMCustomVehicleData( String vehicleDataName, Boolean vehicleDataState) {
+ public GetVehicleData setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
/**
* Gets a boolean value for OEM Custom VehicleData.
+ *
* @return a Boolean value.
*/
- public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ public Boolean getOEMCustomVehicleData(String vehicleDataName) {
return getBoolean(vehicleDataName);
}
@@ -663,7 +713,7 @@ public class GetVehicleData extends RPCRequest {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleData setWindowStatus( Boolean windowStatus) {
+ public GetVehicleData setWindowStatus(Boolean windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -684,7 +734,7 @@ public class GetVehicleData extends RPCRequest {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleData setHandsOffSteering( Boolean handsOffSteering) {
+ public GetVehicleData setHandsOffSteering(Boolean handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -705,7 +755,7 @@ public class GetVehicleData extends RPCRequest {
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleData setGearStatus( Boolean gearStatus) {
+ public GetVehicleData setGearStatus(Boolean gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -726,7 +776,7 @@ public class GetVehicleData extends RPCRequest {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleData setStabilityControlsStatus( Boolean stabilityControlsStatus) {
+ public GetVehicleData setStabilityControlsStatus(Boolean stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
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 fc1abcf53..1ce840819 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -50,66 +50,69 @@ import java.util.List;
/**
* Get Vehicle Data Response is sent, when GetVehicleData has been called.
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class GetVehicleDataResponse extends RPCResponse {
- public static final String KEY_GPS = "gps";
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- /**
- * @deprecated
- */
- @Deprecated
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
/**
* @deprecated
*/
@Deprecated
public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_VIN = "vin";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
- public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
- public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_VIN = "vin";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_MY_KEY = "myKey";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_GEAR_STATUS = "gearStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new GetVehicleDataResponse object
- */
+ /**
+ * Constructs a new GetVehicleDataResponse object
+ */
public GetVehicleDataResponse() {
super(FunctionID.GET_VEHICLE_DATA.toString());
}
+
public GetVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new GetVehicleDataResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public GetVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -117,40 +120,49 @@ public class GetVehicleDataResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
- public GetVehicleDataResponse setGps( GPSData gps) {
+
+ public GetVehicleDataResponse setGps(GPSData gps) {
setParameters(KEY_GPS, gps);
return this;
}
+
public GPSData getGps() {
return (GPSData) getObject(GPSData.class, KEY_GPS);
}
- public GetVehicleDataResponse setSpeed( Double speed) {
+
+ public GetVehicleDataResponse setSpeed(Double speed) {
setParameters(KEY_SPEED, speed);
return this;
}
+
public Double getSpeed() {
- Object object = getParameters(KEY_SPEED);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_SPEED);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public GetVehicleDataResponse setRpm( Integer rpm) {
+
+ public GetVehicleDataResponse setRpm(Integer rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
+
public Integer getRpm() {
- return getInteger(KEY_RPM);
+ return getInteger(KEY_RPM);
}
/**
* Sets Fuel Level State
+ *
* @param fuelLevelState a ComponentVolumeStatus related to FuelLevel State
*/
@Deprecated
- public GetVehicleDataResponse setFuelLevelState( ComponentVolumeStatus fuelLevelState) {
+ public GetVehicleDataResponse setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
+
/**
* Gets Fuel Level State
+ *
* @return a ComponentVolumeStatus related to FuelLevel State
*/
@Deprecated
@@ -162,11 +174,11 @@ public class GetVehicleDataResponse extends RPCResponse {
* Sets the fuelLevel.
*
* @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
+ * 7.0, please see fuelRange.
* @since SmartDeviceLink 7.0.0
*/
@Deprecated
- public GetVehicleDataResponse setFuelLevel( Double fuelLevel) {
+ public GetVehicleDataResponse setFuelLevel(Double fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
@@ -183,28 +195,34 @@ public class GetVehicleDataResponse extends RPCResponse {
Object object = getParameters(KEY_FUEL_LEVEL);
return SdlDataTypeConverter.objectToDouble(object);
}
- public GetVehicleDataResponse setInstantFuelConsumption( Double instantFuelConsumption) {
+
+ public GetVehicleDataResponse setInstantFuelConsumption(Double instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
+
public Double getInstantFuelConsumption() {
- Object object = getParameters(KEY_INSTANT_FUEL_CONSUMPTION);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_INSTANT_FUEL_CONSUMPTION);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public GetVehicleDataResponse setExternalTemperature( Double externalTemperature) {
+
+ public GetVehicleDataResponse setExternalTemperature(Double externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
+
public Double getExternalTemperature() {
- Object object = getParameters(KEY_EXTERNAL_TEMPERATURE);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_EXTERNAL_TEMPERATURE);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public GetVehicleDataResponse setVin( String vin) {
+
+ public GetVehicleDataResponse setVin(String vin) {
setParameters(KEY_VIN, vin);
return this;
}
+
public String getVin() {
- return getString(KEY_VIN);
+ return getString(KEY_VIN);
}
/**
@@ -214,7 +232,7 @@ public class GetVehicleDataResponse extends RPCResponse {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public GetVehicleDataResponse setPrndl( PRNDL prndl) {
+ public GetVehicleDataResponse setPrndl(PRNDL prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
@@ -229,152 +247,181 @@ public class GetVehicleDataResponse extends RPCResponse {
public PRNDL getPrndl() {
return (PRNDL) getObject(PRNDL.class, KEY_PRNDL);
}
- public GetVehicleDataResponse setTirePressure( TireStatus tirePressure) {
+
+ public GetVehicleDataResponse setTirePressure(TireStatus tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
+
public TireStatus getTirePressure() {
return (TireStatus) getObject(TireStatus.class, KEY_TIRE_PRESSURE);
}
- public GetVehicleDataResponse setOdometer( Integer odometer) {
+
+ public GetVehicleDataResponse setOdometer(Integer odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
+
public Integer getOdometer() {
- return getInteger(KEY_ODOMETER);
+ return getInteger(KEY_ODOMETER);
}
- public GetVehicleDataResponse setBeltStatus( BeltStatus beltStatus) {
+
+ public GetVehicleDataResponse setBeltStatus(BeltStatus beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
+
public BeltStatus getBeltStatus() {
return (BeltStatus) getObject(BeltStatus.class, KEY_BELT_STATUS);
}
- public GetVehicleDataResponse setBodyInformation( BodyInformation bodyInformation) {
+
+ public GetVehicleDataResponse setBodyInformation(BodyInformation bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
+
public BodyInformation getBodyInformation() {
return (BodyInformation) getObject(BodyInformation.class, KEY_BODY_INFORMATION);
}
- public GetVehicleDataResponse setDeviceStatus( DeviceStatus deviceStatus) {
+
+ public GetVehicleDataResponse setDeviceStatus(DeviceStatus deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
+
public DeviceStatus getDeviceStatus() {
return (DeviceStatus) getObject(DeviceStatus.class, KEY_DEVICE_STATUS);
}
- public GetVehicleDataResponse setDriverBraking( VehicleDataEventStatus driverBraking) {
+
+ public GetVehicleDataResponse setDriverBraking(VehicleDataEventStatus driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
+
public VehicleDataEventStatus getDriverBraking() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_BRAKING);
}
- public GetVehicleDataResponse setWiperStatus( WiperStatus wiperStatus) {
+
+ public GetVehicleDataResponse setWiperStatus(WiperStatus wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
+
public WiperStatus getWiperStatus() {
return (WiperStatus) getObject(WiperStatus.class, KEY_WIPER_STATUS);
}
-
- public GetVehicleDataResponse setHeadLampStatus( HeadLampStatus headLampStatus) {
+
+ public GetVehicleDataResponse setHeadLampStatus(HeadLampStatus headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
+
public HeadLampStatus getHeadLampStatus() {
return (HeadLampStatus) getObject(HeadLampStatus.class, KEY_HEAD_LAMP_STATUS);
}
- public GetVehicleDataResponse setEngineTorque( Double engineTorque) {
+
+ public GetVehicleDataResponse setEngineTorque(Double engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
+
public Double getEngineTorque() {
Object object = getParameters(KEY_ENGINE_TORQUE);
return SdlDataTypeConverter.objectToDouble(object);
}
- public GetVehicleDataResponse setEngineOilLife( Float engineOilLife) {
+
+ public GetVehicleDataResponse setEngineOilLife(Float engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
+
public Float getEngineOilLife() {
Object object = getParameters(KEY_ENGINE_OIL_LIFE);
return SdlDataTypeConverter.objectToFloat(object);
}
- public GetVehicleDataResponse setAccPedalPosition( Double accPedalPosition) {
+ public GetVehicleDataResponse setAccPedalPosition(Double accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
+
public Double getAccPedalPosition() {
- Object object = getParameters(KEY_ACC_PEDAL_POSITION);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_ACC_PEDAL_POSITION);
+ return SdlDataTypeConverter.objectToDouble(object);
}
-
- public GetVehicleDataResponse setSteeringWheelAngle( Double steeringWheelAngle) {
+
+ public GetVehicleDataResponse setSteeringWheelAngle(Double steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
+
public Double getSteeringWheelAngle() {
- Object object = getParameters(KEY_STEERING_WHEEL_ANGLE);
- return SdlDataTypeConverter.objectToDouble(object);
- }
+ Object object = getParameters(KEY_STEERING_WHEEL_ANGLE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
- public GetVehicleDataResponse setECallInfo( ECallInfo eCallInfo) {
+ public GetVehicleDataResponse setECallInfo(ECallInfo eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public ECallInfo getECallInfo() {
return (ECallInfo) getObject(ECallInfo.class, KEY_E_CALL_INFO);
- }
-
- public GetVehicleDataResponse setAirbagStatus( AirbagStatus airbagStatus) {
+ }
+
+ public GetVehicleDataResponse setAirbagStatus(AirbagStatus airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public AirbagStatus getAirbagStatus() {
return (AirbagStatus) getObject(AirbagStatus.class, KEY_AIRBAG_STATUS);
- }
+ }
- public GetVehicleDataResponse setEmergencyEvent( EmergencyEvent emergencyEvent) {
+ public GetVehicleDataResponse setEmergencyEvent(EmergencyEvent emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public EmergencyEvent getEmergencyEvent() {
return (EmergencyEvent) getObject(EmergencyEvent.class, KEY_EMERGENCY_EVENT);
}
- public GetVehicleDataResponse setClusterModeStatus( ClusterModeStatus clusterModeStatus) {
+
+ public GetVehicleDataResponse setClusterModeStatus(ClusterModeStatus clusterModeStatus) {
setParameters(KEY_CLUSTER_MODE_STATUS, clusterModeStatus);
return this;
}
+
public ClusterModeStatus getClusterModeStatus() {
return (ClusterModeStatus) getObject(ClusterModeStatus.class, KEY_CLUSTER_MODE_STATUS);
}
- public GetVehicleDataResponse setMyKey( MyKey myKey) {
+
+ public GetVehicleDataResponse setMyKey(MyKey myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public MyKey getMyKey() {
return (MyKey) getObject(MyKey.class, KEY_MY_KEY);
}
/**
* Sets Fuel Range List. Fuel Range - The estimate range in KM the vehicle can travel based on fuel level and consumption.
- * @param fuelRange the range in KM left as well as fuel type
*
+ * @param fuelRange the range in KM left as well as fuel type
* @see FuelRange
* @see com.smartdevicelink.proxy.rpc.enums.FuelType
*/
- public GetVehicleDataResponse setFuelRange( List<FuelRange> fuelRange) {
+ public GetVehicleDataResponse setFuelRange(List<FuelRange> fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
/**
* Gets Fuel Range List
+ *
* @return List<FuelRange>
- * Fuel Range - The estimate range in KM the vehicle can travel based on fuel level and consumption.
+ * Fuel Range - The estimate range in KM the vehicle can travel based on fuel level and consumption.
*/
@SuppressWarnings("unchecked")
public List<FuelRange> getFuelRange() {
@@ -383,19 +430,19 @@ public class GetVehicleDataResponse extends RPCResponse {
/**
* Sets turnSignal
- * @param turnSignal status of the turn signals
*
+ * @param turnSignal status of the turn signals
* @see TurnSignal
*/
- public GetVehicleDataResponse setTurnSignal( TurnSignal turnSignal) {
+ public GetVehicleDataResponse setTurnSignal(TurnSignal turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
/**
* Gets turnSignal
- * @return TurnSignal status of the turn signals
*
+ * @return TurnSignal status of the turn signals
* @see com.smartdevicelink.proxy.rpc.enums.TurnSignal
*/
public TurnSignal getTurnSignal() {
@@ -404,58 +451,62 @@ public class GetVehicleDataResponse extends RPCResponse {
/**
* Sets electronicParkBrakeStatus
- * @param electronicParkBrakeStatus status of the electronic park brake of the connected vehicle
*
+ * @param electronicParkBrakeStatus status of the electronic park brake of the connected vehicle
* @see ElectronicParkBrakeStatus
*/
- public GetVehicleDataResponse setElectronicParkBrakeStatus( ElectronicParkBrakeStatus electronicParkBrakeStatus) {
+ public GetVehicleDataResponse setElectronicParkBrakeStatus(ElectronicParkBrakeStatus electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
/**
* Gets electronicParkBrakeStatus
- * @return ElectronicParkBrakeStatus status of the electronic park brake of the connected vehicle
*
+ * @return ElectronicParkBrakeStatus status of the electronic park brake of the connected vehicle
* @see com.smartdevicelink.proxy.rpc.enums.ElectronicParkBrakeStatus
*/
- public ElectronicParkBrakeStatus getElectronicParkBrakeStatus(){
+ public ElectronicParkBrakeStatus getElectronicParkBrakeStatus() {
return (ElectronicParkBrakeStatus) getObject(ElectronicParkBrakeStatus.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
/**
* Sets a string value for the cloud app vehicle ID
+ *
* @param cloudAppVehicleID a string value
*/
- public GetVehicleDataResponse setCloudAppVehicleID( String cloudAppVehicleID) {
+ public GetVehicleDataResponse setCloudAppVehicleID(String cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
/**
* Gets a String value of the returned cloud app vehicle ID
+ *
* @return a String value.
*/
- public String getCloudAppVehicleID(){
+ public String getCloudAppVehicleID() {
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
/**
* Sets a value for OEM Custom VehicleData.
- * @param vehicleDataName a String value
+ *
+ * @param vehicleDataName a String value
* @param vehicleDataState a VehicleDataResult value
*/
- public GetVehicleDataResponse setOEMCustomVehicleData( String vehicleDataName, Object vehicleDataState) {
+ public GetVehicleDataResponse setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
/**
* Gets a VehicleData value for the vehicle data item.
+ *
* @return a Object related to the vehicle data
*/
- public Object getOEMCustomVehicleData(String vehicleDataName){
+ public Object getOEMCustomVehicleData(String vehicleDataName) {
return getParameters(vehicleDataName);
}
@@ -465,7 +516,7 @@ public class GetVehicleDataResponse extends RPCResponse {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleDataResponse setWindowStatus( List<WindowStatus> windowStatus) {
+ public GetVehicleDataResponse setWindowStatus(List<WindowStatus> windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -487,7 +538,7 @@ public class GetVehicleDataResponse extends RPCResponse {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleDataResponse setHandsOffSteering( Boolean handsOffSteering) {
+ public GetVehicleDataResponse setHandsOffSteering(Boolean handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -508,7 +559,7 @@ public class GetVehicleDataResponse extends RPCResponse {
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleDataResponse setGearStatus( GearStatus gearStatus) {
+ public GetVehicleDataResponse setGearStatus(GearStatus gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -539,7 +590,7 @@ public class GetVehicleDataResponse extends RPCResponse {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public GetVehicleDataResponse setStabilityControlsStatus( StabilityControlsStatus stabilityControlsStatus) {
+ public GetVehicleDataResponse setStabilityControlsStatus(StabilityControlsStatus stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
index 6ad9518e9..9a36e7f83 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,7 +40,7 @@ import com.smartdevicelink.proxy.rpc.enums.WayPointType;
import java.util.Hashtable;
public class GetWayPoints extends RPCRequest {
- public static final String KEY_WAY_POINT_TYPE = "wayPointType";
+ public static final String KEY_WAY_POINT_TYPE = "wayPointType";
public GetWayPoints() {
super(FunctionID.GET_WAY_POINTS.toString());
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
index cb7b99be3..e7dd16c92 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,17 +41,20 @@ import java.util.Hashtable;
import java.util.List;
public class GetWayPointsResponse extends RPCResponse {
- public static final String KEY_WAY_POINTS = "wayPoints";
+ public static final String KEY_WAY_POINTS = "wayPoints";
public GetWayPointsResponse() {
super(FunctionID.GET_WAY_POINTS.toString());
}
+
public GetWayPointsResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new GetWayPointsResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public GetWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -59,12 +62,14 @@ public class GetWayPointsResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
- public GetWayPointsResponse setWayPoints( List<LocationDetails> wayPoints) {
+
+ public GetWayPointsResponse setWayPoints(List<LocationDetails> wayPoints) {
setParameters(KEY_WAY_POINTS, wayPoints);
return this;
}
+
@SuppressWarnings("unchecked")
public List<LocationDetails> getWayPoints() {
- return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
+ return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
index 861c1a433..0144d704f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
@@ -18,7 +18,8 @@ public class Grid extends RPCStruct {
public static final String KEY_ROW_SPAN = "rowspan";
public static final String KEY_LEVEL_SPAN = "levelspan";
- public Grid() {}
+ public Grid() {
+ }
public Grid(Hashtable<String, Object> hash) {
super(hash);
@@ -26,10 +27,11 @@ public class Grid extends RPCStruct {
/**
* 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 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){
+ public Grid(@NonNull Integer row, @NonNull Integer column) {
this();
setRow(row);
setCol(column);
@@ -37,6 +39,7 @@ public class Grid extends RPCStruct {
/**
* Sets the column of this Grid
+ *
* @param col the column to be set
*/
public Grid setCol(@NonNull Integer col) {
@@ -46,6 +49,7 @@ public class Grid extends RPCStruct {
/**
* Get the column value of this Grid
+ *
* @return the column value
*/
public Integer getCol() {
@@ -54,6 +58,7 @@ public class Grid extends RPCStruct {
/**
* Sets the row's value of this Grid
+ *
* @param row the row to be set
*/
public Grid setRow(@NonNull Integer row) {
@@ -63,6 +68,7 @@ public class Grid extends RPCStruct {
/**
* Gets the row value of this Grid
+ *
* @return the row value
*/
public Integer getRow() {
@@ -71,15 +77,17 @@ public class Grid extends RPCStruct {
/**
* Sets the level value of this Grid
+ *
* @param level the level to be set
*/
- public Grid setLevel( Integer level) {
+ public Grid setLevel(Integer level) {
setValue(KEY_LEVEL, level);
return this;
}
/**
* Gets the level value of this Grid
+ *
* @return the level
*/
public Integer getLevel() {
@@ -88,15 +96,17 @@ public class Grid extends RPCStruct {
/**
* Sets the column span of this Grid
+ *
* @param span the span to be set
*/
- public Grid setColSpan( Integer span) {
+ public Grid setColSpan(Integer span) {
setValue(KEY_COL_SPAN, span);
return this;
}
/**
* Gets the column span of this Grid
+ *
* @return the column span
*/
public Integer getColSpan() {
@@ -105,15 +115,17 @@ public class Grid extends RPCStruct {
/**
* Sets the row span of this Grid
+ *
* @param span the span to be set
*/
- public Grid setRowSpan( Integer span) {
+ public Grid setRowSpan(Integer span) {
setValue(KEY_ROW_SPAN, span);
return this;
}
/**
* Gets the row span of this Grid
+ *
* @return the row span
*/
public Integer getRowSpan() {
@@ -122,15 +134,17 @@ public class Grid extends RPCStruct {
/**
* Sets the level span of this Grid
+ *
* @param span the span to be set
*/
- public Grid setLevelSpan( Integer span) {
+ public Grid setLevelSpan(Integer span) {
setValue(KEY_LEVEL_SPAN, span);
return this;
}
/**
* Gets the level span of this Grid
+ *
* @return the level span
*/
public Integer getLevelSpan() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
index 662c4529b..c7c8d659b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
@@ -35,7 +35,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-public class HMICapabilities extends RPCStruct{
+public class HMICapabilities extends RPCStruct {
public static final String KEY_NAVIGATION = "navigation";
public static final String KEY_PHONE_CALL = "phoneCall";
public static final String KEY_VIDEO_STREAMING = "videoStreaming";
@@ -45,125 +45,126 @@ public class HMICapabilities extends RPCStruct{
public static final String KEY_SEAT_LOCATION = "seatLocation";
public static final String KEY_DRIVER_DISTRACTION = "driverDistraction";
- public HMICapabilities() { }
-
- public HMICapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public boolean isNavigationAvailable(){
- Object available = getValue(KEY_NAVIGATION);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
-
- /**
- * @deprecated use {@link #setNavigationAvailable(Boolean available)} instead.
- */
- @Deprecated
- public HMICapabilities setNavigationAvilable( Boolean available) {
+ public HMICapabilities() {
+ }
+
+ public HMICapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public boolean isNavigationAvailable() {
+ Object available = getValue(KEY_NAVIGATION);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
+
+ /**
+ * @deprecated use {@link #setNavigationAvailable(Boolean available)} instead.
+ */
+ @Deprecated
+ public HMICapabilities setNavigationAvilable(Boolean available) {
return setNavigationAvailable(available);
}
- /**
- * Sets the navigationAvailable.
- *
- * @param available Availability of driver Navigation capability. True: Available, False: Not Available
- */
- public HMICapabilities setNavigationAvailable(Boolean available) {
- setValue(KEY_NAVIGATION, available);
- return this;
- }
-
- public boolean isPhoneCallAvailable(){
- Object available = getValue(KEY_PHONE_CALL);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
-
- /**
- * @deprecated use {@link #setPhoneCallAvailable(Boolean available)} instead.
- */
- @Deprecated
- public HMICapabilities setPhoneCallAvilable( Boolean available) {
+ /**
+ * Sets the navigationAvailable.
+ *
+ * @param available Availability of driver Navigation capability. True: Available, False: Not Available
+ */
+ public HMICapabilities setNavigationAvailable(Boolean available) {
+ setValue(KEY_NAVIGATION, available);
+ return this;
+ }
+
+ public boolean isPhoneCallAvailable() {
+ Object available = getValue(KEY_PHONE_CALL);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
+
+ /**
+ * @deprecated use {@link #setPhoneCallAvailable(Boolean available)} instead.
+ */
+ @Deprecated
+ public HMICapabilities setPhoneCallAvilable(Boolean available) {
return setPhoneCallAvailable(available);
}
- /**
- * Sets the PhoneCallAvailable.
- *
- * @param available Availability of PhoneCall capability. True: Available, False: Not Available
- */
- public HMICapabilities setPhoneCallAvailable( Boolean available) {
- setValue(KEY_PHONE_CALL, available);
- return this;
- }
-
- public boolean isVideoStreamingAvailable(){
- Object available = getValue(KEY_VIDEO_STREAMING);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
-
- public HMICapabilities setVideoStreamingAvailable( Boolean available) {
+ /**
+ * Sets the PhoneCallAvailable.
+ *
+ * @param available Availability of PhoneCall capability. True: Available, False: Not Available
+ */
+ public HMICapabilities setPhoneCallAvailable(Boolean available) {
+ setValue(KEY_PHONE_CALL, available);
+ return this;
+ }
+
+ public boolean isVideoStreamingAvailable() {
+ Object available = getValue(KEY_VIDEO_STREAMING);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
+
+ public HMICapabilities setVideoStreamingAvailable(Boolean available) {
setValue(KEY_VIDEO_STREAMING, available);
return this;
}
- public boolean isRemoteControlAvailable(){
- Object available = getValue(KEY_REMOTE_CONTROL);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
+ public boolean isRemoteControlAvailable() {
+ Object available = getValue(KEY_REMOTE_CONTROL);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
- public HMICapabilities setRemoteControlAvailable( Boolean available) {
+ public HMICapabilities setRemoteControlAvailable(Boolean available) {
setValue(KEY_REMOTE_CONTROL, available);
return this;
}
- public boolean isAppServicesAvailable(){
- Object available = getValue(KEY_APP_SERVICES);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
+ public boolean isAppServicesAvailable() {
+ Object available = getValue(KEY_APP_SERVICES);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
- public HMICapabilities setAppServicesAvailable( Boolean available) {
+ public HMICapabilities setAppServicesAvailable(Boolean available) {
setValue(KEY_APP_SERVICES, available);
return this;
}
- public boolean isDisplaysCapabilityAvailable(){
- Object available = getValue(KEY_DISPLAYS);
- if (available == null) {
- return false;
- }
- return (Boolean) available;
- }
+ public boolean isDisplaysCapabilityAvailable() {
+ Object available = getValue(KEY_DISPLAYS);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
- public HMICapabilities setDisplaysCapabilityAvailable( Boolean available) {
+ public HMICapabilities setDisplaysCapabilityAvailable(Boolean available) {
setValue(KEY_DISPLAYS, available);
return this;
}
- public boolean isSeatLocationAvailable(){
- Object available = getValue(KEY_SEAT_LOCATION);
- if(available == null){
- return false;
- }
- return (Boolean)available;
- }
+ public boolean isSeatLocationAvailable() {
+ Object available = getValue(KEY_SEAT_LOCATION);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
- public HMICapabilities setSeatLocationAvailable( Boolean available) {
+ public HMICapabilities setSeatLocationAvailable(Boolean available) {
setValue(KEY_SEAT_LOCATION, available);
return this;
}
@@ -174,7 +175,7 @@ public class HMICapabilities extends RPCStruct{
* @param driverDistraction Availability of driver distraction capability. True: Available, False: Not Available
* @since SmartDeviceLink 7.0.0
*/
- public HMICapabilities setDriverDistraction( Boolean driverDistraction) {
+ public HMICapabilities setDriverDistraction(Boolean driverDistraction) {
setValue(KEY_DRIVER_DISTRACTION, driverDistraction);
return this;
}
@@ -185,11 +186,11 @@ public class HMICapabilities extends RPCStruct{
* @return Boolean Availability of driver distraction capability. True: Available, False: Not Available
* @since SmartDeviceLink 7.0.0
*/
- public Boolean isDriverDistractionAvailable() {
- Object available = getValue(KEY_DRIVER_DISTRACTION);
- if (available == null) {
- return false;
- }
- return (Boolean) available;
- }
+ public Boolean isDriverDistractionAvailable() {
+ Object available = getValue(KEY_DRIVER_DISTRACTION);
+ if (available == null) {
+ return false;
+ }
+ return (Boolean) available;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
index 5d5237b12..8b88366df 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -54,9 +54,9 @@ import java.util.List;
* <td>HMILevel</td>
* <td>A set of all HMI levels that are permitted for this given RPC.
* <ul>
- * <li>Min: 0</li>
- * <li>Max: 100</li>
- * </ul>
+ * <li>Min: 0</li>
+ * <li>Max: 100</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -65,70 +65,81 @@ import java.util.List;
* <td>HMILevel</td>
* <td>A set of all HMI levels that are prohibited for this given RPC.
* <ul>
- * <li>Min: 0</li>
- * <li>Max: 100</li>
- * </ul>
+ * <li>Min: 0</li>
+ * <li>Max: 100</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class HMIPermissions extends RPCStruct {
- public static final String KEY_ALLOWED = "allowed";
- public static final String KEY_USER_DISALLOWED = "userDisallowed";
- /**
- * Constructs a newly allocated HMIPermissions object
- */
- public HMIPermissions() { }
-
+ public static final String KEY_ALLOWED = "allowed";
+ public static final String KEY_USER_DISALLOWED = "userDisallowed";
+
+ /**
+ * Constructs a newly allocated HMIPermissions object
+ */
+ public HMIPermissions() {
+ }
+
/**
* Constructs a newly allocated HMIPermissions object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public HMIPermissions(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a newly allocated HMIPermissions object
- * @param allowed HMI level that is permitted for this given RPC
- * @param userDisallowed HMI level that is prohibited for this given RPC
+ *
+ * @param allowed HMI level that is permitted for this given RPC
+ * @param userDisallowed HMI level that is prohibited for this given RPC
*/
public HMIPermissions(@NonNull List<HMILevel> allowed, @NonNull List<HMILevel> userDisallowed) {
this();
setAllowed(allowed);
setUserDisallowed(userDisallowed);
}
+
/**
* get a set of all HMI levels that are permitted for this given RPC.
- * @return a set of all HMI levels that are permitted for this given RPC
+ *
+ * @return a set of all HMI levels that are permitted for this given RPC
*/
@SuppressWarnings("unchecked")
public List<HMILevel> getAllowed() {
- return (List<HMILevel>) getObject(HMILevel.class, KEY_ALLOWED);
+ return (List<HMILevel>) getObject(HMILevel.class, KEY_ALLOWED);
}
-
+
/**
* set HMI level that is permitted for this given RPC.
+ *
* @param allowed HMI level that is permitted for this given RPC
*/
public HMIPermissions setAllowed(@NonNull List<HMILevel> allowed) {
setValue(KEY_ALLOWED, allowed);
return this;
}
-
+
/**
* get a set of all HMI levels that are prohibited for this given RPC
+ *
* @return a set of all HMI levels that are prohibited for this given RPC
*/
@SuppressWarnings("unchecked")
public List<HMILevel> getUserDisallowed() {
- return (List<HMILevel>) getObject(HMILevel.class, KEY_USER_DISALLOWED);
+ return (List<HMILevel>) getObject(HMILevel.class, KEY_USER_DISALLOWED);
}
-
+
/**
* set a set of all HMI levels that are prohibited for this given RPC
- * @param userDisallowed HMI level that is prohibited for this given RPC
+ *
+ * @param userDisallowed HMI level that is prohibited for this given RPC
*/
public HMIPermissions setUserDisallowed(@NonNull List<HMILevel> userDisallowed) {
setValue(KEY_USER_DISALLOWED, userDisallowed);
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 36ef9c12c..7a84ffbb5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,123 +38,125 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
public class HMISettingsControlCapabilities extends RPCStruct {
- public static final String KEY_MODULE_NAME = "moduleName";
- 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
- */
- public HMISettingsControlCapabilities() {
- }
-
- /**
- * <p>Constructs a new HMISettingsControlCapabilities object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public HMISettingsControlCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public HMISettingsControlCapabilities(@NonNull String moduleName) {
- this();
- setModuleName(moduleName);
- }
-
- /**
- * Sets the moduleName portion of the HMISettingsControlCapabilities class
- *
- * @param moduleName The short friendly name of the hmi setting module. It should not be used to identify a module by mobile application.
- */
- public HMISettingsControlCapabilities setModuleName(@NonNull String moduleName) {
+ public static final String KEY_MODULE_NAME = "moduleName";
+ 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
+ */
+ public HMISettingsControlCapabilities() {
+ }
+
+ /**
+ * <p>Constructs a new HMISettingsControlCapabilities object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public HMISettingsControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public HMISettingsControlCapabilities(@NonNull String moduleName) {
+ this();
+ setModuleName(moduleName);
+ }
+
+ /**
+ * Sets the moduleName portion of the HMISettingsControlCapabilities class
+ *
+ * @param moduleName The short friendly name of the hmi setting module. It should not be used to identify a module by mobile application.
+ */
+ public HMISettingsControlCapabilities setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
return this;
}
- /**
- * Gets the moduleName portion of the HMISettingsControlCapabilities class
- *
- * @return String - The short friendly name of the hmi setting module. It should not be used to identify a module by mobile application.
- */
- public String getModuleName() {
- return getString(KEY_MODULE_NAME);
- }
-
- /**
- * Sets the distanceUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @param distanceUnitAvailable Availability of the control of distance unit.
- */
- public HMISettingsControlCapabilities setDistanceUnitAvailable( Boolean distanceUnitAvailable) {
+ /**
+ * Gets the moduleName portion of the HMISettingsControlCapabilities class
+ *
+ * @return String - The short friendly name of the hmi setting module. It should not be used to identify a module by mobile application.
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
+
+ /**
+ * Sets the distanceUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @param distanceUnitAvailable Availability of the control of distance unit.
+ */
+ public HMISettingsControlCapabilities setDistanceUnitAvailable(Boolean distanceUnitAvailable) {
setValue(KEY_DISTANCE_UNIT_AVAILABLE, distanceUnitAvailable);
return this;
}
- /**
- * Gets the distanceUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @return Boolean - Availability of the control of distance unit.
- */
- public Boolean getDistanceUnitAvailable() {
- return getBoolean(KEY_DISTANCE_UNIT_AVAILABLE);
- }
-
- /**
- * Sets the temperatureUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @param temperatureUnitAvailable Availability of the control of temperature unit.
- */
- public HMISettingsControlCapabilities setTemperatureUnitAvailable( Boolean temperatureUnitAvailable) {
+ /**
+ * Gets the distanceUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of distance unit.
+ */
+ public Boolean getDistanceUnitAvailable() {
+ return getBoolean(KEY_DISTANCE_UNIT_AVAILABLE);
+ }
+
+ /**
+ * Sets the temperatureUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @param temperatureUnitAvailable Availability of the control of temperature unit.
+ */
+ public HMISettingsControlCapabilities setTemperatureUnitAvailable(Boolean temperatureUnitAvailable) {
setValue(KEY_TEMPERATURE_UNIT_AVAILABLE, temperatureUnitAvailable);
return this;
}
- /**
- * Gets the temperatureUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @return Boolean - Availability of the control of temperature unit.
- */
- public Boolean getTemperatureUnitAvailable() {
- return getBoolean(KEY_TEMPERATURE_UNIT_AVAILABLE);
- }
-
- /**
- * Sets the displayModeUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @param displayModeUnitAvailable Availability of the control of HMI display mode.
- */
- public HMISettingsControlCapabilities setDisplayModeUnitAvailable( Boolean displayModeUnitAvailable) {
+ /**
+ * Gets the temperatureUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of temperature unit.
+ */
+ public Boolean getTemperatureUnitAvailable() {
+ return getBoolean(KEY_TEMPERATURE_UNIT_AVAILABLE);
+ }
+
+ /**
+ * Sets the displayModeUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @param displayModeUnitAvailable Availability of the control of HMI display mode.
+ */
+ public HMISettingsControlCapabilities setDisplayModeUnitAvailable(Boolean displayModeUnitAvailable) {
setValue(KEY_DISPLAY_MODE_UNIT_AVAILABLE, displayModeUnitAvailable);
return this;
}
- /**
- * Gets the displayModeUnitAvailable portion of the HMISettingsControlCapabilities class
- *
- * @return Boolean - Availability of the control of HMI display mode.
- */
- public Boolean getDisplayModeUnitAvailable() {
- return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE);
- }
-
- /**
- * Sets ModuleInfo for this capability
- * @param info the ModuleInfo to be set
- */
- public HMISettingsControlCapabilities setModuleInfo( ModuleInfo info) {
+ /**
+ * Gets the displayModeUnitAvailable portion of the HMISettingsControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of HMI display mode.
+ */
+ public Boolean getDisplayModeUnitAvailable() {
+ return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE);
+ }
+
+ /**
+ * Sets ModuleInfo for this capability
+ *
+ * @param info the ModuleInfo to be set
+ */
+ public HMISettingsControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
- /**
- * Gets a ModuleInfo of this capability
- * @return module info of this capability
- */
- public ModuleInfo getModuleInfo() {
- return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_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/HMISettingsControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlData.java
index 05dda0de2..a14b4d44d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,83 +43,77 @@ import java.util.Hashtable;
*/
public class HMISettingsControlData extends RPCStruct {
- public static final String KEY_DISPLAY_MODE = "displayMode";
- public static final String KEY_TEMPERATURE_UNIT = "temperatureUnit";
- public static final String KEY_DISTANCE_UNIT = "distanceUnit";
+ public static final String KEY_DISPLAY_MODE = "displayMode";
+ public static final String KEY_TEMPERATURE_UNIT = "temperatureUnit";
+ public static final String KEY_DISTANCE_UNIT = "distanceUnit";
- public HMISettingsControlData() {
- }
+ public HMISettingsControlData() {
+ }
- public HMISettingsControlData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public HMISettingsControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Sets the displayMode portion of the HMISettingsControlData class
- *
- * @param displayMode the display mode (DAY, NIGHT, AUTO) of screen on the respective module
- *
- * @see DisplayMode
- */
- public HMISettingsControlData setDisplayMode( DisplayMode displayMode) {
+ /**
+ * Sets the displayMode portion of the HMISettingsControlData class
+ *
+ * @param displayMode the display mode (DAY, NIGHT, AUTO) of screen on the respective module
+ * @see DisplayMode
+ */
+ public HMISettingsControlData setDisplayMode(DisplayMode displayMode) {
setValue(KEY_DISPLAY_MODE, displayMode);
return this;
}
- /**
- * Gets the displayMode portion of the HMISettingsControlData class
- *
- * @return DisplayMode the display mode (DAY, NIGHT, AUTO) of screen on the respective module
- *
- * @see com.smartdevicelink.proxy.rpc.enums.DisplayMode
- */
- public DisplayMode getDisplayMode() {
- return (DisplayMode) getObject(DisplayMode.class, KEY_DISPLAY_MODE);
- }
+ /**
+ * Gets the displayMode portion of the HMISettingsControlData class
+ *
+ * @return DisplayMode the display mode (DAY, NIGHT, AUTO) of screen on the respective module
+ * @see com.smartdevicelink.proxy.rpc.enums.DisplayMode
+ */
+ public DisplayMode getDisplayMode() {
+ return (DisplayMode) getObject(DisplayMode.class, KEY_DISPLAY_MODE);
+ }
- /**
- * Sets the temperatureUnit portion of the HMISettingsControlData class
- *
- * @param temperatureUnit enum value of temperature unit associated with the display of the current module
- *
- * @see TemperatureUnit
- */
- public HMISettingsControlData setTemperatureUnit( TemperatureUnit temperatureUnit) {
+ /**
+ * Sets the temperatureUnit portion of the HMISettingsControlData class
+ *
+ * @param temperatureUnit enum value of temperature unit associated with the display of the current module
+ * @see TemperatureUnit
+ */
+ public HMISettingsControlData setTemperatureUnit(TemperatureUnit temperatureUnit) {
setValue(KEY_TEMPERATURE_UNIT, temperatureUnit);
return this;
}
- /**
- * Gets the temperatureUnit portion of the HMISettingsControlData class
- *
- * @return TemperatureUnit enum value of temperature unit associated with the display of the current module
- *
- * @see com.smartdevicelink.proxy.rpc.enums.TemperatureUnit
- */
- public TemperatureUnit getTemperatureUnit() {
- return (TemperatureUnit) getObject(TemperatureUnit.class, KEY_TEMPERATURE_UNIT);
- }
+ /**
+ * Gets the temperatureUnit portion of the HMISettingsControlData class
+ *
+ * @return TemperatureUnit enum value of temperature unit associated with the display of the current module
+ * @see com.smartdevicelink.proxy.rpc.enums.TemperatureUnit
+ */
+ public TemperatureUnit getTemperatureUnit() {
+ return (TemperatureUnit) getObject(TemperatureUnit.class, KEY_TEMPERATURE_UNIT);
+ }
- /**
- * Sets the distanceUnit portion of the HMISettingsControlData class
- *
- * @param distanceUnit enum value of distance unit associated with the display of the current module
- *
- * @see DistanceUnit
- */
- public HMISettingsControlData setDistanceUnit( DistanceUnit distanceUnit) {
+ /**
+ * Sets the distanceUnit portion of the HMISettingsControlData class
+ *
+ * @param distanceUnit enum value of distance unit associated with the display of the current module
+ * @see DistanceUnit
+ */
+ public HMISettingsControlData setDistanceUnit(DistanceUnit distanceUnit) {
setValue(KEY_DISTANCE_UNIT, distanceUnit);
return this;
}
- /**
- * Gets the distanceUnit portion of the HMISettingsControlData class
- *
- * @return DistanceUnit enum value of distance unit associated with the display of the current module
- *
- * @see com.smartdevicelink.proxy.rpc.enums.DistanceUnit
- */
- public DistanceUnit getDistanceUnit() {
- return (DistanceUnit) getObject(DistanceUnit.class, KEY_DISTANCE_UNIT);
- }
+ /**
+ * Gets the distanceUnit portion of the HMISettingsControlData class
+ *
+ * @return DistanceUnit enum value of distance unit associated with the display of the current module
+ * @see com.smartdevicelink.proxy.rpc.enums.DistanceUnit
+ */
+ public DistanceUnit getDistanceUnit() {
+ return (DistanceUnit) getObject(DistanceUnit.class, KEY_DISTANCE_UNIT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
index a50c2d37b..0cacd364d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
@@ -40,52 +40,54 @@ import java.util.Hashtable;
/**
* Defines a haptic rectangle that contains a reference ID and the spatial data of a rectangle UI component.
- * @since SmartDeviceLink 4.5.0
*
+ * @since SmartDeviceLink 4.5.0
*/
public class HapticRect extends RPCStruct {
- public static final String KEY_ID = "id";
- public static final String KEY_RECT = "rect";
+ public static final String KEY_ID = "id";
+ public static final String KEY_RECT = "rect";
+
+ public HapticRect() {
+ }
- public HapticRect() {}
+ public HapticRect(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public HapticRect(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public HapticRect(@NonNull Integer id, @NonNull Rectangle rect) {
+ this();
+ setId(id);
+ setRect(rect);
+ }
- public HapticRect(@NonNull Integer id, @NonNull Rectangle rect) {
- this();
- setId(id);
- setRect(rect);
- }
- /**
- * Set a user control spatial identifier that references the supplied spatial data
- */
- public HapticRect setId(@NonNull Integer id) {
+ /**
+ * Set a user control spatial identifier that references the supplied spatial data
+ */
+ public HapticRect setId(@NonNull Integer id) {
setValue(KEY_ID, id);
return this;
}
- /**
- * @return a user control spatial identifier that references the supplied spatial data
- */
- public Integer getId() {
- return getInteger(KEY_ID);
- }
+ /**
+ * @return a user control spatial identifier that references the supplied spatial data
+ */
+ public Integer getId() {
+ return getInteger(KEY_ID);
+ }
- /**
- * Set the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
- */
- public HapticRect setRect(@NonNull Rectangle rect) {
+ /**
+ * Set the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
+ */
+ public HapticRect setRect(@NonNull Rectangle rect) {
setValue(KEY_RECT, rect);
return this;
}
- /**
- * @return the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
- */
- public Rectangle getRect() {
- return (Rectangle) getObject(Rectangle.class, KEY_RECT);
- }
+ /**
+ * @return the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
+ */
+ public Rectangle getRect() {
+ return (Rectangle) getObject(Rectangle.class, KEY_RECT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
index 693219fe0..d03825ebc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,86 +37,98 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import java.util.Hashtable;
-/** Status of the head lamps.
- *
+
+/**
+ * Status of the head lamps.
+ *
* <p><table border="1" rules="all"></p>
- * <tr>
- * <th>Param Name</th>
- * <th>Type</th>
- * <th>Mandatory</th>
- * <th>Description</th>
- * </tr>
- * <tr>
- * <td>lowBeamsOn</td>
- * <td>Boolean</td>
- * <td>true</td>
- * <td>Status of the low beam lamps. </td>
- * </tr>
- * <tr>
- * <td>highBeamsOn</td>
- * <td>Boolean</td>
- * <td>true</td>
- * <td>Status of the high beam lamps. </td>
- * </tr>
- * <tr>
- * <td>ambientLightSensorStatus</td>
- * <td>AmbientLightStatus</td>
- * <td>true</td>
- * <td>Status of the ambient light sensor.</td>
- * </tr>
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>lowBeamsOn</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>Status of the low beam lamps. </td>
+ * </tr>
+ * <tr>
+ * <td>highBeamsOn</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>Status of the high beam lamps. </td>
+ * </tr>
+ * <tr>
+ * <td>ambientLightSensorStatus</td>
+ * <td>AmbientLightStatus</td>
+ * <td>true</td>
+ * <td>Status of the ambient light sensor.</td>
+ * </tr>
*
*
* </table>
+ *
* @see OnVehicleData
* @see GetVehicleData
* @since SmartDeviceLink 1.0
- *
*/
public class HeadLampStatus extends RPCStruct {
- public static final String KEY_AMBIENT_LIGHT_SENSOR_STATUS = "ambientLightSensorStatus";
- public static final String KEY_HIGH_BEAMS_ON = "highBeamsOn";
+ public static final String KEY_AMBIENT_LIGHT_SENSOR_STATUS = "ambientLightSensorStatus";
+ public static final String KEY_HIGH_BEAMS_ON = "highBeamsOn";
public static final String KEY_LOW_BEAMS_ON = "lowBeamsOn";
/**
- * Constructs a new HeadLampStatus object
+ * Constructs a new HeadLampStatus object
*/
- public HeadLampStatus() {}
+ public HeadLampStatus() {
+ }
+
/**
- * <p>Constructs a new HeadLampStatus object indicated by the Hashtable
+ * <p>Constructs a new HeadLampStatus object indicated by the Hashtable
* parameter</p>
+ *
* @param hash The hash table to use
*/
public HeadLampStatus(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- * Constructs a new HeadLampStatus object
+ * Constructs a new HeadLampStatus object
*/
public HeadLampStatus(@NonNull Boolean lowBeamsOn, @NonNull Boolean highBeamsOn) {
this();
setLowBeamsOn(lowBeamsOn);
setHighBeamsOn(highBeamsOn);
}
- public HeadLampStatus setAmbientLightStatus( AmbientLightStatus ambientLightSensorStatus) {
+
+ public HeadLampStatus setAmbientLightStatus(AmbientLightStatus ambientLightSensorStatus) {
setValue(KEY_AMBIENT_LIGHT_SENSOR_STATUS, ambientLightSensorStatus);
return this;
}
+
public AmbientLightStatus getAmbientLightStatus() {
return (AmbientLightStatus) getObject(AmbientLightStatus.class, KEY_AMBIENT_LIGHT_SENSOR_STATUS);
}
+
public HeadLampStatus setHighBeamsOn(@NonNull Boolean highBeamsOn) {
setValue(KEY_HIGH_BEAMS_ON, highBeamsOn);
return this;
}
+
public Boolean getHighBeamsOn() {
- return getBoolean(KEY_HIGH_BEAMS_ON);
+ return getBoolean(KEY_HIGH_BEAMS_ON);
}
+
public HeadLampStatus setLowBeamsOn(@NonNull Boolean lowBeamsOn) {
setValue(KEY_LOW_BEAMS_ON, lowBeamsOn);
return this;
}
+
public Boolean getLowBeamsOn() {
- return getBoolean(KEY_LOW_BEAMS_ON);
+ return getBoolean(KEY_LOW_BEAMS_ON);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Headers.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Headers.java
index f8eed013b..562f798db 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Headers.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Headers.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,127 +34,127 @@ package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
- *
* @since SmartDeviceLink 3.0
- *
*/
public class Headers extends RPCStruct {
- public static final String KEY_CONTENT_TYPE = "ContentType";
- public static final String KEY_CONNECT_TIMEOUT = "ConnectTimeout";
- public static final String KEY_DO_OUTPUT = "DoOutput";
- public static final String KEY_DO_INPUT = "DoInput";
- public static final String KEY_USE_CACHES = "UseCaches";
- public static final String KEY_REQUEST_METHOD = "RequestMethod";
- public static final String KEY_READ_TIMEOUT = "ReadTimeout";
- public static final String KEY_INSTANCE_FOLLOW_REDIRECTS = "InstanceFollowRedirects";
- public static final String KEY_CHARSET = "charset";
- public static final String KEY_CONTENT_LENGTH = "Content-Length";
-
- public Headers() { }
+ public static final String KEY_CONTENT_TYPE = "ContentType";
+ public static final String KEY_CONNECT_TIMEOUT = "ConnectTimeout";
+ public static final String KEY_DO_OUTPUT = "DoOutput";
+ public static final String KEY_DO_INPUT = "DoInput";
+ public static final String KEY_USE_CACHES = "UseCaches";
+ public static final String KEY_REQUEST_METHOD = "RequestMethod";
+ public static final String KEY_READ_TIMEOUT = "ReadTimeout";
+ public static final String KEY_INSTANCE_FOLLOW_REDIRECTS = "InstanceFollowRedirects";
+ public static final String KEY_CHARSET = "charset";
+ public static final String KEY_CONTENT_LENGTH = "Content-Length";
+
+ public Headers() {
+ }
+
/**
- * <p>
- * Constructs a new Headers object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new Headers object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public Headers(Hashtable<String, Object> hash) {
super(hash);
- }
-
- public Headers setContentType( String contentType) {
+ }
+
+ public Headers setContentType(String contentType) {
setValue(KEY_CONTENT_TYPE, contentType);
return this;
}
-
+
public String getContentType() {
return getString(KEY_CONTENT_TYPE);
- }
-
- public Headers setConnectTimeout( Integer connectionTimeout) {
+ }
+
+ public Headers setConnectTimeout(Integer connectionTimeout) {
setValue(KEY_CONNECT_TIMEOUT, connectionTimeout);
return this;
}
-
+
public Integer getConnectTimeout() {
return getInteger(KEY_CONNECT_TIMEOUT);
}
-
- public Headers setDoOutput( Boolean doOutput) {
+
+ public Headers setDoOutput(Boolean doOutput) {
setValue(KEY_DO_OUTPUT, doOutput);
return this;
}
-
+
public Boolean getDoOutput() {
return getBoolean(KEY_DO_OUTPUT);
- }
-
- public Headers setDoInput( Boolean doInput) {
+ }
+
+ public Headers setDoInput(Boolean doInput) {
setValue(KEY_DO_INPUT, doInput);
return this;
}
-
+
public Boolean getDoInput() {
return getBoolean(KEY_DO_INPUT);
- }
+ }
- public Headers setUseCaches( Boolean usesCaches) {
+ public Headers setUseCaches(Boolean usesCaches) {
setValue(KEY_USE_CACHES, usesCaches);
return this;
}
-
+
public Boolean getUseCaches() {
return getBoolean(KEY_USE_CACHES);
- }
-
- public Headers setRequestMethod( String requestMethod) {
+ }
+
+ public Headers setRequestMethod(String requestMethod) {
setValue(KEY_REQUEST_METHOD, requestMethod);
return this;
}
-
+
public String getRequestMethod() {
return getString(KEY_REQUEST_METHOD);
- }
-
-
- public Headers setReadTimeout( Integer readTimeout) {
+ }
+
+
+ public Headers setReadTimeout(Integer readTimeout) {
setValue(KEY_READ_TIMEOUT, readTimeout);
return this;
}
-
+
public Integer getReadTimeout() {
return getInteger(KEY_READ_TIMEOUT);
}
-
- public Headers setInstanceFollowRedirects( Boolean instanceFollowRedirects) {
+
+ public Headers setInstanceFollowRedirects(Boolean instanceFollowRedirects) {
setValue(KEY_INSTANCE_FOLLOW_REDIRECTS, instanceFollowRedirects);
return this;
}
-
+
public Boolean getInstanceFollowRedirects() {
return getBoolean(KEY_INSTANCE_FOLLOW_REDIRECTS);
}
-
- public Headers setCharset( String charset) {
+
+ public Headers setCharset(String charset) {
setValue(KEY_CHARSET, charset);
return this;
}
-
+
public String getCharset() {
return getString(KEY_CHARSET);
}
- public Headers setContentLength( Integer contentLength) {
+ public Headers setContentLength(Integer contentLength) {
setValue(KEY_CONTENT_LENGTH, contentLength);
return this;
}
-
+
public Integer getContentLength() {
return getInteger(KEY_CONTENT_LENGTH);
- }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Image.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
index 0cf1ef12a..dfa452e90 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,8 +39,8 @@ import com.smartdevicelink.proxy.rpc.enums.ImageType;
import java.util.Hashtable;
/**
- *Specifies, which image shall be used, e.g. in Alerts or on SoftButtons provided the display supports it.
- *<p><b>Parameter List</b></p>
+ * Specifies, which image shall be used, e.g. in Alerts or on SoftButtons provided the display supports it.
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -53,9 +53,9 @@ import java.util.Hashtable;
* <td>String</td>
* <td>Either the static hex icon value or the binary image file name identifier (sent by PutFile).
* <ul>
- * <li>Min: 0</li>
- * <li>Max: 65535</li>
- * </ul>
+ * <li>Min: 0</li>
+ * <li>Max: 65535</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -66,29 +66,33 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class Image extends RPCStruct {
- public static final String KEY_VALUE = "value";
- public static final String KEY_IMAGE_TYPE = "imageType";
- public static final String KEY_IS_TEMPLATE = "isTemplate";
+ public static final String KEY_VALUE = "value";
+ public static final String KEY_IMAGE_TYPE = "imageType";
+ public static final String KEY_IS_TEMPLATE = "isTemplate";
+
+ /**
+ * Constructs a newly allocated Image object
+ */
+ public Image() {
+ }
- /**
- * Constructs a newly allocated Image object
- */
- public Image() { }
-
/**
* Constructs a newly allocated Image object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public Image(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a newly allocated Image object
- * @param value either the static hex icon value or the binary image file name identifier (sent by PutFile)
+ *
+ * @param value either the static hex icon value or the binary image file name identifier (sent by PutFile)
* @param imageType whether it is a static or dynamic image
*/
public Image(@NonNull String value, @NonNull ImageType imageType) {
@@ -99,32 +103,36 @@ public class Image extends RPCStruct {
/**
* Set either the static hex icon value or the binary image file name identifier (sent by PutFile)
+ *
* @param value either the static hex icon value or the binary image file name identifier (sent by PutFile)
*/
public Image setValue(@NonNull String value) {
setValue(KEY_VALUE, value);
return this;
}
-
+
/**
* Get either the static hex icon value or the binary image file name identifier (sent by PutFile)
- * @return either the static hex icon value or the binary image file name identifier (sent by PutFile)
+ *
+ * @return either the static hex icon value or the binary image file name identifier (sent by PutFile)
*/
public String getValue() {
return getString(KEY_VALUE);
}
-
+
/**
* Set the image type (static or dynamic image)
+ *
* @param imageType whether it is a static or dynamic image
*/
public Image setImageType(@NonNull ImageType imageType) {
setValue(KEY_IMAGE_TYPE, imageType);
return this;
}
-
+
/**
* Get image type (static or dynamic image)
+ *
* @return the image type (static or dynamic image)
*/
public ImageType getImageType() {
@@ -133,18 +141,20 @@ public class Image extends RPCStruct {
/**
* Set whether this Image is a template image whose coloring should be decided by the HMI
+ *
* @param isTemplate boolean that tells whether this Image is a template image
*/
- public Image setIsTemplate( Boolean isTemplate) {
+ public Image setIsTemplate(Boolean isTemplate) {
setValue(KEY_IS_TEMPLATE, isTemplate);
return this;
}
/**
* Get whether this Image is a template image whose coloring should be decided by the HMI
+ *
* @return boolean that tells whether this Image is a template image
*/
- public Boolean getIsTemplate(){
+ public Boolean getIsTemplate() {
return getBoolean(KEY_IS_TEMPLATE);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
index 6fa2e3651..a7a79fa1b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,8 +40,9 @@ import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import java.util.Hashtable;
import java.util.List;
-/** <p>The name that identifies the field.For example AppIcon,SoftButton, LocationImage, etc.</p>
- *
+/**
+ * <p>The name that identifies the field.For example AppIcon,SoftButton, LocationImage, etc.</p>
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -77,24 +78,22 @@ import java.util.List;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- * @since SmartDeviceLink 3.0
+ *
* @see com.smartdevicelink.proxy.rpc.enums.ImageType
* @see com.smartdevicelink.proxy.rpc.ImageResolution
* @see com.smartdevicelink.proxy.rpc.enums.ImageFieldName
- *
- *
- *
- *
+ * @since SmartDeviceLink 3.0
*/
public class ImageField extends RPCStruct {
public static final String KEY_IMAGE_TYPE_SUPPORTED = "imageTypeSupported";
public static final String KEY_IMAGE_RESOLUTION = "imageResolution";
public static final String KEY_NAME = "name";
-
-
- public ImageField() { }
-
+
+
+ public ImageField() {
+ }
+
public ImageField(Hashtable<String, Object> hash) {
super(hash);
}
@@ -107,23 +106,28 @@ public class ImageField extends RPCStruct {
public ImageFieldName getName() {
return (ImageFieldName) getObject(ImageFieldName.class, KEY_NAME);
- }
+ }
+
public ImageField setName(@NonNull ImageFieldName name) {
setValue(KEY_NAME, name);
return this;
}
+
@SuppressWarnings("unchecked")
- public List<FileType> getImageTypeSupported() {
+ public List<FileType> getImageTypeSupported() {
return (List<FileType>) getObject(FileType.class, KEY_IMAGE_TYPE_SUPPORTED);
}
+
public ImageField setImageTypeSupported(@NonNull List<FileType> imageTypeSupported) {
setValue(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported);
return this;
}
+
public ImageResolution getImageResolution() {
return (ImageResolution) getObject(ImageResolution.class, KEY_IMAGE_RESOLUTION);
- }
- public ImageField setImageResolution( ImageResolution imageResolution) {
+ }
+
+ public ImageField setImageResolution(ImageResolution imageResolution) {
setValue(KEY_IMAGE_RESOLUTION, imageResolution);
return this;
}
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 ab326ed06..b14e2ccba 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,10 +36,12 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-/** The image resolution of this field.
- *
+
+/**
+ * The image resolution of this field.
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -65,26 +67,27 @@ import java.util.Hashtable;
* <td>minvalue:1; maxvalue: 10000</td>
* <td>SmartDeviceLink 3.0 </td>
* </tr>
- *
+ *
* </table>
+ *
* @since SmartDeviceLink 3.0
- *
*/
public class ImageResolution extends RPCStruct {
- public static final String KEY_RESOLUTION_WIDTH = "resolutionWidth";
- public static final String KEY_RESOLUTION_HEIGHT = "resolutionHeight";
-
- public ImageResolution() {}
+ public static final String KEY_RESOLUTION_WIDTH = "resolutionWidth";
+ public static final String KEY_RESOLUTION_HEIGHT = "resolutionHeight";
+
+ public ImageResolution() {
+ }
+
/**
- * <p>
- * Constructs a new ImageResolution object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new ImageResolution object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public ImageResolution(Hashtable<String, Object> hash) {
super(hash);
@@ -102,30 +105,30 @@ public class ImageResolution extends RPCStruct {
* converted to a pair value.
*/
public ImageResolution setResolutionWidth(@NonNull Integer resolutionWidth) {
- if(resolutionWidth != null && resolutionWidth % 2 != 0) {
+ if (resolutionWidth != null && resolutionWidth % 2 != 0) {
resolutionWidth++;
}
setValue(KEY_RESOLUTION_WIDTH, resolutionWidth);
return this;
}
-
+
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.
+ * the Android H264 decoder, as a workaround the odd value is
+ * converted to a pair value.
*/
public ImageResolution setResolutionHeight(@NonNull Integer resolutionHeight) {
- if(resolutionHeight != null && resolutionHeight % 2 != 0) {
+ if (resolutionHeight != null && resolutionHeight % 2 != 0) {
resolutionHeight++;
}
setValue(KEY_RESOLUTION_HEIGHT, resolutionHeight);
return this;
}
-
+
public Integer getResolutionHeight() {
return getInteger(KEY_RESOLUTION_HEIGHT);
}
@@ -133,6 +136,6 @@ public class ImageResolution extends RPCStruct {
@Override
public String toString() {
return "width=" + getResolutionWidth() +
- ", height=" + getResolutionHeight();
+ ", height=" + getResolutionHeight();
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
index 1a182e732..cfd9b0dae 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,8 +39,9 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import java.util.Hashtable;
import java.util.List;
-/** This mode causes the interaction to immediately display a keyboard entry through the HMI.
- *
+/**
+ * This mode causes the interaction to immediately display a keyboard entry through the HMI.
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -101,19 +102,19 @@ import java.util.List;
* <td>Allows an app to prepopulate the text field with a list of suggested or completed entry as the user types. Set to an empty array to remove the auto-complete list from the screen</td>
* </tr>
* </table>
- *
- * @since SmartDeviceLink 3.0
*
+ * @since SmartDeviceLink 3.0
*/
public class KeyboardProperties extends RPCStruct {
public static final String KEY_KEYPRESS_MODE = "keypressMode";
- public static final String KEY_KEYBOARD_LAYOUT = "keyboardLayout";
- public static final String KEY_LIMITED_CHARACTER_LIST = "limitedCharacterList";
- @Deprecated public static final String KEY_AUTO_COMPLETE_TEXT = "autoCompleteText";
- public static final String KEY_AUTO_COMPLETE_LIST = "autoCompleteList";
- public static final String KEY_LANGUAGE = "language";
-
+ public static final String KEY_KEYBOARD_LAYOUT = "keyboardLayout";
+ public static final String KEY_LIMITED_CHARACTER_LIST = "limitedCharacterList";
+ @Deprecated
+ public static final String KEY_AUTO_COMPLETE_TEXT = "autoCompleteText";
+ public static final String KEY_AUTO_COMPLETE_LIST = "autoCompleteList";
+ public static final String KEY_LANGUAGE = "language";
+
private static final KeypressMode KEYPRESS_MODE_DEFAULT = KeypressMode.RESEND_CURRENT_ENTRY;
public KeyboardProperties() {
@@ -131,7 +132,7 @@ public class KeyboardProperties extends RPCStruct {
return (Language) getObject(Language.class, KEY_LANGUAGE);
}
- public KeyboardProperties setLanguage( Language language) {
+ public KeyboardProperties setLanguage(Language language) {
setValue(KEY_LANGUAGE, language);
return this;
}
@@ -140,20 +141,20 @@ public class KeyboardProperties extends RPCStruct {
return (KeyboardLayout) getObject(KeyboardLayout.class, KEY_KEYBOARD_LAYOUT);
}
- public KeyboardProperties setKeyboardLayout( KeyboardLayout keyboardLayout) {
+ public KeyboardProperties setKeyboardLayout(KeyboardLayout keyboardLayout) {
setValue(KEY_KEYBOARD_LAYOUT, keyboardLayout);
return this;
}
public KeypressMode getKeypressMode() {
KeypressMode kp = (KeypressMode) getObject(KeypressMode.class, KEY_KEYPRESS_MODE);
- if(kp == null){
+ if (kp == null) {
kp = KEYPRESS_MODE_DEFAULT;
}
return kp;
}
- public KeyboardProperties setKeypressMode( KeypressMode keypressMode) {
+ public KeyboardProperties setKeypressMode(KeypressMode keypressMode) {
if (keypressMode != null) {
setValue(KEY_KEYPRESS_MODE, keypressMode);
} else {
@@ -167,13 +168,14 @@ public class KeyboardProperties extends RPCStruct {
return (List<String>) getObject(String.class, KEY_LIMITED_CHARACTER_LIST);
}
- public KeyboardProperties setLimitedCharacterList( List<String> limitedCharacterList) {
+ public KeyboardProperties setLimitedCharacterList(List<String> limitedCharacterList) {
setValue(KEY_LIMITED_CHARACTER_LIST, limitedCharacterList);
return this;
}
/**
* Gets the text that allows an app to prepopulate the text field with a suggested entry as the user types
+ *
* @return String representing the suggestions text
*/
@Deprecated
@@ -183,10 +185,12 @@ public class KeyboardProperties extends RPCStruct {
/**
* Sets the text that allows an app to prepopulate the text field with a suggested entry as the user types
+ *
* @param autoCompleteText String representing the suggestions text
- * @deprecated use {@link #setAutoCompleteList( List <String>)} instead
+ * @deprecated use {@link #setAutoCompleteList(List <String>)} instead
*/
- @Deprecated public KeyboardProperties setAutoCompleteText( String autoCompleteText) {
+ @Deprecated
+ public KeyboardProperties setAutoCompleteText(String autoCompleteText) {
setValue(KEY_AUTO_COMPLETE_TEXT, autoCompleteText);
return this;
}
@@ -194,6 +198,7 @@ public class KeyboardProperties extends RPCStruct {
/**
* Gets the list that allows an app to prepopulate the text field with a list of suggested or
* completed entries as the user types.
+ *
* @return List<String> representing the suggestions list
*/
public List<String> getAutoCompleteList() {
@@ -203,9 +208,10 @@ public class KeyboardProperties extends RPCStruct {
/**
* Sets the lists that allows an app to prepopulate the text field with a list of suggested or
* completed entries as the user types. Set to an empty array to remove the auto-complete list from the screen
+ *
* @param autoCompleteList List<String> representing the suggestions list
*/
- public KeyboardProperties setAutoCompleteList( List<String> autoCompleteList) {
+ public KeyboardProperties setAutoCompleteList(List<String> autoCompleteList) {
setValue(KEY_AUTO_COMPLETE_LIST, autoCompleteList);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightCapabilities.java
index 365e71543..13aae6abe 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,113 +40,111 @@ import java.util.Hashtable;
public class LightCapabilities extends RPCStruct {
- public static final String KEY_NAME = "name";
- public static final String KEY_DENSITY_AVAILABLE = "densityAvailable";
- public static final String KEY_RGB_COLOR_SPACE_AVAILABLE = "rgbColorSpaceAvailable";
- public static final String KEY_STATUS_AVAILABLE = "statusAvailable";
-
- /**
- * Constructs a newly allocated LightCapabilities object
- */
- public LightCapabilities() {
- }
-
- /**
- * Constructs a newly allocated LightCapabilities object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public LightCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a newly allocated LightCapabilities object
- *
- * @param name name of Light
- */
- public LightCapabilities(@NonNull LightName name) {
- this();
- setName(name);
- }
-
- /**
- * Sets the name portion of the LightCapabilities class
- *
- * @param name enum value of type LightName that describes the specific light
- *
- * @see LightName
- */
- public LightCapabilities setName(@NonNull LightName name) {
+ public static final String KEY_NAME = "name";
+ public static final String KEY_DENSITY_AVAILABLE = "densityAvailable";
+ public static final String KEY_RGB_COLOR_SPACE_AVAILABLE = "rgbColorSpaceAvailable";
+ public static final String KEY_STATUS_AVAILABLE = "statusAvailable";
+
+ /**
+ * Constructs a newly allocated LightCapabilities object
+ */
+ public LightCapabilities() {
+ }
+
+ /**
+ * Constructs a newly allocated LightCapabilities object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public LightCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated LightCapabilities object
+ *
+ * @param name name of Light
+ */
+ public LightCapabilities(@NonNull LightName name) {
+ this();
+ setName(name);
+ }
+
+ /**
+ * Sets the name portion of the LightCapabilities class
+ *
+ * @param name enum value of type LightName that describes the specific light
+ * @see LightName
+ */
+ public LightCapabilities setName(@NonNull LightName name) {
setValue(KEY_NAME, name);
return this;
}
- /**
- * Gets the name portion of the LightCapabilities class
- *
- * @return LightName enum value that describes the specific light
- *
- * @see com.smartdevicelink.proxy.rpc.enums.LightName
- */
- public LightName getName() {
- return (LightName) getObject(LightName.class, KEY_NAME);
- }
-
- /**
- * Sets the densityAvailable portion of the LightCapabilities class
- *
- * @param densityAvailable Indicates if the light's density can be set remotely (similar to a dimmer).
- */
- public LightCapabilities setDensityAvailable( Boolean densityAvailable) {
+ /**
+ * Gets the name portion of the LightCapabilities class
+ *
+ * @return LightName enum value that describes the specific light
+ * @see com.smartdevicelink.proxy.rpc.enums.LightName
+ */
+ public LightName getName() {
+ return (LightName) getObject(LightName.class, KEY_NAME);
+ }
+
+ /**
+ * Sets the densityAvailable portion of the LightCapabilities class
+ *
+ * @param densityAvailable Indicates if the light's density can be set remotely (similar to a dimmer).
+ */
+ public LightCapabilities setDensityAvailable(Boolean densityAvailable) {
setValue(KEY_DENSITY_AVAILABLE, densityAvailable);
return this;
}
- /**
- * Gets the densityAvailable portion of the LightCapabilities class
- *
- * @return Boolean - Indicates if the light's density can be set remotely (similar to a dimmer).
- */
- public Boolean getDensityAvailable() {
- return getBoolean(KEY_DENSITY_AVAILABLE);
- }
-
- /**
- * Sets the RGBColorSpaceAvailable portion of the LightCapabilities class
- *
- * @param RGBColorSpaceAvailable Indicates if the light's color can be set remotely by using the RGB color space.
- */
- public LightCapabilities setRGBColorSpaceAvailable( Boolean RGBColorSpaceAvailable) {
+ /**
+ * Gets the densityAvailable portion of the LightCapabilities class
+ *
+ * @return Boolean - Indicates if the light's density can be set remotely (similar to a dimmer).
+ */
+ public Boolean getDensityAvailable() {
+ return getBoolean(KEY_DENSITY_AVAILABLE);
+ }
+
+ /**
+ * Sets the RGBColorSpaceAvailable portion of the LightCapabilities class
+ *
+ * @param RGBColorSpaceAvailable Indicates if the light's color can be set remotely by using the RGB color space.
+ */
+ public LightCapabilities setRGBColorSpaceAvailable(Boolean RGBColorSpaceAvailable) {
setValue(KEY_RGB_COLOR_SPACE_AVAILABLE, RGBColorSpaceAvailable);
return this;
}
- /**
- * Gets the RGBColorSpaceAvailable portion of the LightCapabilities class
- *
- * @return Boolean - Indicates if the light's color can be set remotely by using the RGB color space.
- */
- public Boolean getRGBColorSpaceAvailable() {
- return getBoolean(KEY_RGB_COLOR_SPACE_AVAILABLE);
- }
-
- /**
- * Sets the statusAvailable portion of the LightCapabilities class
- *
- * @param statusAvailable Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
- */
- public LightCapabilities setStatusAvailable( Boolean statusAvailable) {
+ /**
+ * Gets the RGBColorSpaceAvailable portion of the LightCapabilities class
+ *
+ * @return Boolean - Indicates if the light's color can be set remotely by using the RGB color space.
+ */
+ public Boolean getRGBColorSpaceAvailable() {
+ return getBoolean(KEY_RGB_COLOR_SPACE_AVAILABLE);
+ }
+
+ /**
+ * Sets the statusAvailable portion of the LightCapabilities class
+ *
+ * @param statusAvailable Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
+ */
+ public LightCapabilities setStatusAvailable(Boolean statusAvailable) {
setValue(KEY_STATUS_AVAILABLE, statusAvailable);
return this;
}
- /**
- * Gets the statusAvailable portion of the LightCapabilities class
- *
- * @return Boolean - Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
- */
- public Boolean getStatusAvailable() {
- return getBoolean(KEY_STATUS_AVAILABLE);
- }
+ /**
+ * Gets the statusAvailable portion of the LightCapabilities class
+ *
+ * @return Boolean - Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
+ */
+ public Boolean getStatusAvailable() {
+ return getBoolean(KEY_STATUS_AVAILABLE);
+ }
}
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 979b0a0cf..54c352cfd 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,91 +39,93 @@ import java.util.Hashtable;
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";
+ 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
- */
- public LightControlCapabilities() {
- }
+ /**
+ * Constructs a new LightControlCapabilities object
+ */
+ public LightControlCapabilities() {
+ }
- /**
- * <p>Constructs a new LightControlCapabilities object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public LightControlCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new LightControlCapabilities object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public LightControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated LightControlCapabilities object
- *
- * @param moduleName short friendly name of the light control module.
- * @param supportedLights An array of available LightCapabilities that are controllable.
- */
- public LightControlCapabilities(@NonNull String moduleName, @NonNull List<LightCapabilities> supportedLights) {
- this();
- setModuleName(moduleName);
- setSupportedLights(supportedLights);
- }
+ /**
+ * Constructs a newly allocated LightControlCapabilities object
+ *
+ * @param moduleName short friendly name of the light control module.
+ * @param supportedLights An array of available LightCapabilities that are controllable.
+ */
+ public LightControlCapabilities(@NonNull String moduleName, @NonNull List<LightCapabilities> supportedLights) {
+ this();
+ setModuleName(moduleName);
+ setSupportedLights(supportedLights);
+ }
- /**
- * Sets the moduleName portion of the LightControlCapabilities class
- *
- * @param moduleName The short friendly name of the light control module. It should not be used to identify a module by mobile application.
- */
- public LightControlCapabilities setModuleName(@NonNull String moduleName) {
+ /**
+ * Sets the moduleName portion of the LightControlCapabilities class
+ *
+ * @param moduleName The short friendly name of the light control module. It should not be used to identify a module by mobile application.
+ */
+ public LightControlCapabilities setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
return this;
}
- /**
- * Gets the moduleName portion of the LightControlCapabilities class
- *
- * @return String - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
- */
- public String getModuleName() {
- return getString(KEY_MODULE_NAME);
- }
+ /**
+ * Gets the moduleName portion of the LightControlCapabilities class
+ *
+ * @return String - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
- /**
- * Gets the supportedLights portion of the LightControlCapabilities class
- *
- * @return List<LightCapabilities> - An array of available LightCapabilities that are controllable.
- */
- @SuppressWarnings("unchecked")
- public List<LightCapabilities> getSupportedLights() {
- return (List<LightCapabilities>) getObject(LightCapabilities.class, KEY_SUPPORTED_LIGHTS);
- }
+ /**
+ * Gets the supportedLights portion of the LightControlCapabilities class
+ *
+ * @return List<LightCapabilities> - An array of available LightCapabilities that are controllable.
+ */
+ @SuppressWarnings("unchecked")
+ public List<LightCapabilities> getSupportedLights() {
+ return (List<LightCapabilities>) getObject(LightCapabilities.class, KEY_SUPPORTED_LIGHTS);
+ }
- /**
- * Sets the supportedLights portion of the LightControlCapabilities class
- *
- * @param supportedLights An array of available LightCapabilities that are controllable.
- */
- public LightControlCapabilities setSupportedLights(@NonNull List<LightCapabilities> supportedLights) {
+ /**
+ * Sets the supportedLights portion of the LightControlCapabilities class
+ *
+ * @param supportedLights An array of available LightCapabilities that are controllable.
+ */
+ public LightControlCapabilities setSupportedLights(@NonNull List<LightCapabilities> supportedLights) {
setValue(KEY_SUPPORTED_LIGHTS, supportedLights);
return this;
}
- /**
- * Sets ModuleInfo for this capability
- * @param info the ModuleInfo to be set
- */
- public LightControlCapabilities setModuleInfo( ModuleInfo info) {
+ /**
+ * Sets ModuleInfo for this capability
+ *
+ * @param info the ModuleInfo to be set
+ */
+ public LightControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
- /**
- * Gets a ModuleInfo of this capability
- * @return module info of this capability
- */
- public ModuleInfo getModuleInfo() {
- return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_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/LightControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlData.java
index e40fd8c68..0b970c6b8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,51 +39,51 @@ import java.util.Hashtable;
import java.util.List;
public class LightControlData extends RPCStruct {
- public static final String KEY_LIGHT_STATE = "lightState";
+ public static final String KEY_LIGHT_STATE = "lightState";
- /**
- * Constructs a new LightControlData object
- */
- public LightControlData() {
- }
+ /**
+ * Constructs a new LightControlData object
+ */
+ public LightControlData() {
+ }
- /**
- * <p>Constructs a new LightControlData object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public LightControlData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new LightControlData object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public LightControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated LightControlData object
- *
- * @param lightState An array of LightNames and their current or desired status.
- * Status of the LightNames that are not listed in the array shall remain unchanged.
- */
- public LightControlData(@NonNull List<LightState> lightState) {
- this();
- setLightState(lightState);
- }
+ /**
+ * Constructs a newly allocated LightControlData object
+ *
+ * @param lightState An array of LightNames and their current or desired status.
+ * Status of the LightNames that are not listed in the array shall remain unchanged.
+ */
+ public LightControlData(@NonNull List<LightState> lightState) {
+ this();
+ setLightState(lightState);
+ }
- /**
- * Gets the lightState portion of the LightControlData class
- *
- * @return List<LightState> - An array of LightNames and their current or desired status. Status of the LightNames that are not listed in the array shall remain unchanged.
- */
- @SuppressWarnings("unchecked")
- public List<LightState> getLightState() {
- return (List<LightState>) getObject(LightState.class, KEY_LIGHT_STATE);
- }
+ /**
+ * Gets the lightState portion of the LightControlData class
+ *
+ * @return List<LightState> - An array of LightNames and their current or desired status. Status of the LightNames that are not listed in the array shall remain unchanged.
+ */
+ @SuppressWarnings("unchecked")
+ public List<LightState> getLightState() {
+ return (List<LightState>) getObject(LightState.class, KEY_LIGHT_STATE);
+ }
- /**
- * Sets the lightState portion of the LightControlData class
- *
- * @param lightState An array of LightNames and their current or desired status. Status of the LightNames that are not listed in the array shall remain unchanged.
- */
- public LightControlData setLightState(@NonNull List<LightState> lightState) {
+ /**
+ * Sets the lightState portion of the LightControlData class
+ *
+ * @param lightState An array of LightNames and their current or desired status. Status of the LightNames that are not listed in the array shall remain unchanged.
+ */
+ public LightControlData setLightState(@NonNull List<LightState> lightState) {
setValue(KEY_LIGHT_STATE, lightState);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightState.java
index 17ba11742..b8e8f7716 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightState.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,120 +41,116 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
public class LightState extends RPCStruct {
- public static final String KEY_ID = "id";
- public static final String KEY_STATUS = "status";
- public static final String KEY_DENSITY = "density";
- public static final String KEY_COLOR = "color";
+ public static final String KEY_ID = "id";
+ public static final String KEY_STATUS = "status";
+ public static final String KEY_DENSITY = "density";
+ public static final String KEY_COLOR = "color";
- /**
- * Constructs a new LightState object
- */
- public LightState() {
- }
+ /**
+ * Constructs a new LightState object
+ */
+ public LightState() {
+ }
- /**
- * <p>Constructs a new LightState object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public LightState(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new LightState object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public LightState(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated LightState object
- *
- * @param id The name of a light or a group of lights.
- * @param status Status of Light.
- */
- public LightState(@NonNull LightName id, @NonNull LightStatus status) {
- this();
- setId(id);
- setStatus(status);
- }
+ /**
+ * Constructs a newly allocated LightState object
+ *
+ * @param id The name of a light or a group of lights.
+ * @param status Status of Light.
+ */
+ public LightState(@NonNull LightName id, @NonNull LightStatus status) {
+ this();
+ setId(id);
+ setStatus(status);
+ }
- /**
- * Sets the id portion of the LightState class
- *
- * @param id The name of a light or a group of lights.
- */
- public LightState setId(@NonNull LightName id) {
+ /**
+ * Sets the id portion of the LightState class
+ *
+ * @param id The name of a light or a group of lights.
+ */
+ public LightState setId(@NonNull LightName id) {
setValue(KEY_ID, id);
return this;
}
- /**
- * Gets the id portion of the LightState class
- *
- * @return LightName - The name of a light or a group of lights.
- */
- public LightName getId() {
- return (LightName) getObject(LightName.class, KEY_ID);
- }
+ /**
+ * Gets the id portion of the LightState class
+ *
+ * @return LightName - The name of a light or a group of lights.
+ */
+ public LightName getId() {
+ return (LightName) getObject(LightName.class, KEY_ID);
+ }
- /**
- * Sets the status portion of the LightState class
- *
- * @param status enum value of type LightStatus that describes the specific lights state
- *
- * @see LightStatus
- */
- public LightState setStatus(@NonNull LightStatus status) {
+ /**
+ * Sets the status portion of the LightState class
+ *
+ * @param status enum value of type LightStatus that describes the specific lights state
+ * @see LightStatus
+ */
+ public LightState setStatus(@NonNull LightStatus status) {
setValue(KEY_STATUS, status);
return this;
}
- /**
- * Gets the status portion of the LightState class
- *
- * @return LightStatus enum value that describes the specific lights state
- *
- * @see com.smartdevicelink.proxy.rpc.enums.LightStatus
- */
- public LightStatus getStatus() {
- return (LightStatus) getObject(LightStatus.class, KEY_STATUS);
- }
+ /**
+ * Gets the status portion of the LightState class
+ *
+ * @return LightStatus enum value that describes the specific lights state
+ * @see com.smartdevicelink.proxy.rpc.enums.LightStatus
+ */
+ public LightStatus getStatus() {
+ return (LightStatus) getObject(LightStatus.class, KEY_STATUS);
+ }
- /**
- * Gets the density portion of the LightState class
- *
- * @return a float representation of the density of the specific light state
- */
- public Float getDensity() {
- Object value = getValue(KEY_DENSITY);
- return SdlDataTypeConverter.objectToFloat(value);
- }
+ /**
+ * Gets the density portion of the LightState class
+ *
+ * @return a float representation of the density of the specific light state
+ */
+ public Float getDensity() {
+ Object value = getValue(KEY_DENSITY);
+ return SdlDataTypeConverter.objectToFloat(value);
+ }
- /**
- * Sets the density portion of the LightState class
- *
- * @param density a float representation of the density of the specific light state
- */
- public LightState setDensity( Float density) {
+ /**
+ * Sets the density portion of the LightState class
+ *
+ * @param density a float representation of the density of the specific light state
+ */
+ public LightState setDensity(Float density) {
setValue(KEY_DENSITY, density);
return this;
}
- /**
- * Gets the color portion of the LightState class
- *
- * @return an RGBColor representation of the color of this specific light state
- *
- * @see com.smartdevicelink.proxy.rpc.RGBColor
- */
- public RGBColor getColor() {
- return (RGBColor) getObject(RGBColor.class, KEY_COLOR);
- }
+ /**
+ * Gets the color portion of the LightState class
+ *
+ * @return an RGBColor representation of the color of this specific light state
+ * @see com.smartdevicelink.proxy.rpc.RGBColor
+ */
+ public RGBColor getColor() {
+ return (RGBColor) getObject(RGBColor.class, KEY_COLOR);
+ }
- /**
- * Sets the color portion of the LightState class
- *
- * @param color an RGBColor representation of the color of this specific light state
- *
- * @see RGBColor
- */
- public LightState setColor( RGBColor color) {
+ /**
+ * Sets the color portion of the LightState class
+ *
+ * @param color an RGBColor representation of the color of this specific light state
+ * @see RGBColor
+ */
+ public LightState setColor(RGBColor color) {
setValue(KEY_COLOR, color);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFiles.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFiles.java
index 046421b32..2fbce7969 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFiles.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFiles.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 com.smartdevicelink.protocol.enums.FunctionID;
@@ -39,7 +39,7 @@ import java.util.Hashtable;
/**
* Requests the current list of resident filenames for the registered app. Not
* supported on First generation SDL vehicles.
- *
+ *
* <p><b>Request</b></p>
* <p>No parameters.</p>
* <p><b>Response:</b></p>
@@ -50,26 +50,26 @@ import java.util.Hashtable;
* <p>OUT_OF_MEMORY</p>
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR </p>
+ * <p>GENERIC_ERROR </p>
* <p>REJECTED</p>
+ *
* @since SmartDeviceLink 2.0
*/
public class ListFiles extends RPCRequest {
- /**
- * Constructs a new ListFiles object
- */
+ /**
+ * Constructs a new ListFiles object
+ */
public ListFiles() {
super(FunctionID.LIST_FILES.toString());
}
- /**
- * <p>Constructs a new ListFiles object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new ListFiles object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public ListFiles(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
index b60d79522..cc3dac810 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,27 +43,29 @@ import java.util.List;
/**
* List Files Response is sent, when ListFiles has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class ListFilesResponse extends RPCResponse {
- public static final String KEY_FILENAMES = "filenames";
- public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
- private static final Integer MAX_VALUE = 2000000000;
+ public static final String KEY_FILENAMES = "filenames";
+ public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
+ private static final Integer MAX_VALUE = 2000000000;
- /**
- * Constructs a new ListFilesResponse object
- */
+ /**
+ * Constructs a new ListFilesResponse object
+ */
public ListFilesResponse() {
super(FunctionID.LIST_FILES.toString());
}
+
public ListFilesResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new ListFilesResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public ListFilesResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -77,21 +79,21 @@ public class ListFilesResponse extends RPCResponse {
* always have a value connects to such a system, it could return null. Check to see if there
* is a value, and if not, set it to MAX_VALUE as defined by the RPC Spec
*
- * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
- * the max value of RPC spec version this library supports should be used.
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
* @param formatParams if true, the format method will be called on subsequent params
*/
@Override
- public void format(Version rpcVersion, boolean formatParams){
- if (rpcVersion == null || rpcVersion.getMajor() >= 5){
- if (getSpaceAvailable() == null){
+ public void format(Version rpcVersion, boolean formatParams) {
+ if (rpcVersion == null || rpcVersion.getMajor() >= 5) {
+ if (getSpaceAvailable() == null) {
setSpaceAvailable(MAX_VALUE);
}
}
super.format(rpcVersion, formatParams);
}
- public ListFilesResponse setFilenames( List<String> filenames) {
+ public ListFilesResponse setFilenames(List<String> filenames) {
setParameters(KEY_FILENAMES, filenames);
return this;
}
@@ -101,7 +103,7 @@ public class ListFilesResponse extends RPCResponse {
return (List<String>) getObject(String.class, KEY_FILENAMES);
}
- public ListFilesResponse setSpaceAvailable( Integer spaceAvailable) {
+ public ListFilesResponse setSpaceAvailable(Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LocationDetails.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LocationDetails.java
index 70e29ec77..4fbb0292a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LocationDetails.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LocationDetails.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,7 +36,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
import java.util.List;
-public class LocationDetails extends RPCStruct{
+public class LocationDetails extends RPCStruct {
public static final String KEY_COORDINATE = "coordinate";
public static final String KEY_LOCATION_NAME = "locationName";
public static final String KEY_ADDRESS_LINES = "addressLines";
@@ -55,7 +55,8 @@ public class LocationDetails extends RPCStruct{
public Coordinate getCoordinate() {
return (Coordinate) getObject(Coordinate.class, KEY_COORDINATE);
}
- public LocationDetails setCoordinate( Coordinate coordinate) {
+
+ public LocationDetails setCoordinate(Coordinate coordinate) {
setValue(KEY_COORDINATE, coordinate);
return this;
}
@@ -64,7 +65,7 @@ public class LocationDetails extends RPCStruct{
return getString(KEY_LOCATION_NAME);
}
- public LocationDetails setLocationName( String locationName) {
+ public LocationDetails setLocationName(String locationName) {
setValue(KEY_LOCATION_NAME, locationName);
return this;
}
@@ -74,7 +75,7 @@ public class LocationDetails extends RPCStruct{
return (List<String>) getObject(String.class, KEY_ADDRESS_LINES);
}
- public LocationDetails setAddressLines( List<String> addressLines) {
+ public LocationDetails setAddressLines(List<String> addressLines) {
setValue(KEY_ADDRESS_LINES, addressLines);
return this;
}
@@ -83,7 +84,7 @@ public class LocationDetails extends RPCStruct{
return getString(KEY_LOCATION_DESCRIPTION);
}
- public LocationDetails setLocationDescription( String locationDescription) {
+ public LocationDetails setLocationDescription(String locationDescription) {
setValue(KEY_LOCATION_DESCRIPTION, locationDescription);
return this;
}
@@ -92,7 +93,7 @@ public class LocationDetails extends RPCStruct{
return getString(KEY_PHONE_NUMBER);
}
- public LocationDetails setPhoneNumber( String phoneNumber) {
+ public LocationDetails setPhoneNumber(String phoneNumber) {
setValue(KEY_PHONE_NUMBER, phoneNumber);
return this;
}
@@ -101,7 +102,7 @@ public class LocationDetails extends RPCStruct{
return (Image) getObject(Image.class, KEY_LOCATION_IMAGE);
}
- public LocationDetails setLocationImage( Image locationImage) {
+ public LocationDetails setLocationImage(Image locationImage) {
setValue(KEY_LOCATION_IMAGE, locationImage);
return this;
}
@@ -109,7 +110,8 @@ public class LocationDetails extends RPCStruct{
public OasisAddress getSearchAddress() {
return (OasisAddress) getObject(OasisAddress.class, KEY_SEARCH_ADDRESS);
}
- public LocationDetails setSearchAddress( OasisAddress searchAddress) {
+
+ public LocationDetails setSearchAddress(OasisAddress searchAddress) {
setValue(KEY_SEARCH_ADDRESS, searchAddress);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageCushionFirmness.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageCushionFirmness.java
index 5d6219e14..b8e62bddf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageCushionFirmness.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageCushionFirmness.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,71 +42,72 @@ import java.util.Hashtable;
* The intensity or firmness of a cushion.
*/
public class MassageCushionFirmness extends RPCStruct {
- public static final String KEY_CUSHION = "cushion";
- public static final String KEY_FIRMNESS = "firmness";
+ public static final String KEY_CUSHION = "cushion";
+ public static final String KEY_FIRMNESS = "firmness";
- /**
- * Constructs a new MassageCushionFirmness object
- */
- public MassageCushionFirmness() {
- }
+ /**
+ * Constructs a new MassageCushionFirmness object
+ */
+ public MassageCushionFirmness() {
+ }
- /**
- * <p>Constructs a new MassageCushionFirmness object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use to create this RPC
- */
- public MassageCushionFirmness(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new MassageCushionFirmness object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use to create this RPC
+ */
+ public MassageCushionFirmness(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated MassageCushionFirmness object
- * @param cushion type of MassageCushion for multi-contour massage seat
- * @param firmness Min: 0 Max: 100
- */
- public MassageCushionFirmness(@NonNull MassageCushion cushion, @NonNull Integer firmness) {
- this();
- setCushion(cushion);
- setFirmness(firmness);
- }
+ /**
+ * Constructs a newly allocated MassageCushionFirmness object
+ *
+ * @param cushion type of MassageCushion for multi-contour massage seat
+ * @param firmness Min: 0 Max: 100
+ */
+ public MassageCushionFirmness(@NonNull MassageCushion cushion, @NonNull Integer firmness) {
+ this();
+ setCushion(cushion);
+ setFirmness(firmness);
+ }
- /**
- * Sets the type of MassageCushion for multi-contour massage seat
- *
- * @param cushion type of MassageCushion for multi-contour massage seat
- */
- public MassageCushionFirmness setCushion(@NonNull MassageCushion cushion) {
+ /**
+ * Sets the type of MassageCushion for multi-contour massage seat
+ *
+ * @param cushion type of MassageCushion for multi-contour massage seat
+ */
+ public MassageCushionFirmness setCushion(@NonNull MassageCushion cushion) {
setValue(KEY_CUSHION, cushion);
return this;
}
- /**
- * Gets the type of MassageCushion for multi-contour massage seat
- *
- * @return the type of MassageCushion for multi-contour massage seat.
- */
- public MassageCushion getCushion() {
- return (MassageCushion) getObject(MassageCushion.class, KEY_CUSHION);
- }
+ /**
+ * Gets the type of MassageCushion for multi-contour massage seat
+ *
+ * @return the type of MassageCushion for multi-contour massage seat.
+ */
+ public MassageCushion getCushion() {
+ return (MassageCushion) getObject(MassageCushion.class, KEY_CUSHION);
+ }
- /**
- * Sets the firmness associated with the supplied MassageCushion
- *
- * @param firmness firmness of the supplied MassageCushion (Min: 0 Max: 100)
- */
- public MassageCushionFirmness setFirmness(@NonNull Integer firmness) {
+ /**
+ * Sets the firmness associated with the supplied MassageCushion
+ *
+ * @param firmness firmness of the supplied MassageCushion (Min: 0 Max: 100)
+ */
+ public MassageCushionFirmness setFirmness(@NonNull Integer firmness) {
setValue(KEY_FIRMNESS, firmness);
return this;
}
- /**
- * Gets the firmness associated with the supplied MassageCushion
- *
- * @return firmness of the supplied MassageCushion (Min: 0 Max: 100)
- */
- public Integer getFirmness() {
- return getInteger(KEY_FIRMNESS);
- }
+ /**
+ * Gets the firmness associated with the supplied MassageCushion
+ *
+ * @return firmness of the supplied MassageCushion (Min: 0 Max: 100)
+ */
+ public Integer getFirmness() {
+ return getInteger(KEY_FIRMNESS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageModeData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageModeData.java
index fee40d30d..bc758b2c3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageModeData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MassageModeData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,70 +43,71 @@ import java.util.Hashtable;
* Specify the mode of a massage zone.
*/
public class MassageModeData extends RPCStruct {
- public static final String KEY_MASSAGE_ZONE = "massageZone";
- public static final String KEY_MASSAGE_MODE = "massageMode";
+ public static final String KEY_MASSAGE_ZONE = "massageZone";
+ public static final String KEY_MASSAGE_MODE = "massageMode";
- /**
- * Constructs a new MassageModeData object
- */
- public MassageModeData() {
- }
+ /**
+ * Constructs a new MassageModeData object
+ */
+ public MassageModeData() {
+ }
- /**
- * <p>Constructs a new MassageModeData object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use to create this RPC
- */
- public MassageModeData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new MassageModeData object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use to create this RPC
+ */
+ public MassageModeData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated MassageModeData object
- * @param massageZone type of MassageZone for multi-contour massage seat
- * @param massageMode mode of massage zone.
- */
- public MassageModeData(@NonNull MassageZone massageZone, @NonNull MassageMode massageMode) {
- this();
- setMassageZone(massageZone);
- setMassageMode(massageMode);
- }
+ /**
+ * Constructs a newly allocated MassageModeData object
+ *
+ * @param massageZone type of MassageZone for multi-contour massage seat
+ * @param massageMode mode of massage zone.
+ */
+ public MassageModeData(@NonNull MassageZone massageZone, @NonNull MassageMode massageMode) {
+ this();
+ setMassageZone(massageZone);
+ setMassageMode(massageMode);
+ }
- /**
- * Sets the massageZone that will be associated with the supplied massage mode
- *
- * @param massageZone the zone of a multi-contour massage seat
- */
- public MassageModeData setMassageZone(@NonNull MassageZone massageZone) {
+ /**
+ * Sets the massageZone that will be associated with the supplied massage mode
+ *
+ * @param massageZone the zone of a multi-contour massage seat
+ */
+ public MassageModeData setMassageZone(@NonNull MassageZone massageZone) {
setValue(KEY_MASSAGE_ZONE, massageZone);
return this;
}
- /**
- * Gets the massageZone that will be associated with the supplied massage mode
- *
- * @return the zone of a multi-contour massage seat.
- */
- public MassageZone getMassageZone() {
- return (MassageZone) getObject(MassageZone.class, KEY_MASSAGE_ZONE);
- }
+ /**
+ * Gets the massageZone that will be associated with the supplied massage mode
+ *
+ * @return the zone of a multi-contour massage seat.
+ */
+ public MassageZone getMassageZone() {
+ return (MassageZone) getObject(MassageZone.class, KEY_MASSAGE_ZONE);
+ }
- /**
- * Gets the massageMode that will be associated with the supplied massage zone
- *
- * @return MassageMode
- */
- public MassageMode getMassageMode() {
- return (MassageMode) getObject(MassageMode.class, KEY_MASSAGE_MODE);
- }
+ /**
+ * Gets the massageMode that will be associated with the supplied massage zone
+ *
+ * @return MassageMode
+ */
+ public MassageMode getMassageMode() {
+ return (MassageMode) getObject(MassageMode.class, KEY_MASSAGE_MODE);
+ }
- /**
- * Sets the massageMode that will be associated with the supplied massage zone
- *
- * @param massageMode mode of massage to be used (OFF, LOW, HIGH)
- */
- public MassageModeData setMassageMode(@NonNull MassageMode massageMode) {
+ /**
+ * Sets the massageMode that will be associated with the supplied massage zone
+ *
+ * @param massageMode mode of massage to be used (OFF, LOW, HIGH)
+ */
+ public MassageModeData setMassageMode(@NonNull MassageMode massageMode) {
setValue(KEY_MASSAGE_MODE, massageMode);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
index a4722adb9..e75b95429 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,290 +41,312 @@ import java.util.Hashtable;
*/
public class MediaServiceData extends RPCStruct {
- public static final String KEY_MEDIA_TYPE = "mediaType";
- public static final String KEY_MEDIA_TITLE = "mediaTitle";
- public static final String KEY_MEDIA_ARTIST = "mediaArtist";
- public static final String KEY_MEDIA_ALBUM = "mediaAlbum";
- public static final String KEY_MEDIA_IMAGE = "mediaImage";
- public static final String KEY_PLAYLIST_NAME = "playlistName";
- public static final String KEY_IS_EXPLICIT = "isExplicit";
- public static final String KEY_TRACK_PLAYBACK_PROGRESS = "trackPlaybackProgress";
- public static final String KEY_TRACK_PLAYBACK_DURATION = "trackPlaybackDuration";
- public static final String KEY_QUEUE_PLAYBACK_PROGRESS = "queuePlaybackProgress";
- public static final String KEY_QUEUE_PLAYBACK_DURATION = "queuePlaybackDuration";
- public static final String KEY_QUEUE_CURRENT_TRACK_NUMBER = "queueCurrentTrackNumber";
- public static final String KEY_QUEUE_TOTAL_TRACK_COUNT = "queueTotalTrackCount";
-
- // Constructors
-
- public MediaServiceData() { }
-
- public MediaServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- // Setters and Getters
-
- /**
- * @param mediaType - The type of the currently playing or paused track.
- */
- public MediaServiceData setMediaType( MediaType mediaType) {
+ public static final String KEY_MEDIA_TYPE = "mediaType";
+ public static final String KEY_MEDIA_TITLE = "mediaTitle";
+ public static final String KEY_MEDIA_ARTIST = "mediaArtist";
+ public static final String KEY_MEDIA_ALBUM = "mediaAlbum";
+ public static final String KEY_MEDIA_IMAGE = "mediaImage";
+ public static final String KEY_PLAYLIST_NAME = "playlistName";
+ public static final String KEY_IS_EXPLICIT = "isExplicit";
+ public static final String KEY_TRACK_PLAYBACK_PROGRESS = "trackPlaybackProgress";
+ public static final String KEY_TRACK_PLAYBACK_DURATION = "trackPlaybackDuration";
+ public static final String KEY_QUEUE_PLAYBACK_PROGRESS = "queuePlaybackProgress";
+ public static final String KEY_QUEUE_PLAYBACK_DURATION = "queuePlaybackDuration";
+ public static final String KEY_QUEUE_CURRENT_TRACK_NUMBER = "queueCurrentTrackNumber";
+ public static final String KEY_QUEUE_TOTAL_TRACK_COUNT = "queueTotalTrackCount";
+
+ // Constructors
+
+ public MediaServiceData() {
+ }
+
+ public MediaServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param mediaType - The type of the currently playing or paused track.
+ */
+ public MediaServiceData setMediaType(MediaType mediaType) {
setValue(KEY_MEDIA_TYPE, mediaType);
return this;
}
- /**
- * @return mediaType - The type of the currently playing or paused track.
- */
- public MediaType getMediaType() {
- return (MediaType) getObject(MediaType.class,KEY_MEDIA_TYPE);
- }
-
- /**
- * Music: The name of the current track
- * Podcast: The name of the current episode
- * Audiobook: The name of the current chapter
- * @param mediaTitle -
- */
- public MediaServiceData setMediaTitle( String mediaTitle) {
+ /**
+ * @return mediaType - The type of the currently playing or paused track.
+ */
+ public MediaType getMediaType() {
+ return (MediaType) getObject(MediaType.class, KEY_MEDIA_TYPE);
+ }
+
+ /**
+ * Music: The name of the current track
+ * Podcast: The name of the current episode
+ * Audiobook: The name of the current chapter
+ *
+ * @param mediaTitle -
+ */
+ public MediaServiceData setMediaTitle(String mediaTitle) {
setValue(KEY_MEDIA_TITLE, mediaTitle);
return this;
}
- /**
- * Music: The name of the current track
- * Podcast: The name of the current episode
- * Audiobook: The name of the current chapter
- * @return mediaTitle -
- */
- public String getMediaTitle() {
- return getString(KEY_MEDIA_TITLE);
- }
-
- /**
- * Music: The name of the current album artist
- * Podcast: The provider of the podcast (hosts, network, company)
- * Audiobook: The book author's name
- * @param mediaArtist -
- */
- public MediaServiceData setMediaArtist( String mediaArtist) {
+ /**
+ * Music: The name of the current track
+ * Podcast: The name of the current episode
+ * Audiobook: The name of the current chapter
+ *
+ * @return mediaTitle -
+ */
+ public String getMediaTitle() {
+ return getString(KEY_MEDIA_TITLE);
+ }
+
+ /**
+ * Music: The name of the current album artist
+ * Podcast: The provider of the podcast (hosts, network, company)
+ * Audiobook: The book author's name
+ *
+ * @param mediaArtist -
+ */
+ public MediaServiceData setMediaArtist(String mediaArtist) {
setValue(KEY_MEDIA_ARTIST, mediaArtist);
return this;
}
- /**
- * Music: The name of the current album artist
- * Podcast: The provider of the podcast (hosts, network, company)
- * Audiobook: The book author's name
- * @return mediaArtist -
- */
- public String getMediaArtist() {
- return getString(KEY_MEDIA_ARTIST);
- }
-
- /**
- * Music: The name of the current album
- * Podcast: The name of the current podcast show
- * Audiobook: The name of the current book
- * @param mediaAlbum -
- */
- public MediaServiceData setMediaAlbum( String mediaAlbum) {
+ /**
+ * Music: The name of the current album artist
+ * Podcast: The provider of the podcast (hosts, network, company)
+ * Audiobook: The book author's name
+ *
+ * @return mediaArtist -
+ */
+ public String getMediaArtist() {
+ return getString(KEY_MEDIA_ARTIST);
+ }
+
+ /**
+ * Music: The name of the current album
+ * Podcast: The name of the current podcast show
+ * Audiobook: The name of the current book
+ *
+ * @param mediaAlbum -
+ */
+ public MediaServiceData setMediaAlbum(String mediaAlbum) {
setValue(KEY_MEDIA_ALBUM, mediaAlbum);
return this;
}
- /**
- * Music: The name of the current album
- * Podcast: The name of the current podcast show
- * Audiobook: The name of the current book
- * @return mediaAlbum -
- */
- public String getMediaAlbum() {
- return getString(KEY_MEDIA_ALBUM);
- }
-
- /**
- * Sets the media image associated with the currently playing media
- * Music: The album art of the current track
- * Podcast: The podcast or chapter artwork of the current podcast episode
- * Audiobook: The book or chapter artwork of the current audiobook
- * @param mediaImage
- */
- public MediaServiceData setMediaImage( Image mediaImage) {
+ /**
+ * Music: The name of the current album
+ * Podcast: The name of the current podcast show
+ * Audiobook: The name of the current book
+ *
+ * @return mediaAlbum -
+ */
+ public String getMediaAlbum() {
+ return getString(KEY_MEDIA_ALBUM);
+ }
+
+ /**
+ * Sets the media image associated with the currently playing media
+ * Music: The album art of the current track
+ * Podcast: The podcast or chapter artwork of the current podcast episode
+ * Audiobook: The book or chapter artwork of the current audiobook
+ *
+ * @param mediaImage
+ */
+ public MediaServiceData setMediaImage(Image mediaImage) {
setValue(KEY_MEDIA_IMAGE, mediaImage);
return this;
}
- /**
- * Returns the media image associated with the currently playing media
- * Music: The album art of the current track
- * Podcast: The podcast or chapter artwork of the current podcast episode
- * Audiobook: The book or chapter artwork of the current audiobook
- */
- public Image getMediaImage(){
- return (Image) getObject(Image.class, KEY_MEDIA_IMAGE);
- }
-
- /**
- * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
- * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
- * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
- * @param playlistName -
- */
- public MediaServiceData setPlaylistName( String playlistName) {
+ /**
+ * Returns the media image associated with the currently playing media
+ * Music: The album art of the current track
+ * Podcast: The podcast or chapter artwork of the current podcast episode
+ * Audiobook: The book or chapter artwork of the current audiobook
+ */
+ public Image getMediaImage() {
+ return (Image) getObject(Image.class, KEY_MEDIA_IMAGE);
+ }
+
+ /**
+ * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ *
+ * @param playlistName -
+ */
+ public MediaServiceData setPlaylistName(String playlistName) {
setValue(KEY_PLAYLIST_NAME, playlistName);
return this;
}
- /**
- * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
- * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
- * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
- * @return playlistName -
- */
- public String getPlaylistName() {
- return getString(KEY_PLAYLIST_NAME);
- }
-
- /**
- * @param isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
- */
- public MediaServiceData setIsExplicit( Boolean isExplicit) {
+ /**
+ * Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ * Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ * Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ *
+ * @return playlistName -
+ */
+ public String getPlaylistName() {
+ return getString(KEY_PLAYLIST_NAME);
+ }
+
+ /**
+ * @param isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
+ */
+ public MediaServiceData setIsExplicit(Boolean isExplicit) {
setValue(KEY_IS_EXPLICIT, isExplicit);
return this;
}
- /**
- * @return isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
- */
- public Boolean getIsExplicit() {
- return getBoolean(KEY_IS_EXPLICIT);
- }
-
- /**
- * Music: The current progress of the track in seconds
- * Podcast: The current progress of the episode in seconds
- * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
- * @param trackPlaybackProgress -
- */
- public MediaServiceData setTrackPlaybackProgress( Integer trackPlaybackProgress) {
+ /**
+ * @return isExplicit - Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content
+ */
+ public Boolean getIsExplicit() {
+ return getBoolean(KEY_IS_EXPLICIT);
+ }
+
+ /**
+ * Music: The current progress of the track in seconds
+ * Podcast: The current progress of the episode in seconds
+ * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ *
+ * @param trackPlaybackProgress -
+ */
+ public MediaServiceData setTrackPlaybackProgress(Integer trackPlaybackProgress) {
setValue(KEY_TRACK_PLAYBACK_PROGRESS, trackPlaybackProgress);
return this;
}
- /**
- * Music: The current progress of the track in seconds
- * Podcast: The current progress of the episode in seconds
- * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
- * @return trackPlaybackProgress -
- */
- public Integer getTrackPlaybackProgress() {
- return getInteger(KEY_TRACK_PLAYBACK_PROGRESS);
- }
-
- /**
- * Music: The total duration of the track in seconds
- * Podcast: The total duration of the episode in seconds
- * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
- * @param trackPlaybackDuration -
- */
- public MediaServiceData setTrackPlaybackDuration( Integer trackPlaybackDuration) {
+ /**
+ * Music: The current progress of the track in seconds
+ * Podcast: The current progress of the episode in seconds
+ * Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ *
+ * @return trackPlaybackProgress -
+ */
+ public Integer getTrackPlaybackProgress() {
+ return getInteger(KEY_TRACK_PLAYBACK_PROGRESS);
+ }
+
+ /**
+ * Music: The total duration of the track in seconds
+ * Podcast: The total duration of the episode in seconds
+ * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ *
+ * @param trackPlaybackDuration -
+ */
+ public MediaServiceData setTrackPlaybackDuration(Integer trackPlaybackDuration) {
setValue(KEY_TRACK_PLAYBACK_DURATION, trackPlaybackDuration);
return this;
}
- /**
- * Music: The total duration of the track in seconds
- * Podcast: The total duration of the episode in seconds
- * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
- * @return trackPlaybackDuration -
- */
- public Integer getTrackPlaybackDuration() {
- return getInteger(KEY_TRACK_PLAYBACK_DURATION);
- }
-
- /**
- * Music: The current progress of the playback queue in seconds
- * Podcast: The current progress of the playback queue in seconds
- * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
- * @param queuePlaybackProgress -
- */
- public MediaServiceData setQueuePlaybackProgress( Integer queuePlaybackProgress) {
+ /**
+ * Music: The total duration of the track in seconds
+ * Podcast: The total duration of the episode in seconds
+ * Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ *
+ * @return trackPlaybackDuration -
+ */
+ public Integer getTrackPlaybackDuration() {
+ return getInteger(KEY_TRACK_PLAYBACK_DURATION);
+ }
+
+ /**
+ * Music: The current progress of the playback queue in seconds
+ * Podcast: The current progress of the playback queue in seconds
+ * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ *
+ * @param queuePlaybackProgress -
+ */
+ public MediaServiceData setQueuePlaybackProgress(Integer queuePlaybackProgress) {
setValue(KEY_QUEUE_PLAYBACK_PROGRESS, queuePlaybackProgress);
return this;
}
- /**
- * Music: The current progress of the playback queue in seconds
- * Podcast: The current progress of the playback queue in seconds
- * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
- * @return queuePlaybackProgress -
- */
- public Integer getQueuePlaybackProgress() {
- return getInteger(KEY_QUEUE_PLAYBACK_PROGRESS);
- }
-
- /**
- * Music: The total duration of the playback queue in seconds
- * Podcast: The total duration of the playback queue in seconds
- * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
- * @param queuePlaybackDuration -
- */
- public MediaServiceData setQueuePlaybackDuration( Integer queuePlaybackDuration) {
+ /**
+ * Music: The current progress of the playback queue in seconds
+ * Podcast: The current progress of the playback queue in seconds
+ * Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ *
+ * @return queuePlaybackProgress -
+ */
+ public Integer getQueuePlaybackProgress() {
+ return getInteger(KEY_QUEUE_PLAYBACK_PROGRESS);
+ }
+
+ /**
+ * Music: The total duration of the playback queue in seconds
+ * Podcast: The total duration of the playback queue in seconds
+ * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ *
+ * @param queuePlaybackDuration -
+ */
+ public MediaServiceData setQueuePlaybackDuration(Integer queuePlaybackDuration) {
setValue(KEY_QUEUE_PLAYBACK_DURATION, queuePlaybackDuration);
return this;
}
- /**
- * Music: The total duration of the playback queue in seconds
- * Podcast: The total duration of the playback queue in seconds
- * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
- * @return queuePlaybackDuration -
- */
- public Integer getQueuePlaybackDuration() {
- return getInteger(KEY_QUEUE_PLAYBACK_DURATION);
- }
-
- /**
- * Music: The current number (1 based) of the track in the playback queue
- * Podcast: The current number (1 based) of the episode in the playback queue
- * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
- * @param queueCurrentTrackNumber -
- */
- public MediaServiceData setQueueCurrentTrackNumber( Integer queueCurrentTrackNumber) {
+ /**
+ * Music: The total duration of the playback queue in seconds
+ * Podcast: The total duration of the playback queue in seconds
+ * Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ *
+ * @return queuePlaybackDuration -
+ */
+ public Integer getQueuePlaybackDuration() {
+ return getInteger(KEY_QUEUE_PLAYBACK_DURATION);
+ }
+
+ /**
+ * Music: The current number (1 based) of the track in the playback queue
+ * Podcast: The current number (1 based) of the episode in the playback queue
+ * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ *
+ * @param queueCurrentTrackNumber -
+ */
+ public MediaServiceData setQueueCurrentTrackNumber(Integer queueCurrentTrackNumber) {
setValue(KEY_QUEUE_CURRENT_TRACK_NUMBER, queueCurrentTrackNumber);
return this;
}
- /**
- * Music: The current number (1 based) of the track in the playback queue
- * Podcast: The current number (1 based) of the episode in the playback queue
- * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
- * @return queueCurrentTrackNumber -
- */
- public Integer getQueueCurrentTrackNumber() {
- return getInteger(KEY_QUEUE_CURRENT_TRACK_NUMBER);
- }
-
- /**
- * Music: The total number of tracks in the playback queue
- * Podcast: The total number of episodes in the playback queue
- * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
- * @param queueTotalTrackCount -
- */
- public MediaServiceData setQueueTotalTrackCount( Integer queueTotalTrackCount) {
+ /**
+ * Music: The current number (1 based) of the track in the playback queue
+ * Podcast: The current number (1 based) of the episode in the playback queue
+ * Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ *
+ * @return queueCurrentTrackNumber -
+ */
+ public Integer getQueueCurrentTrackNumber() {
+ return getInteger(KEY_QUEUE_CURRENT_TRACK_NUMBER);
+ }
+
+ /**
+ * Music: The total number of tracks in the playback queue
+ * Podcast: The total number of episodes in the playback queue
+ * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ *
+ * @param queueTotalTrackCount -
+ */
+ public MediaServiceData setQueueTotalTrackCount(Integer queueTotalTrackCount) {
setValue(KEY_QUEUE_TOTAL_TRACK_COUNT, queueTotalTrackCount);
return this;
}
- /**
- * Music: The total number of tracks in the playback queue
- * Podcast: The total number of episodes in the playback queue
- * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
- * @return queueTotalTrackCount -
- */
- public Integer getQueueTotalTrackCount() {
- return getInteger(KEY_QUEUE_TOTAL_TRACK_COUNT);
- }
+ /**
+ * Music: The total number of tracks in the playback queue
+ * Podcast: The total number of episodes in the playback queue
+ * Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ *
+ * @return queueTotalTrackCount -
+ */
+ public Integer getQueueTotalTrackCount() {
+ return getInteger(KEY_QUEUE_TOTAL_TRACK_COUNT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java
index c03329331..e5da44273 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceManifest.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,9 +38,10 @@ import java.util.Hashtable;
public class MediaServiceManifest extends RPCStruct {
- public MediaServiceManifest() { }
+ public MediaServiceManifest() {
+ }
- public MediaServiceManifest(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public MediaServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
index 408c36f71..9c6635427 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,6 +36,7 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
* Used when adding a sub menu to an application menu or existing sub menu.
* <p><b> Parameter List</b></p>
@@ -50,18 +51,18 @@ import java.util.Hashtable;
* <td>parentID</td>
* <td>Integer</td>
* <td>The unique ID of an existing submenu to which a command will be added.
- * If this element is not provided, the command will be added to the top level of the Command Menu.
- * <ul>
- * <li>Min: 0</li>
- * <li>Max: 2000000000</li>
- * </ul>
- * </td>
+ * If this element is not provided, the command will be added to the top level of the Command Menu.
+ * <ul>
+ * <li>Min: 0</li>
+ * <li>Max: 2000000000</li>
+ * </ul>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>position</td>
* <td>Integer</td>
- * <td>Position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
+ * <td>Position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
* Position of any submenu will always be located before the return and exit options.
* <ul>
* <li>Min Value: 0</li>
@@ -84,97 +85,116 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
- * @see AddCommand
+ *
+ * @see AddCommand
* @see AddSubMenu
+ * @since SmartDeviceLink 1.0
*/
public class MenuParams extends RPCStruct {
- public static final String KEY_PARENT_ID = "parentID";
- public static final String KEY_POSITION = "position";
- public static final String KEY_MENU_NAME = "menuName";
- /**
- * Constructs a newly allocated MenuParams object
- */
- public MenuParams() { }
+ public static final String KEY_PARENT_ID = "parentID";
+ public static final String KEY_POSITION = "position";
+ public static final String KEY_MENU_NAME = "menuName";
+
+ /**
+ * Constructs a newly allocated MenuParams object
+ */
+ public MenuParams() {
+ }
+
/**
* Constructs a newly allocated MenuParams object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public MenuParams(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a newly allocated MenuParams object
+ *
* @param menuName the menu name
*/
public MenuParams(@NonNull String menuName) {
this();
setMenuName(menuName);
}
+
/**
* Get the unique ID of an existing submenu to which a command will be added.
- * If this element is not provided, the command will be added to the top level of the Command Menu.
+ * If this element is not provided, the command will be added to the top level of the Command Menu.
+ *
* @return parentID Min: 0 Max: 2000000000
- */
+ */
public Integer getParentID() {
- return getInteger( KEY_PARENT_ID );
+ return getInteger(KEY_PARENT_ID);
}
+
/**
* Set the unique ID of an existing submenu to which a command will be added.
- * If this element is not provided, the command will be added to the top level of the Command Menu.
+ * If this element is not provided, the command will be added to the top level of the Command Menu.
+ *
* @param parentID Min: 0; Max: 2000000000
*/
- public MenuParams setParentID( Integer parentID) {
+ public MenuParams setParentID(Integer parentID) {
setValue(KEY_PARENT_ID, parentID);
return this;
}
+
/**
- * Get the position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
- * Position of any submenu will always be located before the return and exit options.
- * <ul>
- * <li>Min Value: 0</li>
- * <li>Max Value: 1000</li>
- * <li>If position is greater or equal than the number of items in the parent Command Menu, the sub menu will be appended to the end of that Command Menu.</li>
- * <li>If this element is omitted, the entry will be added at the end of the parent menu.</li>
- * </ul>
- * @return the position within the items of the parent Command Menu
- */
+ * Get the position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
+ * Position of any submenu will always be located before the return and exit options.
+ * <ul>
+ * <li>Min Value: 0</li>
+ * <li>Max Value: 1000</li>
+ * <li>If position is greater or equal than the number of items in the parent Command Menu, the sub menu will be appended to the end of that Command Menu.</li>
+ * <li>If this element is omitted, the entry will be added at the end of the parent menu.</li>
+ * </ul>
+ *
+ * @return the position within the items of the parent Command Menu
+ */
public Integer getPosition() {
- return getInteger( KEY_POSITION );
+ return getInteger(KEY_POSITION);
}
+
/**
* Set the position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
- * Position of any submenu will always be located before the return and exit options.
- * <ul>
- * <li>Min Value: 0</li>
- * <li>Max Value: 1000</li>
- * <li>If position is greater or equal than the number of items in the parent Command Menu, the sub menu will be appended to the end of that Command Menu.</li>
- * <li>If this element is omitted, the entry will be added at the end of the parent menu.</li>
- * </ul>
+ * Position of any submenu will always be located before the return and exit options.
+ * <ul>
+ * <li>Min Value: 0</li>
+ * <li>Max Value: 1000</li>
+ * <li>If position is greater or equal than the number of items in the parent Command Menu, the sub menu will be appended to the end of that Command Menu.</li>
+ * <li>If this element is omitted, the entry will be added at the end of the parent menu.</li>
+ * </ul>
+ *
* @param position Mix: 0 Max: 1000
*/
- public MenuParams setPosition( Integer position) {
+ public MenuParams setPosition(Integer position) {
setValue(KEY_POSITION, position);
return this;
}
+
/**
* Get the text which appears in menu, representing this command.
- * <ul>
- * <li>Min: 1</li>
- * <li>Max: 100</li>
- * </ul>
+ * <ul>
+ * <li>Min: 1</li>
+ * <li>Max: 100</li>
+ * </ul>
+ *
* @return menuName the menu name
*/
-
+
public String getMenuName() {
- return getString( KEY_MENU_NAME );
+ return getString(KEY_MENU_NAME);
}
+
/**
* Set text which appears in menu, representing this command.
- * <ul>
- * <li>Min: 1</li>
- * <li>Max: 100</li>
- * </ul>
+ * <ul>
+ * <li>Min: 1</li>
+ * <li>Max: 100</li>
+ * </ul>
+ *
* @param menuName the menu name
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
index 6894109fa..523b04b31 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,116 +40,120 @@ import java.util.List;
public class MetadataTags extends RPCStruct {
- public static final String KEY_MAIN_FIELD_1_TYPE = "mainField1";
- public static final String KEY_MAIN_FIELD_2_TYPE = "mainField2";
- public static final String KEY_MAIN_FIELD_3_TYPE = "mainField3";
- public static final String KEY_MAIN_FIELD_4_TYPE = "mainField4";
-
- /**
- * Constructs a newly allocated MetadataTags object
- */
- public MetadataTags(){}
-
- /**
- * Constructs a newly allocated MetadataTags object indicated by the Hashtable parameter
- * @param hash The Hashtable to use
- */
- public MetadataTags(Hashtable<String, Object> hash){super(hash);}
-
- /**
- * Set the metadata types of data contained in the "mainField1" text field
- */
- public MetadataTags setMainField1( List<MetadataType> metadataTypes) {
+ public static final String KEY_MAIN_FIELD_1_TYPE = "mainField1";
+ public static final String KEY_MAIN_FIELD_2_TYPE = "mainField2";
+ public static final String KEY_MAIN_FIELD_3_TYPE = "mainField3";
+ public static final String KEY_MAIN_FIELD_4_TYPE = "mainField4";
+
+ /**
+ * Constructs a newly allocated MetadataTags object
+ */
+ public MetadataTags() {
+ }
+
+ /**
+ * Constructs a newly allocated MetadataTags object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public MetadataTags(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField1" text field
+ */
+ public MetadataTags setMainField1(List<MetadataType> metadataTypes) {
setValue(KEY_MAIN_FIELD_1_TYPE, metadataTypes);
return this;
}
- /**
- * Set the metadata type of data contained in the "mainField1" text field
- */
- public MetadataTags setMainField1( MetadataType metadataType) {
+ /**
+ * Set the metadata type of data contained in the "mainField1" text field
+ */
+ public MetadataTags setMainField1(MetadataType metadataType) {
setValue(KEY_MAIN_FIELD_1_TYPE, Collections.singletonList(metadataType));
return this;
}
- /**
- * @return The type of data contained in the "mainField1" text field
- */
- @SuppressWarnings("unchecked")
- public List<MetadataType> getMainField1() {
- return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_1_TYPE);
- }
-
- /**
- * Set the metadata types of data contained in the "mainField2" text field
- */
- public MetadataTags setMainField2( List<MetadataType> metadataTypes) {
+ /**
+ * @return The type of data contained in the "mainField1" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField1() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_1_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField2" text field
+ */
+ public MetadataTags setMainField2(List<MetadataType> metadataTypes) {
setValue(KEY_MAIN_FIELD_2_TYPE, metadataTypes);
return this;
}
- /**
- * Set the metadata type of data contained in the "mainField2" text field
- */
- public MetadataTags setMainField2( MetadataType metadataType) {
+ /**
+ * Set the metadata type of data contained in the "mainField2" text field
+ */
+ public MetadataTags setMainField2(MetadataType metadataType) {
setValue(KEY_MAIN_FIELD_2_TYPE, Collections.singletonList(metadataType));
return this;
}
- /**
- * @return The type of data contained in the "mainField2" text field
- */
- @SuppressWarnings("unchecked")
- public List<MetadataType> getMainField2() {
- return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_2_TYPE);
- }
-
- /**
- * Set the metadata types of data contained in the "mainField3" text field
- */
- public MetadataTags setMainField3( List<MetadataType> metadataTypes) {
+ /**
+ * @return The type of data contained in the "mainField2" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField2() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_2_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField3" text field
+ */
+ public MetadataTags setMainField3(List<MetadataType> metadataTypes) {
setValue(KEY_MAIN_FIELD_3_TYPE, metadataTypes);
return this;
}
- /**
- * Set the metadata type of data contained in the "mainField3" text field
- */
- public MetadataTags setMainField3( MetadataType metadataType) {
+ /**
+ * Set the metadata type of data contained in the "mainField3" text field
+ */
+ public MetadataTags setMainField3(MetadataType metadataType) {
setValue(KEY_MAIN_FIELD_3_TYPE, Collections.singletonList(metadataType));
return this;
}
- /**
- * @return The type of data contained in the "mainField3" text field
- */
- @SuppressWarnings("unchecked")
- public List<MetadataType> getMainField3() {
- return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_3_TYPE);
- }
-
- /**
- * Set the metadata types of data contained in the "mainField4" text field
- */
- public MetadataTags setMainField4( List<MetadataType> metadataTypes) {
+ /**
+ * @return The type of data contained in the "mainField3" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField3() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_3_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField4" text field
+ */
+ public MetadataTags setMainField4(List<MetadataType> metadataTypes) {
setValue(KEY_MAIN_FIELD_4_TYPE, metadataTypes);
return this;
}
- /**
- * Set the metadata type of data contained in the "mainField4" text field
- */
- public MetadataTags setMainField4( MetadataType metadataType) {
+ /**
+ * Set the metadata type of data contained in the "mainField4" text field
+ */
+ public MetadataTags setMainField4(MetadataType metadataType) {
setValue(KEY_MAIN_FIELD_4_TYPE, Collections.singletonList(metadataType));
return this;
}
- /**
- * @return The type of data contained in the "mainField4" text field
- */
- @SuppressWarnings("unchecked")
- public List<MetadataType> getMainField4() {
- return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_4_TYPE);
- }
+ /**
+ * @return The type of data contained in the "mainField4" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField4() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_4_TYPE);
+ }
}
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 b20124551..3e5e8ae9b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,176 +39,178 @@ import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import java.util.Hashtable;
public class ModuleData extends RPCStruct {
- public static final String KEY_MODULE_TYPE = "moduleType";
- public static final String KEY_RADIO_CONTROL_DATA = "radioControlData";
- public static final String KEY_CLIMATE_CONTROL_DATA = "climateControlData";
- public static final String KEY_SEAT_CONTROL_DATA = "seatControlData";
- 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() {
- }
-
- public ModuleData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public ModuleData(@NonNull ModuleType moduleType) {
- this();
- setModuleType(moduleType);
- }
-
- /**
- * Sets the moduleType portion of the ModuleData class
- *
- * @param moduleType The moduleType indicates which type of data should be changed and identifies which data object exists in this struct.
- * For example, if the moduleType is CLIMATE then a "climateControlData" should exist
- */
- public ModuleData setModuleType(@NonNull ModuleType moduleType) {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_RADIO_CONTROL_DATA = "radioControlData";
+ public static final String KEY_CLIMATE_CONTROL_DATA = "climateControlData";
+ public static final String KEY_SEAT_CONTROL_DATA = "seatControlData";
+ 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() {
+ }
+
+ public ModuleData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public ModuleData(@NonNull ModuleType moduleType) {
+ this();
+ setModuleType(moduleType);
+ }
+
+ /**
+ * Sets the moduleType portion of the ModuleData class
+ *
+ * @param moduleType The moduleType indicates which type of data should be changed and identifies which data object exists in this struct.
+ * For example, if the moduleType is CLIMATE then a "climateControlData" should exist
+ */
+ public ModuleData setModuleType(@NonNull ModuleType moduleType) {
setValue(KEY_MODULE_TYPE, moduleType);
return this;
}
- /**
- * Gets the moduleType portion of the ModuleData class
- *
- * @return ModuleType - The moduleType indicates which type of data should be changed and identifies which data object exists in this struct.
- * For example, if the moduleType is CLIMATE then a "climateControlData" should exist.
- */
- public ModuleType getModuleType() {
- return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
- }
-
- /**
- * Sets the radioControlData portion of the ModuleData class
- *
- * @param radioControlData
- */
- public ModuleData setRadioControlData( RadioControlData radioControlData) {
+ /**
+ * Gets the moduleType portion of the ModuleData class
+ *
+ * @return ModuleType - The moduleType indicates which type of data should be changed and identifies which data object exists in this struct.
+ * For example, if the moduleType is CLIMATE then a "climateControlData" should exist.
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the radioControlData portion of the ModuleData class
+ *
+ * @param radioControlData
+ */
+ public ModuleData setRadioControlData(RadioControlData radioControlData) {
setValue(KEY_RADIO_CONTROL_DATA, radioControlData);
return this;
}
- /**
- * Gets the radioControlData portion of the ModuleData class
- *
- * @return RadioControlData
- */
- public RadioControlData getRadioControlData() {
- return (RadioControlData) getObject(RadioControlData.class, KEY_RADIO_CONTROL_DATA);
- }
-
- /**
- * Sets the climateControlData portion of the ModuleData class
- *
- * @param climateControlData
- */
- public ModuleData setClimateControlData( ClimateControlData climateControlData) {
+ /**
+ * Gets the radioControlData portion of the ModuleData class
+ *
+ * @return RadioControlData
+ */
+ public RadioControlData getRadioControlData() {
+ return (RadioControlData) getObject(RadioControlData.class, KEY_RADIO_CONTROL_DATA);
+ }
+
+ /**
+ * Sets the climateControlData portion of the ModuleData class
+ *
+ * @param climateControlData
+ */
+ public ModuleData setClimateControlData(ClimateControlData climateControlData) {
setValue(KEY_CLIMATE_CONTROL_DATA, climateControlData);
return this;
}
- /**
- * Gets the climateControlData portion of the ModuleData class
- *
- * @return ClimateControlData
- */
- public ClimateControlData getClimateControlData() {
- return (ClimateControlData) getObject(ClimateControlData.class, KEY_CLIMATE_CONTROL_DATA);
- }
-
- /**
- * Sets the seatControlData portion of the ModuleData class
- *
- * @param seatControlData
- */
- public ModuleData setSeatControlData( SeatControlData seatControlData) {
+ /**
+ * Gets the climateControlData portion of the ModuleData class
+ *
+ * @return ClimateControlData
+ */
+ public ClimateControlData getClimateControlData() {
+ return (ClimateControlData) getObject(ClimateControlData.class, KEY_CLIMATE_CONTROL_DATA);
+ }
+
+ /**
+ * Sets the seatControlData portion of the ModuleData class
+ *
+ * @param seatControlData
+ */
+ public ModuleData setSeatControlData(SeatControlData seatControlData) {
setValue(KEY_SEAT_CONTROL_DATA, seatControlData);
return this;
}
- /**
- * Gets the seatControlData portion of the ModuleData class
- *
- * @return SeatControlData
- */
- public SeatControlData getSeatControlData() {
- return (SeatControlData) getObject(SeatControlData.class, KEY_SEAT_CONTROL_DATA);
- }
-
- /**
- * Sets the audioControlData portion of the ModuleData class
- *
- * @param audioControlData
- */
- public ModuleData setAudioControlData( AudioControlData audioControlData) {
+ /**
+ * Gets the seatControlData portion of the ModuleData class
+ *
+ * @return SeatControlData
+ */
+ public SeatControlData getSeatControlData() {
+ return (SeatControlData) getObject(SeatControlData.class, KEY_SEAT_CONTROL_DATA);
+ }
+
+ /**
+ * Sets the audioControlData portion of the ModuleData class
+ *
+ * @param audioControlData
+ */
+ public ModuleData setAudioControlData(AudioControlData audioControlData) {
setValue(KEY_AUDIO_CONTROL_DATA, audioControlData);
return this;
}
- /**
- * Gets the audioControlData portion of the ModuleData class
- *
- * @return AudioControlData
- */
- public AudioControlData getAudioControlData() {
- return (AudioControlData) getObject(AudioControlData.class, KEY_AUDIO_CONTROL_DATA);
- }
-
- /**
- * Sets the lightControlData portion of the ModuleData class
- *
- * @param lightControlData
- */
- public ModuleData setLightControlData( LightControlData lightControlData) {
+ /**
+ * Gets the audioControlData portion of the ModuleData class
+ *
+ * @return AudioControlData
+ */
+ public AudioControlData getAudioControlData() {
+ return (AudioControlData) getObject(AudioControlData.class, KEY_AUDIO_CONTROL_DATA);
+ }
+
+ /**
+ * Sets the lightControlData portion of the ModuleData class
+ *
+ * @param lightControlData
+ */
+ public ModuleData setLightControlData(LightControlData lightControlData) {
setValue(KEY_LIGHT_CONTROL_DATA, lightControlData);
return this;
}
- /**
- * Gets the lightControlData portion of the ModuleData class
- *
- * @return LightControlData
- */
- public LightControlData getLightControlData() {
- return (LightControlData) getObject(LightControlData.class, KEY_LIGHT_CONTROL_DATA);
- }
-
- /**
- * Sets the hmiSettingsControlData portion of the ModuleData class
- *
- * @param hmiSettingsControlData
- */
- public ModuleData setHmiSettingsControlData( HMISettingsControlData hmiSettingsControlData) {
+ /**
+ * Gets the lightControlData portion of the ModuleData class
+ *
+ * @return LightControlData
+ */
+ public LightControlData getLightControlData() {
+ return (LightControlData) getObject(LightControlData.class, KEY_LIGHT_CONTROL_DATA);
+ }
+
+ /**
+ * Sets the hmiSettingsControlData portion of the ModuleData class
+ *
+ * @param hmiSettingsControlData
+ */
+ public ModuleData setHmiSettingsControlData(HMISettingsControlData hmiSettingsControlData) {
setValue(KEY_HMI_SETTINGS_CONTROL_DATA, hmiSettingsControlData);
return this;
}
- /**
- * Gets the hmiSettingsControlData portion of the ModuleData class
- *
- * @return HMISettingsControlData
- */
- 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 ModuleData setModuleId( String id) {
+ /**
+ * Gets the hmiSettingsControlData portion of the ModuleData class
+ *
+ * @return HMISettingsControlData
+ */
+ 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 ModuleData setModuleId(String id) {
setValue(KEY_MODULE_ID, id);
return this;
}
- /**
- * Gets the Module ID of the ModuleData class
- * @return the Module ID
- */
- public String getModuleId() {
- return getString(KEY_MODULE_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
index 65debe0cf..b3eb6683a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
@@ -15,7 +15,8 @@ public class ModuleInfo extends RPCStruct {
public static final String KEY_MODULE_SERVICE_AREA = "serviceArea";
public static final String KEY_MULTIPLE_ACCESS_ALLOWED = "allowMultipleAccess";
- public ModuleInfo(){}
+ public ModuleInfo() {
+ }
public ModuleInfo(Hashtable<String, Object> hash) {
super(hash);
@@ -23,15 +24,17 @@ public class ModuleInfo extends RPCStruct {
/**
* Struct that describes a module within different SystemCapabilities
+ *
* @param moduleId Sets the Module ID for this Module
*/
- public ModuleInfo(@NonNull String moduleId){
+ public ModuleInfo(@NonNull String moduleId) {
this();
setModuleId(moduleId);
}
/**
* Sets the Module ID for this Module
+ *
* @param id the id to be set
*/
public ModuleInfo setModuleId(@NonNull String id) {
@@ -41,6 +44,7 @@ public class ModuleInfo extends RPCStruct {
/**
* Gets the Module ID for this module
+ *
* @return the Module ID as a String
*/
public String getModuleId() {
@@ -49,15 +53,17 @@ public class ModuleInfo extends RPCStruct {
/**
* Sets the location of this Module
+ *
* @param location the location to be set
*/
- public ModuleInfo setModuleLocation( Grid location) {
+ public ModuleInfo setModuleLocation(Grid location) {
setValue(KEY_MODULE_LOCATION, location);
return this;
}
/**
* Gets the location of this Module
+ *
* @return the location of this Module
*/
public Grid getModuleLocation() {
@@ -66,15 +72,17 @@ public class ModuleInfo extends RPCStruct {
/**
* Sets the service area of this Module
+ *
* @param serviceArea the service area of this Module
*/
- public ModuleInfo setModuleServiceArea( Grid serviceArea) {
+ public ModuleInfo setModuleServiceArea(Grid serviceArea) {
setValue(KEY_MODULE_SERVICE_AREA, serviceArea);
return this;
}
/**
* Gets the service area of this Module
+ *
* @return the service area of this Module
*/
public Grid getModuleServiceArea() {
@@ -83,15 +91,17 @@ public class ModuleInfo extends RPCStruct {
/**
* Sets the multiple access allowance for this Module
+ *
* @param isMultipleAccess the access to be set
*/
- public ModuleInfo setMultipleAccessAllowance( Boolean isMultipleAccess) {
+ public ModuleInfo setMultipleAccessAllowance(Boolean isMultipleAccess) {
setValue(KEY_MULTIPLE_ACCESS_ALLOWED, isMultipleAccess);
return this;
}
/**
* Gets the multiple allowance access of this Module
+ *
* @return the multiple access allowance of this Module
*/
public Boolean getMultipleAccessAllowance() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
index e73565677..319dca3c7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,7 +37,9 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
import java.util.Hashtable;
-/** Information related to the MyKey feature.
+
+/**
+ * Information related to the MyKey feature.
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -50,33 +52,35 @@ import java.util.Hashtable;
* <td>e911Override</td>
* <td>VehicleDataStatus</td>
* <td>true</td>
- * <td>Indicates whether e911 override is on.</td>
+ * <td>Indicates whether e911 override is on.</td>
* </tr>
* </table>
*
- *@since SmartDeviceLink 2.0
- *
- *@see GetVehicleData
- *@see OnVehicleData
- *@see VehicleDataStatus
- *
- *
+ * @see GetVehicleData
+ * @see OnVehicleData
+ * @see VehicleDataStatus
+ * @since SmartDeviceLink 2.0
*/
public class MyKey extends RPCStruct {
public static final String KEY_E_911_OVERRIDE = "e911Override";
- /**
- * Constructs a new MyKey object indicated
- */
- public MyKey() { }
+
+ /**
+ * Constructs a new MyKey object indicated
+ */
+ public MyKey() {
+ }
+
/**
* <p>Constructs a new MyKey object indicated by the Hashtable
* parameter</p>
+ *
* @param hash The Hashtable to use
*/
public MyKey(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new MyKey object indicated
*/
@@ -84,10 +88,12 @@ public class MyKey extends RPCStruct {
this();
setE911Override(e911Override);
}
+
public MyKey setE911Override(@NonNull VehicleDataStatus e911Override) {
setValue(KEY_E_911_OVERRIDE, e911Override);
return this;
}
+
public VehicleDataStatus getE911Override() {
return (VehicleDataStatus) getObject(VehicleDataStatus.class, KEY_E_911_OVERRIDE);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java
index c3d19c3b1..8c7fe0c55 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,30 +38,31 @@ import java.util.Hashtable;
/*
* Extended capabilities for an onboard navigation system
*/
-public class NavigationCapability extends RPCStruct{
- public static final String KEY_LOCATION_ENABLED = "sendLocationEnabled";
- public static final String KEY_GETWAYPOINTS_ENABLED = "getWayPointsEnabled";
+public class NavigationCapability extends RPCStruct {
+ public static final String KEY_LOCATION_ENABLED = "sendLocationEnabled";
+ public static final String KEY_GETWAYPOINTS_ENABLED = "getWayPointsEnabled";
- public NavigationCapability(){}
+ public NavigationCapability() {
+ }
- public NavigationCapability(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public NavigationCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public Boolean getSendLocationEnabled(){
- return getBoolean(KEY_LOCATION_ENABLED);
- }
+ public Boolean getSendLocationEnabled() {
+ return getBoolean(KEY_LOCATION_ENABLED);
+ }
- public NavigationCapability setSendLocationEnabled( Boolean sendLocationEnabled) {
+ public NavigationCapability setSendLocationEnabled(Boolean sendLocationEnabled) {
setValue(KEY_LOCATION_ENABLED, sendLocationEnabled);
return this;
}
- public Boolean getWayPointsEnabled(){
- return getBoolean(KEY_GETWAYPOINTS_ENABLED);
- }
+ public Boolean getWayPointsEnabled() {
+ return getBoolean(KEY_GETWAYPOINTS_ENABLED);
+ }
- public NavigationCapability setWayPointsEnabled( Boolean getWayPointsEnabled) {
+ public NavigationCapability setWayPointsEnabled(Boolean getWayPointsEnabled) {
setValue(KEY_GETWAYPOINTS_ENABLED, getWayPointsEnabled);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java
index e4c3136ab..6f82684d8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationInstruction.java
@@ -42,167 +42,176 @@ import java.util.Hashtable;
public class NavigationInstruction extends RPCStruct {
- public static final String KEY_LOCATION_DETAILS = "locationDetails";
- public static final String KEY_ACTION = "action";
- public static final String KEY_ETA = "eta";
- public static final String KEY_BEARING = "bearing";
- public static final String KEY_JUNCTION_TYPE = "junctionType";
- public static final String KEY_DRIVING_SIDE = "drivingSide";
- public static final String KEY_DETAILS = "details";
- public static final String KEY_IMAGE = "image";
-
- // Constructors
-
- public NavigationInstruction() { }
-
- public NavigationInstruction(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public NavigationInstruction(@NonNull LocationDetails locationDetails, @NonNull NavigationAction action){
- this();
- setLocationDetails(locationDetails);
- setAction(action);
- }
-
- // Setters and Getters
-
- /**
- * @param locationDetails -
- */
- public NavigationInstruction setLocationDetails(@NonNull LocationDetails locationDetails) {
+ public static final String KEY_LOCATION_DETAILS = "locationDetails";
+ public static final String KEY_ACTION = "action";
+ public static final String KEY_ETA = "eta";
+ public static final String KEY_BEARING = "bearing";
+ public static final String KEY_JUNCTION_TYPE = "junctionType";
+ public static final String KEY_DRIVING_SIDE = "drivingSide";
+ public static final String KEY_DETAILS = "details";
+ public static final String KEY_IMAGE = "image";
+
+ // Constructors
+
+ public NavigationInstruction() {
+ }
+
+ public NavigationInstruction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public NavigationInstruction(@NonNull LocationDetails locationDetails, @NonNull NavigationAction action) {
+ this();
+ setLocationDetails(locationDetails);
+ setAction(action);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param locationDetails -
+ */
+ public NavigationInstruction setLocationDetails(@NonNull LocationDetails locationDetails) {
setValue(KEY_LOCATION_DETAILS, locationDetails);
return this;
}
- /**
- * @return locationDetails
- */
- public LocationDetails getLocationDetails(){
- return (LocationDetails) getObject(LocationDetails.class, KEY_LOCATION_DETAILS);
- }
+ /**
+ * @return locationDetails
+ */
+ public LocationDetails getLocationDetails() {
+ return (LocationDetails) getObject(LocationDetails.class, KEY_LOCATION_DETAILS);
+ }
- /**
- * @param action -
- */
- public NavigationInstruction setAction(@NonNull NavigationAction action) {
+ /**
+ * @param action -
+ */
+ public NavigationInstruction setAction(@NonNull NavigationAction action) {
setValue(KEY_ACTION, action);
return this;
}
- /**
- * @return action
- */
- public NavigationAction getAction(){
- return (NavigationAction) getObject(NavigationAction.class, KEY_ACTION);
- }
+ /**
+ * @return action
+ */
+ public NavigationAction getAction() {
+ return (NavigationAction) getObject(NavigationAction.class, KEY_ACTION);
+ }
- /**
- * @param eta -
- */
- public NavigationInstruction setEta( DateTime eta) {
+ /**
+ * @param eta -
+ */
+ public NavigationInstruction setEta(DateTime eta) {
setValue(KEY_ETA, eta);
return this;
}
- /**
- * @return eta
- */
- public DateTime getEta(){
- return (DateTime) getObject(DateTime.class, KEY_ETA);
- }
-
- /**
- * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
- * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
- * a U-Turn, etc.
- * @param bearing - minValue="0" maxValue="359"
- */
- public NavigationInstruction setBearing( Integer bearing) {
+ /**
+ * @return eta
+ */
+ public DateTime getEta() {
+ return (DateTime) getObject(DateTime.class, KEY_ETA);
+ }
+
+ /**
+ * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
+ * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
+ * a U-Turn, etc.
+ *
+ * @param bearing - minValue="0" maxValue="359"
+ */
+ public NavigationInstruction setBearing(Integer bearing) {
setValue(KEY_BEARING, bearing);
return this;
}
- /**
- * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
- * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
- * a U-Turn, etc.
- * @return bearing - minValue="0" maxValue="359"
- */
- public Integer getBearing(){
- return getInteger(KEY_BEARING);
- }
-
- /**
- * @param junctionType -
- */
- public NavigationInstruction setJunctionType( NavigationJunction junctionType) {
+ /**
+ * The angle at which this instruction takes place. For example, 0 would mean straight, <=45
+ * is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
+ * a U-Turn, etc.
+ *
+ * @return bearing - minValue="0" maxValue="359"
+ */
+ public Integer getBearing() {
+ return getInteger(KEY_BEARING);
+ }
+
+ /**
+ * @param junctionType -
+ */
+ public NavigationInstruction setJunctionType(NavigationJunction junctionType) {
setValue(KEY_JUNCTION_TYPE, junctionType);
return this;
}
- /**
- * @return junctionType
- */
- public NavigationJunction getJunctionType(){
- return (NavigationJunction) getObject(NavigationJunction.class, KEY_JUNCTION_TYPE);
- }
+ /**
+ * @return junctionType
+ */
+ public NavigationJunction getJunctionType() {
+ return (NavigationJunction) getObject(NavigationJunction.class, KEY_JUNCTION_TYPE);
+ }
- /**
- * Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
- * will determine which direction the turn should take place.
- * @param drivingSide - Direction enum value that represents the driving side
- */
- public NavigationInstruction setDrivingSide( Direction drivingSide) {
+ /**
+ * Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
+ * will determine which direction the turn should take place.
+ *
+ * @param drivingSide - Direction enum value that represents the driving side
+ */
+ public NavigationInstruction setDrivingSide(Direction drivingSide) {
setValue(KEY_DRIVING_SIDE, drivingSide);
return this;
}
- /**
- * Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
- * will determine which direction the turn should take place.
- * @return drivingSide
- */
- public Direction getDrivingSide(){
- return (Direction) getObject(Direction.class, KEY_DRIVING_SIDE);
- }
-
- /**
- * This is a string representation of this instruction, used to display instructions to the
- * users. This is not intended to be read aloud to the users, see the param prompt in
- * NavigationServiceData for that.
- * @param details -
- */
- public NavigationInstruction setDetails( String details) {
+ /**
+ * Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
+ * will determine which direction the turn should take place.
+ *
+ * @return drivingSide
+ */
+ public Direction getDrivingSide() {
+ return (Direction) getObject(Direction.class, KEY_DRIVING_SIDE);
+ }
+
+ /**
+ * This is a string representation of this instruction, used to display instructions to the
+ * users. This is not intended to be read aloud to the users, see the param prompt in
+ * NavigationServiceData for that.
+ *
+ * @param details -
+ */
+ public NavigationInstruction setDetails(String details) {
setValue(KEY_DETAILS, details);
return this;
}
- /**
- * This is a string representation of this instruction, used to display instructions to the
- * users. This is not intended to be read aloud to the users, see the param prompt in
- * NavigationServiceData for that.
- * @return details
- */
- public String getDetails(){
- return getString(KEY_DETAILS);
- }
-
- /**
- * An image representation of this instruction.
- * @param image -
- */
- public NavigationInstruction setImage( Image image) {
+ /**
+ * This is a string representation of this instruction, used to display instructions to the
+ * users. This is not intended to be read aloud to the users, see the param prompt in
+ * NavigationServiceData for that.
+ *
+ * @return details
+ */
+ public String getDetails() {
+ return getString(KEY_DETAILS);
+ }
+
+ /**
+ * An image representation of this instruction.
+ *
+ * @param image -
+ */
+ public NavigationInstruction setImage(Image image) {
setValue(KEY_IMAGE, image);
return this;
}
- /**
- * An image representation of this instruction.
- * @return image
- */
- public Image getImage(){
- return (Image) getObject(Image.class, KEY_IMAGE);
- }
+ /**
+ * An image representation of this instruction.
+ *
+ * @return image
+ */
+ public Image getImage() {
+ return (Image) getObject(Image.class, KEY_IMAGE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java
index dd4b9237f..e415ced42 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceData.java
@@ -43,187 +43,198 @@ import java.util.List;
*/
public class NavigationServiceData extends RPCStruct {
- public static final String KEY_TIMESTAMP = "timeStamp";
- public static final String KEY_ORIGIN= "origin";
- public static final String KEY_DESTINATION = "destination";
- public static final String KEY_DESTINATION_ETA = "destinationETA";
- public static final String KEY_INSTRUCTIONS = "instructions";
- public static final String KEY_NEXT_INSTRUCTION_ETA = "nextInstructionETA";
- public static final String KEY_NEXT_INSTRUCTION_DISTANCE = "nextInstructionDistance";
- public static final String KEY_NEXT_INSTRUCTION_DISTANCE_SCALE= "nextInstructionDistanceScale";
- public static final String KEY_PROMPT = "prompt";
-
- // Constructors
-
- public NavigationServiceData() { }
-
- public NavigationServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public NavigationServiceData(@NonNull DateTime timeStamp){
- this();
- setTimeStamp(timeStamp);
- }
-
- // Setters and Getters
-
- /**
- * This is the timeStamp of when the data was generated. This is to ensure any time or distance
- * given in the data can accurately be adjusted if necessary.
- * @param timeStamp -
- */
- public NavigationServiceData setTimeStamp(@NonNull DateTime timeStamp) {
+ public static final String KEY_TIMESTAMP = "timeStamp";
+ public static final String KEY_ORIGIN = "origin";
+ public static final String KEY_DESTINATION = "destination";
+ public static final String KEY_DESTINATION_ETA = "destinationETA";
+ public static final String KEY_INSTRUCTIONS = "instructions";
+ public static final String KEY_NEXT_INSTRUCTION_ETA = "nextInstructionETA";
+ public static final String KEY_NEXT_INSTRUCTION_DISTANCE = "nextInstructionDistance";
+ public static final String KEY_NEXT_INSTRUCTION_DISTANCE_SCALE = "nextInstructionDistanceScale";
+ public static final String KEY_PROMPT = "prompt";
+
+ // Constructors
+
+ public NavigationServiceData() {
+ }
+
+ public NavigationServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public NavigationServiceData(@NonNull DateTime timeStamp) {
+ this();
+ setTimeStamp(timeStamp);
+ }
+
+ // Setters and Getters
+
+ /**
+ * This is the timeStamp of when the data was generated. This is to ensure any time or distance
+ * given in the data can accurately be adjusted if necessary.
+ *
+ * @param timeStamp -
+ */
+ public NavigationServiceData setTimeStamp(@NonNull DateTime timeStamp) {
setValue(KEY_TIMESTAMP, timeStamp);
return this;
}
- /**
- * This is the timeStamp of when the data was generated. This is to ensure any time or distance
- * given in the data can accurately be adjusted if necessary.
- * @return timeStamp
- */
- public DateTime getTimeStamp(){
- return (DateTime) getObject(DateTime.class, KEY_TIMESTAMP);
- }
+ /**
+ * This is the timeStamp of when the data was generated. This is to ensure any time or distance
+ * given in the data can accurately be adjusted if necessary.
+ *
+ * @return timeStamp
+ */
+ public DateTime getTimeStamp() {
+ return (DateTime) getObject(DateTime.class, KEY_TIMESTAMP);
+ }
- /**
- * @param origin -
- */
- public NavigationServiceData setOrigin( LocationDetails origin) {
+ /**
+ * @param origin -
+ */
+ public NavigationServiceData setOrigin(LocationDetails origin) {
setValue(KEY_ORIGIN, origin);
return this;
}
- /**
- * @return origin
- */
- public LocationDetails getOrigin(){
- return (LocationDetails) getObject(LocationDetails.class, KEY_ORIGIN);
- }
+ /**
+ * @return origin
+ */
+ public LocationDetails getOrigin() {
+ return (LocationDetails) getObject(LocationDetails.class, KEY_ORIGIN);
+ }
- /**
- * @param destination -
- */
- public NavigationServiceData setDestination( LocationDetails destination) {
+ /**
+ * @param destination -
+ */
+ public NavigationServiceData setDestination(LocationDetails destination) {
setValue(KEY_DESTINATION, destination);
return this;
}
- /**
- * @return destination
- */
- public LocationDetails getDestination(){
- return (LocationDetails) getObject(LocationDetails.class, KEY_DESTINATION);
- }
+ /**
+ * @return destination
+ */
+ public LocationDetails getDestination() {
+ return (LocationDetails) getObject(LocationDetails.class, KEY_DESTINATION);
+ }
- /**
- * @param destinationETA -
- */
- public NavigationServiceData setDestinationETA( DateTime destinationETA) {
+ /**
+ * @param destinationETA -
+ */
+ public NavigationServiceData setDestinationETA(DateTime destinationETA) {
setValue(KEY_DESTINATION_ETA, destinationETA);
return this;
}
- /**
- * @return destinationETA
- */
- public DateTime getDestinationETA(){
- return (DateTime) getObject(DateTime.class, KEY_DESTINATION_ETA);
- }
+ /**
+ * @return destinationETA
+ */
+ public DateTime getDestinationETA() {
+ return (DateTime) getObject(DateTime.class, KEY_DESTINATION_ETA);
+ }
- /**
- * This array should be ordered with all remaining instructions. The start of this array should
- * always contain the next instruction.
- * @param instructions -
- */
- public NavigationServiceData setInstructions( List<NavigationInstruction> instructions) {
+ /**
+ * This array should be ordered with all remaining instructions. The start of this array should
+ * always contain the next instruction.
+ *
+ * @param instructions -
+ */
+ public NavigationServiceData setInstructions(List<NavigationInstruction> instructions) {
setValue(KEY_INSTRUCTIONS, instructions);
return this;
}
- /**
- * This array should be ordered with all remaining instructions. The start of this array should
- * always contain the next instruction.
- * @return instructions
- */
- @SuppressWarnings("unchecked")
- public List<NavigationInstruction> getInstructions(){
- return (List<NavigationInstruction>) getObject(NavigationInstruction.class,KEY_INSTRUCTIONS);
- }
-
- /**
- * @param nextInstructionETA -
- */
- public NavigationServiceData setNextInstructionETA( DateTime nextInstructionETA) {
+ /**
+ * This array should be ordered with all remaining instructions. The start of this array should
+ * always contain the next instruction.
+ *
+ * @return instructions
+ */
+ @SuppressWarnings("unchecked")
+ public List<NavigationInstruction> getInstructions() {
+ return (List<NavigationInstruction>) getObject(NavigationInstruction.class, KEY_INSTRUCTIONS);
+ }
+
+ /**
+ * @param nextInstructionETA -
+ */
+ public NavigationServiceData setNextInstructionETA(DateTime nextInstructionETA) {
setValue(KEY_NEXT_INSTRUCTION_ETA, nextInstructionETA);
return this;
}
- /**
- * @return nextInstructionETA
- */
- public DateTime getNextInstructionETA(){
- return (DateTime) getObject(DateTime.class, KEY_NEXT_INSTRUCTION_ETA);
- }
-
- /**
- * The distance to this instruction from current location. This should only be updated every
- * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
- * the next instruction.
- * @param nextInstructionDistance -
- */
- public NavigationServiceData setNextInstructionDistance( Float nextInstructionDistance) {
+ /**
+ * @return nextInstructionETA
+ */
+ public DateTime getNextInstructionETA() {
+ return (DateTime) getObject(DateTime.class, KEY_NEXT_INSTRUCTION_ETA);
+ }
+
+ /**
+ * The distance to this instruction from current location. This should only be updated every
+ * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
+ * the next instruction.
+ *
+ * @param nextInstructionDistance -
+ */
+ public NavigationServiceData setNextInstructionDistance(Float nextInstructionDistance) {
setValue(KEY_NEXT_INSTRUCTION_DISTANCE, nextInstructionDistance);
return this;
}
- /**
- * The distance to this instruction from current location. This should only be updated every
- * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
- * the next instruction.
- * @return nextInstructionDistance
- */
- public Float getNextInstructionDistance(){
- return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE);
- }
-
- /**
- * Distance till next maneuver (starting from) from previous maneuver.
- * @param nextInstructionDistanceScale -
- */
- public NavigationServiceData setNextInstructionDistanceScale( Float nextInstructionDistanceScale) {
+ /**
+ * The distance to this instruction from current location. This should only be updated every
+ * .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and
+ * the next instruction.
+ *
+ * @return nextInstructionDistance
+ */
+ public Float getNextInstructionDistance() {
+ return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE);
+ }
+
+ /**
+ * Distance till next maneuver (starting from) from previous maneuver.
+ *
+ * @param nextInstructionDistanceScale -
+ */
+ public NavigationServiceData setNextInstructionDistanceScale(Float nextInstructionDistanceScale) {
setValue(KEY_NEXT_INSTRUCTION_DISTANCE_SCALE, nextInstructionDistanceScale);
return this;
}
- /**
- * Distance till next maneuver (starting from) from previous maneuver.
- * @return nextInstructionDistanceScale
- */
- public Float getNextInstructionDistanceScale(){
- return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE_SCALE);
- }
-
- /**
- * This is a prompt message that should be conveyed to the user through either display or voice
- * (TTS). This param will change often as it should represent the following: approaching
- * instruction, post instruction, alerts that affect the current navigation session, etc.
- * @param prompt -
- */
- public NavigationServiceData setPrompt( String prompt) {
+ /**
+ * Distance till next maneuver (starting from) from previous maneuver.
+ *
+ * @return nextInstructionDistanceScale
+ */
+ public Float getNextInstructionDistanceScale() {
+ return getFloat(KEY_NEXT_INSTRUCTION_DISTANCE_SCALE);
+ }
+
+ /**
+ * This is a prompt message that should be conveyed to the user through either display or voice
+ * (TTS). This param will change often as it should represent the following: approaching
+ * instruction, post instruction, alerts that affect the current navigation session, etc.
+ *
+ * @param prompt -
+ */
+ public NavigationServiceData setPrompt(String prompt) {
setValue(KEY_PROMPT, prompt);
return this;
}
- /**
- * This is a prompt message that should be conveyed to the user through either display or voice
- * (TTS). This param will change often as it should represent the following: approaching
- * instruction, post instruction, alerts that affect the current navigation session, etc.
- * @return prompt
- */
- public String getPrompt(){
- return getString(KEY_PROMPT);
- }
+ /**
+ * This is a prompt message that should be conveyed to the user through either display or voice
+ * (TTS). This param will change often as it should represent the following: approaching
+ * instruction, post instruction, alerts that affect the current navigation session, etc.
+ *
+ * @return prompt
+ */
+ public String getPrompt() {
+ return getString(KEY_PROMPT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java
index e355c7a1c..89236f747 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/NavigationServiceManifest.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,33 +37,36 @@ import java.util.Hashtable;
public class NavigationServiceManifest extends RPCStruct {
- public static final String KEY_ACCEPTS_WAY_POINTS = "acceptsWayPoints";
+ public static final String KEY_ACCEPTS_WAY_POINTS = "acceptsWayPoints";
- // Constructors
+ // Constructors
- public NavigationServiceManifest() { }
+ public NavigationServiceManifest() {
+ }
- public NavigationServiceManifest(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public NavigationServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * Informs the subscriber if this service can actually accept way points.
- * @param acceptsWayPoints -
- */
- public NavigationServiceManifest setAcceptsWayPoints( Boolean acceptsWayPoints) {
+ /**
+ * Informs the subscriber if this service can actually accept way points.
+ *
+ * @param acceptsWayPoints -
+ */
+ public NavigationServiceManifest setAcceptsWayPoints(Boolean acceptsWayPoints) {
setValue(KEY_ACCEPTS_WAY_POINTS, acceptsWayPoints);
return this;
}
- /**
- * Informs the subscriber if this service can actually accept way points.
- * @return acceptsWayPoints
- */
- public Boolean getAcceptsWayPoints(){
- return getBoolean(KEY_ACCEPTS_WAY_POINTS);
- }
+ /**
+ * Informs the subscriber if this service can actually accept way points.
+ *
+ * @return acceptsWayPoints
+ */
+ public Boolean getAcceptsWayPoints() {
+ return getBoolean(KEY_ACCEPTS_WAY_POINTS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OasisAddress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OasisAddress.java
index 775f50d2c..72577ec84 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OasisAddress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OasisAddress.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,7 +35,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-public class OasisAddress extends RPCStruct{
+public class OasisAddress extends RPCStruct {
public static final String KEY_COUNTRY_NAME = "countryName";
public static final String KEY_COUNTRY_CODE = "countryCode";
public static final String KEY_POSTAL_CODE = "postalCode";
@@ -46,12 +46,11 @@ public class OasisAddress extends RPCStruct{
public static final String KEY_THOROUGH_FARE = "thoroughfare";
public static final String KEY_SUB_THOROUGH_FARE = "subThoroughfare";
- /**
- * OASIS Address - A standard based address class that has been established by The Organization for the Advancement of Structured Information Standards (OASIS).
- * Oasis is a global nonprofit consortium that works on the development, convergence, and adoption of standards for security,
- * Internet of Things, energy, content technologies, emergency management, and other areas.
- *
- */
+ /**
+ * OASIS Address - A standard based address class that has been established by The Organization for the Advancement of Structured Information Standards (OASIS).
+ * Oasis is a global nonprofit consortium that works on the development, convergence, and adoption of standards for security,
+ * Internet of Things, energy, content technologies, emergency management, and other areas.
+ */
public OasisAddress() {
}
@@ -60,198 +59,172 @@ public class OasisAddress extends RPCStruct{
}
/**
- * Gets the localized Name of the country associated with the OasisAddress class.
- *
- * @return String - The localized Name of the country associated with the OasisAddress class.
- *
- */
+ * Gets the localized Name of the country associated with the OasisAddress class.
+ *
+ * @return String - The localized Name of the country associated with the OasisAddress class.
+ */
public String getCountryName() {
return getString(KEY_COUNTRY_NAME);
}
- /**
- * Sets the localized Name of the country associated with the OasisAddress class.
- *
- * @param countryName
- * The localized Name of the country associated with the OasisAddress class.
- *
- */
- public OasisAddress setCountryName( String countryName) {
+ /**
+ * Sets the localized Name of the country associated with the OasisAddress class.
+ *
+ * @param countryName The localized Name of the country associated with the OasisAddress class.
+ */
+ public OasisAddress setCountryName(String countryName) {
setValue(KEY_COUNTRY_NAME, countryName);
return this;
}
/**
- * Gets the country code in ISO 3166-2 format associated with the OasisAddress class.
- *
- * @return String - The country code in ISO 3166-2 format associated with the OasisAddress class.
- *
- */
+ * Gets the country code in ISO 3166-2 format associated with the OasisAddress class.
+ *
+ * @return String - The country code in ISO 3166-2 format associated with the OasisAddress class.
+ */
public String getCountryCode() {
return getString(KEY_COUNTRY_CODE);
}
- /**
- * Sets the country code in ISO 3166-2 format associated with the OasisAddress class.
- *
- * @param countryCode
- * The country code in ISO 3166-2 format associated with the OasisAddress class.
- *
- */
- public OasisAddress setCountryCode( String countryCode) {
+ /**
+ * Sets the country code in ISO 3166-2 format associated with the OasisAddress class.
+ *
+ * @param countryCode The country code in ISO 3166-2 format associated with the OasisAddress class.
+ */
+ public OasisAddress setCountryCode(String countryCode) {
setValue(KEY_COUNTRY_CODE, countryCode);
return this;
}
/**
- * Gets the Postal Code associated with the OasisAddress class.
- *
- * @return String - The Postal Code associated with the OasisAddress class.
- *
- */
+ * Gets the Postal Code associated with the OasisAddress class.
+ *
+ * @return String - The Postal Code associated with the OasisAddress class.
+ */
public String getPostalCode() {
return getString(KEY_POSTAL_CODE);
}
- /**
- * Sets the Postal Code associated with the OasisAddress class.
- *
- * @param postalCode
- * The Postal Code associated with the OasisAddress class.
- *
- */
- public OasisAddress setPostalCode( String postalCode) {
+ /**
+ * Sets the Postal Code associated with the OasisAddress class.
+ *
+ * @param postalCode The Postal Code associated with the OasisAddress class.
+ */
+ public OasisAddress setPostalCode(String postalCode) {
setValue(KEY_POSTAL_CODE, postalCode);
return this;
}
/**
- * Gets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area's can include details of the top-level area division in the country, such as state, district, province, island, region, etc.
- *
- * @return String - The Administrative Area associated with the OasisAddress class.
- *
- */
+ * Gets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area's can include details of the top-level area division in the country, such as state, district, province, island, region, etc.
+ *
+ * @return String - The Administrative Area associated with the OasisAddress class.
+ */
public String getAdministrativeArea() {
return getString(KEY_ADMINISTRATIVE_AREA);
}
- /**
- * Sets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area can include details of the top-level area division in the country, such as state, district, province, island, region, etc.
- *
- * @param administrativeArea
- * The Administrative Area associated with the OasisAddress class.
- *
- */
- public OasisAddress setAdministrativeArea( String administrativeArea) {
+ /**
+ * Sets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area can include details of the top-level area division in the country, such as state, district, province, island, region, etc.
+ *
+ * @param administrativeArea The Administrative Area associated with the OasisAddress class.
+ */
+ public OasisAddress setAdministrativeArea(String administrativeArea) {
setValue(KEY_ADMINISTRATIVE_AREA, administrativeArea);
return this;
}
/**
- * Gets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation.
- *
- * @return String - The SubAdministrative Area associated with the OasisAddress class.
- *
- */
+ * Gets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation.
+ *
+ * @return String - The SubAdministrative Area associated with the OasisAddress class.
+ */
public String getSubAdministrativeArea() {
return getString(KEY_SUB_ADMINISTRATIVE_AREA);
}
- /**
- * Sets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation.
- *
- * @param subAdministrativeArea
- * The SubAdministrative Area associated with the OasisAddress class.
- *
- */
- public OasisAddress setSubAdministrativeArea( String subAdministrativeArea) {
+ /**
+ * Sets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation.
+ *
+ * @param subAdministrativeArea The SubAdministrative Area associated with the OasisAddress class.
+ */
+ public OasisAddress setSubAdministrativeArea(String subAdministrativeArea) {
setValue(KEY_SUB_ADMINISTRATIVE_AREA, subAdministrativeArea);
return this;
}
/**
- * Gets the Locality associated with the OasisAddress class. - A hypernym for city/village
- *
- * @return String - The Locality associated with the OasisAddress class.
- *
- */
+ * Gets the Locality associated with the OasisAddress class. - A hypernym for city/village
+ *
+ * @return String - The Locality associated with the OasisAddress class.
+ */
public String getLocality() {
return getString(KEY_LOCALITY);
}
- /**
- * Sets the Locality associated with the OasisAddress class. - A hypernym for city/village.
- *
- * @param locality
- * The Locality associated with the OasisAddress class.
- *
- */
- public OasisAddress setLocality( String locality) {
+ /**
+ * Sets the Locality associated with the OasisAddress class. - A hypernym for city/village.
+ *
+ * @param locality The Locality associated with the OasisAddress class.
+ */
+ public OasisAddress setLocality(String locality) {
setValue(KEY_LOCALITY, locality);
return this;
}
/**
- * Gets the Sub-Locality associated with the OasisAddress class. - Hypernym for district.
- *
- * @return String - The Sub-Locality associated with the OasisAddress class.
- *
- */
+ * Gets the Sub-Locality associated with the OasisAddress class. - Hypernym for district.
+ *
+ * @return String - The Sub-Locality associated with the OasisAddress class.
+ */
public String getSubLocality() {
return getString(KEY_SUB_LOCALITY);
}
- /**
- * Sets the Sub-Locality associated with the OasisAddress class. A hypernym for district.
- *
- * @param subLocality
- * The Sub-Locality associated with the OasisAddress class.
- *
- */
- public OasisAddress setSubLocality( String subLocality) {
+ /**
+ * Sets the Sub-Locality associated with the OasisAddress class. A hypernym for district.
+ *
+ * @param subLocality The Sub-Locality associated with the OasisAddress class.
+ */
+ public OasisAddress setSubLocality(String subLocality) {
setValue(KEY_SUB_LOCALITY, subLocality);
return this;
}
/**
- * Gets the Thoroughfare associated with the OasisAddress class. - A hypernym for street, road etc.
- *
- * @return String - The Thoroughfare associated with the OasisAddress class.
- *
- */
+ * Gets the Thoroughfare associated with the OasisAddress class. - A hypernym for street, road etc.
+ *
+ * @return String - The Thoroughfare associated with the OasisAddress class.
+ */
public String getThoroughfare() {
return getString(KEY_THOROUGH_FARE);
}
- /**
- * Sets the Thoroughfare associated with the OasisAddress class. A hypernym for street, road etc.
- *
- * @param thoroughFare
- * The Thoroughfare associated with the OasisAddress class.
- *
- */
- public OasisAddress setThoroughfare( String thoroughFare) {
+ /**
+ * Sets the Thoroughfare associated with the OasisAddress class. A hypernym for street, road etc.
+ *
+ * @param thoroughFare The Thoroughfare associated with the OasisAddress class.
+ */
+ public OasisAddress setThoroughfare(String thoroughFare) {
setValue(KEY_THOROUGH_FARE, thoroughFare);
return this;
}
-
+
/**
- * Gets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number).
- *
- * @return String - The Sub-Thoroughfare associated with the OasisAddress class.
- */
+ * Gets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number).
+ *
+ * @return String - The Sub-Thoroughfare associated with the OasisAddress class.
+ */
public String getSubThoroughfare() {
return getString(KEY_SUB_THOROUGH_FARE);
}
-
- /**
- * Sets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number).
- *
- * @param subThoroughfare
- * The Sub-Thoroughfare associated with the OasisAddress class.
- *
- */
- public OasisAddress setSubThoroughfare( String subThoroughfare) {
+
+ /**
+ * Sets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number).
+ *
+ * @param subThoroughfare The Sub-Thoroughfare associated with the OasisAddress class.
+ */
+ public OasisAddress setSubThoroughfare(String subThoroughfare) {
setValue(KEY_SUB_THOROUGH_FARE, subThoroughfare);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
index 33a896c2f..fdb3542f6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,17 +40,17 @@ import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
import java.util.Hashtable;
/**
- * <p>Notifies an application that its interface registration has been terminated. This means that all SDL resources
+ * <p>Notifies an application that its interface registration has been terminated. This means that all SDL resources
* associated with the application are discarded, including the Command Menu, Choice Sets, button subscriptions, etc.</p>
* For more information about SDL resources related to an interface registration, see {@linkplain RegisterAppInterface}.
* <p></p>
* <b>HMI Status Requirements:</b>
* <ul>
- * HMILevel:
+ * HMILevel:
* <ul><li>Any</li></ul>
- * AudioStreamingState:
+ * AudioStreamingState:
* <ul><li>Any</li></ul>
- * SystemContext:
+ * SystemContext:
* <ul><li>Any</li></ul>
* </ul>
* <p></p>
@@ -69,41 +69,51 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
+ *
* @see RegisterAppInterface
+ * @since SmartDeviceLink 1.0
*/
public class OnAppInterfaceUnregistered extends RPCNotification {
- public static final String KEY_REASON = "reason";
- /**
- *Constructs a newly allocated OnAppInterfaceUnregistered object
- */
+ public static final String KEY_REASON = "reason";
+
+ /**
+ * Constructs a newly allocated OnAppInterfaceUnregistered object
+ */
public OnAppInterfaceUnregistered() {
super(FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString());
}
+
/**
- *<p>Constructs a newly allocated OnAppInterfaceUnregistered object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+ * <p>Constructs a newly allocated OnAppInterfaceUnregistered object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnAppInterfaceUnregistered(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnAppInterfaceUnregistered object
+ * Constructs a newly allocated OnAppInterfaceUnregistered object
+ *
* @param reason The reason application's interface registration was terminated
*/
public OnAppInterfaceUnregistered(@NonNull AppInterfaceUnregisteredReason reason) {
this();
setReason(reason);
}
+
/**
* <p>Get the reason the registration was terminated</p>
+ *
* @return {@linkplain AppInterfaceUnregisteredReason} the reason the application's interface registration was terminated
- */
+ */
public AppInterfaceUnregisteredReason getReason() {
return (AppInterfaceUnregisteredReason) getObject(AppInterfaceUnregisteredReason.class, KEY_REASON);
}
+
/**
* <p>Set the reason application's interface was terminated</p>
+ *
* @param reason The reason application's interface registration was terminated
*/
public OnAppInterfaceUnregistered setReason(@NonNull AppInterfaceUnregisteredReason reason) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java
index 61b696809..e968f9cdb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAppServiceData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,38 +43,38 @@ import java.util.Hashtable;
*/
public class OnAppServiceData extends RPCNotification {
- public static final String KEY_SERVICE_DATA = "serviceData";
+ public static final String KEY_SERVICE_DATA = "serviceData";
- // Constructors
+ // Constructors
- public OnAppServiceData() {
- super(FunctionID.ON_APP_SERVICE_DATA.toString());
- }
+ public OnAppServiceData() {
+ super(FunctionID.ON_APP_SERVICE_DATA.toString());
+ }
- public OnAppServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public OnAppServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public OnAppServiceData(@NonNull AppServiceData serviceData) {
- this();
- setServiceData(serviceData);
- }
+ public OnAppServiceData(@NonNull AppServiceData serviceData) {
+ this();
+ setServiceData(serviceData);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param serviceData -
- */
- public OnAppServiceData setServiceData(@NonNull AppServiceData serviceData) {
+ /**
+ * @param serviceData -
+ */
+ public OnAppServiceData setServiceData(@NonNull AppServiceData serviceData) {
setParameters(KEY_SERVICE_DATA, serviceData);
return this;
}
- /**
- * @return serviceData
- */
- public AppServiceData getServiceData(){
- return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
- }
+ /**
+ * @return serviceData
+ */
+ public AppServiceData getServiceData() {
+ return (AppServiceData) getObject(AppServiceData.class, KEY_SERVICE_DATA);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
index e5b9a5993..e1227d207 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,7 +38,7 @@ import java.util.Hashtable;
/**
* Binary data is in binary part of hybrid msg.
- * <p>
+ * <p>
* </p>
* <b>HMI Status Requirements:</b>
* <ul>
@@ -68,26 +68,29 @@ import java.util.Hashtable;
* </tr>
* </table>
* </p>
- *
*/
public class OnAudioPassThru extends RPCNotification {
- /**
- *Constructs a newly allocated OnCommand object
- */
+ /**
+ * Constructs a newly allocated OnCommand object
+ */
public OnAudioPassThru() {
super(FunctionID.ON_AUDIO_PASS_THRU.toString());
}
+
/**
- *<p>Constructs a newly allocated OnAudioPassThru object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+ * <p>Constructs a newly allocated OnAudioPassThru object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnAudioPassThru(Hashtable<String, Object> hash) {
super(hash);
}
- public OnAudioPassThru setAPTData( byte[] aptData) {
+
+ public OnAudioPassThru setAPTData(byte[] aptData) {
setBulkData(aptData);
return this;
}
+
public byte[] getAPTData() {
return getBulkData();
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
index 3bdd9670a..1c1d00653 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -107,42 +107,41 @@ import java.util.Hashtable;
* </tr>
* </table>
* <p></p>
- *
- * @since SmartDeviceLink 1.0
- *
+ *
* @see SubscribeButton
* @see UnsubscribeButton
- *
- *
+ * @since SmartDeviceLink 1.0
*/
public class OnButtonEvent extends RPCNotification {
- public static final String KEY_BUTTON_EVENT_MODE = "buttonEventMode";
- public static final String KEY_BUTTON_NAME = "buttonName";
- public static final String KEY_CUSTOM_BUTTON_ID = "customButtonID";
- /**
- *Constructs a newly allocated OnButtonEvent object
- */
+ public static final String KEY_BUTTON_EVENT_MODE = "buttonEventMode";
+ public static final String KEY_BUTTON_NAME = "buttonName";
+ public static final String KEY_CUSTOM_BUTTON_ID = "customButtonID";
+
+ /**
+ * Constructs a newly allocated OnButtonEvent object
+ */
public OnButtonEvent() {
super(FunctionID.ON_BUTTON_EVENT.toString());
}
+
/**
- * <p>
- * Constructs a newly allocated OnButtonEvent object indicated by the
- * Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use to create this RPC
- *
- */
+ * <p>
+ * Constructs a newly allocated OnButtonEvent object indicated by the
+ * Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use to create this RPC
+ */
public OnButtonEvent(Hashtable<String, Object> hash) {
super(hash);
}
/**
- *Constructs a newly allocated OnButtonEvent object
- * @param buttonName name of the button
+ * Constructs a newly allocated OnButtonEvent object
+ *
+ * @param buttonName name of the button
* @param buttonEventMode indicates the button is pressed or released
*/
public OnButtonEvent(@NonNull ButtonName buttonName, @NonNull ButtonEventMode buttonEventMode) {
@@ -153,6 +152,7 @@ public class OnButtonEvent extends RPCNotification {
/**
* <p>Returns <i>{@linkplain ButtonName}</i> the button's name</p>
+ *
* @return ButtonName Name of the button
*/
public ButtonName getButtonName() {
@@ -161,6 +161,7 @@ public class OnButtonEvent extends RPCNotification {
/**
* <p>Set the button's name</p>
+ *
* @param buttonName name of the button
*/
public OnButtonEvent setButtonName(@NonNull ButtonName buttonName) {
@@ -170,14 +171,16 @@ public class OnButtonEvent extends RPCNotification {
/**
* <p>Return <i>{@linkplain ButtonEventMode} indicates the button was depressed or released</i></p>
+ *
* @return ButtonEventMode the button depressed or released
- */
+ */
public ButtonEventMode getButtonEventMode() {
return (ButtonEventMode) getObject(ButtonEventMode.class, KEY_BUTTON_EVENT_MODE);
}
/**
* <p> Set the event mode of the button,pressed or released</p>
+ *
* @param buttonEventMode indicates the button is pressed or released
* @see ButtonEventMode
*/
@@ -186,11 +189,12 @@ public class OnButtonEvent extends RPCNotification {
return this;
}
- public OnButtonEvent setCustomButtonID( Integer customButtonID) {
+ public OnButtonEvent setCustomButtonID(Integer customButtonID) {
setParameters(KEY_CUSTOM_BUTTON_ID, customButtonID);
return this;
}
+
public Integer getCustomButtonID() {
- return getInteger(KEY_CUSTOM_BUTTON_ID);
+ return getInteger(KEY_CUSTOM_BUTTON_ID);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
index e214e8b96..05c47351e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -115,36 +115,39 @@ import java.util.Hashtable;
* </tr>
* </table>
* </p>
- *
- * @since SmartDeviceLink 1.0
+ *
* @see SubscribeButton
* @see UnsubscribeButton
+ * @since SmartDeviceLink 1.0
*/
public class OnButtonPress extends RPCNotification {
- public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
- public static final String KEY_BUTTON_NAME = "buttonName";
- public static final String KEY_CUSTOM_BUTTON_ID = "customButtonID";
- /**
- *Constructs a newly allocated OnButtonPress object
- */
+ public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
+ public static final String KEY_BUTTON_NAME = "buttonName";
+ public static final String KEY_CUSTOM_BUTTON_ID = "customButtonID";
+
+ /**
+ * Constructs a newly allocated OnButtonPress object
+ */
public OnButtonPress() {
super(FunctionID.ON_BUTTON_PRESS.toString());
}
+
/**
- * <p>
- * Constructs a newly allocated OnButtonPress object indicated by the
- * Hashtable parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a newly allocated OnButtonPress object indicated by the
+ * Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnButtonPress(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnButtonPress object
- * @param buttonName name of the button
+ * Constructs a newly allocated OnButtonPress object
+ *
+ * @param buttonName name of the button
* @param buttonPressMode indicates whether this is a short or long press
*/
public OnButtonPress(@NonNull ButtonName buttonName, @NonNull ButtonPressMode buttonPressMode) {
@@ -152,29 +155,38 @@ public class OnButtonPress extends RPCNotification {
setButtonName(buttonName);
setButtonPressMode(buttonPressMode);
}
+
/**
* <p>Returns an <i>{@linkplain ButtonName}</i> the button's name</p>
+ *
* @return ButtonName Name of the button
- */
+ */
public ButtonName getButtonName() {
return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
}
+
/**
* <p>Set the button's name</p>
+ *
* @param buttonName name of the button
*/
public OnButtonPress setButtonName(@NonNull ButtonName buttonName) {
setParameters(KEY_BUTTON_NAME, buttonName);
return this;
}
- /**<p>Returns <i>{@linkplain ButtonPressMode}</i></p>
+
+ /**
+ * <p>Returns <i>{@linkplain ButtonPressMode}</i></p>
+ *
* @return ButtonPressMode whether this is a long or short button press event
- */
+ */
public ButtonPressMode getButtonPressMode() {
return (ButtonPressMode) getObject(ButtonPressMode.class, KEY_BUTTON_PRESS_MODE);
}
+
/**
* <p>Set the button press mode of the event</p>
+ *
* @param buttonPressMode indicates whether this is a short or long press
*/
public OnButtonPress setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
@@ -185,9 +197,10 @@ public class OnButtonPress extends RPCNotification {
/**
* Set CustomButtonID of the button
* If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)
+ *
* @param customButtonID CustomButtonID of the button
*/
- public OnButtonPress setCustomButtonID( Integer customButtonID) {
+ public OnButtonPress setCustomButtonID(Integer customButtonID) {
setParameters(KEY_CUSTOM_BUTTON_ID, customButtonID);
return this;
}
@@ -195,6 +208,7 @@ public class OnButtonPress extends RPCNotification {
/**
* Get CustomButtonID of the button
* If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)
+ *
* @return CustomButtonID of the button
*/
public Integer getCustomButtonID() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
index 93fd96dce..83f311487 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,17 +40,17 @@ import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import java.util.Hashtable;
/**
- * This is called when a command was selected via VR after pressing the PTT button, or selected from the menu after
+ * This is called when a command was selected via VR after pressing the PTT button, or selected from the menu after
* pressing the MENU button. <p>
* <b>Note: </b>Sequence of OnHMIStatus and OnCommand notifications for user-initiated interactions is indeterminate.
* <p></p>
* <b>HMI Status Requirements:</b>
* <ul>
- * HMILevel:
+ * HMILevel:
* <ul><li>FULL,LIMITED</li></ul>
- * AudioStreamingState:
+ * AudioStreamingState:
* <ul><li>Any</li></ul>
- * SystemContext:
+ * SystemContext:
* <ul><li>Any</li></ul>
* </ul>
* <p>
@@ -79,30 +79,36 @@ import java.util.Hashtable;
* </tr>
* </table>
* </p>
- * @since SmartDeviceLink 1.0
+ *
* @see AddCommand
* @see DeleteCommand
* @see DeleteSubMenu
+ * @since SmartDeviceLink 1.0
*/
public class OnCommand extends RPCNotification {
- public static final String KEY_CMD_ID = "cmdID";
- public static final String KEY_TRIGGER_SOURCE = "triggerSource";
- /**
- *Constructs a newly allocated OnCommand object
- */
+ public static final String KEY_CMD_ID = "cmdID";
+ public static final String KEY_TRIGGER_SOURCE = "triggerSource";
+
+ /**
+ * Constructs a newly allocated OnCommand object
+ */
public OnCommand() {
super(FunctionID.ON_COMMAND.toString());
}
+
/**
- *<p>Constructs a newly allocated OnCommand object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+ * <p>Constructs a newly allocated OnCommand object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnCommand(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnCommand object
- * @param cmdID an integer object representing a Command ID
+ * Constructs a newly allocated OnCommand object
+ *
+ * @param cmdID an integer object representing a Command ID
* @param triggerSource a TriggerSource object
*/
public OnCommand(@NonNull Integer cmdID, @NonNull TriggerSource triggerSource) {
@@ -110,31 +116,39 @@ public class OnCommand extends RPCNotification {
setCmdID(cmdID);
setTriggerSource(triggerSource);
}
+
/**
* <p>Returns an <i>Integer</i> object representing the Command ID</p>
+ *
* @return Integer an integer representation of this object
- */
+ */
public Integer getCmdID() {
- return getInteger( KEY_CMD_ID );
+ return getInteger(KEY_CMD_ID);
}
+
/**
* <p>Sets a Command ID</p>
+ *
* @param cmdID an integer object representing a Command ID
*/
public OnCommand setCmdID(@NonNull Integer cmdID) {
setParameters(KEY_CMD_ID, cmdID);
return this;
}
+
/**
- * <p>Returns a <I>TriggerSource</I> object which will be shown in the HMI</p>
+ * <p>Returns a <I>TriggerSource</I> object which will be shown in the HMI</p>
+ *
* @return TriggerSource a TriggerSource object
- */
+ */
public TriggerSource getTriggerSource() {
return (TriggerSource) getObject(TriggerSource.class, KEY_TRIGGER_SOURCE);
}
+
/**
* <p>Sets TriggerSource</p>
* <p>Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
+ *
* @param triggerSource a TriggerSource object
*/
public OnCommand setTriggerSource(@NonNull TriggerSource triggerSource) {
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 d9c16e50d..59be54ed8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,17 +40,17 @@ import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import java.util.Hashtable;
/**
- * <p>Notifies the application of the current driver distraction state (whether driver distraction rules are in effect, or
+ * <p>Notifies the application of the current driver distraction state (whether driver distraction rules are in effect, or
* not).</p>
*
* <p></p>
* <b>HMI Status Requirements:</b>
* <ul>
- * HMILevel:
+ * HMILevel:
* <ul><li>Can be sent with FULL, LIMITED or BACKGROUND</li></ul>
- * AudioStreamingState:
+ * AudioStreamingState:
* <ul><li>Any</li></ul>
- * SystemContext:
+ * SystemContext:
* <ul><li>Any</li></ul>
* </ul>
* <p></p>
@@ -68,43 +68,53 @@ import java.util.Hashtable;
* <td>Current driver distraction state (i.e. whether driver distraction rules are in effect, or not). </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
- * </table>
+ * </table>
+ *
* @since SmartDeviceLink 1.0
*/
-public class OnDriverDistraction extends RPCNotification {
- public static final String KEY_STATE = "state";
+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
- */
- public OnDriverDistraction() {
+
+ /**
+ * Constructs a newly allocated OnDriverDistraction object
+ */
+ public OnDriverDistraction() {
super(FunctionID.ON_DRIVER_DISTRACTION.toString());
}
- /**
- *<p>Constructs a newly allocated OnDriverDistraction object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a newly allocated OnDriverDistraction object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnDriverDistraction(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnDriverDistraction object
+ * Constructs a newly allocated OnDriverDistraction object
+ *
* @param state the current driver distraction state
*/
public OnDriverDistraction(@NonNull DriverDistractionState state) {
this();
setState(state);
}
+
/**
* <p>Called to get the current driver distraction state(i.e. whether driver distraction rules are in effect, or not)</p>
+ *
* @return {@linkplain DriverDistractionState} the Current driver distraction state.
- */
+ */
public DriverDistractionState getState() {
return (DriverDistractionState) getObject(DriverDistractionState.class, KEY_STATE);
}
+
/**
* <p>Called to set the driver distraction state(i.e. whether driver distraction rules are in effect, or not)</p>
+ *
* @param state the current driver distraction state
*/
public OnDriverDistraction setState(@NonNull DriverDistractionState state) {
@@ -114,15 +124,17 @@ public class OnDriverDistraction extends RPCNotification {
/**
* <p>Called to set dismissible state of Lockscreen</p>
+ *
* @param isDismissible the Lockscreen's dismissibility
*/
- public OnDriverDistraction setLockscreenDismissibility( boolean isDismissible) {
+ public OnDriverDistraction setLockscreenDismissibility(boolean isDismissible) {
setParameters(KEY_LOCKSCREEN_DISMISSIBLE, isDismissible);
return this;
}
/**
* <p>Called to get the dismissible state of Lockscreen</p>
+ *
* @return true if the Lockscreen is dismissible, false otherwise
*/
public Boolean getLockscreenDismissibility() {
@@ -131,15 +143,17 @@ public class OnDriverDistraction extends RPCNotification {
/**
* Called to set a warning message for the lockscreen
+ *
* @param msg the message to be set
*/
- public OnDriverDistraction setLockscreenWarningMessage( String msg) {
+ public OnDriverDistraction setLockscreenWarningMessage(String msg) {
setParameters(KEY_LOCKSCREEN_DISMISSIBLE_MSG, msg);
return this;
}
/**
* Called to get the lockscreen warning message
+ *
* @return warning message
*/
public String getLockscreenWarningMessage() {
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 52f3c4b84..b0dc4db4e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,16 +43,16 @@ import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import java.util.Hashtable;
/**
- * <p>Notifies an application that HMI conditions have changed for the application. This indicates whether the application
- * can speak phrases, display text, perform interactions, receive button presses and events, stream audio, etc. This
- * notification will be sent to the application when there has been a change in any one or several of the indicated
+ * <p>Notifies an application that HMI conditions have changed for the application. This indicates whether the application
+ * can speak phrases, display text, perform interactions, receive button presses and events, stream audio, etc. This
+ * notification will be sent to the application when there has been a change in any one or several of the indicated
* states ({@linkplain HMILevel}, {@linkplain AudioStreamingState} or {@linkplain SystemContext}) for the application</p>
- * <p>All three values are, in principle, independent of each other (though there may be some relationships). A value for
+ * <p>All three values are, in principle, independent of each other (though there may be some relationships). A value for
* one parameter should not be interpreted from the value of another parameter.</p>
- * <p>There are no guarantees about the timeliness or latency of the OnHMIStatus notification. Therefore, for example,
- * information such as {@linkplain AudioStreamingState} may not indicate that the audio stream became inaudible to the user
+ * <p>There are no guarantees about the timeliness or latency of the OnHMIStatus notification. Therefore, for example,
+ * information such as {@linkplain AudioStreamingState} may not indicate that the audio stream became inaudible to the user
* exactly when the OnHMIStatus notification was received.</p>
- *
+ *
* <p>
* <b>Parameter List:</b>
* <table border="1" rules="all">
@@ -71,16 +71,16 @@ import java.util.Hashtable;
* <tr>
* <td>audioStreamingState</td>
* <td>{@linkplain AudioStreamingState}</td>
- * <td>Current state of audio streaming for the application.
- * When this parameter has a value of NOT_AUDIBLE,
- * the application must stop streaming audio to SDL.
- * Informs app whether any currently streaming audio is
- * audible to user (AUDIBLE) or not (NOT_AUDIBLE). A
- * value of NOT_AUDIBLE means that either the
- * application's audio will not be audible to the user, or
- * that the application's audio should not be audible to
- * the user (i.e. some other application on the mobile
- * device may be streaming audio and the application's
+ * <td>Current state of audio streaming for the application.
+ * When this parameter has a value of NOT_AUDIBLE,
+ * the application must stop streaming audio to SDL.
+ * Informs app whether any currently streaming audio is
+ * audible to user (AUDIBLE) or not (NOT_AUDIBLE). A
+ * value of NOT_AUDIBLE means that either the
+ * application's audio will not be audible to the user, or
+ * that the application's audio should not be audible to
+ * the user (i.e. some other application on the mobile
+ * device may be streaming audio and the application's
* audio would be blended with that other audio). </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -93,42 +93,47 @@ import java.util.Hashtable;
* <tr>
* <td>systemContext</td>
* <td>{@linkplain SystemContext}</td>
- * <td>Indicates that a user-initiated interaction is in-progress
+ * <td>Indicates that a user-initiated interaction is in-progress
* (VRSESSION or MENU), or not (MAIN)</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
* </p>
+ *
+ * @see RegisterAppInterface
* @since SmartDeviceLink 1.0
- * @see RegisterAppInterface
*/
public class OnHMIStatus extends RPCNotification {
public static final String KEY_AUDIO_STREAMING_STATE = "audioStreamingState";
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_SYSTEM_CONTEXT = "systemContext";
+ public static final String KEY_HMI_LEVEL = "hmiLevel";
public static final String KEY_WINDOW_ID = "windowID";
private Boolean firstRun;
-
- /**
- *Constructs a newly allocated OnHMIStatus object
- */
+
+ /**
+ * Constructs a newly allocated OnHMIStatus object
+ */
public OnHMIStatus() {
super(FunctionID.ON_HMI_STATUS.toString());
}
+
/**
- *<p>Constructs a newly allocated OnHMIStatus object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+ * <p>Constructs a newly allocated OnHMIStatus object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnHMIStatus(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnHMIStatus object
- * @param hmiLevel the HMILevel to set
+ * Constructs a newly allocated OnHMIStatus object
+ *
+ * @param hmiLevel the HMILevel to set
* @param audioStreamingState the state of audio streaming of the application
- * @param systemContext Indicates that a user-initiated interaction is in-progress
+ * @param systemContext Indicates that a user-initiated interaction is in-progress
*/
public OnHMIStatus(@NonNull HMILevel hmiLevel, @NonNull AudioStreamingState audioStreamingState, @NonNull SystemContext systemContext) {
this();
@@ -138,105 +143,128 @@ public class OnHMIStatus extends RPCNotification {
}
@Override
- public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams){
- if(rpcVersion.getMajor() < 5){
- if(getVideoStreamingState() == null){
+ public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) {
+ if (rpcVersion.getMajor() < 5) {
+ if (getVideoStreamingState() == null) {
setVideoStreamingState(VideoStreamingState.STREAMABLE);
}
}
- super.format(rpcVersion,formatParams);
+ super.format(rpcVersion, formatParams);
}
/**
* <p>Get HMILevel in effect for the application</p>
+ *
* @return {@linkplain HMILevel} the current HMI Level in effect for the application
- */
+ */
public HMILevel getHmiLevel() {
return (HMILevel) getObject(HMILevel.class, KEY_HMI_LEVEL);
}
+
/**
* <p>Set the HMILevel of OnHMIStatus</p>
+ *
* @param hmiLevel the HMILevel to set
*/
public OnHMIStatus setHmiLevel(@NonNull HMILevel hmiLevel) {
setParameters(KEY_HMI_LEVEL, hmiLevel);
return this;
}
+
/**
* <p>Get current state of audio streaming for the application</p>
+ *
* @return {@linkplain AudioStreamingState} Returns current state of audio streaming for the application
*/
public AudioStreamingState getAudioStreamingState() {
return (AudioStreamingState) getObject(AudioStreamingState.class, KEY_AUDIO_STREAMING_STATE);
}
+
/**
* <p>Set the audio streaming state</p>
+ *
* @param audioStreamingState the state of audio streaming of the application
*/
public OnHMIStatus setAudioStreamingState(@NonNull AudioStreamingState audioStreamingState) {
setParameters(KEY_AUDIO_STREAMING_STATE, audioStreamingState);
return this;
}
+
/**
* <p>Get current state of video streaming for the application</p>
+ *
* @return {@linkplain VideoStreamingState} Returns current state of video streaming for the application
*/
public VideoStreamingState getVideoStreamingState() {
return (VideoStreamingState) getObject(VideoStreamingState.class, KEY_VIDEO_STREAMING_STATE);
}
+
/**
* <p>Set the video streaming state</p>
+ *
* @param videoStreamingState the state of video streaming of the application
*/
- public OnHMIStatus setVideoStreamingState( VideoStreamingState videoStreamingState) {
+ public OnHMIStatus setVideoStreamingState(VideoStreamingState videoStreamingState) {
setParameters(KEY_VIDEO_STREAMING_STATE, videoStreamingState);
return this;
}
+
/**
* <p>Get the System Context</p>
+ *
* @return {@linkplain SystemContext} whether a user-initiated interaction is in-progress (VRSESSION or MENU), or not (MAIN).
- */
+ */
public SystemContext getSystemContext() {
return (SystemContext) getObject(SystemContext.class, KEY_SYSTEM_CONTEXT);
}
+
/**
* <p>Set the System Context of OnHMIStatus</p>
+ *
* @param systemContext Indicates that a user-initiated interaction is in-progress
- * (VRSESSION or MENU), or not (MAIN)
+ * (VRSESSION or MENU), or not (MAIN)
*/
public OnHMIStatus setSystemContext(@NonNull SystemContext systemContext) {
setParameters(KEY_SYSTEM_CONTEXT, systemContext);
return this;
}
+
/**
* <p>Query whether it's the first run</p>
+ *
* @return boolean whether it's the first run
- */
+ */
public Boolean getFirstRun() {
- return this.firstRun;
+ return this.firstRun;
}
+
/**
* <p>Set the firstRun value</p>
+ *
* @param firstRun True if it is the first run, False or not
*/
- public OnHMIStatus setFirstRun( Boolean firstRun) {
+ public OnHMIStatus setFirstRun(Boolean firstRun) {
this.firstRun = firstRun;
return this;
}
+
/**
* <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.
+ * 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 OnHMIStatus setWindowID( Integer windowID) {
+ public OnHMIStatus setWindowID(Integer windowID) {
setParameters(KEY_WINDOW_ID, windowID);
return this;
}
+
/**
* <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
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
index baea12ec3..e095c2d3d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,10 +39,10 @@ import com.smartdevicelink.proxy.RPCNotification;
import java.util.Hashtable;
/**
- * Notification containing an updated hashID which can be used over connection cycles (i.e. loss of connection, ignition cycles, etc.).
+ * Notification containing an updated hashID which can be used over connection cycles (i.e. loss of connection, ignition cycles, etc.).
* Sent after initial registration and subsequently after any change in the calculated hash of all persisted app data.
* <p></p>
- * <p><b>Parameter List</b></p>
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -61,27 +61,28 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- * @since SmartDeviceLink 3.0
*
+ * @since SmartDeviceLink 3.0
*/
public class OnHashChange extends RPCNotification {
- public static final String KEY_HASH_ID = "hashID";
- /**
- * Constructs a new OnHashChange object
- */
+ public static final String KEY_HASH_ID = "hashID";
+
+ /**
+ * Constructs a new OnHashChange object
+ */
public OnHashChange() {
super(FunctionID.ON_HASH_CHANGE.toString());
}
+
/**
- * <p>
- * Constructs a new OnKeyboardInput object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new OnKeyboardInput object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnHashChange(Hashtable<String, Object> hash) {
super(hash);
@@ -94,14 +95,14 @@ public class OnHashChange extends RPCNotification {
this();
setHashID(hashID);
}
-
+
public String getHashID() {
return getString(KEY_HASH_ID);
}
-
+
public OnHashChange setHashID(@NonNull String hashID) {
setParameters(KEY_HASH_ID, hashID);
return this;
}
-
+
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java
index a532421d9..6c487615f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,12 +39,12 @@ import com.smartdevicelink.proxy.RPCNotification;
import java.util.Hashtable;
public class OnInteriorVehicleData extends RPCNotification {
- public static final String KEY_MODULE_DATA = "moduleData";
+ public static final String KEY_MODULE_DATA = "moduleData";
/**
* Constructs a new OnInteriorVehicleData object
*/
- public OnInteriorVehicleData() {
+ public OnInteriorVehicleData() {
super(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString());
}
@@ -52,9 +52,7 @@ public class OnInteriorVehicleData extends RPCNotification {
* <p>Constructs a new OnInteriorVehicleData object indicated by the
* Hashtable parameter</p>
*
- *
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public OnInteriorVehicleData(Hashtable<String, Object> hash) {
super(hash);
@@ -62,6 +60,7 @@ public class OnInteriorVehicleData extends RPCNotification {
/**
* Constructs a new OnInteriorVehicleData object
+ *
* @param moduleData
*/
public OnInteriorVehicleData(@NonNull ModuleData moduleData) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
index c2906fbce..496b912be 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -68,33 +68,34 @@ import java.util.Hashtable;
* <td>Maxlength: 500</td>
* <td>SmartDeviceLink 3.0 </td>
* </tr>
- *
- * </table>
*
+ * </table>
*/
public class OnKeyboardInput extends RPCNotification {
- public static final String KEY_DATA = "data";
- public static final String KEY_EVENT = "event";
- /**
- * Constructs a new OnKeyboardInput object
- */
+ public static final String KEY_DATA = "data";
+ public static final String KEY_EVENT = "event";
+
+ /**
+ * Constructs a new OnKeyboardInput object
+ */
public OnKeyboardInput() {
super(FunctionID.ON_KEYBOARD_INPUT.toString());
}
+
/**
- * <p>
- * Constructs a new OnKeyboardInput object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new OnKeyboardInput object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnKeyboardInput(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new OnKeyboardInput object
*/
@@ -112,10 +113,11 @@ public class OnKeyboardInput extends RPCNotification {
return this;
}
- public OnKeyboardInput setData( String data) {
+ public OnKeyboardInput setData(String data) {
setParameters(KEY_DATA, data);
return this;
}
+
public String getData() {
Object obj = getParameters(KEY_DATA);
if (obj instanceof String) {
@@ -125,8 +127,8 @@ public class OnKeyboardInput extends RPCNotification {
}
@Override
- public String toString(){
- return this.getFunctionName() +": " + " data: " + this.getData() + " event:" + this.getEvent().toString();
+ public String toString() {
+ return this.getFunctionName() + ": " + " data: " + this.getData() + " event:" + this.getEvent().toString();
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
index cc58efaf6..819d7d3a5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -87,27 +87,31 @@ import java.util.Hashtable;
* </tr>
* </table>
* </p>
- *
*/
public class OnLanguageChange extends RPCNotification {
- public static final String KEY_LANGUAGE = "language";
- public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
- /**
- *Constructs a newly allocated OnCommand object
- */
+ public static final String KEY_LANGUAGE = "language";
+ public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
+
+ /**
+ * Constructs a newly allocated OnCommand object
+ */
public OnLanguageChange() {
super(FunctionID.ON_LANGUAGE_CHANGE.toString());
}
+
/**
- *<p>Constructs a newly allocated OnLanguageChange object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
+ * <p>Constructs a newly allocated OnLanguageChange object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
*/
public OnLanguageChange(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnCommand object
- * @param language language that current SDL voice engine(VR+TTS) use
+ * Constructs a newly allocated OnCommand object
+ *
+ * @param language language that current SDL voice engine(VR+TTS) use
* @param hmiDisplayLanguage language that current SDL voice engine(VR+TTS) use
*/
public OnLanguageChange(@NonNull Language language, @NonNull Language hmiDisplayLanguage) {
@@ -115,33 +119,41 @@ public class OnLanguageChange extends RPCNotification {
setLanguage(language);
setHmiDisplayLanguage(hmiDisplayLanguage);
}
+
/**
* <p>Sets language that current SDL voice engine(VR+TTS) use</p>
+ *
* @param language language that current SDL voice engine(VR+TTS) use
*/
public OnLanguageChange setLanguage(@NonNull Language language) {
setParameters(KEY_LANGUAGE, language);
return this;
}
+
/**
* <p>Returns language that current SDL voice engine(VR+TTS) use</p>
+ *
* @return {@linkplain Language} language that current SDL voice engine(VR+TTS) use
- */
+ */
public Language getLanguage() {
- return (Language) getObject(Language.class, KEY_LANGUAGE);
+ return (Language) getObject(Language.class, KEY_LANGUAGE);
}
+
/**
* <p>Sets language that current display use</p>
+ *
* @param hmiDisplayLanguage language that current SDL voice engine(VR+TTS) use
*/
public OnLanguageChange setHmiDisplayLanguage(@NonNull Language hmiDisplayLanguage) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE, hmiDisplayLanguage);
return this;
}
+
/**
* <p>Returns language that current display use</p>
+ *
* @return {@linkplain Language} language that current display use
- */
+ */
public Language getHmiDisplayLanguage() {
return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
index ebc95f699..c1d18e3e9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -81,59 +81,70 @@ import java.util.List;
* </p>
*/
public class OnPermissionsChange extends RPCNotification {
- public static final String KEY_PERMISSION_ITEM = "permissionItem";
- public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
- /**
- *Constructs a newly allocated OnCommand object
- */
- public OnPermissionsChange() {
- super(FunctionID.ON_PERMISSIONS_CHANGE.toString());
- }
- /**
- *<p>Constructs a newly allocated OnPermissionsChange object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
+ public static final String KEY_PERMISSION_ITEM = "permissionItem";
+ public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
+
+ /**
+ * Constructs a newly allocated OnCommand object
+ */
+ public OnPermissionsChange() {
+ super(FunctionID.ON_PERMISSIONS_CHANGE.toString());
+ }
+
+ /**
+ * <p>Constructs a newly allocated OnPermissionsChange object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public OnPermissionsChange(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated OnCommand object
+ *
+ * @param permissionItem an List of PermissionItem describing change in permissions for a given set of RPCs
*/
- public OnPermissionsChange(Hashtable<String, Object> hash) {
- super(hash);
- }
- /**
- *Constructs a newly allocated OnCommand object
- * @param permissionItem an List of PermissionItem describing change in permissions for a given set of RPCs
- */
- public OnPermissionsChange(@NonNull List<PermissionItem> permissionItem) {
- this();
- setPermissionItem(permissionItem);
- }
- /**
+ public OnPermissionsChange(@NonNull List<PermissionItem> permissionItem) {
+ this();
+ setPermissionItem(permissionItem);
+ }
+
+ /**
* <p>Returns List<PermissionItem> object describing change in permissions for a given set of RPCs</p>
- * @return List<{@linkplain PermissionItem}> an object describing describing change in permissions for a given set of RPCs
- */
+ *
+ * @return List<{ @ linkplain PermissionItem }> an object describing describing change in permissions for a given set of RPCs
+ */
@SuppressWarnings("unchecked")
- public List<PermissionItem> getPermissionItem() {
- return (List<PermissionItem>) getObject(PermissionItem.class, KEY_PERMISSION_ITEM);
- }
+ public List<PermissionItem> getPermissionItem() {
+ return (List<PermissionItem>) getObject(PermissionItem.class, KEY_PERMISSION_ITEM);
+ }
+
/**
* <p>Sets PermissionItems describing change in permissions for a given set of RPCs</p>
+ *
* @param permissionItem an List of PermissionItem describing change in permissions for a given set of RPCs
*/
- public OnPermissionsChange setPermissionItem(@NonNull List<PermissionItem> permissionItem) {
+ public OnPermissionsChange setPermissionItem(@NonNull List<PermissionItem> permissionItem) {
setParameters(KEY_PERMISSION_ITEM, permissionItem);
return this;
}
- /**
- * Returns the encryption requirement for this permission change
- * @return true if encryption is required, false otherwise
- */
- public Boolean getRequireEncryption() {
- return getBoolean(KEY_REQUIRE_ENCRYPTION);
- }
+ /**
+ * Returns the encryption requirement for this permission change
+ *
+ * @return true if encryption is required, false otherwise
+ */
+ public Boolean getRequireEncryption() {
+ return getBoolean(KEY_REQUIRE_ENCRYPTION);
+ }
- /**
- * Sets the encryption requirement for this permission change
- * @param isRequired the boolean requirement to be set
- */
- public OnPermissionsChange setRequireEncryption( Boolean isRequired) {
+ /**
+ * Sets the encryption requirement for this permission change
+ *
+ * @param isRequired the boolean requirement to be set
+ */
+ public OnPermissionsChange setRequireEncryption(Boolean isRequired) {
setParameters(KEY_REQUIRE_ENCRYPTION, isRequired);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnRCStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnRCStatus.java
index e2f7831c9..0a2fd0c5d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnRCStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnRCStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,63 +40,64 @@ import java.util.Hashtable;
import java.util.List;
public class OnRCStatus extends RPCNotification {
- public static final String KEY_ALLOCATED_MODULES = "allocatedModules";
- public static final String KEY_FREE_MODULES = "freeModules";
- public static final String KEY_ALLOWED = "allowed";
+ public static final String KEY_ALLOCATED_MODULES = "allocatedModules";
+ public static final String KEY_FREE_MODULES = "freeModules";
+ public static final String KEY_ALLOWED = "allowed";
- /**
- * Constructs a new OnRCStatus object
- */
- public OnRCStatus() {
- super(FunctionID.ON_RC_STATUS.toString());
- }
+ /**
+ * Constructs a new OnRCStatus object
+ */
+ public OnRCStatus() {
+ super(FunctionID.ON_RC_STATUS.toString());
+ }
- /**
- * Constructs a new OnRCStatus object indicated by the Hashtable
- * parameter
- * @param hash The Hashtable to use
- */
- public OnRCStatus(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a new OnRCStatus object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public OnRCStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated OnRCStatus object
- *
- * @param allocatedModules Contains a list (zero or more) of module types that are allocated to the application.
- * @param freeModules Contains a list (zero or more) of module types that are free to access for the application.
- */
- public OnRCStatus(@NonNull List<ModuleData> allocatedModules, @NonNull List<ModuleData> freeModules) {
- this();
- setAllocatedModules(allocatedModules);
- setFreeModules(freeModules);
- }
+ /**
+ * Constructs a newly allocated OnRCStatus object
+ *
+ * @param allocatedModules Contains a list (zero or more) of module types that are allocated to the application.
+ * @param freeModules Contains a list (zero or more) of module types that are free to access for the application.
+ */
+ public OnRCStatus(@NonNull List<ModuleData> allocatedModules, @NonNull List<ModuleData> freeModules) {
+ this();
+ setAllocatedModules(allocatedModules);
+ setFreeModules(freeModules);
+ }
- @SuppressWarnings("unchecked")
- public List<ModuleData> getAllocatedModules() {
- return (List<ModuleData>) getObject(ModuleData.class, KEY_ALLOCATED_MODULES);
- }
+ @SuppressWarnings("unchecked")
+ public List<ModuleData> getAllocatedModules() {
+ return (List<ModuleData>) getObject(ModuleData.class, KEY_ALLOCATED_MODULES);
+ }
- public OnRCStatus setAllocatedModules(@NonNull List<ModuleData> allocatedModules) {
+ public OnRCStatus setAllocatedModules(@NonNull List<ModuleData> allocatedModules) {
setParameters(KEY_ALLOCATED_MODULES, allocatedModules);
return this;
}
- @SuppressWarnings("unchecked")
- public List<ModuleData> getFreeModules() {
- return (List<ModuleData>) getObject(ModuleData.class, KEY_FREE_MODULES);
- }
+ @SuppressWarnings("unchecked")
+ public List<ModuleData> getFreeModules() {
+ return (List<ModuleData>) getObject(ModuleData.class, KEY_FREE_MODULES);
+ }
- public OnRCStatus setFreeModules(@NonNull List<ModuleData> freeModules) {
+ public OnRCStatus setFreeModules(@NonNull List<ModuleData> freeModules) {
setParameters(KEY_FREE_MODULES, freeModules);
return this;
}
- public Boolean getAllowed() {
- return getBoolean(KEY_ALLOWED);
- }
+ public Boolean getAllowed() {
+ return getBoolean(KEY_ALLOWED);
+ }
- public OnRCStatus setAllowed( Boolean allowed) {
+ public OnRCStatus setAllowed(Boolean allowed) {
setParameters(KEY_ALLOWED, allowed);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java
index 98e9088c6..26f51a78d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemCapabilityUpdated.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,38 +43,38 @@ import java.util.Hashtable;
*/
public class OnSystemCapabilityUpdated extends RPCNotification {
- public static final String KEY_SYSTEM_CAPABILITY = "systemCapability";
+ public static final String KEY_SYSTEM_CAPABILITY = "systemCapability";
- // Constructors
+ // Constructors
- public OnSystemCapabilityUpdated() {
- super(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString());
- }
+ public OnSystemCapabilityUpdated() {
+ super(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString());
+ }
- public OnSystemCapabilityUpdated(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public OnSystemCapabilityUpdated(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public OnSystemCapabilityUpdated(@NonNull SystemCapability serviceData) {
- this();
- setSystemCapability(serviceData);
- }
+ public OnSystemCapabilityUpdated(@NonNull SystemCapability serviceData) {
+ this();
+ setSystemCapability(serviceData);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param systemCapability - The system capability that has been updated
- */
- public OnSystemCapabilityUpdated setSystemCapability(@NonNull SystemCapability systemCapability) {
+ /**
+ * @param systemCapability - The system capability that has been updated
+ */
+ public OnSystemCapabilityUpdated setSystemCapability(@NonNull SystemCapability systemCapability) {
setParameters(KEY_SYSTEM_CAPABILITY, systemCapability);
return this;
}
- /**
- * @return systemCapability - The system capability that has been updated
- */
- public SystemCapability getSystemCapability(){
- return (SystemCapability) getObject(SystemCapability.class, KEY_SYSTEM_CAPABILITY);
- }
+ /**
+ * @return systemCapability - The system capability that has been updated
+ */
+ public SystemCapability getSystemCapability() {
+ return (SystemCapability) getObject(SystemCapability.class, KEY_SYSTEM_CAPABILITY);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
index ff7f1b959..940a727eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,7 +49,7 @@ import java.util.List;
/**
* An asynchronous request from the system for specific data from the device or the cloud or response to a request from the device or cloud. Binary data can be included in hybrid part of message for some requests (such as Authentication request responses)
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -118,29 +118,30 @@ import java.util.List;
* <td>SmartDeviceLink 2.3.2 </td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.3.2
*/
public class OnSystemRequest extends RPCNotification {
private static final String TAG = "OnSystemRequest";
- public static final String KEY_URL_V1 = "URL";
+ public static final String KEY_URL_V1 = "URL";
public static final String KEY_URL = "url";
- public static final String KEY_TIMEOUT_V1 = "Timeout";
+ public static final String KEY_TIMEOUT_V1 = "Timeout";
public static final String KEY_TIMEOUT = "timeout";
- public static final String KEY_HEADERS = "headers";
- public static final String KEY_BODY = "body";
- public static final String KEY_FILE_TYPE = "fileType";
- public static final String KEY_REQUEST_TYPE = "requestType";
- public static final String KEY_REQUEST_SUB_TYPE = "requestSubType";
- public static final String KEY_DATA = "data";
- public static final String KEY_OFFSET = "offset";
- public static final String KEY_LENGTH = "length";
-
- private String body;
- private Headers headers;
-
- /**
- * Constructs a new OnSystemsRequest object
- */
+ public static final String KEY_HEADERS = "headers";
+ public static final String KEY_BODY = "body";
+ public static final String KEY_FILE_TYPE = "fileType";
+ public static final String KEY_REQUEST_TYPE = "requestType";
+ public static final String KEY_REQUEST_SUB_TYPE = "requestSubType";
+ public static final String KEY_DATA = "data";
+ public static final String KEY_OFFSET = "offset";
+ public static final String KEY_LENGTH = "length";
+
+ private String body;
+ private Headers headers;
+
+ /**
+ * Constructs a new OnSystemsRequest object
+ */
public OnSystemRequest() {
super(FunctionID.ON_SYSTEM_REQUEST.toString());
}
@@ -148,117 +149,117 @@ public class OnSystemRequest extends RPCNotification {
public OnSystemRequest(Hashtable<String, Object> hash) {
this(hash, (byte[]) hash.get(RPCStruct.KEY_BULK_DATA));
}
-
- public OnSystemRequest(Hashtable<String, Object> hash, byte[] bulkData){
+
+ public OnSystemRequest(Hashtable<String, Object> hash, byte[] bulkData) {
super(hash);
setBulkData(bulkData);
}
/**
- * Constructs a new OnSystemsRequest object
+ * Constructs a new OnSystemsRequest object
*/
public OnSystemRequest(@NonNull RequestType requestType) {
this();
setRequestType(requestType);
}
-
- private void handleBulkData(byte[] bulkData){
- if(bulkData == null){
+
+ private void handleBulkData(byte[] bulkData) {
+ if (bulkData == null) {
return;
}
-
+
JSONObject httpJson;
String tempBody = null;
Headers tempHeaders = null;
- if(RequestType.PROPRIETARY.equals(this.getRequestType())){
- try{
- JSONObject bulkJson = new JSONObject(new String(bulkData));
-
- httpJson = bulkJson.getJSONObject("HTTPRequest");
- tempBody = getBody(httpJson);
- tempHeaders = getHeaders(httpJson);
- }catch(JSONException e){
+ if (RequestType.PROPRIETARY.equals(this.getRequestType())) {
+ try {
+ JSONObject bulkJson = new JSONObject(new String(bulkData));
+
+ httpJson = bulkJson.getJSONObject("HTTPRequest");
+ tempBody = getBody(httpJson);
+ tempHeaders = getHeaders(httpJson);
+ } catch (JSONException e) {
DebugTool.logError(TAG, "HTTPRequest in bulk data was malformed.");
- e.printStackTrace();
- }catch(NullPointerException e){
+ e.printStackTrace();
+ } catch (NullPointerException e) {
DebugTool.logError(TAG, "Invalid HTTPRequest object in bulk data.");
- e.printStackTrace();
- }
- }else if(RequestType.HTTP.equals(this.getRequestType())){
- tempHeaders = new Headers();
- tempHeaders.setContentType("application/json");
- tempHeaders.setConnectTimeout(7);
- tempHeaders.setDoOutput(true);
- tempHeaders.setDoInput(true);
- tempHeaders.setUseCaches(false);
- tempHeaders.setRequestMethod("POST");
- tempHeaders.setReadTimeout(7);
- tempHeaders.setInstanceFollowRedirects(false);
- tempHeaders.setCharset("utf-8");
- tempHeaders.setContentLength(bulkData.length);
+ e.printStackTrace();
+ }
+ } else if (RequestType.HTTP.equals(this.getRequestType())) {
+ tempHeaders = new Headers();
+ tempHeaders.setContentType("application/json");
+ tempHeaders.setConnectTimeout(7);
+ tempHeaders.setDoOutput(true);
+ tempHeaders.setDoInput(true);
+ tempHeaders.setUseCaches(false);
+ tempHeaders.setRequestMethod("POST");
+ tempHeaders.setReadTimeout(7);
+ tempHeaders.setInstanceFollowRedirects(false);
+ tempHeaders.setCharset("utf-8");
+ tempHeaders.setContentLength(bulkData.length);
}
-
+
this.body = tempBody;
this.headers = tempHeaders;
}
-
- private String getBody(JSONObject httpJson){
+
+ private String getBody(JSONObject httpJson) {
String result = null;
-
- try{
+
+ try {
result = httpJson.getString(KEY_BODY);
- }catch(JSONException e){
+ } catch (JSONException e) {
DebugTool.logError(TAG, KEY_BODY + " key doesn't exist in bulk data.");
e.printStackTrace();
}
-
+
return result;
}
-
- private Headers getHeaders(JSONObject httpJson){
+
+ private Headers getHeaders(JSONObject httpJson) {
Headers result = null;
-
- try{
+
+ try {
JSONObject httpHeadersJson = httpJson.getJSONObject(KEY_HEADERS);
Hashtable<String, Object> httpHeadersHash = JsonRPCMarshaller.deserializeJSONObject(httpHeadersJson);
result = new Headers(httpHeadersHash);
- }catch(JSONException e){
+ } catch (JSONException e) {
DebugTool.logError(TAG, KEY_HEADERS + " key doesn't exist in bulk data.");
e.printStackTrace();
}
-
+
return result;
}
-
+
@Override
- public OnSystemRequest setBulkData(byte[] bulkData){
+ public OnSystemRequest setBulkData(byte[] bulkData) {
super.setBulkData(bulkData);
handleBulkData(bulkData);
return this;
}
-
-
+
+
@SuppressWarnings("unchecked")
public List<String> getLegacyData() {
return (List<String>) getObject(String.class, KEY_DATA);
}
- public String getBody(){
+ public String getBody() {
return this.body;
}
-
- public OnSystemRequest setBody( String body) {
+
+ public OnSystemRequest setBody(String body) {
this.body = body;
return this;
}
-
- public OnSystemRequest setHeaders( Headers header) {
+
+ public OnSystemRequest setHeaders(Headers header) {
this.headers = header;
return this;
}
public Headers getHeader() {
- return this.headers;
+ return this.headers;
}
public RequestType getRequestType() {
@@ -274,28 +275,27 @@ public class OnSystemRequest extends RPCNotification {
return getString(KEY_REQUEST_SUB_TYPE);
}
- public OnSystemRequest setRequestSubType( String requestSubType) {
+ public OnSystemRequest setRequestSubType(String requestSubType) {
setParameters(KEY_REQUEST_SUB_TYPE, requestSubType);
return this;
}
public String getUrl() {
Object o = getParameters(KEY_URL);
- if (o == null)
- {
- //try again for gen 1.1
- o = getParameters(KEY_URL_V1);
+ if (o == null) {
+ //try again for gen 1.1
+ o = getParameters(KEY_URL_V1);
}
if (o == null)
- return null;
-
+ return null;
+
if (o instanceof String) {
return (String) o;
}
return null;
}
- public OnSystemRequest setUrl( String url) {
+ public OnSystemRequest setUrl(String url) {
setParameters(KEY_URL, url);
return this;
}
@@ -304,91 +304,91 @@ public class OnSystemRequest extends RPCNotification {
return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
}
- public OnSystemRequest setFileType( FileType fileType) {
+ public OnSystemRequest setFileType(FileType fileType) {
setParameters(KEY_FILE_TYPE, fileType);
return this;
}
/**
+ * @param offset of the data attached
* @deprecated as of SmartDeviceLink 4.0
- * @param offset of the data attached
*/
- public OnSystemRequest setOffset( Integer offset) {
- if(offset == null){
- setOffset((Long)null);
- }else{
- setOffset(offset.longValue());
- }
+ public OnSystemRequest setOffset(Integer offset) {
+ if (offset == null) {
+ setOffset((Long) null);
+ } else {
+ setOffset(offset.longValue());
+ }
return this;
}
-
+
public Long getOffset() {
final Object o = getParameters(KEY_OFFSET);
-
- if (o == null){
- return null;
+
+ if (o == null) {
+ return null;
}
-
+
if (o instanceof Integer) {
return ((Integer) o).longValue();
- }else if(o instanceof Long){
- return (Long) o;
+ } else if (o instanceof Long) {
+ return (Long) o;
}
return null;
}
- public OnSystemRequest setOffset( Long offset) {
+ public OnSystemRequest setOffset(Long offset) {
setParameters(KEY_OFFSET, offset);
return this;
}
-
+
public Integer getTimeout() {
Object o = getParameters(KEY_TIMEOUT);
-
- if (o == null){
- o = getParameters(KEY_TIMEOUT_V1);
- if (o == null) return null;
+
+ if (o == null) {
+ o = getParameters(KEY_TIMEOUT_V1);
+ if (o == null) return null;
}
-
+
if (o instanceof Integer) {
return (Integer) o;
}
return null;
}
- public OnSystemRequest setTimeout( Integer timeout) {
+ public OnSystemRequest setTimeout(Integer timeout) {
setParameters(KEY_TIMEOUT, timeout);
return this;
}
-
+
public Long getLength() {
final Object o = getParameters(KEY_LENGTH);
- if (o == null){
- return null;
+ if (o == null) {
+ return null;
}
-
+
if (o instanceof Integer) {
return ((Integer) o).longValue();
- }else if(o instanceof Long){
- return (Long) o;
+ } else if (o instanceof Long) {
+ return (Long) o;
}
return null;
}
/**
- * @deprecated as of SmartDeviceLink 4.0
* @param length of the data attached
+ * @deprecated as of SmartDeviceLink 4.0
*/
- public OnSystemRequest setLength( Integer length) {
- if(length == null){
- setLength((Long)null);
- }else{
- setLength(length.longValue());
- }
+ public OnSystemRequest setLength(Integer length) {
+ if (length == null) {
+ setLength((Long) null);
+ } else {
+ setLength(length.longValue());
+ }
return this;
}
-
- public OnSystemRequest setLength( Long length) {
+
+ public OnSystemRequest setLength(Long length) {
setParameters(KEY_LENGTH, length);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
index 977e2afe9..8c16f5232 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -45,11 +45,11 @@ import java.util.Hashtable;
* <p></p>
* <b>HMI Status Requirements:</b>
* <ul>
- * HMILevel:
+ * HMILevel:
* <ul><li>Can be sent with FULL, LIMITED or BACKGROUND</li></ul>
- * AudioStreamingState:
+ * AudioStreamingState:
* <ul><li>Any</li></ul>
- * SystemContext:
+ * SystemContext:
* <ul><li>Any</li></ul>
* </ul>
* <p></p>
@@ -68,44 +68,53 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 1.0
- *
*/
public class OnTBTClientState extends RPCNotification {
- public static final String KEY_STATE = "state";
- /**
- *Constructs a newly allocated OnTBTClientState object
- */
+ public static final String KEY_STATE = "state";
+
+ /**
+ * Constructs a newly allocated OnTBTClientState object
+ */
public OnTBTClientState() {
super(FunctionID.ON_TBT_CLIENT_STATE.toString());
}
+
/**
- *<p>Constructs a newly allocated OnTBTClientState object indicated by the Hashtable parameter</p>
- *@param hash The Hashtable to use
- */
+ * <p>Constructs a newly allocated OnTBTClientState object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnTBTClientState(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
- *Constructs a newly allocated OnTBTClientState object
+ * Constructs a newly allocated OnTBTClientState object
+ *
* @param state current state of TBT client
*/
public OnTBTClientState(@NonNull TBTState state) {
this();
setState(state);
}
+
/**
* <p>Called to get the current state of TBT client</p>
+ *
* @return {@linkplain TBTState} the current state of TBT client
- */
+ */
public TBTState getState() {
return (TBTState) getObject(TBTState.class, KEY_STATE);
}
+
/**
* <p>Called to set the current state of TBT client</p>
+ *
* @param state current state of TBT client
*/
- public OnTBTClientState setState( TBTState state) {
+ public OnTBTClientState setState(TBTState state) {
setParameters(KEY_STATE, state);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
index bdc83bfab..07bfa0393 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,10 +41,9 @@ import java.util.Hashtable;
import java.util.List;
/**
- *
* Notifies about touch events on the screen's prescribed area.
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -70,61 +69,61 @@ import java.util.List;
* <td>minsize:1; maxsize:10</td>
* <td>SmartDeviceLink 3.0 </td>
* </tr>
- * </table>
- *
+ * </table>
+ *
* <p><b>Note:</b></p>
* <p>SDL needs to be informed about every User`s touching the touch screen.</p>
- *
*/
public class OnTouchEvent extends RPCNotification {
- public static final String KEY_EVENT = "event";
- public static final String KEY_TYPE = "type";
- /**
- * Constructs a new OnTouchEvent object
- */
+ public static final String KEY_EVENT = "event";
+ public static final String KEY_TYPE = "type";
+
+ /**
+ * Constructs a new OnTouchEvent object
+ */
+
+ public OnTouchEvent() {
+ super(FunctionID.ON_TOUCH_EVENT.toString());
+ }
- public OnTouchEvent() {
- super(FunctionID.ON_TOUCH_EVENT.toString());
- }
- /**
- * <p>
- * Constructs a new OnTouchEvent object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>
+ * Constructs a new OnTouchEvent object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public OnTouchEvent(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new OnTouchEvent object
- */
- public OnTouchEvent(@NonNull TouchType type, @NonNull List<TouchEvent> event) {
- this();
- setType(type);
- setEvent(event);
- }
-
+ /**
+ * Constructs a new OnTouchEvent object
+ */
+ public OnTouchEvent(@NonNull TouchType type, @NonNull List<TouchEvent> event) {
+ this();
+ setType(type);
+ setEvent(event);
+ }
+
public OnTouchEvent setType(@NonNull TouchType type) {
setParameters(KEY_TYPE, type);
return this;
}
-
+
public TouchType getType() {
- return (TouchType) getObject(TouchType.class, KEY_TYPE);
+ return (TouchType) getObject(TouchType.class, KEY_TYPE);
}
-
+
public OnTouchEvent setEvent(@NonNull List<TouchEvent> event) {
setParameters(KEY_EVENT, event);
return this;
}
-
+
@SuppressWarnings("unchecked")
public List<TouchEvent> getEvent() {
- return (List<TouchEvent>) getObject(TouchEvent.class, KEY_EVENT);
+ return (List<TouchEvent>) getObject(TouchEvent.class, KEY_EVENT);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnUpdateSubMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnUpdateSubMenu.java
index 1b12dd76a..0fafc37ef 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnUpdateSubMenu.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnUpdateSubMenu.java
@@ -123,10 +123,10 @@ public class OnUpdateSubMenu extends RPCNotification {
* Sets the updateSubCells.
*
* @param updateSubCells If not set, assume false. If true, the app should send AddCommands with parentIDs matching
- * the menuID. These AddCommands will then be attached to the submenu and displayed if the
- * submenu is selected.
+ * the menuID. These AddCommands will then be attached to the submenu and displayed if the
+ * submenu is selected.
*/
- public OnUpdateSubMenu setUpdateSubCells( Boolean updateSubCells) {
+ public OnUpdateSubMenu setUpdateSubCells(Boolean updateSubCells) {
setParameters(KEY_UPDATE_SUB_CELLS, updateSubCells);
return this;
}
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 b18fd2c50..e8f5b57ca 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -45,18 +45,18 @@ import java.util.Hashtable;
import java.util.List;
/**
- *Individual requested DID result and data.
+ * Individual requested DID result and data.
+ *
*
- *
* <p>Callback for the periodic and non periodic vehicle data read function.</p>
- *
+ *
* <p> <b>Note:</b></p>
- *
+ * <p>
* Initially SDL sends SubscribeVehicleData for getting the periodic updates from HMI whenever each of subscribed data types changes. OnVehicleData is expected to bring such updated values to SDL
- *
*
- *
- *
+ *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -301,8 +301,8 @@ import java.util.List;
* <td>cloudAppVehicleID</td>
* <td>String</td>
* <td>ID for the vehicle when connecting to cloud applications</td>
- * <td>N</td>
- * <td></td>
+ * <td>N</td>
+ * <td></td>
* <td>SmartDeviceLink 5.1 </td>
* </tr>
* <tr>
@@ -328,41 +328,38 @@ import java.util.List;
* </tr>
* </table>
*
- * @since SmartDeviceLink 1.0
- *
* @see SubscribeVehicleData
* @see UnsubscribeVehicleData
- *
- *
+ * @since SmartDeviceLink 1.0
*/
public class OnVehicleData extends RPCNotification {
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_VIN = "vin";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_VIN = "vin";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
@@ -383,40 +380,47 @@ public class OnVehicleData extends RPCNotification {
public OnVehicleData() {
super(FunctionID.ON_VEHICLE_DATA.toString());
}
+
public OnVehicleData(Hashtable<String, Object> hash) {
super(hash);
}
- public OnVehicleData setGps( GPSData gps) {
+
+ public OnVehicleData setGps(GPSData gps) {
setParameters(KEY_GPS, gps);
return this;
}
+
public GPSData getGps() {
return (GPSData) getObject(GPSData.class, KEY_GPS);
}
- public OnVehicleData setSpeed( Double speed) {
+
+ public OnVehicleData setSpeed(Double speed) {
setParameters(KEY_SPEED, speed);
return this;
}
+
public Double getSpeed() {
- Object object = getParameters(KEY_SPEED);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_SPEED);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setRpm( Integer rpm) {
+
+ public OnVehicleData setRpm(Integer rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
+
public Integer getRpm() {
- return getInteger(KEY_RPM);
+ return getInteger(KEY_RPM);
}
/**
* Sets the fuelLevel.
*
* @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
+ * 7.0, please see fuelRange.
*/
@Deprecated
- public OnVehicleData setFuelLevel( Double fuelLevel) {
+ public OnVehicleData setFuelLevel(Double fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
@@ -429,40 +433,48 @@ public class OnVehicleData extends RPCNotification {
*/
@Deprecated
public Double getFuelLevel() {
- Object object = getParameters(KEY_FUEL_LEVEL);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_FUEL_LEVEL);
+ return SdlDataTypeConverter.objectToDouble(object);
}
+
@Deprecated
- public OnVehicleData setFuelLevelState( ComponentVolumeStatus fuelLevelState) {
+ public OnVehicleData setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
+
@Deprecated
public ComponentVolumeStatus getFuelLevelState() {
return (ComponentVolumeStatus) getObject(ComponentVolumeStatus.class, KEY_FUEL_LEVEL_STATE);
}
- public OnVehicleData setInstantFuelConsumption( Double instantFuelConsumption) {
+
+ public OnVehicleData setInstantFuelConsumption(Double instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
+
public Double getInstantFuelConsumption() {
- Object object = getParameters(KEY_INSTANT_FUEL_CONSUMPTION);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_INSTANT_FUEL_CONSUMPTION);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setExternalTemperature( Double externalTemperature) {
+
+ public OnVehicleData setExternalTemperature(Double externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
+
public Double getExternalTemperature() {
- Object object = getParameters(KEY_EXTERNAL_TEMPERATURE);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_EXTERNAL_TEMPERATURE);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setVin( String vin) {
+
+ public OnVehicleData setVin(String vin) {
setParameters(KEY_VIN, vin);
return this;
}
+
public String getVin() {
- return getString(KEY_VIN);
+ return getString(KEY_VIN);
}
/**
@@ -472,7 +484,7 @@ public class OnVehicleData extends RPCNotification {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public OnVehicleData setPrndl( PRNDL prndl) {
+ public OnVehicleData setPrndl(PRNDL prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
@@ -493,126 +505,159 @@ public class OnVehicleData extends RPCNotification {
*
* @param tirePressure See TireStatus
*/
- public OnVehicleData setTirePressure( TireStatus tirePressure) {
+ public OnVehicleData setTirePressure(TireStatus tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
+
public TireStatus getTirePressure() {
return (TireStatus) getObject(TireStatus.class, KEY_TIRE_PRESSURE);
}
- public OnVehicleData setOdometer( Integer odometer) {
+
+ public OnVehicleData setOdometer(Integer odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
+
public Integer getOdometer() {
- return getInteger(KEY_ODOMETER);
+ return getInteger(KEY_ODOMETER);
}
- public OnVehicleData setBeltStatus( BeltStatus beltStatus) {
+
+ public OnVehicleData setBeltStatus(BeltStatus beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
+
public BeltStatus getBeltStatus() {
return (BeltStatus) getObject(BeltStatus.class, KEY_BELT_STATUS);
}
- public OnVehicleData setBodyInformation( BodyInformation bodyInformation) {
+
+ public OnVehicleData setBodyInformation(BodyInformation bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
+
public BodyInformation getBodyInformation() {
return (BodyInformation) getObject(BodyInformation.class, KEY_BODY_INFORMATION);
}
- public OnVehicleData setDeviceStatus( DeviceStatus deviceStatus) {
+
+ public OnVehicleData setDeviceStatus(DeviceStatus deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
+
public DeviceStatus getDeviceStatus() {
return (DeviceStatus) getObject(DeviceStatus.class, KEY_DEVICE_STATUS);
}
- public OnVehicleData setDriverBraking( VehicleDataEventStatus driverBraking) {
+
+ public OnVehicleData setDriverBraking(VehicleDataEventStatus driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
+
public VehicleDataEventStatus getDriverBraking() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_BRAKING);
}
- public OnVehicleData setWiperStatus( WiperStatus wiperStatus) {
+
+ public OnVehicleData setWiperStatus(WiperStatus wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
+
public WiperStatus getWiperStatus() {
return (WiperStatus) getObject(WiperStatus.class, KEY_WIPER_STATUS);
}
- public OnVehicleData setHeadLampStatus( HeadLampStatus headLampStatus) {
+
+ public OnVehicleData setHeadLampStatus(HeadLampStatus headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
+
public HeadLampStatus getHeadLampStatus() {
return (HeadLampStatus) getObject(HeadLampStatus.class, KEY_HEAD_LAMP_STATUS);
}
- public OnVehicleData setEngineTorque( Double engineTorque) {
+
+ public OnVehicleData setEngineTorque(Double engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
+
public Double getEngineTorque() {
Object object = getParameters(KEY_ENGINE_TORQUE);
return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setEngineOilLife( Float engineOilLife) {
+
+ public OnVehicleData setEngineOilLife(Float engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
+
public Float getEngineOilLife() {
Object object = getParameters(KEY_ENGINE_OIL_LIFE);
return SdlDataTypeConverter.objectToFloat(object);
}
- public OnVehicleData setAccPedalPosition( Double accPedalPosition) {
+
+ public OnVehicleData setAccPedalPosition(Double accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
+
public Double getAccPedalPosition() {
- Object object = getParameters(KEY_ACC_PEDAL_POSITION);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_ACC_PEDAL_POSITION);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setSteeringWheelAngle( Double steeringWheelAngle) {
+
+ public OnVehicleData setSteeringWheelAngle(Double steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
+
public Double getSteeringWheelAngle() {
- Object object = getParameters(KEY_STEERING_WHEEL_ANGLE);
- return SdlDataTypeConverter.objectToDouble(object);
+ Object object = getParameters(KEY_STEERING_WHEEL_ANGLE);
+ return SdlDataTypeConverter.objectToDouble(object);
}
- public OnVehicleData setECallInfo( ECallInfo eCallInfo) {
+
+ public OnVehicleData setECallInfo(ECallInfo eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public ECallInfo getECallInfo() {
return (ECallInfo) getObject(ECallInfo.class, KEY_E_CALL_INFO);
}
- public OnVehicleData setAirbagStatus( AirbagStatus airbagStatus) {
+
+ public OnVehicleData setAirbagStatus(AirbagStatus airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public AirbagStatus getAirbagStatus() {
return (AirbagStatus) getObject(AirbagStatus.class, KEY_AIRBAG_STATUS);
}
- public OnVehicleData setEmergencyEvent( EmergencyEvent emergencyEvent) {
+
+ public OnVehicleData setEmergencyEvent(EmergencyEvent emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public EmergencyEvent getEmergencyEvent() {
return (EmergencyEvent) getObject(EmergencyEvent.class, KEY_EMERGENCY_EVENT);
}
- public OnVehicleData setClusterModeStatus( ClusterModeStatus clusterModeStatus) {
+
+ public OnVehicleData setClusterModeStatus(ClusterModeStatus clusterModeStatus) {
setParameters(KEY_CLUSTER_MODE_STATUS, clusterModeStatus);
return this;
}
+
public ClusterModeStatus getClusterModeStatus() {
return (ClusterModeStatus) getObject(ClusterModeStatus.class, KEY_CLUSTER_MODE_STATUS);
}
- public OnVehicleData setMyKey( MyKey myKey) {
+
+ public OnVehicleData setMyKey(MyKey myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public MyKey getMyKey() {
return (MyKey) getObject(MyKey.class, KEY_MY_KEY);
}
@@ -621,11 +666,11 @@ public class OnVehicleData extends RPCNotification {
* Sets the fuelRange.
*
* @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
- * {"array_min_size": 0, "array_max_size": 100}
+ * vehicle. See struct FuelRange for details.
+ * {"array_min_size": 0, "array_max_size": 100}
* @since SmartDeviceLink 5.0.0
*/
- public OnVehicleData setFuelRange( List<FuelRange> fuelRange) {
+ public OnVehicleData setFuelRange(List<FuelRange> fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
@@ -637,7 +682,6 @@ public class OnVehicleData extends RPCNotification {
* vehicle. See struct FuelRange for details.
* {"array_min_size": 0, "array_max_size": 100}
* @since SmartDeviceLink 5.0.0
-
*/
@SuppressWarnings("unchecked")
public List<FuelRange> getFuelRange() {
@@ -646,15 +690,17 @@ public class OnVehicleData extends RPCNotification {
/**
* Sets turnSignal
+ *
* @param turnSignal
*/
- public OnVehicleData setTurnSignal( TurnSignal turnSignal) {
+ public OnVehicleData setTurnSignal(TurnSignal turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
/**
* Gets turnSignal
+ *
* @return TurnSignal
*/
public TurnSignal getTurnSignal() {
@@ -663,53 +709,59 @@ public class OnVehicleData extends RPCNotification {
/**
* Sets electronicParkBrakeStatus
+ *
* @param electronicParkBrakeStatus
*/
- public OnVehicleData setElectronicParkBrakeStatus( ElectronicParkBrakeStatus electronicParkBrakeStatus) {
+ public OnVehicleData setElectronicParkBrakeStatus(ElectronicParkBrakeStatus electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
/**
* Gets electronicParkBrakeStatus
+ *
* @return ElectronicParkBrakeStatus
*/
- public ElectronicParkBrakeStatus getElectronicParkBrakeStatus(){
+ public ElectronicParkBrakeStatus getElectronicParkBrakeStatus() {
return (ElectronicParkBrakeStatus) getObject(ElectronicParkBrakeStatus.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
/**
* Sets a string value for the cloud app vehicle ID
+ *
* @param cloudAppVehicleID a string value
*/
- public OnVehicleData setCloudAppVehicleID( String cloudAppVehicleID) {
+ public OnVehicleData setCloudAppVehicleID(String cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
/**
* Gets a String value of the returned cloud app vehicle ID
+ *
* @return a String value.
*/
- public String getCloudAppVehicleID(){
+ public String getCloudAppVehicleID() {
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
/**
* Sets a value for OEM Custom VehicleData.
- * @param vehicleDataName a String value
+ *
+ * @param vehicleDataName a String value
* @param vehicleDataState a VehicleDataResult value
*/
- public OnVehicleData setOEMCustomVehicleData( String vehicleDataName, Object vehicleDataState) {
+ public OnVehicleData setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
/**
* Gets a VehicleData value for the vehicle data item.
+ *
* @return a Object related to the vehicle data
*/
- public Object getOEMCustomVehicleData(String vehicleDataName){
+ public Object getOEMCustomVehicleData(String vehicleDataName) {
return getParameters(vehicleDataName);
}
@@ -719,7 +771,7 @@ public class OnVehicleData extends RPCNotification {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public OnVehicleData setWindowStatus( List<WindowStatus> windowStatus) {
+ public OnVehicleData setWindowStatus(List<WindowStatus> windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -751,7 +803,7 @@ public class OnVehicleData extends RPCNotification {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public OnVehicleData setStabilityControlsStatus( StabilityControlsStatus stabilityControlsStatus) {
+ public OnVehicleData setStabilityControlsStatus(StabilityControlsStatus stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
@@ -762,7 +814,7 @@ public class OnVehicleData extends RPCNotification {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public OnVehicleData setHandsOffSteering( Boolean handsOffSteering) {
+ public OnVehicleData setHandsOffSteering(Boolean handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -776,13 +828,14 @@ public class OnVehicleData extends RPCNotification {
public Boolean getHandsOffSteering() {
return getBoolean(KEY_HANDS_OFF_STEERING);
}
+
/**
* Sets the gearStatus.
*
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public OnVehicleData setGearStatus( GearStatus gearStatus) {
+ public OnVehicleData setGearStatus(GearStatus gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
index 27809115b..5d54d4eeb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,27 +40,27 @@ import java.util.Hashtable;
import java.util.List;
public class OnWayPointChange extends RPCNotification {
- public static final String KEY_WAY_POINTS = "wayPoints";
+ public static final String KEY_WAY_POINTS = "wayPoints";
- public OnWayPointChange() {
- super(FunctionID.ON_WAY_POINT_CHANGE.toString());
- }
+ public OnWayPointChange() {
+ super(FunctionID.ON_WAY_POINT_CHANGE.toString());
+ }
- public OnWayPointChange(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public OnWayPointChange(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public OnWayPointChange(@NonNull List<LocationDetails> wayPoints) {
- this();
- setWayPoints(wayPoints);
- }
+ public OnWayPointChange(@NonNull List<LocationDetails> wayPoints) {
+ this();
+ setWayPoints(wayPoints);
+ }
@SuppressWarnings("unchecked")
- public List<LocationDetails> getWayPoints() {
- return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
- }
+ public List<LocationDetails> getWayPoints() {
+ return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
+ }
- public OnWayPointChange setWayPoints(@NonNull List<LocationDetails> wayPoints) {
+ public OnWayPointChange setWayPoints(@NonNull List<LocationDetails> wayPoints) {
setParameters(KEY_WAY_POINTS, wayPoints);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
index be856f93b..cd563bc64 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -53,10 +53,10 @@ import java.util.List;
* <td>String</td>
* <td>A set of all parameters that are permitted for this given RPC.
* <ul>
- * <li>Min size: 0</li>
- * <li>Max size: 100</li>
- * <li>Max length: 100</li>
- * </ul>
+ * <li>Min size: 0</li>
+ * <li>Max size: 100</li>
+ * <li>Max length: 100</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -65,27 +65,30 @@ import java.util.List;
* <td>String</td>
* <td>A set of all parameters that are prohibited for this given RPC.
* <ul>
- * <li>Min size: 0</li>
- * <li>Max size: 100</li>
- * <li>Max length: 100</li>
- * </ul>
+ * <li>Min size: 0</li>
+ * <li>Max size: 100</li>
+ * <li>Max length: 100</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class ParameterPermissions extends RPCStruct {
- public static final String KEY_ALLOWED = "allowed";
- public static final String KEY_USER_DISALLOWED = "userDisallowed";
+ public static final String KEY_ALLOWED = "allowed";
+ public static final String KEY_USER_DISALLOWED = "userDisallowed";
+
+ /**
+ * Constructs a newly allocated ParameterPermissions object
+ */
+ public ParameterPermissions() {
+ }
- /**
- * Constructs a newly allocated ParameterPermissions object
- */
- public ParameterPermissions() { }
-
/**
* Constructs a newly allocated ParameterPermissions object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public ParameterPermissions(Hashtable<String, Object> hash) {
@@ -93,8 +96,9 @@ public class ParameterPermissions extends RPCStruct {
}
/**
- * Constructs a newly allocated ParameterPermissions object
- * @param allowed parameter that is permitted for this given RPC
+ * Constructs a newly allocated ParameterPermissions object
+ *
+ * @param allowed parameter that is permitted for this given RPC
* @param userDisallowed parameter that is prohibited for this given RPC
*/
public ParameterPermissions(@NonNull List<String> allowed, @NonNull List<String> userDisallowed) {
@@ -105,33 +109,37 @@ public class ParameterPermissions extends RPCStruct {
/**
* get a set of all parameters that are permitted for this given RPC.
+ *
* @return a set of all parameters that are permitted for this given RPC.
*/
@SuppressWarnings("unchecked")
public List<String> getAllowed() {
return (List<String>) getObject(String.class, KEY_ALLOWED);
}
-
+
/**
* set a set of all parameters that are permitted for this given RPC.
+ *
* @param allowed parameter that is permitted for this given RPC
*/
public ParameterPermissions setAllowed(@NonNull List<String> allowed) {
setValue(KEY_ALLOWED, allowed);
return this;
}
-
+
/**
* get a set of all parameters that are prohibited for this given RPC.
+ *
* @return a set of all parameters that are prohibited for this given RPC
*/
@SuppressWarnings("unchecked")
public List<String> getUserDisallowed() {
return (List<String>) getObject(String.class, KEY_USER_DISALLOWED);
}
-
+
/**
* set a set of all parameters that are prohibited for this given RPC.
+ *
* @param userDisallowed parameter that is prohibited for this given RPC
*/
public ParameterPermissions setUserDisallowed(@NonNull List<String> userDisallowed) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java
index af70ab1c0..4fa15c77b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteraction.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,97 +40,105 @@ import java.util.Hashtable;
public class PerformAppServiceInteraction extends RPCRequest {
- public static final String KEY_SERVICE_URI = "serviceUri";
- public static final String KEY_SERVICE_ID = "serviceID";
- public static final String KEY_ORIGIN_APP = "originApp";
- public static final String KEY_REQUEST_SERVICE_ACTIVE = "requestServiceActive";
-
- // Constructors
-
- public PerformAppServiceInteraction() {
- super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
- }
-
- public PerformAppServiceInteraction(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public PerformAppServiceInteraction(@NonNull String serviceUri, @NonNull String appServiceId, @NonNull String originApp) {
- this();
- setServiceUri(serviceUri);
- setServiceID(appServiceId);
- setOriginApp(originApp);
- }
-
- /**
- * Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this
- * URI is correct.
- * @param serviceUri -
- */
- public PerformAppServiceInteraction setServiceUri(@NonNull String serviceUri) {
+ public static final String KEY_SERVICE_URI = "serviceUri";
+ public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_ORIGIN_APP = "originApp";
+ public static final String KEY_REQUEST_SERVICE_ACTIVE = "requestServiceActive";
+
+ // Constructors
+
+ public PerformAppServiceInteraction() {
+ super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
+ }
+
+ public PerformAppServiceInteraction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public PerformAppServiceInteraction(@NonNull String serviceUri, @NonNull String appServiceId, @NonNull String originApp) {
+ this();
+ setServiceUri(serviceUri);
+ setServiceID(appServiceId);
+ setOriginApp(originApp);
+ }
+
+ /**
+ * Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this
+ * URI is correct.
+ *
+ * @param serviceUri -
+ */
+ public PerformAppServiceInteraction setServiceUri(@NonNull String serviceUri) {
setParameters(KEY_SERVICE_URI, serviceUri);
return this;
}
- /**
- * Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this
- * URI is correct.
- * @return serviceUri
- */
- public String getServiceUri(){
- return getString(KEY_SERVICE_URI);
- }
-
- /**
- * The service ID that the app consumer wishes to send this URI.
- * @param appServiceId -
- */
- public PerformAppServiceInteraction setServiceID(@NonNull String appServiceId) {
+ /**
+ * Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this
+ * URI is correct.
+ *
+ * @return serviceUri
+ */
+ public String getServiceUri() {
+ return getString(KEY_SERVICE_URI);
+ }
+
+ /**
+ * The service ID that the app consumer wishes to send this URI.
+ *
+ * @param appServiceId -
+ */
+ public PerformAppServiceInteraction setServiceID(@NonNull String appServiceId) {
setParameters(KEY_SERVICE_ID, appServiceId);
return this;
}
- /**
- * The service ID that the app consumer wishes to send this URI.
- * @return appServiceId
- */
- public String getServiceID(){
- return getString(KEY_SERVICE_ID);
- }
-
- /**
- * This string is the appID of the app requesting the app service provider take the specific action.
- * @param originApp -
- */
- public PerformAppServiceInteraction setOriginApp(@NonNull String originApp) {
+ /**
+ * The service ID that the app consumer wishes to send this URI.
+ *
+ * @return appServiceId
+ */
+ public String getServiceID() {
+ return getString(KEY_SERVICE_ID);
+ }
+
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ *
+ * @param originApp -
+ */
+ public PerformAppServiceInteraction setOriginApp(@NonNull String originApp) {
setParameters(KEY_ORIGIN_APP, originApp);
return this;
}
- /**
- * This string is the appID of the app requesting the app service provider take the specific action.
- * @return originApp
- */
- public String getOriginApp(){
- return getString(KEY_ORIGIN_APP);
- }
-
- /**
- * This flag signals the requesting consumer would like this service to become the active primary
- * service of the destination's type.
- * @param requestServiceActive -
- */
- public PerformAppServiceInteraction setRequestServiceActive( Boolean requestServiceActive) {
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ *
+ * @return originApp
+ */
+ public String getOriginApp() {
+ return getString(KEY_ORIGIN_APP);
+ }
+
+ /**
+ * This flag signals the requesting consumer would like this service to become the active primary
+ * service of the destination's type.
+ *
+ * @param requestServiceActive -
+ */
+ public PerformAppServiceInteraction setRequestServiceActive(Boolean requestServiceActive) {
setParameters(KEY_REQUEST_SERVICE_ACTIVE, requestServiceActive);
return this;
}
- /**
- * This string is the appID of the app requesting the app service provider take the specific action.
- * @return requestServiceActive
- */
- public Boolean getRequestServiceActive(){
- return getBoolean(KEY_REQUEST_SERVICE_ACTIVE);
- }
+ /**
+ * This string is the appID of the app requesting the app service provider take the specific action.
+ *
+ * @return requestServiceActive
+ */
+ public Boolean getRequestServiceActive() {
+ return getBoolean(KEY_REQUEST_SERVICE_ACTIVE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java
index 481c91e17..d8ed259ac 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAppServiceInteractionResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,46 +41,50 @@ import java.util.Hashtable;
public class PerformAppServiceInteractionResponse extends RPCResponse {
- public static final String KEY_SERVICE_SPECIFIC_RESULT = "serviceSpecificResult";
+ public static final String KEY_SERVICE_SPECIFIC_RESULT = "serviceSpecificResult";
- /**
- * Constructs a new PerformAppServiceInteractionResponse object
- */
- public PerformAppServiceInteractionResponse() {
- super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
- }
+ /**
+ * Constructs a new PerformAppServiceInteractionResponse object
+ */
+ public PerformAppServiceInteractionResponse() {
+ super(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString());
+ }
- public PerformAppServiceInteractionResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
- /**
- * Constructs a new PerformAppServiceInteractionResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public PerformAppServiceInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ public PerformAppServiceInteractionResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- // Setters / getters
+ /**
+ * Constructs a new PerformAppServiceInteractionResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PerformAppServiceInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
- /**
- * The service can provide specific result strings to the consumer through this param.
- * @param serviceSpecificResult -
- */
- public PerformAppServiceInteractionResponse setServiceSpecificResult( String serviceSpecificResult) {
+ // Setters / getters
+
+ /**
+ * The service can provide specific result strings to the consumer through this param.
+ *
+ * @param serviceSpecificResult -
+ */
+ public PerformAppServiceInteractionResponse setServiceSpecificResult(String serviceSpecificResult) {
setParameters(KEY_SERVICE_SPECIFIC_RESULT, serviceSpecificResult);
return this;
}
- /**
- * The service can provide specific result strings to the consumer through this param.
- * @return serviceSpecificResult
- */
- public String getServiceSpecificResult(){
- return getString(KEY_SERVICE_SPECIFIC_RESULT);
- }
+ /**
+ * The service can provide specific result strings to the consumer through this param.
+ *
+ * @return serviceSpecificResult
+ */
+ public String getServiceSpecificResult() {
+ return getString(KEY_SERVICE_SPECIFIC_RESULT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
index 0e125f8a7..088ef5c8e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -45,11 +45,11 @@ import java.util.List;
/**
* This will open an audio pass thru session. By doing so the app can receive
* audio data through the vehicles microphone
- *
+ *
* <p>Function Group: AudioPassThru</p>
- *
+ *
* <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -117,248 +117,240 @@ import java.util.List;
* <td>SmartDeviceLink 2.0</td>
* </tr>
*
- *
- *
- *
- *
+ *
+ *
+ *
+ *
* </table>
- * @since SmartDeviceLink 2.0
+ *
* @see EndAudioPassThru
+ * @since SmartDeviceLink 2.0
*/
public class PerformAudioPassThru extends RPCRequest {
- public static final String KEY_MAX_DURATION = "maxDuration";
- public static final String KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1 = "audioPassThruDisplayText1";
- public static final String KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2 = "audioPassThruDisplayText2";
+ public static final String KEY_MAX_DURATION = "maxDuration";
+ public static final String KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1 = "audioPassThruDisplayText1";
+ public static final String KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2 = "audioPassThruDisplayText2";
public static final String KEY_MUTE_AUDIO = "muteAudio";
public static final String KEY_SAMPLING_RATE = "samplingRate";
public static final String KEY_AUDIO_TYPE = "audioType";
public static final String KEY_INITIAL_PROMPT = "initialPrompt";
public static final String KEY_BITS_PER_SAMPLE = "bitsPerSample";
-
- /**
- * Constructs a new PerformAudioPassThru object
- */
+
+ /**
+ * Constructs a new PerformAudioPassThru object
+ */
public PerformAudioPassThru() {
super(FunctionID.PERFORM_AUDIO_PASS_THRU.toString());
}
- /**
- * <p>Constructs a new PerformAudioPassThru object indicated by the Hashtable
- * parameter</p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new PerformAudioPassThru object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public PerformAudioPassThru(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new PerformAudioPassThru object
- * @param samplingRate a SamplingRate value representing a 8 or 16 or 22 or 24 khz
- * @param maxDuration an Integer value representing the maximum duration of audio recording in millisecond <b>Notes: </b>Minvalue:1; Maxvalue:1000000
- * @param bitsPerSample a BitsPerSample value representing 8 bit or 16 bit
- * @param audioType an audioType
- */
- public PerformAudioPassThru(@NonNull SamplingRate samplingRate, @NonNull Integer maxDuration, @NonNull BitsPerSample bitsPerSample, @NonNull AudioType audioType) {
- this();
- setSamplingRate(samplingRate);
- setMaxDuration(maxDuration);
- setBitsPerSample(bitsPerSample);
- setAudioType(audioType);
- }
+ /**
+ * Constructs a new PerformAudioPassThru object
+ *
+ * @param samplingRate a SamplingRate value representing a 8 or 16 or 22 or 24 khz
+ * @param maxDuration an Integer value representing the maximum duration of audio recording in millisecond <b>Notes: </b>Minvalue:1; Maxvalue:1000000
+ * @param bitsPerSample a BitsPerSample value representing 8 bit or 16 bit
+ * @param audioType an audioType
+ */
+ public PerformAudioPassThru(@NonNull SamplingRate samplingRate, @NonNull Integer maxDuration, @NonNull BitsPerSample bitsPerSample, @NonNull AudioType audioType) {
+ this();
+ setSamplingRate(samplingRate);
+ setMaxDuration(maxDuration);
+ setBitsPerSample(bitsPerSample);
+ setAudioType(audioType);
+ }
- /**
- * Sets initial prompt which will be spoken before opening the audio pass
- * thru session by SDL
- *
- * @param initialPrompt
- * a List<TTSChunk> value represents the initial prompt which
- * will be spoken before opening the audio pass thru session by
- * SDL
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>This is an array of text chunks of type TTSChunk</li>
- * <li>The array must have at least one item</li>
- * <li>If omitted, then no initial prompt is spoken</li>
- * <li>Array Minsize: 1</li>
- * <li>Array Maxsize: 100</li>
- * </ul>
- */
- public PerformAudioPassThru setInitialPrompt( List<TTSChunk> initialPrompt) {
+ /**
+ * Sets initial prompt which will be spoken before opening the audio pass
+ * thru session by SDL
+ *
+ * @param initialPrompt a List<TTSChunk> value represents the initial prompt which
+ * will be spoken before opening the audio pass thru session by
+ * SDL
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>This is an array of text chunks of type TTSChunk</li>
+ * <li>The array must have at least one item</li>
+ * <li>If omitted, then no initial prompt is spoken</li>
+ * <li>Array Minsize: 1</li>
+ * <li>Array Maxsize: 100</li>
+ * </ul>
+ */
+ public PerformAudioPassThru setInitialPrompt(List<TTSChunk> initialPrompt) {
setParameters(KEY_INITIAL_PROMPT, initialPrompt);
return this;
}
- /**
- * Gets a List value representing an initial prompt which will be spoken
- * before opening the audio pass thru session by SDL
- *
- * @return List<TTSChunk> -a List value representing an initial prompt
- * which will be spoken before opening the audio pass thru session
- * by SDL
- */
+ /**
+ * Gets a List value representing an initial prompt which will be spoken
+ * before opening the audio pass thru session by SDL
+ *
+ * @return List<TTSChunk> -a List value representing an initial prompt
+ * which will be spoken before opening the audio pass thru session
+ * by SDL
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getInitialPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_INITIAL_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_INITIAL_PROMPT);
}
- /**
- * Sets a line of text displayed during audio capture
- *
- * @param audioPassThruDisplayText1
- * <p>a String value representing the line of text displayed during
- * audio capture</p>
- * <p></p>
- * <b>Notes: </b>Maxlength=500
- */
- public PerformAudioPassThru setAudioPassThruDisplayText1( String audioPassThruDisplayText1) {
+ /**
+ * Sets a line of text displayed during audio capture
+ *
+ * @param audioPassThruDisplayText1 <p>a String value representing the line of text displayed during
+ * audio capture</p>
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
+ */
+ public PerformAudioPassThru setAudioPassThruDisplayText1(String audioPassThruDisplayText1) {
setParameters(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1, audioPassThruDisplayText1);
return this;
}
- /**
- * Gets a first line of text displayed during audio capture
- *
- * @return String -a String value representing a first line of text
- * displayed during audio capture
- */
+ /**
+ * Gets a first line of text displayed during audio capture
+ *
+ * @return String -a String value representing a first line of text
+ * displayed during audio capture
+ */
public String getAudioPassThruDisplayText1() {
- return getString(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1);
+ return getString(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_1);
}
- /**
- * Sets a line of text displayed during audio capture
- *
- * @param audioPassThruDisplayText2
- * <p>a String value representing the line of text displayed during
- * audio capture</p>
- * <p></p>
- * <b>Notes: </b>Maxlength=500
- */
- public PerformAudioPassThru setAudioPassThruDisplayText2( String audioPassThruDisplayText2) {
+ /**
+ * Sets a line of text displayed during audio capture
+ *
+ * @param audioPassThruDisplayText2 <p>a String value representing the line of text displayed during
+ * audio capture</p>
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
+ */
+ public PerformAudioPassThru setAudioPassThruDisplayText2(String audioPassThruDisplayText2) {
setParameters(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2, audioPassThruDisplayText2);
return this;
}
- /**
- * Gets a second line of text displayed during audio capture
- *
- * @return String -a String value representing a first line of text
- * displayed during audio capture
- */
+ /**
+ * Gets a second line of text displayed during audio capture
+ *
+ * @return String -a String value representing a first line of text
+ * displayed during audio capture
+ */
public String getAudioPassThruDisplayText2() {
- return getString(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2);
+ return getString(KEY_AUDIO_PASS_THRU_DISPLAY_TEXT_2);
}
- /**
- * Sets a samplingRate
- *
- * @param samplingRate
- * a SamplingRate value representing a 8 or 16 or 22 or 24 khz
- */
+ /**
+ * Sets a samplingRate
+ *
+ * @param samplingRate a SamplingRate value representing a 8 or 16 or 22 or 24 khz
+ */
public PerformAudioPassThru setSamplingRate(@NonNull SamplingRate samplingRate) {
setParameters(KEY_SAMPLING_RATE, samplingRate);
return this;
}
- /**
- * Gets a samplingRate
- *
- * @return SamplingRate -a SamplingRate value
- */
+ /**
+ * Gets a samplingRate
+ *
+ * @return SamplingRate -a SamplingRate value
+ */
public SamplingRate getSamplingRate() {
- return (SamplingRate) getObject(SamplingRate.class, KEY_SAMPLING_RATE);
+ return (SamplingRate) getObject(SamplingRate.class, KEY_SAMPLING_RATE);
}
- /**
- * Sets the maximum duration of audio recording in milliseconds
- *
- * @param maxDuration
- * an Integer value representing the maximum duration of audio
- * recording in millisecond
- * <p></p>
- * <b>Notes: </b>Minvalue:1; Maxvalue:1000000
- */
+ /**
+ * Sets the maximum duration of audio recording in milliseconds
+ *
+ * @param maxDuration an Integer value representing the maximum duration of audio
+ * recording in millisecond
+ * <p></p>
+ * <b>Notes: </b>Minvalue:1; Maxvalue:1000000
+ */
public PerformAudioPassThru setMaxDuration(@NonNull Integer maxDuration) {
setParameters(KEY_MAX_DURATION, maxDuration);
return this;
}
- /**
- * Gets a max duration of audio recording in milliseconds
- *
- * @return int -an int value representing the maximum duration of audio
- * recording in milliseconds
- */
+ /**
+ * Gets a max duration of audio recording in milliseconds
+ *
+ * @return int -an int value representing the maximum duration of audio
+ * recording in milliseconds
+ */
public Integer getMaxDuration() {
- return getInteger(KEY_MAX_DURATION);
+ return getInteger(KEY_MAX_DURATION);
}
- /**
- * Sets the quality the audio is recorded - 8 bit or 16 bit
- *
- * @param audioQuality
- * a BitsPerSample value representing 8 bit or 16 bit
- */
+ /**
+ * Sets the quality the audio is recorded - 8 bit or 16 bit
+ *
+ * @param audioQuality a BitsPerSample value representing 8 bit or 16 bit
+ */
public PerformAudioPassThru setBitsPerSample(@NonNull BitsPerSample audioQuality) {
setParameters(KEY_BITS_PER_SAMPLE, audioQuality);
return this;
}
- /**
- * Gets a BitsPerSample value, 8 bit or 16 bit
- *
- * @return BitsPerSample -a BitsPerSample value
- */
+ /**
+ * Gets a BitsPerSample value, 8 bit or 16 bit
+ *
+ * @return BitsPerSample -a BitsPerSample value
+ */
public BitsPerSample getBitsPerSample() {
- return (BitsPerSample) getObject(BitsPerSample.class, KEY_BITS_PER_SAMPLE);
+ return (BitsPerSample) getObject(BitsPerSample.class, KEY_BITS_PER_SAMPLE);
}
- /**
- * Sets an audioType
- *
- * @param audioType
- * an audioType
- */
+ /**
+ * Sets an audioType
+ *
+ * @param audioType an audioType
+ */
public PerformAudioPassThru setAudioType(@NonNull AudioType audioType) {
setParameters(KEY_AUDIO_TYPE, audioType);
return this;
}
- /**
- * Gets a type of audio data
- *
- * @return AudioType -an AudioType
- */
+ /**
+ * Gets a type of audio data
+ *
+ * @return AudioType -an AudioType
+ */
public AudioType getAudioType() {
- return (AudioType) getObject(AudioType.class, KEY_AUDIO_TYPE);
+ return (AudioType) getObject(AudioType.class, KEY_AUDIO_TYPE);
}
- /**
- *<p> Gets a Boolean value representing if the current audio source should be
- * muted during the APT session</p>
- *
- *
- * @return Boolean -a Boolean value representing if the current audio source
- * should be muted during the APT session
- */
+ /**
+ * <p> Gets a Boolean value representing if the current audio source should be
+ * muted during the APT session</p>
+ *
+ * @return Boolean -a Boolean value representing if the current audio source
+ * should be muted during the APT session
+ */
public Boolean getMuteAudio() {
- return getBoolean(KEY_MUTE_AUDIO);
+ return getBoolean(KEY_MUTE_AUDIO);
}
- /**
- * <p>Sets a muteAudio value representing if the current audio source should be
- * muted during the APT session
- * If not, the audio source will play without interruption. If omitted, the
- * value is set to true</p>
- *
- *
- * @param muteAudio
- * a Boolean value representing if the current audio source
- * should be muted during the APT session
- */
- public PerformAudioPassThru setMuteAudio( Boolean muteAudio) {
+ /**
+ * <p>Sets a muteAudio value representing if the current audio source should be
+ * muted during the APT session
+ * If not, the audio source will play without interruption. If omitted, the
+ * value is set to true</p>
+ *
+ * @param muteAudio a Boolean value representing if the current audio source
+ * should be muted during the APT session
+ */
+ public PerformAudioPassThru setMuteAudio(Boolean muteAudio) {
setParameters(KEY_MUTE_AUDIO, muteAudio);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
index 05d4683a7..872f766cb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,37 @@ import java.util.Hashtable;
/**
* Perform Audio Pass Thru Response is sent, when PerformAudioPassThru has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class PerformAudioPassThruResponse extends RPCResponse {
- /**
- * Constructs a new PerformAudioPassThruResponse object
- */
+ /**
+ * Constructs a new PerformAudioPassThruResponse object
+ */
public PerformAudioPassThruResponse() {
super(FunctionID.PERFORM_AUDIO_PASS_THRU.toString());
}
- /**
- * <p>Constructs a new PerformAudioPassThruResponse object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new PerformAudioPassThruResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public PerformAudioPassThruResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new PerformAudioPassThruResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public PerformAudioPassThruResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new PerformAudioPassThruResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PerformAudioPassThruResponse(@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/PerformInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index 99efbb2ef..adbb09e52 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -47,13 +47,13 @@ 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>
* 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>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -145,311 +145,315 @@ import java.util.List;
* <td>SmartDeviceLink 6.0</td>
* </tr>
* </table>
- *
- *
- * @since SmartDeviceLink 1.0
+ *
* @see CreateInteractionChoiceSet
* @see DeleteInteractionChoiceSet
+ * @since SmartDeviceLink 1.0
*/
public class PerformInteraction extends RPCRequest {
- public static final String KEY_INITIAL_TEXT = "initialText";
- public static final String KEY_INTERACTION_MODE = "interactionMode";
- public static final String KEY_INTERACTION_CHOICE_SET_ID_LIST = "interactionChoiceSetIDList";
- public static final String KEY_INTERACTION_LAYOUT = "interactionLayout";
- public static final String KEY_INITIAL_PROMPT = "initialPrompt";
- public static final String KEY_HELP_PROMPT = "helpPrompt";
- 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";
+ public static final String KEY_INITIAL_TEXT = "initialText";
+ public static final String KEY_INTERACTION_MODE = "interactionMode";
+ public static final String KEY_INTERACTION_CHOICE_SET_ID_LIST = "interactionChoiceSetIDList";
+ public static final String KEY_INTERACTION_LAYOUT = "interactionLayout";
+ public static final String KEY_INITIAL_PROMPT = "initialPrompt";
+ public static final String KEY_HELP_PROMPT = "helpPrompt";
+ 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
- */
+ /**
+ * Constructs a new PerformInteraction object
+ */
public PerformInteraction() {
super(FunctionID.PERFORM_INTERACTION.toString());
}
- /**
- * Constructs a new PerformInteraction object indicated by the Hashtable
- * parameter
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new PerformInteraction object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
public PerformInteraction(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new PerformInteraction object
- * @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 Value: 2000000000
- */
- public PerformInteraction(@NonNull String initialText, @NonNull InteractionMode interactionMode, @NonNull List<Integer> interactionChoiceSetIDList) {
- this();
- setInitialText(initialText);
- setInteractionMode(interactionMode);
- setInteractionChoiceSetIDList(interactionChoiceSetIDList);
- }
- /**
- * Gets the Text that Displayed when the interaction begins. This text may
- * be overlaid by the "Listening" prompt during the interaction. Text is
- * displayed on first line of multiline display, and is centered. If text
- * does not fit on line, it will be truncated
- *
- * @return String -the text displayed when the interaction begins
- */
+
+ /**
+ * Constructs a new PerformInteraction object
+ *
+ * @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 Value: 2000000000
+ */
+ public PerformInteraction(@NonNull String initialText, @NonNull InteractionMode interactionMode, @NonNull List<Integer> interactionChoiceSetIDList) {
+ this();
+ setInitialText(initialText);
+ setInteractionMode(interactionMode);
+ setInteractionChoiceSetIDList(interactionChoiceSetIDList);
+ }
+
+ /**
+ * Gets the Text that Displayed when the interaction begins. This text may
+ * be overlaid by the "Listening" prompt during the interaction. Text is
+ * displayed on first line of multiline display, and is centered. If text
+ * does not fit on line, it will be truncated
+ *
+ * @return String -the text displayed when the interaction begins
+ */
public String getInitialText() {
return getString(KEY_INITIAL_TEXT);
}
- /**
- * Sets the Text that Displayed when the interaction begins. This text may
- * be overlaid by the "Listening" prompt during the interaction. Text is
- * displayed on first line of multiline display, and is centered. If text
- * does not fit on line, it will be truncated
- *
- * @param initialText
- * a String value that Displayed when the interaction begins
- */
+
+ /**
+ * Sets the Text that Displayed when the interaction begins. This text may
+ * be overlaid by the "Listening" prompt during the interaction. Text is
+ * displayed on first line of multiline display, and is centered. If text
+ * does not fit on line, it will be truncated
+ *
+ * @param initialText a String value that Displayed when the interaction begins
+ */
public PerformInteraction setInitialText(@NonNull String initialText) {
setParameters(KEY_INITIAL_TEXT, initialText);
return this;
}
- /**
- * Gets an An array of one or more TTSChunks that, taken together, specify
- * what is to be spoken to the user at the start of an interaction
- *
- * @return List<TTSChunk> -a List<TTSChunk> value, specify what is to be
- * spoken to the user at the start of an interaction
- */
+
+ /**
+ * Gets an An array of one or more TTSChunks that, taken together, specify
+ * what is to be spoken to the user at the start of an interaction
+ *
+ * @return List<TTSChunk> -a List<TTSChunk> value, specify what is to be
+ * spoken to the user at the start of an interaction
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getInitialPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_INITIAL_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_INITIAL_PROMPT);
}
- /**
- * Sets An array of one or more TTSChunks that, taken together, specify what
- * is to be spoken to the user at the start of an interaction
- *
- * @param initialPrompt
- * a List<TTSChunk> value, specify what is to be spoken to the
- * user at the start of an interaction
- */
- public PerformInteraction setInitialPrompt( List<TTSChunk> initialPrompt) {
+
+ /**
+ * Sets An array of one or more TTSChunks that, taken together, specify what
+ * is to be spoken to the user at the start of an interaction
+ *
+ * @param initialPrompt a List<TTSChunk> value, specify what is to be spoken to the
+ * user at the start of an interaction
+ */
+ public PerformInteraction setInitialPrompt(List<TTSChunk> initialPrompt) {
setParameters(KEY_INITIAL_PROMPT, initialPrompt);
return this;
}
- /**
- * Gets the Indicates mode that indicate how user selects interaction
- * choice. User can choose either by voice (VR_ONLY), by visual selection
- * from the menu (MANUAL_ONLY), or by either mode (BOTH)
- *
- * @return InteractionMode -indicate how user selects interaction choice
- * (VR_ONLY, MANUAL_ONLY or BOTH)
- */
+
+ /**
+ * Gets the Indicates mode that indicate how user selects interaction
+ * choice. User can choose either by voice (VR_ONLY), by visual selection
+ * from the menu (MANUAL_ONLY), or by either mode (BOTH)
+ *
+ * @return InteractionMode -indicate how user selects interaction choice
+ * (VR_ONLY, MANUAL_ONLY or BOTH)
+ */
public InteractionMode getInteractionMode() {
- return (InteractionMode) getObject(InteractionMode.class, KEY_INTERACTION_MODE);
+ return (InteractionMode) getObject(InteractionMode.class, KEY_INTERACTION_MODE);
}
- /**
- * Sets the Indicates mode that indicate how user selects interaction
- * choice. User can choose either by voice (VR_ONLY), by visual selection
- * from the menu (MANUAL_ONLY), or by either mode (BOTH)
- *
- * @param interactionMode
- * indicate how user selects interaction choice (VR_ONLY,
- * MANUAL_ONLY or BOTH)
- */
+
+ /**
+ * Sets the Indicates mode that indicate how user selects interaction
+ * choice. User can choose either by voice (VR_ONLY), by visual selection
+ * from the menu (MANUAL_ONLY), or by either mode (BOTH)
+ *
+ * @param interactionMode indicate how user selects interaction choice (VR_ONLY,
+ * MANUAL_ONLY or BOTH)
+ */
public PerformInteraction setInteractionMode(@NonNull InteractionMode interactionMode) {
setParameters(KEY_INTERACTION_MODE, interactionMode);
return this;
}
- /**
- * Gets a List<Integer> value representing an Array of one or more Choice
- * Set IDs
- *
- * @return List<Integer> -a List<Integer> value representing an Array of
- * one or more Choice Set IDs. User can select any choice from any
- * of the specified Choice Sets
- */
+
+ /**
+ * Gets a List<Integer> value representing an Array of one or more Choice
+ * Set IDs
+ *
+ * @return List<Integer> -a List<Integer> value representing an Array of
+ * one or more Choice Set IDs. User can select any choice from any
+ * of the specified Choice Sets
+ */
@SuppressWarnings("unchecked")
public List<Integer> getInteractionChoiceSetIDList() {
- return (List<Integer>) getObject(Integer.class, KEY_INTERACTION_CHOICE_SET_ID_LIST);
+ return (List<Integer>) getObject(Integer.class, KEY_INTERACTION_CHOICE_SET_ID_LIST);
}
- /**
- * Sets 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
- *
- * @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
- * <p></p>
- * <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
- */
+
+ /**
+ * Sets 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
+ *
+ * @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
+ * <p></p>
+ * <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
+ */
public PerformInteraction setInteractionChoiceSetIDList(@NonNull List<Integer> interactionChoiceSetIDList) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID_LIST, interactionChoiceSetIDList);
return this;
}
- /**
- * Gets a List<TTSChunk> which taken together, specify the help phrase to
- * be spoken when the user says "help" during the VR session
- *
- * @return List<TTSChunk> -a List<TTSChunk> which taken together,
- * specify the help phrase to be spoken when the user says "help"
- * during the VR session
- */
+
+ /**
+ * Gets a List<TTSChunk> which taken together, specify the help phrase to
+ * be spoken when the user says "help" during the VR session
+ *
+ * @return List<TTSChunk> -a List<TTSChunk> which taken together,
+ * specify the help phrase to be spoken when the user says "help"
+ * during the VR session
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getHelpPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_HELP_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_HELP_PROMPT);
}
- /**
- * Sets An array of TTSChunks which, taken together, specify the help phrase
- * to be spoken when the user says "help" during the VR session
- * <p></p>
- * If this parameter is omitted, the help prompt will be constructed by SDL
- * from the first vrCommand of each choice of all the Choice Sets specified
- * in the interactionChoiceSetIDList parameter
- * <P></p>
- * <b>Notes: </b>The helpPrompt specified in
- * {@linkplain SetGlobalProperties} is not used by PerformInteraction
- *
- * @param helpPrompt
- * a List<TTSChunk> which taken together, specify the help
- * phrase to be spoken when the user says "help" during the VR
- * session
- */
- public PerformInteraction setHelpPrompt( List<TTSChunk> helpPrompt) {
+
+ /**
+ * Sets An array of TTSChunks which, taken together, specify the help phrase
+ * to be spoken when the user says "help" during the VR session
+ * <p></p>
+ * If this parameter is omitted, the help prompt will be constructed by SDL
+ * from the first vrCommand of each choice of all the Choice Sets specified
+ * in the interactionChoiceSetIDList parameter
+ * <P></p>
+ * <b>Notes: </b>The helpPrompt specified in
+ * {@linkplain SetGlobalProperties} is not used by PerformInteraction
+ *
+ * @param helpPrompt a List<TTSChunk> which taken together, specify the help
+ * phrase to be spoken when the user says "help" during the VR
+ * session
+ */
+ public PerformInteraction setHelpPrompt(List<TTSChunk> helpPrompt) {
setParameters(KEY_HELP_PROMPT, helpPrompt);
return this;
}
- /**
- * Gets An array of TTSChunks which, taken together, specify the phrase to
- * be spoken when the listen times out during the VR session
- *
- * @return List<TTSChunk> -a List<TTSChunk> specify the phrase to be
- * spoken when the listen times out during the VR session
- */
+
+ /**
+ * Gets An array of TTSChunks which, taken together, specify the phrase to
+ * be spoken when the listen times out during the VR session
+ *
+ * @return List<TTSChunk> -a List<TTSChunk> specify the phrase to be
+ * spoken when the listen times out during the VR session
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getTimeoutPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TIMEOUT_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TIMEOUT_PROMPT);
}
- /**
- * Sets An array of TTSChunks which, taken together, specify the phrase to
- * be spoken when the listen times out during the VR session
- * <p></p>
- * <b>Notes: </b>The timeoutPrompt specified in
- * {@linkplain SetGlobalProperties} is not used by PerformInteraction
- *
- * @param timeoutPrompt
- * a List<TTSChunk> specify the phrase to be spoken when the
- * listen times out during the VR session
- */
- public PerformInteraction setTimeoutPrompt( List<TTSChunk> timeoutPrompt) {
+
+ /**
+ * Sets An array of TTSChunks which, taken together, specify the phrase to
+ * be spoken when the listen times out during the VR session
+ * <p></p>
+ * <b>Notes: </b>The timeoutPrompt specified in
+ * {@linkplain SetGlobalProperties} is not used by PerformInteraction
+ *
+ * @param timeoutPrompt a List<TTSChunk> specify the phrase to be spoken when the
+ * listen times out during the VR session
+ */
+ public PerformInteraction setTimeoutPrompt(List<TTSChunk> timeoutPrompt) {
setParameters(KEY_TIMEOUT_PROMPT, timeoutPrompt);
return this;
}
- /**
- * Gets a Integer value representing the amount of time, in milliseconds,
- * SDL will wait for the user to make a choice (VR or Menu)
- *
- * @return Integer -a Integer representing the amount of time, in
- * milliseconds, SDL will wait for the user to make a choice (VR or
- * Menu)
- */
+
+ /**
+ * Gets a Integer value representing the amount of time, in milliseconds,
+ * SDL will wait for the user to make a choice (VR or Menu)
+ *
+ * @return Integer -a Integer representing the amount of time, in
+ * milliseconds, SDL will wait for the user to make a choice (VR or
+ * Menu)
+ */
public Integer getTimeout() {
return getInteger(KEY_TIMEOUT);
}
- /**
- * Sets the amount of time, in milliseconds, SDL will wait for the user to
- * make a choice (VR or Menu). If this time elapses without the user making
- * a choice, the timeoutPrompt will be spoken. After this timeout value has
- * been reached, the interaction will stop and a subsequent interaction will
- * take place after SDL speaks the timeout prompt. If that times out as
- * well, the interaction will end completely. If omitted, the default is
- * 10000ms
- *
- * @param timeout
- * an Integer value representing the amount of time, in
- * milliseconds, SDL will wait for the user to make a choice (VR
- * or Menu)
- * <p></p>
- * <b>Notes: </b>Min Value: 5000; Max Value: 100000
- */
- public PerformInteraction setTimeout( Integer timeout) {
+
+ /**
+ * Sets the amount of time, in milliseconds, SDL will wait for the user to
+ * make a choice (VR or Menu). If this time elapses without the user making
+ * a choice, the timeoutPrompt will be spoken. After this timeout value has
+ * been reached, the interaction will stop and a subsequent interaction will
+ * take place after SDL speaks the timeout prompt. If that times out as
+ * well, the interaction will end completely. If omitted, the default is
+ * 10000ms
+ *
+ * @param timeout an Integer value representing the amount of time, in
+ * milliseconds, SDL will wait for the user to make a choice (VR
+ * or Menu)
+ * <p></p>
+ * <b>Notes: </b>Min Value: 5000; Max Value: 100000
+ */
+ public PerformInteraction setTimeout(Integer timeout) {
setParameters(KEY_TIMEOUT, timeout);
return this;
}
- /**
- * 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
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * 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
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<VrHelpItem> getVrHelp() {
- return (List<VrHelpItem>) getObject(VrHelpItem.class, KEY_VR_HELP);
+ return (List<VrHelpItem>) getObject(VrHelpItem.class, KEY_VR_HELP);
}
- /**
- * 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
- * If omitted on supported displays, the default SDL generated
- * list of suggested choices will be displayed
- * <p></p>
- * <b>Notes: </b>Min=1; Max=100
- * @since SmartDeviceLink 2.0
- */
- public PerformInteraction setVrHelp( List<VrHelpItem> vrHelp) {
+ /**
+ * 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
+ * If omitted on supported displays, the default SDL generated
+ * list of suggested choices will be displayed
+ * <p></p>
+ * <b>Notes: </b>Min=1; Max=100
+ * @since SmartDeviceLink 2.0
+ */
+ public PerformInteraction setVrHelp(List<VrHelpItem> vrHelp) {
setParameters(KEY_VR_HELP, vrHelp);
return this;
}
- /**
- * 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);
+ /**
+ * 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);
}
- /**
- * 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 PerformInteraction 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 PerformInteraction setInteractionLayout(LayoutMode interactionLayout) {
setParameters(KEY_INTERACTION_LAYOUT, interactionLayout);
return this;
}
- /**
- * 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);
- }
+ /**
+ * 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 PerformInteraction setCancelID( Integer cancelID) {
+ /**
+ * 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 PerformInteraction setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
index 9bd0e37a9..ab2d40207 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,7 +42,7 @@ import java.util.Hashtable;
/**
* PerformInteraction Response is sent, when PerformInteraction has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class PerformInteractionResponse extends RPCResponse {
@@ -50,27 +50,28 @@ public class PerformInteractionResponse extends RPCResponse {
public static final String KEY_TRIGGER_SOURCE = "triggerSource";
public static final String KEY_CHOICE_ID = "choiceID";
- /**
- * Constructs a new PerformInteractionResponse object
- */
+ /**
+ * Constructs a new PerformInteractionResponse object
+ */
public PerformInteractionResponse() {
super(FunctionID.PERFORM_INTERACTION.toString());
}
- /**
- * Constructs a new PerformInteractionResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new PerformInteractionResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public PerformInteractionResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new PerformInteractionResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public PerformInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -78,43 +79,52 @@ public class PerformInteractionResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
+
/**
* Gets the application-scoped identifier that uniquely identifies this choice.
+ *
* @return choiceID Min: 0 Max: 65535
- */
+ */
public Integer getChoiceID() {
- return getInteger( KEY_CHOICE_ID );
+ return getInteger(KEY_CHOICE_ID);
}
+
/**
* Sets the application-scoped identifier that uniquely identifies this choice.
+ *
* @param choiceID Min: 0 Max: 65535
*/
- public PerformInteractionResponse setChoiceID( Integer choiceID) {
+ public PerformInteractionResponse setChoiceID(Integer choiceID) {
setParameters(KEY_CHOICE_ID, choiceID);
return this;
}
+
/**
- * <p>Returns a <I>TriggerSource</I> object which will be shown in the HMI</p>
+ * <p>Returns a <I>TriggerSource</I> object which will be shown in the HMI</p>
+ *
* @return TriggerSource a TriggerSource object
- */
+ */
public TriggerSource getTriggerSource() {
return (TriggerSource) getObject(TriggerSource.class, KEY_TRIGGER_SOURCE);
}
+
/**
* <p>Sets TriggerSource
* Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
+ *
* @param triggerSource a TriggerSource object
*/
- public PerformInteractionResponse setTriggerSource( TriggerSource triggerSource) {
+ public PerformInteractionResponse setTriggerSource(TriggerSource triggerSource) {
setParameters(KEY_TRIGGER_SOURCE, triggerSource);
return this;
}
-
- public PerformInteractionResponse setManualTextEntry( String manualTextEntry) {
+
+ public PerformInteractionResponse setManualTextEntry(String manualTextEntry) {
setParameters(KEY_MANUAL_TEXT_ENTRY, manualTextEntry);
return this;
}
+
public String getManualTextEntry() {
return getString(KEY_MANUAL_TEXT_ENTRY);
- }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
index 830e27930..d7d902c5c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,9 +37,10 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
* Change in permissions for a given set of RPCs
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -80,19 +81,21 @@ import java.util.Hashtable;
* @since SmartDeviceLink 2.0
*/
public class PermissionItem extends RPCStruct {
- public static final String KEY_RPC_NAME = "rpcName";
- public static final String KEY_HMI_PERMISSIONS = "hmiPermissions";
- public static final String KEY_PARAMETER_PERMISSIONS = "parameterPermissions";
- public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
- /**
- * Constructs a new PermissionItem object
- */
+ public static final String KEY_RPC_NAME = "rpcName";
+ public static final String KEY_HMI_PERMISSIONS = "hmiPermissions";
+ public static final String KEY_PARAMETER_PERMISSIONS = "parameterPermissions";
+ public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
+
+ /**
+ * Constructs a new PermissionItem object
+ */
public PermissionItem(@NonNull String rpcName, @NonNull HMIPermissions hmiPermissions, @NonNull ParameterPermissions parameterPermissions) {
this();
setRpcName(rpcName);
setHMIPermissions(hmiPermissions);
setParameterPermissions(parameterPermissions);
}
+
/**
* Constructs a new PermissionItem object indicated by the Hashtable
* parameter
@@ -102,27 +105,35 @@ public class PermissionItem extends RPCStruct {
public PermissionItem(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new PermissionItem object
*/
- public PermissionItem() { }
+ public PermissionItem() {
+ }
+
public String getRpcName() {
return getString(KEY_RPC_NAME);
}
+
public PermissionItem setRpcName(@NonNull String rpcName) {
setValue(KEY_RPC_NAME, rpcName);
return this;
}
+
public HMIPermissions getHMIPermissions() {
return (HMIPermissions) getObject(HMIPermissions.class, KEY_HMI_PERMISSIONS);
}
+
public PermissionItem setHMIPermissions(@NonNull HMIPermissions hmiPermissions) {
setValue(KEY_HMI_PERMISSIONS, hmiPermissions);
return this;
}
+
public ParameterPermissions getParameterPermissions() {
- return (ParameterPermissions) getObject(ParameterPermissions.class, KEY_PARAMETER_PERMISSIONS);
+ return (ParameterPermissions) getObject(ParameterPermissions.class, KEY_PARAMETER_PERMISSIONS);
}
+
public PermissionItem setParameterPermissions(@NonNull ParameterPermissions parameterPermissions) {
setValue(KEY_PARAMETER_PERMISSIONS, parameterPermissions);
return this;
@@ -130,6 +141,7 @@ public class PermissionItem extends RPCStruct {
/**
* Gets the encryption requirement for this item
+ *
* @return true is encryption is required, false otherwise
*/
public Boolean getRequireEncryption() {
@@ -138,9 +150,10 @@ public class PermissionItem extends RPCStruct {
/**
* Sets the encryption requirement for this item
+ *
* @param isRequired the boolean requirement to be set
*/
- public PermissionItem setRequireEncryption( Boolean isRequired) {
+ public PermissionItem setRequireEncryption(Boolean isRequired) {
setValue(KEY_REQUIRE_ENCRYPTION, isRequired);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java
index bffabdf09..77bb95440 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,19 +40,20 @@ import java.util.Hashtable;
*/
public class PhoneCapability extends RPCStruct {
- public static final String KEY_DIALNUMBER_ENABLED = "dialNumberEnabled";
+ public static final String KEY_DIALNUMBER_ENABLED = "dialNumberEnabled";
- public PhoneCapability(){}
+ public PhoneCapability() {
+ }
- public PhoneCapability(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public PhoneCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public Boolean getDialNumberEnabled(){
- return getBoolean(KEY_DIALNUMBER_ENABLED);
- }
+ public Boolean getDialNumberEnabled() {
+ return getBoolean(KEY_DIALNUMBER_ENABLED);
+ }
- public PhoneCapability setDialNumberEnabled( Boolean dialNumberEnabled) {
+ public PhoneCapability setDialNumberEnabled(Boolean dialNumberEnabled) {
setValue(KEY_DIALNUMBER_ENABLED, dialNumberEnabled);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
index cb59d5f6c..1efdcc75f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -55,18 +55,21 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class PresetBankCapabilities extends RPCStruct {
- public static final String KEY_ON_SCREEN_PRESETS_AVAILABLE = "OnScreenPresetsAvailable";
+ public static final String KEY_ON_SCREEN_PRESETS_AVAILABLE = "OnScreenPresetsAvailable";
+
+ /**
+ * Constructs a newly allocated PresetBankCapabilities object
+ */
+ public PresetBankCapabilities() {
+ }
- /**
- * Constructs a newly allocated PresetBankCapabilities object
- */
- public PresetBankCapabilities() { }
-
/**
* Constructs a newly allocated PresetBankCapabilities object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public PresetBankCapabilities(Hashtable<String, Object> hash) {
@@ -75,6 +78,7 @@ public class PresetBankCapabilities extends RPCStruct {
/**
* Constructs a newly allocated PresetBankCapabilities object
+ *
* @param onScreenPresetsAvailable if Onscreen custom presets are available.
*/
public PresetBankCapabilities(@NonNull Boolean onScreenPresetsAvailable) {
@@ -84,23 +88,26 @@ public class PresetBankCapabilities extends RPCStruct {
/**
* set if Onscreen custom presets are available.
+ *
* @param onScreenPresetsAvailable if Onscreen custom presets are available.
*/
public PresetBankCapabilities setOnScreenPresetsAvailable(@NonNull Boolean onScreenPresetsAvailable) {
setValue(KEY_ON_SCREEN_PRESETS_AVAILABLE, onScreenPresetsAvailable);
return this;
}
-
+
/**
* Defines, if Onscreen custom presets are available.
+ *
* @return if Onscreen custom presets are available
*/
public Boolean onScreenPresetsAvailable() {
- return getBoolean(KEY_ON_SCREEN_PRESETS_AVAILABLE);
+ return getBoolean(KEY_ON_SCREEN_PRESETS_AVAILABLE);
}
/**
* Defines, if Onscreen custom presets are available.
+ *
* @return if Onscreen custom presets are available
*/
public Boolean getOnScreenPresetsAvailable() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
index bc3e48e33..301d677a5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
@@ -44,52 +44,56 @@ import java.util.Hashtable;
*/
public class PublishAppService extends RPCRequest {
- public static final String KEY_APP_SERVICE_MANIFEST = "appServiceManifest";
+ public static final String KEY_APP_SERVICE_MANIFEST = "appServiceManifest";
- // Constructors
- /**
- * Constructs a new PublishAppService object
- */
- public PublishAppService() {
- super(FunctionID.PUBLISH_APP_SERVICE.toString());
- }
+ // Constructors
- /**
- * Constructs a new PublishAppService object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public PublishAppService(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a new PublishAppService object
+ */
+ public PublishAppService() {
+ super(FunctionID.PUBLISH_APP_SERVICE.toString());
+ }
- /**
- * Constructs a new PublishAppService object
- * @param appServiceManifest - The appServiceManifest
- */
- public PublishAppService(@NonNull AppServiceManifest appServiceManifest) {
- this();
- setAppServiceManifest(appServiceManifest);
- }
+ /**
+ * Constructs a new PublishAppService object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public PublishAppService(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- // Getters / Setters
+ /**
+ * Constructs a new PublishAppService object
+ *
+ * @param appServiceManifest - The appServiceManifest
+ */
+ public PublishAppService(@NonNull AppServiceManifest appServiceManifest) {
+ this();
+ setAppServiceManifest(appServiceManifest);
+ }
- /**
- * The manifest of the service that wishes to be published.
- * If already published, the updated manifest for this service.
- * @param serviceManifest - the App Service Manifest
- */
- public PublishAppService setAppServiceManifest(@NonNull AppServiceManifest serviceManifest) {
+ // Getters / Setters
+
+ /**
+ * The manifest of the service that wishes to be published.
+ * If already published, the updated manifest for this service.
+ *
+ * @param serviceManifest - the App Service Manifest
+ */
+ public PublishAppService setAppServiceManifest(@NonNull AppServiceManifest serviceManifest) {
setParameters(KEY_APP_SERVICE_MANIFEST, serviceManifest);
return this;
}
- /**
- * The manifest of the service that wishes to be published.
- * If already published, the updated manifest for this service.
- * @return serviceManifest - the App Service Manifest
- */
- public AppServiceManifest getAppServiceManifest(){
- return (AppServiceManifest) getObject(AppServiceManifest.class,KEY_APP_SERVICE_MANIFEST);
- }
+ /**
+ * The manifest of the service that wishes to be published.
+ * If already published, the updated manifest for this service.
+ *
+ * @return serviceManifest - the App Service Manifest
+ */
+ public AppServiceManifest getAppServiceManifest() {
+ return (AppServiceManifest) getObject(AppServiceManifest.class, KEY_APP_SERVICE_MANIFEST);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java
index d52a310dd..3facb9982 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppServiceResponse.java
@@ -41,46 +41,51 @@ import java.util.Hashtable;
public class PublishAppServiceResponse extends RPCResponse {
- public static final String KEY_APP_SERVICE_RECORD = "appServiceRecord";
- /**
- * Constructs a new PublishAppServiceResponse object
- */
- public PublishAppServiceResponse() {
- super(FunctionID.PUBLISH_APP_SERVICE.toString());
- }
+ public static final String KEY_APP_SERVICE_RECORD = "appServiceRecord";
- public PublishAppServiceResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
- /**
- * Constructs a new PublishAppServiceResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public PublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ */
+ public PublishAppServiceResponse() {
+ super(FunctionID.PUBLISH_APP_SERVICE.toString());
+ }
+
+ public PublishAppServiceResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- // Custom Getters / Setters
+ /**
+ * Constructs a new PublishAppServiceResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ // Custom Getters / Setters
- /**
- * If the request was successful, this object will be the current status of the service record
- * for the published service. This will include the Core supplied service ID.
- * @param appServiceRecord - the App Service Record
- */
- public PublishAppServiceResponse setServiceRecord( AppServiceRecord appServiceRecord) {
+ /**
+ * If the request was successful, this object will be the current status of the service record
+ * for the published service. This will include the Core supplied service ID.
+ *
+ * @param appServiceRecord - the App Service Record
+ */
+ public PublishAppServiceResponse setServiceRecord(AppServiceRecord appServiceRecord) {
setParameters(KEY_APP_SERVICE_RECORD, appServiceRecord);
return this;
}
- /**
- * If the request was successful, this object will be the current status of the service record
- * for the published service. This will include the Core supplied service ID.
- * @return appServiceRecord - the App Service Record
- */
- public AppServiceRecord getServiceRecord(){
- return (AppServiceRecord) getObject(AppServiceRecord.class,KEY_APP_SERVICE_RECORD);
- }
+ /**
+ * If the request was successful, this object will be the current status of the service record
+ * for the published service. This will include the Core supplied service ID.
+ *
+ * @return appServiceRecord - the App Service Record
+ */
+ public AppServiceRecord getServiceRecord() {
+ return (AppServiceRecord) getObject(AppServiceRecord.class, KEY_APP_SERVICE_RECORD);
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
index da4adfb1d..638fb6273 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,9 +43,9 @@ import java.util.zip.CRC32;
/**
* Used to push a binary data onto the SDL module from a mobile device, such as
* icons and album art.
- *
+ *
* <p><b> Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -114,10 +114,10 @@ import java.util.zip.CRC32;
* </table>
* <p> <b>Note: </b></p>
* When using PutFiles you may want to check for memory
- *
+ *
* <p><b>Response</b> </p>
* Response is sent, when the file data was copied (success case). Or when an error occurred. Not supported on First generation SDL modules.
- *
+ *
* <p><b> Non-default Result Codes:</b></p>
* <p> SUCCESS</p>
* <p> INVALID_DATA</p>
@@ -146,12 +146,13 @@ import java.util.zip.CRC32;
* </tr>
*
* </table>
- * @since SmartDeviceLink 2.0
+ *
* @see DeleteFile
* @see ListFiles
+ * @since SmartDeviceLink 2.0
*/
public class PutFile extends RPCRequest {
- public static final String KEY_PERSISTENT_FILE = "persistentFile";
+ public static final String KEY_PERSISTENT_FILE = "persistentFile";
public static final String KEY_SYSTEM_FILE = "systemFile";
public static final String KEY_FILE_TYPE = "fileType";
public static final String KEY_SDL_FILE_NAME = "syncFileName";
@@ -159,142 +160,142 @@ public class PutFile extends RPCRequest {
public static final String KEY_LENGTH = "length";
public static final String KEY_CRC = "crc";
- /**
- * Constructs a new PutFile object
- */
+ /**
+ * Constructs a new PutFile object
+ */
public PutFile() {
super(FunctionID.PUT_FILE.toString());
}
- /**
- * Constructs a new PutFile object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new PutFile object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
public PutFile(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new PutFile object
- * @param syncFileName a String value representing a file reference name
- * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
- * @param fileType a FileType value representing a selected file type
- */
- public PutFile(@NonNull String syncFileName, @NonNull FileType fileType) {
- this();
- setSdlFileName(syncFileName);
- setFileType(fileType);
- }
+ /**
+ * Constructs a new PutFile object
+ *
+ * @param syncFileName a String value representing a file reference name
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
+ * @param fileType a FileType value representing a selected file type
+ */
+ public PutFile(@NonNull String syncFileName, @NonNull FileType fileType) {
+ this();
+ setSdlFileName(syncFileName);
+ setFileType(fileType);
+ }
- /**
- * Sets a file reference name
- *
- * @param sdlFileName
- * a String value representing a file reference name
- * <p></p>
- * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
- */
+ /**
+ * Sets a file reference name
+ *
+ * @param sdlFileName a String value representing a file reference name
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
+ */
public PutFile setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
return this;
}
- /**
- * Gets a file reference name
- *
- * @return String - a String value representing a file reference name
- */
+ /**
+ * Gets a file reference name
+ *
+ * @return String - a String value representing a file reference name
+ */
public String getSdlFileName() {
return getString(KEY_SDL_FILE_NAME);
}
- /**
- * Sets file type
- *
- * @param fileType
- * a FileType value representing a selected file type
- */
+ /**
+ * Sets file type
+ *
+ * @param fileType a FileType value representing a selected file type
+ */
public PutFile setFileType(@NonNull FileType fileType) {
setParameters(KEY_FILE_TYPE, fileType);
return this;
}
- /**
- * Gets a file type
- *
- * @return FileType -a FileType value representing a selected file type
- */
+ /**
+ * Gets a file type
+ *
+ * @return FileType -a FileType value representing a selected file type
+ */
public FileType getFileType() {
return (FileType) getObject(FileType.class, KEY_FILE_TYPE);
}
- /**
- * Sets a value to indicates if the file is meant to persist between
- * sessions / ignition cycles. If set to TRUE, then the system will aim to
- * persist this file through session / cycles. While files with this
- * designation will have priority over others, they are subject to deletion
- * by the system at any time. In the event of automatic deletion by the
- * system, the app will receive a rejection and have to resend the file. If
- * omitted, the value will be set to false
- * <p></p>
- *
- * @param persistentFile
- * a Boolean value
- */
- public PutFile setPersistentFile( Boolean persistentFile) {
+ /**
+ * Sets a value to indicates if the file is meant to persist between
+ * sessions / ignition cycles. If set to TRUE, then the system will aim to
+ * persist this file through session / cycles. While files with this
+ * designation will have priority over others, they are subject to deletion
+ * by the system at any time. In the event of automatic deletion by the
+ * system, the app will receive a rejection and have to resend the file. If
+ * omitted, the value will be set to false
+ * <p></p>
+ *
+ * @param persistentFile a Boolean value
+ */
+ public PutFile setPersistentFile(Boolean persistentFile) {
setParameters(KEY_PERSISTENT_FILE, persistentFile);
return this;
}
- /**
- * Gets a value to Indicates if the file is meant to persist between
- * sessions / ignition cycles
- *
- * @return Boolean -a Boolean value to indicates if the file is meant to
- * persist between sessions / ignition cycles
- */
+ /**
+ * Gets a value to Indicates if the file is meant to persist between
+ * sessions / ignition cycles
+ *
+ * @return Boolean -a Boolean value to indicates if the file is meant to
+ * persist between sessions / ignition cycles
+ */
public Boolean getPersistentFile() {
return getBoolean(KEY_PERSISTENT_FILE);
}
- public PutFile setFileData( byte[] fileData) {
+
+ public PutFile setFileData(byte[] fileData) {
setBulkData(fileData);
return this;
}
+
public byte[] getFileData() {
return getBulkData();
}
-
+
/**
- * @deprecated as of SmartDeviceLink 4.0
* @param offset Optional offset in bytes for resuming partial data chunks
+ * @deprecated as of SmartDeviceLink 4.0
*/
- public PutFile setOffset( Integer offset) {
- if(offset == null){
- setOffset((Long)null);
- }else{
- setOffset(offset.longValue());
- }
+ public PutFile setOffset(Integer offset) {
+ if (offset == null) {
+ setOffset((Long) null);
+ } else {
+ setOffset(offset.longValue());
+ }
return this;
}
- /**
- * @param offset Optional offset in bytes for resuming partial data chunks
- */
- public PutFile setOffset( Long offset) {
+ /**
+ * @param offset Optional offset in bytes for resuming partial data chunks
+ */
+ public PutFile setOffset(Long offset) {
setParameters(KEY_OFFSET, offset);
return this;
}
public Long getOffset() {
final Object o = getParameters(KEY_OFFSET);
- if (o == null){
- return null;
+ if (o == null) {
+ return null;
}
if (o instanceof Integer) {
return ((Integer) o).longValue();
- }else if(o instanceof Long){
- return (Long) o;
+ } else if (o instanceof Long) {
+ return (Long) o;
}
@@ -302,43 +303,43 @@ public class PutFile extends RPCRequest {
}
/**
- * @deprecated as of SmartDeviceLink 4.0
* @param length Optional length in bytes for resuming partial data chunks. If offset is set to 0, then length is
- * the total length of the file to be downloaded
+ * the total length of the file to be downloaded
+ * @deprecated as of SmartDeviceLink 4.0
*/
- public PutFile setLength( Integer length) {
- if(length == null){
- setLength((Long)null);
- }else{
- setLength(length.longValue());
- }
+ public PutFile setLength(Integer length) {
+ if (length == null) {
+ setLength((Long) null);
+ } else {
+ setLength(length.longValue());
+ }
return this;
}
- /**
- * @param length Optional length in bytes for resuming partial data chunks. If offset is set to 0, then length is
- * the total length of the file to be downloaded
- */
- public PutFile setLength( Long length) {
+ /**
+ * @param length Optional length in bytes for resuming partial data chunks. If offset is set to 0, then length is
+ * the total length of the file to be downloaded
+ */
+ public PutFile setLength(Long length) {
setParameters(KEY_LENGTH, length);
return this;
}
public Long getLength() {
final Object o = getParameters(KEY_LENGTH);
- if (o == null){
- return null;
+ if (o == null) {
+ return null;
}
if (o instanceof Integer) {
return ((Integer) o).longValue();
- }else if(o instanceof Long){
- return (Long) o;
+ } else if (o instanceof Long) {
+ return (Long) o;
}
return null;
}
- public PutFile setSystemFile( Boolean systemFile) {
+ public PutFile setSystemFile(Boolean systemFile) {
setParameters(KEY_SYSTEM_FILE, systemFile);
return this;
}
@@ -347,56 +348,58 @@ public class PutFile extends RPCRequest {
final Object o = getParameters(KEY_SYSTEM_FILE);
if (o instanceof Boolean) {
return (Boolean) o;
- }
- else
- return null;
+ } else
+ return null;
}
- /**
- * This takes the file data as an array of bytes and calculates the
- * CRC32 for it.
- * @param fileData - the file as a byte array
- */
- public PutFile setCRC( byte[] fileData) {
+ /**
+ * This takes the file data as an array of bytes and calculates the
+ * CRC32 for it.
+ *
+ * @param fileData - the file as a byte array
+ */
+ public PutFile setCRC(byte[] fileData) {
if (fileData != null) {
- CRC32 crc = new CRC32();
- crc.update(fileData);
- parameters.put(KEY_CRC, crc.getValue());
- } else {
- parameters.remove(KEY_CRC);
- }
+ CRC32 crc = new CRC32();
+ crc.update(fileData);
+ parameters.put(KEY_CRC, crc.getValue());
+ } else {
+ parameters.remove(KEY_CRC);
+ }
return this;
}
- /**
- * This assumes you have created your own CRC32 and are setting it with the file
- * <STRONG>Please avoid using your own calculations for this, and use the method
- * included in java.util</STRONG>
- * @param crc - the CRC32 of the file being set
- */
- public PutFile setCRC( Long crc) {
+ /**
+ * This assumes you have created your own CRC32 and are setting it with the file
+ * <STRONG>Please avoid using your own calculations for this, and use the method
+ * included in java.util</STRONG>
+ *
+ * @param crc - the CRC32 of the file being set
+ */
+ public PutFile setCRC(Long crc) {
if (crc != null) {
- parameters.put(KEY_CRC, crc);
- } else {
- parameters.remove(KEY_CRC);
- }
+ parameters.put(KEY_CRC, crc);
+ } else {
+ parameters.remove(KEY_CRC);
+ }
return this;
}
- /**
- * This returns the CRC, if it has been set, for the file object
- * @return - a CRC32 Long
- */
- public Long getCRC() {
- final Object o = parameters.get(KEY_CRC);
- if (o == null){
- return null;
- }
- if (o instanceof Integer) {
- return ((Integer) o).longValue();
- }else if(o instanceof Long){
- return (Long) o;
- }
- return null;
- }
+ /**
+ * This returns the CRC, if it has been set, for the file object
+ *
+ * @return - a CRC32 Long
+ */
+ public Long getCRC() {
+ final Object o = parameters.get(KEY_CRC);
+ if (o == null) {
+ return null;
+ }
+ if (o instanceof Integer) {
+ return ((Integer) o).longValue();
+ } else if (o instanceof Long) {
+ return (Long) o;
+ }
+ return null;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
index 1bc5a6887..89ca1e161 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,62 +42,63 @@ import java.util.Hashtable;
/**
* Put File Response is sent, when PutFile has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class PutFileResponse extends RPCResponse {
- public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
- private static final Integer MAX_VALUE = 2000000000;
+ public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
+ private static final Integer MAX_VALUE = 2000000000;
- /**
- * Constructs a new PutFileResponse object
- */
+ /**
+ * Constructs a new PutFileResponse object
+ */
public PutFileResponse() {
super(FunctionID.PUT_FILE.toString());
}
- /**
- * Constructs a new PutFileResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new PutFileResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public PutFileResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new PutFileResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public PutFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new PutFileResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PutFileResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
- /**
- * SpaceAvailable became optional as of RPC Spec 5.0. If a system that expected the value to
- * always have a value connects to such a system, it could return null. Check to see if there
- * is a value, and if not, set it to MAX_VALUE as defined by the RPC Spec
- *
- * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
- * the max value of RPC spec version this library supports should be used.
- * @param formatParams if true, the format method will be called on subsequent params
- */
- @Override
- public void format(Version rpcVersion, boolean formatParams){
- if (rpcVersion == null || rpcVersion.getMajor() >= 5){
- if (getSpaceAvailable() == null){
- setSpaceAvailable(MAX_VALUE);
- }
- }
- super.format(rpcVersion, formatParams);
- }
+ /**
+ * SpaceAvailable became optional as of RPC Spec 5.0. If a system that expected the value to
+ * always have a value connects to such a system, it could return null. Check to see if there
+ * is a value, and if not, set it to MAX_VALUE as defined by the RPC Spec
+ *
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
+ * @param formatParams if true, the format method will be called on subsequent params
+ */
+ @Override
+ public void format(Version rpcVersion, boolean formatParams) {
+ if (rpcVersion == null || rpcVersion.getMajor() >= 5) {
+ if (getSpaceAvailable() == null) {
+ setSpaceAvailable(MAX_VALUE);
+ }
+ }
+ super.format(rpcVersion, formatParams);
+ }
- public PutFileResponse setSpaceAvailable( Integer spaceAvailable) {
+ public PutFileResponse setSpaceAvailable(Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RGBColor.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RGBColor.java
index 0a22821ac..84393121a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RGBColor.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RGBColor.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,7 +36,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- * A color class that stores RGB values
+ * A color class that stores RGB values
* <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -68,9 +68,10 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 5.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 5.0
*/
-public class RGBColor extends RPCStruct{
+public class RGBColor extends RPCStruct {
public static final String KEY_RED = "red";
public static final String KEY_GREEN = "green";
public static final String KEY_BLUE = "blue";
@@ -79,12 +80,13 @@ public class RGBColor extends RPCStruct{
/**
* Constructs a new RGBColor object
*/
- public RGBColor(){
+ public RGBColor() {
this(MIN_VALUE, MIN_VALUE, MIN_VALUE);
}
/**
* Constructs a new RGBColor object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public RGBColor(Hashtable<String, Object> hash) {
@@ -93,9 +95,10 @@ public class RGBColor extends RPCStruct{
/**
* Constructs a new RGB object
- * @param red red value - min: 0; max: 255
+ *
+ * @param red red value - min: 0; max: 255
* @param green green value - min: 0; max: 255
- * @param blue blue value - min: 0; max: 255
+ * @param blue blue value - min: 0; max: 255
*/
public RGBColor(Integer red, Integer green, Integer blue) {
Hashtable<String, Object> hash = new Hashtable<>();
@@ -119,9 +122,10 @@ public class RGBColor extends RPCStruct{
/**
* Sets the red value of the color object
+ *
* @param color red value - min: 0; max: 255
*/
- public RGBColor setRed( Integer color) {
+ public RGBColor setRed(Integer color) {
if (color != null && color >= MIN_VALUE && color <= MAX_VALUE) {
setValue(KEY_RED, color);
}
@@ -130,6 +134,7 @@ public class RGBColor extends RPCStruct{
/**
* Gets the red value of the color
+ *
* @return red value
*/
public Integer getRed() {
@@ -138,9 +143,10 @@ public class RGBColor extends RPCStruct{
/**
* Sets the green value of the color object
+ *
* @param color green value - min: 0; max: 255
*/
- public RGBColor setGreen( Integer color) {
+ public RGBColor setGreen(Integer color) {
if (color != null && color >= MIN_VALUE && color <= MAX_VALUE) {
setValue(KEY_GREEN, color);
}
@@ -149,6 +155,7 @@ public class RGBColor extends RPCStruct{
/**
* Gets the green value of the color
+ *
* @return green value
*/
public Integer getGreen() {
@@ -157,9 +164,10 @@ public class RGBColor extends RPCStruct{
/**
* Sets the blue value of the color object
+ *
* @param color blue value - min: 0; max: 255
*/
- public RGBColor setBlue( Integer color) {
+ public RGBColor setBlue(Integer color) {
if (color != null && color >= MIN_VALUE && color <= MAX_VALUE) {
setValue(KEY_BLUE, color);
}
@@ -168,6 +176,7 @@ public class RGBColor extends RPCStruct{
/**
* Gets the green value of the color
+ *
* @return green value
*/
public Integer getBlue() {
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 0b6297b68..05dccbc88 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,17 +40,18 @@ import java.util.Hashtable;
/**
* Contains information about a radio control module's capabilities.
*/
-public class RadioControlCapabilities extends RPCStruct{
- public static final String KEY_MODULE_NAME= "moduleName";
- public static final String KEY_RADIO_ENABLE_AVAILABLE= "radioEnableAvailable";
- public static final String KEY_RADIO_BAND_AVAILABLE= "radioBandAvailable";
- public static final String KEY_RADIO_FREQUENCY_AVAILABLE= "radioFrequencyAvailable";
- public static final String KEY_HD_CHANNEL_AVAILABLE= "hdChannelAvailable";
- public static final String KEY_RDS_DATA_AVAILABLE= "rdsDataAvailable";
- @Deprecated public static final String KEY_AVAILABLE_HDS_AVAILABLE= "availableHDsAvailable";
- public static final String KEY_STATE_AVAILABLE= "stateAvailable";
- public static final String KEY_SIGNAL_STRENGTH_AVAILABLE= "signalStrengthAvailable";
- public static final String KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE= "signalChangeThresholdAvailable";
+public class RadioControlCapabilities extends RPCStruct {
+ public static final String KEY_MODULE_NAME = "moduleName";
+ public static final String KEY_RADIO_ENABLE_AVAILABLE = "radioEnableAvailable";
+ public static final String KEY_RADIO_BAND_AVAILABLE = "radioBandAvailable";
+ public static final String KEY_RADIO_FREQUENCY_AVAILABLE = "radioFrequencyAvailable";
+ public static final String KEY_HD_CHANNEL_AVAILABLE = "hdChannelAvailable";
+ public static final String KEY_RDS_DATA_AVAILABLE = "rdsDataAvailable";
+ @Deprecated
+ public static final String KEY_AVAILABLE_HDS_AVAILABLE = "availableHDsAvailable";
+ public static final String KEY_STATE_AVAILABLE = "stateAvailable";
+ public static final String KEY_SIGNAL_STRENGTH_AVAILABLE = "signalStrengthAvailable";
+ public static final String KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE = "signalChangeThresholdAvailable";
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";
@@ -66,20 +67,20 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Constructs a new RadioControlCapabilities object
- * @param moduleName
- * The short friendly name of the climate control module.
- * It should not be used to identify a module by mobile application.
+ *
+ * @param moduleName The short friendly name of the climate control module.
+ * It should not be used to identify a module by mobile application.
*/
public RadioControlCapabilities(@NonNull String moduleName) {
this();
setModuleName(moduleName);
}
+
/**
* Sets the moduleName portion of the RadioControlCapabilities class
*
- * @param moduleName
- * The short friendly name of the climate control module.
- * It should not be used to identify a module by mobile application.
+ * @param moduleName The short friendly name of the climate control module.
+ * It should not be used to identify a module by mobile application.
*/
public RadioControlCapabilities setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
@@ -98,11 +99,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the radioEnableAvailable portion of the RadioControlCapabilities class
*
- * @param radioEnableAvailable
- * Availability of the control of enable/disable radio.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param radioEnableAvailable Availability of the control of enable/disable radio.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setRadioEnableAvailable( Boolean radioEnableAvailable) {
+ public RadioControlCapabilities setRadioEnableAvailable(Boolean radioEnableAvailable) {
setValue(KEY_RADIO_ENABLE_AVAILABLE, radioEnableAvailable);
return this;
}
@@ -120,11 +120,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the radioBandAvailable portion of the RadioControlCapabilities class
*
- * @param radioBandAvailable
- * Availability of the control of radio band.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param radioBandAvailable Availability of the control of radio band.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setRadioBandAvailable( Boolean radioBandAvailable) {
+ public RadioControlCapabilities setRadioBandAvailable(Boolean radioBandAvailable) {
setValue(KEY_RADIO_BAND_AVAILABLE, radioBandAvailable);
return this;
}
@@ -142,11 +141,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the radioFrequencyAvailable portion of the RadioControlCapabilities class
*
- * @param radioFrequencyAvailable
- * Availability of the control of radio frequency.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param radioFrequencyAvailable Availability of the control of radio frequency.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setRadioFrequencyAvailable( Boolean radioFrequencyAvailable) {
+ public RadioControlCapabilities setRadioFrequencyAvailable(Boolean radioFrequencyAvailable) {
setValue(KEY_RADIO_FREQUENCY_AVAILABLE, radioFrequencyAvailable);
return this;
}
@@ -164,11 +162,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the hdChannelAvailable portion of the RadioControlCapabilities class
*
- * @param hdChannelAvailable
- * Availability of the control of HD radio channel.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param hdChannelAvailable Availability of the control of HD radio channel.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setHdChannelAvailable( Boolean hdChannelAvailable) {
+ public RadioControlCapabilities setHdChannelAvailable(Boolean hdChannelAvailable) {
setValue(KEY_HD_CHANNEL_AVAILABLE, hdChannelAvailable);
return this;
}
@@ -186,11 +183,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the rdsDataAvailable portion of the RadioControlCapabilities class
*
- * @param rdsDataAvailable
- * Availability of the getting Radio Data System (RDS) data.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param rdsDataAvailable Availability of the getting Radio Data System (RDS) data.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setRdsDataAvailable( Boolean rdsDataAvailable) {
+ public RadioControlCapabilities setRdsDataAvailable(Boolean rdsDataAvailable) {
setValue(KEY_RDS_DATA_AVAILABLE, rdsDataAvailable);
return this;
}
@@ -208,12 +204,11 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the availableHDsAvailable portion of the RadioControlCapabilities class
*
- * @param availableHDsAvailable
- * Availability of the getting the number of available HD channels.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param availableHDsAvailable Availability of the getting the number of available HD channels.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
@Deprecated
- public RadioControlCapabilities setAvailableHDsAvailable( Boolean availableHDsAvailable) {
+ public RadioControlCapabilities setAvailableHDsAvailable(Boolean availableHDsAvailable) {
setValue(KEY_AVAILABLE_HDS_AVAILABLE, availableHDsAvailable);
return this;
}
@@ -232,11 +227,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the availableHdChannelsAvailable portion of the RadioControlCapabilities class
*
- * @param availableHdChannelsAvailable
- * Availability of the list of available HD sub-channel indexes.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param availableHdChannelsAvailable Availability of the list of available HD sub-channel indexes.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setAvailableHdChannelsAvailable( Boolean availableHdChannelsAvailable) {
+ public RadioControlCapabilities setAvailableHdChannelsAvailable(Boolean availableHdChannelsAvailable) {
setValue(KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, availableHdChannelsAvailable);
return this;
}
@@ -254,11 +248,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the stateAvailable portion of the RadioControlCapabilities class
*
- * @param stateAvailable
- * Availability of the getting the Radio state.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param stateAvailable Availability of the getting the Radio state.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setStateAvailable( Boolean stateAvailable) {
+ public RadioControlCapabilities setStateAvailable(Boolean stateAvailable) {
setValue(KEY_STATE_AVAILABLE, stateAvailable);
return this;
}
@@ -276,11 +269,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the signalStrengthAvailable portion of the RadioControlCapabilities class
*
- * @param signalStrengthAvailable
- * Availability of the getting the signal strength.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param signalStrengthAvailable Availability of the getting the signal strength.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setSignalStrengthAvailable( Boolean signalStrengthAvailable) {
+ public RadioControlCapabilities setSignalStrengthAvailable(Boolean signalStrengthAvailable) {
setValue(KEY_SIGNAL_STRENGTH_AVAILABLE, signalStrengthAvailable);
return this;
}
@@ -298,11 +290,10 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets the signalChangeThresholdAvailable portion of the RadioControlCapabilities class
*
- * @param signalChangeThresholdAvailable
- * Availability of the getting the signal Change Threshold.
- * True: Available, False: Not Available, Not present: Not Available.
+ * @param signalChangeThresholdAvailable Availability of the getting the signal Change Threshold.
+ * True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setSignalChangeThresholdAvailable( Boolean signalChangeThresholdAvailable) {
+ public RadioControlCapabilities setSignalChangeThresholdAvailable(Boolean signalChangeThresholdAvailable) {
setValue(KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, signalChangeThresholdAvailable);
return this;
}
@@ -323,7 +314,7 @@ public class RadioControlCapabilities extends RPCStruct{
* @param hdRadioEnableAvailable Availability of the control of enable/disable HD radio.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setHdRadioEnableAvailable( Boolean hdRadioEnableAvailable) {
+ public RadioControlCapabilities setHdRadioEnableAvailable(Boolean hdRadioEnableAvailable) {
setValue(KEY_HD_RADIO_ENABLE_AVAILABLE, hdRadioEnableAvailable);
return this;
}
@@ -344,7 +335,7 @@ public class RadioControlCapabilities extends RPCStruct{
* @param siriusxmRadioAvailable Availability of sirius XM radio.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setSiriusXMRadioAvailable( Boolean siriusxmRadioAvailable) {
+ public RadioControlCapabilities setSiriusXMRadioAvailable(Boolean siriusxmRadioAvailable) {
setValue(KEY_SIRIUS_XM_RADIO_AVAILABLE, siriusxmRadioAvailable);
return this;
}
@@ -365,7 +356,7 @@ public class RadioControlCapabilities extends RPCStruct{
* @param sisDataAvailable Availability of the getting HD radio Station Information Service (SIS) data.
* True: Available, False: Not Available, Not present: Not Available.
*/
- public RadioControlCapabilities setSisDataAvailable( Boolean sisDataAvailable) {
+ public RadioControlCapabilities setSisDataAvailable(Boolean sisDataAvailable) {
setValue(KEY_SIS_DATA_AVAILABLE, sisDataAvailable);
return this;
}
@@ -382,15 +373,17 @@ public class RadioControlCapabilities extends RPCStruct{
/**
* Sets ModuleInfo for this capability
+ *
* @param info the ModuleInfo to be set
*/
- public RadioControlCapabilities setModuleInfo( ModuleInfo info) {
+ public RadioControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
/**
* Gets a ModuleInfo of this capability
+ *
* @return module info of this capability
*/
public ModuleInfo getModuleInfo() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
index 433d7ad28..4a47fe56c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,20 +42,21 @@ import java.util.List;
* Include information (both read-only and changeable data) about a
* remote control radio module.
*/
-public class RadioControlData extends RPCStruct{
- public static final String KEY_FREQUENCY_INTEGER= "frequencyInteger";
- public static final String KEY_FREQUENCY_FRACTION= "frequencyFraction";
- public static final String KEY_BAND= "band";
- public static final String KEY_RDS_DATA= "rdsData";
- @Deprecated public static final String KEY_AVAILABLE_HDS= "availableHDs";
- public static final String KEY_HD_CHANNEL= "hdChannel";
- public static final String KEY_SIGNAL_STRENGTH= "signalStrength";
- public static final String KEY_SIGNAL_CHANGE_THRESHOLD= "signalChangeThreshold";
- public static final String KEY_RADIO_ENABLE= "radioEnable";
- public static final String KEY_STATE= "state";
+public class RadioControlData extends RPCStruct {
+ public static final String KEY_FREQUENCY_INTEGER = "frequencyInteger";
+ public static final String KEY_FREQUENCY_FRACTION = "frequencyFraction";
+ public static final String KEY_BAND = "band";
+ public static final String KEY_RDS_DATA = "rdsData";
+ @Deprecated
+ public static final String KEY_AVAILABLE_HDS = "availableHDs";
+ public static final String KEY_HD_CHANNEL = "hdChannel";
+ public static final String KEY_SIGNAL_STRENGTH = "signalStrength";
+ public static final String KEY_SIGNAL_CHANGE_THRESHOLD = "signalChangeThreshold";
+ public static final String KEY_RADIO_ENABLE = "radioEnable";
+ public static final String KEY_STATE = "state";
public static final String KEY_HD_RADIO_ENABLE = "hdRadioEnable";
public static final String KEY_SIS_DATA = "sisData";
- public static final String KEY_AVAILABLE_HD_CHANNELS= "availableHdChannels";
+ public static final String KEY_AVAILABLE_HD_CHANNELS = "availableHdChannels";
public RadioControlData() {
}
@@ -67,10 +68,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the frequencyInteger portion of the RadioControlData class
*
- * @param frequencyInteger
- * The integer part of the frequency i.e. for 101.7 this value should be 101
+ * @param frequencyInteger The integer part of the frequency i.e. for 101.7 this value should be 101
*/
- public RadioControlData setFrequencyInteger( Integer frequencyInteger) {
+ public RadioControlData setFrequencyInteger(Integer frequencyInteger) {
setValue(KEY_FREQUENCY_INTEGER, frequencyInteger);
return this;
}
@@ -87,10 +87,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the frequencyFraction portion of the RadioControlData class
*
- * @param frequencyFraction
- * The fractional part of the frequency i.e. for 101.7 is 7.
+ * @param frequencyFraction The fractional part of the frequency i.e. for 101.7 is 7.
*/
- public RadioControlData setFrequencyFraction( Integer frequencyFraction) {
+ public RadioControlData setFrequencyFraction(Integer frequencyFraction) {
setValue(KEY_FREQUENCY_FRACTION, frequencyFraction);
return this;
}
@@ -107,10 +106,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the band portion of the RadioControlData class
*
- * @param band
- * The radio band (AM|FM|XM) of the radio tuner.
+ * @param band The radio band (AM|FM|XM) of the radio tuner.
*/
- public RadioControlData setBand( RadioBand band) {
+ public RadioControlData setBand(RadioBand band) {
setValue(KEY_BAND, band);
return this;
}
@@ -127,10 +125,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the rdsData portion of the RadioControlData class
*
- * @param rdsData
- * Read only parameter. See RdsData data type for details.
+ * @param rdsData Read only parameter. See RdsData data type for details.
*/
- public RadioControlData setRdsData( RdsData rdsData) {
+ public RadioControlData setRdsData(RdsData rdsData) {
setValue(KEY_RDS_DATA, rdsData);
return this;
}
@@ -147,11 +144,10 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the availableHDs portion of the RadioControlData class
*
- * @param availableHDs
- * Number of HD sub-channels if available.
+ * @param availableHDs Number of HD sub-channels if available.
*/
@Deprecated
- public RadioControlData setAvailableHDs( Integer availableHDs) {
+ public RadioControlData setAvailableHDs(Integer availableHDs) {
setValue(KEY_AVAILABLE_HDS, availableHDs);
return this;
}
@@ -169,10 +165,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the hdChannel portion of the RadioControlData class
*
- * @param hdChannel
- * Current HD sub-channel if available.
+ * @param hdChannel Current HD sub-channel if available.
*/
- public RadioControlData setHdChannel( Integer hdChannel) {
+ public RadioControlData setHdChannel(Integer hdChannel) {
setValue(KEY_HD_CHANNEL, hdChannel);
return this;
}
@@ -189,10 +184,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the signalStrength portion of the RadioControlData class
*
- * @param signalStrength
- * Read only parameter. Indicates the strength of receiving radio signal in current frequency.
+ * @param signalStrength Read only parameter. Indicates the strength of receiving radio signal in current frequency.
*/
- public RadioControlData setSignalStrength( Integer signalStrength) {
+ public RadioControlData setSignalStrength(Integer signalStrength) {
setValue(KEY_SIGNAL_STRENGTH, signalStrength);
return this;
}
@@ -209,10 +203,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the signalChangeThreshold portion of the RadioControlData class
*
- * @param signalChangeThreshold
- * If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency.
+ * @param signalChangeThreshold If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency.
*/
- public RadioControlData setSignalChangeThreshold( Integer signalChangeThreshold) {
+ public RadioControlData setSignalChangeThreshold(Integer signalChangeThreshold) {
setValue(KEY_SIGNAL_CHANGE_THRESHOLD, signalChangeThreshold);
return this;
}
@@ -231,10 +224,9 @@ public class RadioControlData extends RPCStruct{
* <br><b>Note: </b> If this is set to false, no other data will be included.
* <br><b>Note: </b> This setting is normally a <b>READ-ONLY</b> setting.
*
- * @param radioEnable
- * True if the radio is on, false is the radio is off.
+ * @param radioEnable True if the radio is on, false is the radio is off.
*/
- public RadioControlData setRadioEnable( Boolean radioEnable) {
+ public RadioControlData setRadioEnable(Boolean radioEnable) {
setValue(KEY_RADIO_ENABLE, radioEnable);
return this;
}
@@ -252,10 +244,9 @@ public class RadioControlData extends RPCStruct{
/**
* Sets the state portion of the RadioControlData class
*
- * @param state
- * Read only parameter. See RadioState data type for details.
+ * @param state Read only parameter. See RadioState data type for details.
*/
- public RadioControlData setState( RadioState state) {
+ public RadioControlData setState(RadioState state) {
setValue(KEY_STATE, state);
return this;
}
@@ -274,7 +265,7 @@ public class RadioControlData extends RPCStruct{
*
* @param hdRadioEnable True if the hd radio is on, false if the radio is off.
*/
- public RadioControlData setHdRadioEnable( Boolean hdRadioEnable) {
+ public RadioControlData setHdRadioEnable(Boolean hdRadioEnable) {
setValue(KEY_HD_RADIO_ENABLE, hdRadioEnable);
return this;
}
@@ -293,7 +284,7 @@ public class RadioControlData extends RPCStruct{
*
* @param sisData Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number.
*/
- public RadioControlData setSisData( SisData sisData) {
+ public RadioControlData setSisData(SisData sisData) {
setValue(KEY_SIS_DATA, sisData);
return this;
}
@@ -312,7 +303,7 @@ public class RadioControlData extends RPCStruct{
*
* @param availableHdChannels List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
*/
- public RadioControlData setAvailableHdChannels( List<Integer> availableHdChannels) {
+ public RadioControlData setAvailableHdChannels(List<Integer> availableHdChannels) {
setValue(KEY_AVAILABLE_HD_CHANNELS, availableHdChannels);
return this;
}
@@ -323,7 +314,7 @@ public class RadioControlData extends RPCStruct{
* @return List<Integer> - List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
*/
@SuppressWarnings("unchecked")
- public List<Integer> getAvailableHdChannels(){
- return (List<Integer>) getObject(Integer.class,KEY_AVAILABLE_HD_CHANNELS);
+ public List<Integer> getAvailableHdChannels() {
+ return (List<Integer>) getObject(Integer.class, KEY_AVAILABLE_HD_CHANNELS);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java
index 223adebd7..d2eb11753 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,15 +39,15 @@ import java.util.Hashtable;
* Include the data defined in Radio Data System, which is a communications protocol standard
* for embedding small amounts of digital information in conventional FM radio broadcasts.
*/
-public class RdsData extends RPCStruct{
- public static final String KEY_PS= "PS";
- public static final String KEY_RT= "RT";
- public static final String KEY_CT= "CT";
- public static final String KEY_PI= "PI";
- public static final String KEY_PTY= "PTY";
- public static final String KEY_TP= "TP";
- public static final String KEY_TA= "TA";
- public static final String KEY_REG= "REG";
+public class RdsData extends RPCStruct {
+ public static final String KEY_PS = "PS";
+ public static final String KEY_RT = "RT";
+ public static final String KEY_CT = "CT";
+ public static final String KEY_PI = "PI";
+ public static final String KEY_PTY = "PTY";
+ public static final String KEY_TP = "TP";
+ public static final String KEY_TA = "TA";
+ public static final String KEY_REG = "REG";
public RdsData() {
}
@@ -59,10 +59,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the programService portion of the RdsData class
*
- * @param programService
- * Program Service Name.
+ * @param programService Program Service Name.
*/
- public RdsData setProgramService( String programService) {
+ public RdsData setProgramService(String programService) {
setValue(KEY_PS, programService);
return this;
}
@@ -79,10 +78,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the radioText portion of the RdsData class
*
- * @param radioText
- * Radio Text.
+ * @param radioText Radio Text.
*/
- public RdsData setRadioText( String radioText) {
+ public RdsData setRadioText(String radioText) {
setValue(KEY_RT, radioText);
return this;
}
@@ -99,10 +97,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the clockText portion of the RdsData class
*
- * @param clockText
- * The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD.
+ * @param clockText The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD.
*/
- public RdsData setClockText( String clockText) {
+ public RdsData setClockText(String clockText) {
setValue(KEY_CT, clockText);
return this;
}
@@ -119,10 +116,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the programIdentification portion of the RdsData class
*
- * @param programIdentification
- * Program Identification - the call sign for the radio station.
+ * @param programIdentification Program Identification - the call sign for the radio station.
*/
- public RdsData setProgramIdentification( String programIdentification) {
+ public RdsData setProgramIdentification(String programIdentification) {
setValue(KEY_PI, programIdentification);
return this;
}
@@ -139,10 +135,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the region portion of the RdsData class
*
- * @param region
- * Region.
+ * @param region Region.
*/
- public RdsData setRegion( String region) {
+ public RdsData setRegion(String region) {
setValue(KEY_REG, region);
return this;
}
@@ -159,10 +154,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the trafficProgram portion of the RdsData class
*
- * @param trafficProgram
- * Traffic Program Identification - Identifies a station that offers traffic.
+ * @param trafficProgram Traffic Program Identification - Identifies a station that offers traffic.
*/
- public RdsData setTrafficProgram( Boolean trafficProgram) {
+ public RdsData setTrafficProgram(Boolean trafficProgram) {
setValue(KEY_TP, trafficProgram);
return this;
}
@@ -179,10 +173,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the trafficAnnouncement portion of the RdsData class
*
- * @param trafficAnnouncement
- * Traffic Announcement Identification - Indicates an ongoing traffic announcement.
+ * @param trafficAnnouncement Traffic Announcement Identification - Indicates an ongoing traffic announcement.
*/
- public RdsData setTrafficAnnouncement( Boolean trafficAnnouncement) {
+ public RdsData setTrafficAnnouncement(Boolean trafficAnnouncement) {
setValue(KEY_TA, trafficAnnouncement);
return this;
}
@@ -199,10 +192,9 @@ public class RdsData extends RPCStruct{
/**
* Sets the programType portion of the RdsData class
*
- * @param programType
- * The program type - The region should be used to differentiate between EU and North America program types.
+ * @param programType The program type - The region should be used to differentiate between EU and North America program types.
*/
- public RdsData setProgramType( Integer programType) {
+ public RdsData setProgramType(Integer programType) {
setValue(KEY_PTY, programType);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
index b72524eeb..91d95c848 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,11 +43,11 @@ import java.util.List;
* <p>Non periodic vehicle data read request. This is an RPC to get diagnostics
* data from certain vehicle modules. DIDs of a certain module might differ from
* vehicle type to vehicle type</p>
- *
+ *
* <p>Function Group: ProprietaryData</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -83,9 +83,9 @@ import java.util.List;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ *
* <p><b>Response</b></p>
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
@@ -97,95 +97,94 @@ import java.util.List;
* <p> DISALLOWED</p>
* <p>USER_DISALLOWED </p>
* <p>TRUNCATED_DATA</p>
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class ReadDID extends RPCRequest {
- public static final String KEY_ECU_NAME = "ecuName";
- public static final String KEY_DID_LOCATION = "didLocation";
+ public static final String KEY_ECU_NAME = "ecuName";
+ public static final String KEY_DID_LOCATION = "didLocation";
- /**
- * Constructs a new ReadDID object
- */
+ /**
+ * Constructs a new ReadDID object
+ */
public ReadDID() {
super(FunctionID.READ_DID.toString());
}
- /**
- * Constructs a new ReadDID object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new ReadDID object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
public ReadDID(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ReadDID object
- * @param ecuName an Integer value representing the ID of the vehicle module
- * <b>Notes: </b>Minvalue:0; Maxvalue:65535
- * @param didLocation a List<Integer> value representing raw data from vehicle data DID location(s) <br>
- * <b>Notes: </b>
- * <ul>
- * <li>Minvalue:0; Maxvalue:65535</li>
- * <li>ArrayMin:0; ArrayMax:1000</li>
- * </ul>
- */
- public ReadDID(@NonNull Integer ecuName, @NonNull List<Integer> didLocation) {
- this();
- setEcuName(ecuName);
- setDidLocation(didLocation);
- }
+ /**
+ * Constructs a new ReadDID object
+ *
+ * @param ecuName an Integer value representing the ID of the vehicle module
+ * <b>Notes: </b>Minvalue:0; Maxvalue:65535
+ * @param didLocation a List<Integer> value representing raw data from vehicle data DID location(s) <br>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Minvalue:0; Maxvalue:65535</li>
+ * <li>ArrayMin:0; ArrayMax:1000</li>
+ * </ul>
+ */
+ public ReadDID(@NonNull Integer ecuName, @NonNull List<Integer> didLocation) {
+ this();
+ setEcuName(ecuName);
+ setDidLocation(didLocation);
+ }
- /**
- * Sets an ID of the vehicle module
- *
- * @param ecuName
- * an Integer value representing the ID of the vehicle module
- * <p></p>
- * <b>Notes: </b>Minvalue:0; Maxvalue:65535
- */
+ /**
+ * Sets an ID of the vehicle module
+ *
+ * @param ecuName an Integer value representing the ID of the vehicle module
+ * <p></p>
+ * <b>Notes: </b>Minvalue:0; Maxvalue:65535
+ */
public ReadDID setEcuName(@NonNull Integer ecuName) {
setParameters(KEY_ECU_NAME, ecuName);
return this;
}
- /**
- * Gets the ID of the vehicle module
- *
- * @return Integer -an Integer value representing the ID of the vehicle
- * module
- */
+ /**
+ * Gets the ID of the vehicle module
+ *
+ * @return Integer -an Integer value representing the ID of the vehicle
+ * module
+ */
public Integer getEcuName() {
- return getInteger(KEY_ECU_NAME);
+ return getInteger(KEY_ECU_NAME);
}
- /**
- * Sets raw data from vehicle data DID location(s)
- *
- * @param didLocation
- * a List<Integer> value representing raw data from vehicle
- * data DID location(s)
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Minvalue:0; Maxvalue:65535</li>
- * <li>ArrayMin:0; ArrayMax:1000</li>
- * </ul>
- */
+ /**
+ * Sets raw data from vehicle data DID location(s)
+ *
+ * @param didLocation a List<Integer> value representing raw data from vehicle
+ * data DID location(s)
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Minvalue:0; Maxvalue:65535</li>
+ * <li>ArrayMin:0; ArrayMax:1000</li>
+ * </ul>
+ */
public ReadDID setDidLocation(@NonNull List<Integer> didLocation) {
setParameters(KEY_DID_LOCATION, didLocation);
return this;
}
- /**
- * Gets raw data from vehicle data DID location(s)
- *
- * @return List<Integer> -a List<Integer> value representing raw data
- * from vehicle data DID location(s)
- */
+ /**
+ * Gets raw data from vehicle data DID location(s)
+ *
+ * @return List<Integer> -a List<Integer> value representing raw data
+ * from vehicle data DID location(s)
+ */
@SuppressWarnings("unchecked")
public List<Integer> getDidLocation() {
- return (List<Integer>) getObject(Integer.class, KEY_DID_LOCATION);
+ return (List<Integer>) getObject(Integer.class, KEY_DID_LOCATION);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
index 61158da36..8197b909f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,21 +42,24 @@ import java.util.List;
/**
* Read DID Response is sent, when ReadDID has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class ReadDIDResponse extends RPCResponse {
- public static final String KEY_DID_RESULT = "didResult";
+ public static final String KEY_DID_RESULT = "didResult";
public ReadDIDResponse() {
super(FunctionID.READ_DID.toString());
}
+
public ReadDIDResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Constructs a new ReadDIDResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public ReadDIDResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -64,12 +67,14 @@ public class ReadDIDResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
- public ReadDIDResponse setDidResult( List<DIDResult> didResult) {
+
+ public ReadDIDResponse setDidResult(List<DIDResult> didResult) {
setParameters(KEY_DID_RESULT, didResult);
return this;
}
+
@SuppressWarnings("unchecked")
public List<DIDResult> getDidResult() {
- return (List<DIDResult>) getObject(DIDResult.class, KEY_DID_RESULT);
+ return (List<DIDResult>) getObject(DIDResult.class, KEY_DID_RESULT);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
index 69f6c26ef..d9b972abe 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
@@ -39,85 +39,88 @@ import java.util.Hashtable;
/**
* Defines Rectangle for each user control object for video streaming application
+ *
* @since SmartDeviceLink 4.5.0
*/
public class Rectangle extends RPCStruct {
- public static final String KEY_X = "x";
- public static final String KEY_Y = "y";
- public static final String KEY_WIDTH = "width";
- public static final String KEY_HEIGHT = "height";
-
- public Rectangle() {}
- public Rectangle(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public Rectangle(@NonNull Float x, @NonNull Float y, @NonNull Float width, @NonNull Float height) {
- this();
- setX(x);
- setY(y);
- setWidth(width);
- setHeight(height);
- }
-
- /**
- * Set the X-coordinate pixel in of the user control that starts in the upper left corner
- */
- public Rectangle setX(@NonNull Float x) {
+ public static final String KEY_X = "x";
+ public static final String KEY_Y = "y";
+ public static final String KEY_WIDTH = "width";
+ public static final String KEY_HEIGHT = "height";
+
+ public Rectangle() {
+ }
+
+ public Rectangle(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public Rectangle(@NonNull Float x, @NonNull Float y, @NonNull Float width, @NonNull Float height) {
+ this();
+ setX(x);
+ setY(y);
+ setWidth(width);
+ setHeight(height);
+ }
+
+ /**
+ * Set the X-coordinate pixel in of the user control that starts in the upper left corner
+ */
+ public Rectangle setX(@NonNull Float x) {
setValue(KEY_X, x);
return this;
}
- /**
- * @return the X-coordinate pixel of the user control that starts in the upper left corner
- */
- public Float getX() {
- return getFloat(KEY_X);
- }
-
- /**
- * Set the Y-coordinate pixel of the user control that starts in the upper left corner
- */
- public Rectangle setY(@NonNull Float y) {
+ /**
+ * @return the X-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public Float getX() {
+ return getFloat(KEY_X);
+ }
+
+ /**
+ * Set the Y-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public Rectangle setY(@NonNull Float y) {
setValue(KEY_Y, y);
return this;
}
- /**
- * @return the Y-coordinate pixel of the user control that starts in the upper left corner
- */
- public Float getY() {
- return getFloat(KEY_Y);
- }
-
- /**
- * Set the width in pixels of the user control's bounding rectangle in pixels
- */
- public Rectangle setWidth(@NonNull Float width) {
+ /**
+ * @return the Y-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public Float getY() {
+ return getFloat(KEY_Y);
+ }
+
+ /**
+ * Set the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public Rectangle setWidth(@NonNull Float width) {
setValue(KEY_WIDTH, width);
return this;
}
- /**
- * @return the width in pixels of the user control's bounding rectangle in pixels
- */
- public Float getWidth() {
- return getFloat(KEY_WIDTH);
- }
-
- /**
- * The height in pixels of the user control's bounding rectangle
- */
- public Rectangle setHeight(@NonNull Float height) {
+ /**
+ * @return the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public Float getWidth() {
+ return getFloat(KEY_WIDTH);
+ }
+
+ /**
+ * The height in pixels of the user control's bounding rectangle
+ */
+ public Rectangle setHeight(@NonNull Float height) {
setValue(KEY_HEIGHT, height);
return this;
}
- /**
- * @return the width in pixels of the user control's bounding rectangle in pixels
- */
- public Float getHeight() {
- return getFloat(KEY_HEIGHT);
- }
+ /**
+ * @return the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public Float getHeight() {
+ return getFloat(KEY_HEIGHT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
index ca2bc9d47..206b74f79 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,6 +41,7 @@ import com.smartdevicelink.util.Version;
import java.util.Hashtable;
import java.util.List;
+
/**
* Registers the application's interface with SDL&reg;, declaring properties of
* the registration, including the messaging interface version, the app name,
@@ -104,10 +105,10 @@ import java.util.List;
* <p></p>
* There is no time limit for how long the autoActivateID is "valid" (i.e. would
* confer focus and opt-in)
- *
- *<p> <b>HMILevel is not defined before registering</b></p>
- *
- *
+ *
+ * <p> <b>HMILevel is not defined before registering</b></p>
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -230,7 +231,7 @@ import java.util.List;
* <td></td>
* <td>SmartDeviceLink 2.3.2.2 </td>
* </tr>
- *
+ *
* <tr>
* <td>sdlVersion</td>
* <td>String</td>
@@ -268,501 +269,505 @@ import java.util.List;
* </tr>
* </table>
* <p></p>
- * @since SmartDeviceLink 1.0
+ *
* @see UnregisterAppInterface
* @see OnAppInterfaceUnregistered
+ * @since SmartDeviceLink 1.0
*/
public class RegisterAppInterface extends RPCRequest {
- public static final String KEY_TTS_NAME = "ttsName";
- public static final String KEY_HMI_DISPLAY_LANGUAGE_DESIRED = "hmiDisplayLanguageDesired";
- public static final String KEY_APP_HMI_TYPE = "appHMIType";
- public static final String KEY_APP_ID = "appID";
- public static final String KEY_FULL_APP_ID = "fullAppID";
- public static final String KEY_LANGUAGE_DESIRED = "languageDesired";
- public static final String KEY_DEVICE_INFO = "deviceInfo";
- public static final String KEY_APP_NAME = "appName";
- public static final String KEY_NGN_MEDIA_SCREEN_APP_NAME = "ngnMediaScreenAppName";
- public static final String KEY_IS_MEDIA_APPLICATION = "isMediaApplication";
- public static final String KEY_VR_SYNONYMS = "vrSynonyms";
- public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
- public static final String KEY_HASH_ID = "hashID";
- public static final String KEY_APP_INFO = "appInfo";
- public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
- public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
- private static final int APP_ID_MAX_LENGTH = 10;
-
- /**
- * Constructs a new RegisterAppInterface object
- */
+ public static final String KEY_TTS_NAME = "ttsName";
+ public static final String KEY_HMI_DISPLAY_LANGUAGE_DESIRED = "hmiDisplayLanguageDesired";
+ public static final String KEY_APP_HMI_TYPE = "appHMIType";
+ public static final String KEY_APP_ID = "appID";
+ public static final String KEY_FULL_APP_ID = "fullAppID";
+ public static final String KEY_LANGUAGE_DESIRED = "languageDesired";
+ public static final String KEY_DEVICE_INFO = "deviceInfo";
+ public static final String KEY_APP_NAME = "appName";
+ public static final String KEY_NGN_MEDIA_SCREEN_APP_NAME = "ngnMediaScreenAppName";
+ public static final String KEY_IS_MEDIA_APPLICATION = "isMediaApplication";
+ public static final String KEY_VR_SYNONYMS = "vrSynonyms";
+ public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
+ public static final String KEY_HASH_ID = "hashID";
+ public static final String KEY_APP_INFO = "appInfo";
+ public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
+ public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
+ private static final int APP_ID_MAX_LENGTH = 10;
+
+ /**
+ * Constructs a new RegisterAppInterface object
+ */
public RegisterAppInterface() {
super(FunctionID.REGISTER_APP_INTERFACE.toString());
}
- /**
- * Constructs a new RegisterAppInterface object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * Constructs a new RegisterAppInterface object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public RegisterAppInterface(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new RegisterAppInterface object
- * @param syncMsgVersion a SdlMsgVersion object representing version of the SDL&reg; SmartDeviceLink interface <br>
- * <b>Notes: </b>To be compatible, app msg major version number
- * must be less than or equal to SDL&reg; major version number.
- * If msg versions are incompatible, app has 20 seconds to
- * attempt successful RegisterAppInterface (w.r.t. msg version)
- * on underlying protocol session, else will be terminated. Major
- * version number is a compatibility declaration. Minor version
- * number indicates minor functional variations (e.g. features,
- * capabilities, bug fixes) when sent from SDL&reg; to app (in
- * RegisterAppInterface response). However, the minor version
- * number sent from the app to SDL&reg; (in RegisterAppInterface
- * request) is ignored by SDL&reg;
- * @param appName a String value representing the Mobile Application's Name <br>
- * <b>Notes: </b>
- * <ul>
- * <li>Must be 1-100 characters in length</li>
- * <li>May not be the same (by case insensitive comparison) as
- * the name or any synonym of any currently-registered
- * application</li>
- * </ul>
- * @param isMediaApplication a Boolean value
- * @param languageDesired a Language Enumeration
- * @param hmiDisplayLanguageDesired the requested language to be used on the HMI/Display
- * @param fullAppID a String value representing a unique ID, which an app will be given when approved <br>
- * <b>Notes: </b>maxLength = 100
- */
- public RegisterAppInterface(@NonNull SdlMsgVersion syncMsgVersion, @NonNull String appName, @NonNull Boolean isMediaApplication,
- @NonNull Language languageDesired, @NonNull Language hmiDisplayLanguageDesired, @NonNull String fullAppID) {
- this();
- setSdlMsgVersion(syncMsgVersion);
- setAppName(appName);
- setIsMediaApplication(isMediaApplication);
- setLanguageDesired(languageDesired);
- setHmiDisplayLanguageDesired(hmiDisplayLanguageDesired);
- setFullAppID(fullAppID);
- }
- /**
- * Gets the version of the SDL&reg; SmartDeviceLink interface
- *
- * @return SdlMsgVersion -a SdlMsgVersion object representing version of
- * the SDL&reg; SmartDeviceLink interface
- */
+
+ /**
+ * Constructs a new RegisterAppInterface object
+ *
+ * @param syncMsgVersion a SdlMsgVersion object representing version of the SDL&reg; SmartDeviceLink interface <br>
+ * <b>Notes: </b>To be compatible, app msg major version number
+ * must be less than or equal to SDL&reg; major version number.
+ * If msg versions are incompatible, app has 20 seconds to
+ * attempt successful RegisterAppInterface (w.r.t. msg version)
+ * on underlying protocol session, else will be terminated. Major
+ * version number is a compatibility declaration. Minor version
+ * number indicates minor functional variations (e.g. features,
+ * capabilities, bug fixes) when sent from SDL&reg; to app (in
+ * RegisterAppInterface response). However, the minor version
+ * number sent from the app to SDL&reg; (in RegisterAppInterface
+ * request) is ignored by SDL&reg;
+ * @param appName a String value representing the Mobile Application's Name <br>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Must be 1-100 characters in length</li>
+ * <li>May not be the same (by case insensitive comparison) as
+ * the name or any synonym of any currently-registered
+ * application</li>
+ * </ul>
+ * @param isMediaApplication a Boolean value
+ * @param languageDesired a Language Enumeration
+ * @param hmiDisplayLanguageDesired the requested language to be used on the HMI/Display
+ * @param fullAppID a String value representing a unique ID, which an app will be given when approved <br>
+ * <b>Notes: </b>maxLength = 100
+ */
+ public RegisterAppInterface(@NonNull SdlMsgVersion syncMsgVersion, @NonNull String appName, @NonNull Boolean isMediaApplication,
+ @NonNull Language languageDesired, @NonNull Language hmiDisplayLanguageDesired, @NonNull String fullAppID) {
+ this();
+ setSdlMsgVersion(syncMsgVersion);
+ setAppName(appName);
+ setIsMediaApplication(isMediaApplication);
+ setLanguageDesired(languageDesired);
+ setHmiDisplayLanguageDesired(hmiDisplayLanguageDesired);
+ setFullAppID(fullAppID);
+ }
+
+ /**
+ * Gets the version of the SDL&reg; SmartDeviceLink interface
+ *
+ * @return SdlMsgVersion -a SdlMsgVersion object representing version of
+ * the SDL&reg; SmartDeviceLink interface
+ */
public SdlMsgVersion getSdlMsgVersion() {
- return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
- }
- /**
- * Sets the version of the SDL&reg; SmartDeviceLink interface
- *
- * @param sdlMsgVersion
- * a SdlMsgVersion object representing version of the SDL&reg;
- * SmartDeviceLink interface
- * <p></p>
- * <b>Notes: </b>To be compatible, app msg major version number
- * must be less than or equal to SDL&reg; major version number.
- * If msg versions are incompatible, app has 20 seconds to
- * attempt successful RegisterAppInterface (w.r.t. msg version)
- * on underlying protocol session, else will be terminated. Major
- * version number is a compatibility declaration. Minor version
- * number indicates minor functional variations (e.g. features,
- * capabilities, bug fixes) when sent from SDL&reg; to app (in
- * RegisterAppInterface response). However, the minor version
- * number sent from the app to SDL&reg; (in RegisterAppInterface
- * request) is ignored by SDL&reg;
- *
- */
+ return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
+ }
+
+ /**
+ * Sets the version of the SDL&reg; SmartDeviceLink interface
+ *
+ * @param sdlMsgVersion a SdlMsgVersion object representing version of the SDL&reg;
+ * SmartDeviceLink interface
+ * <p></p>
+ * <b>Notes: </b>To be compatible, app msg major version number
+ * must be less than or equal to SDL&reg; major version number.
+ * If msg versions are incompatible, app has 20 seconds to
+ * attempt successful RegisterAppInterface (w.r.t. msg version)
+ * on underlying protocol session, else will be terminated. Major
+ * version number is a compatibility declaration. Minor version
+ * number indicates minor functional variations (e.g. features,
+ * capabilities, bug fixes) when sent from SDL&reg; to app (in
+ * RegisterAppInterface response). However, the minor version
+ * number sent from the app to SDL&reg; (in RegisterAppInterface
+ * request) is ignored by SDL&reg;
+ */
public RegisterAppInterface setSdlMsgVersion(@NonNull SdlMsgVersion sdlMsgVersion) {
setParameters(KEY_SDL_MSG_VERSION, sdlMsgVersion);
return this;
}
-
+
public DeviceInfo getDeviceInfo() {
return (DeviceInfo) getObject(DeviceInfo.class, KEY_DEVICE_INFO);
- }
-
- public RegisterAppInterface setDeviceInfo( DeviceInfo deviceInfo) {
+ }
+
+ public RegisterAppInterface setDeviceInfo(DeviceInfo deviceInfo) {
setParameters(KEY_DEVICE_INFO, deviceInfo);
return this;
}
- /**
- * Gets Mobile Application's Name
- *
- * @return String -a String representing the Mobile Application's Name
- */
+
+ /**
+ * Gets Mobile Application's Name
+ *
+ * @return String -a String representing the Mobile Application's Name
+ */
public String getAppName() {
return getString(KEY_APP_NAME);
}
- /**
- * Sets Mobile Application's Name, This name is displayed in the SDL&reg;
- * Mobile Applications menu. It also serves as the unique identifier of the
- * application for SmartDeviceLink
- *
- * @param appName
- * a String value representing the Mobile Application's Name
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Must be 1-100 characters in length</li>
- * <li>May not be the same (by case insensitive comparison) as
- * the name or any synonym of any currently-registered
- * application</li>
- * </ul>
- */
+
+ /**
+ * Sets Mobile Application's Name, This name is displayed in the SDL&reg;
+ * Mobile Applications menu. It also serves as the unique identifier of the
+ * application for SmartDeviceLink
+ *
+ * @param appName a String value representing the Mobile Application's Name
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Must be 1-100 characters in length</li>
+ * <li>May not be the same (by case insensitive comparison) as
+ * the name or any synonym of any currently-registered
+ * application</li>
+ * </ul>
+ */
public RegisterAppInterface setAppName(@NonNull String appName) {
setParameters(KEY_APP_NAME, appName);
return this;
}
- /**
- * Gets TTS string for VR recognition of the mobile application name
- *
- * @return List<TTSChunk> -List value representing the TTS string
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets TTS string for VR recognition of the mobile application name
+ *
+ * @return List<TTSChunk> -List value representing the TTS string
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getTtsName() {
return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_NAME);
}
- /**
- *
- * @param ttsName
- * a List<TTSChunk> value representing the TTS Name
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Size must be 1-100</li>
- * <li>Needs to be unique over all applications</li>
- * <li>May not be empty</li>
- * <li>May not start with a new line character</li>
- * <li>May not interfere with any name or synonym of previously
- * registered applications and the following list of words</li>
- * <li>Needs to be unique over all applications. Applications
- * with the same name will be rejected</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public RegisterAppInterface setTtsName( List<TTSChunk> ttsName) {
+ /**
+ * @param ttsName a List<TTSChunk> value representing the TTS Name
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Size must be 1-100</li>
+ * <li>Needs to be unique over all applications</li>
+ * <li>May not be empty</li>
+ * <li>May not start with a new line character</li>
+ * <li>May not interfere with any name or synonym of previously
+ * registered applications and the following list of words</li>
+ * <li>Needs to be unique over all applications. Applications
+ * with the same name will be rejected</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public RegisterAppInterface setTtsName(List<TTSChunk> ttsName) {
setParameters(KEY_TTS_NAME, ttsName);
return this;
}
- /**
- * Gets a String representing an abbreviated version of the mobile
- * application's name (if necessary) that will be displayed on the NGN
- * media screen
- *
- * @return String -a String value representing an abbreviated version of the
- * mobile application's name
- */
+
+ /**
+ * Gets a String representing an abbreviated version of the mobile
+ * application's name (if necessary) that will be displayed on the NGN
+ * media screen
+ *
+ * @return String -a String value representing an abbreviated version of the
+ * mobile application's name
+ */
public String getNgnMediaScreenAppName() {
return getString(KEY_NGN_MEDIA_SCREEN_APP_NAME);
}
- /**
- * Sets a String representing an abbreviated version of the mobile
- * application's name (if necessary) that will be displayed on the NGN
- * media screen
- *
- * @param ngnMediaScreenAppName
- * a String value representing an abbreviated version of the
- * mobile application's name
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Must be 1-5 characters</li>
- * <li>If not provided, value will be derived from appName
- * truncated to 5 characters</li>
- * </ul>
- */
- public RegisterAppInterface setNgnMediaScreenAppName( String ngnMediaScreenAppName) {
+
+ /**
+ * Sets a String representing an abbreviated version of the mobile
+ * application's name (if necessary) that will be displayed on the NGN
+ * media screen
+ *
+ * @param ngnMediaScreenAppName a String value representing an abbreviated version of the
+ * mobile application's name
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Must be 1-5 characters</li>
+ * <li>If not provided, value will be derived from appName
+ * truncated to 5 characters</li>
+ * </ul>
+ */
+ public RegisterAppInterface setNgnMediaScreenAppName(String ngnMediaScreenAppName) {
setParameters(KEY_NGN_MEDIA_SCREEN_APP_NAME, ngnMediaScreenAppName);
return this;
}
- /**
- * Gets the List<String> representing the an array of 1-100 elements, each
- * element containing a voice-recognition synonym
- *
- * @return List<String> -a List value representing the an array of
- * 1-100 elements, each element containing a voice-recognition
- * synonym
- */
+
+ /**
+ * Gets the List<String> representing the an array of 1-100 elements, each
+ * element containing a voice-recognition synonym
+ *
+ * @return List<String> -a List value representing the an array of
+ * 1-100 elements, each element containing a voice-recognition
+ * synonym
+ */
@SuppressWarnings("unchecked")
public List<String> getVrSynonyms() {
return (List<String>) getObject(String.class, KEY_VR_SYNONYMS);
}
- /**
- * Sets a vrSynonyms representing the an array of 1-100 elements, each
- * element containing a voice-recognition synonym
- *
- * @param vrSynonyms
- * a List<String> value representing the an array of 1-100
- * elements
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Each vr synonym is limited to 40 characters, and there can
- * be 1-100 synonyms in array</li>
- * <li>May not be the same (by case insensitive comparison) as
- * the name or any synonym of any currently-registered
- * application</li>
- * </ul>
- */
- public RegisterAppInterface setVrSynonyms( List<String> vrSynonyms) {
+
+ /**
+ * Sets a vrSynonyms representing the an array of 1-100 elements, each
+ * element containing a voice-recognition synonym
+ *
+ * @param vrSynonyms a List<String> value representing the an array of 1-100
+ * elements
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Each vr synonym is limited to 40 characters, and there can
+ * be 1-100 synonyms in array</li>
+ * <li>May not be the same (by case insensitive comparison) as
+ * the name or any synonym of any currently-registered
+ * application</li>
+ * </ul>
+ */
+ public RegisterAppInterface setVrSynonyms(List<String> vrSynonyms) {
setParameters(KEY_VR_SYNONYMS, vrSynonyms);
return this;
}
- /**
- * Gets a Boolean representing MediaApplication
- *
- * @return Boolean -a Boolean value representing a mobile application that is
- * a media application or not
- */
+
+ /**
+ * Gets a Boolean representing MediaApplication
+ *
+ * @return Boolean -a Boolean value representing a mobile application that is
+ * a media application or not
+ */
public Boolean getIsMediaApplication() {
return getBoolean(KEY_IS_MEDIA_APPLICATION);
}
- /**
- * Sets a Boolean to indicate a mobile application that is a media
- * application or not
- *
- * @param isMediaApplication
- * a Boolean value
- */
+
+ /**
+ * Sets a Boolean to indicate a mobile application that is a media
+ * application or not
+ *
+ * @param isMediaApplication a Boolean value
+ */
public RegisterAppInterface setIsMediaApplication(@NonNull Boolean isMediaApplication) {
setParameters(KEY_IS_MEDIA_APPLICATION, isMediaApplication);
return this;
}
- /**
- * Gets a Language enumeration indicating what language the application
- * intends to use for user interaction (Display, TTS and VR)
- *
- * @return Enumeration -a language enumeration
- */
+
+ /**
+ * Gets a Language enumeration indicating what language the application
+ * intends to use for user interaction (Display, TTS and VR)
+ *
+ * @return Enumeration -a language enumeration
+ */
public Language getLanguageDesired() {
return (Language) getObject(Language.class, KEY_LANGUAGE_DESIRED);
}
- /**
- * Sets an enumeration indicating what language the application intends to
- * use for user interaction (Display, TTS and VR)
- *
- * @param languageDesired
- * a Language Enumeration
- *
- *
- */
+
+ /**
+ * Sets an enumeration indicating what language the application intends to
+ * use for user interaction (Display, TTS and VR)
+ *
+ * @param languageDesired a Language Enumeration
+ */
public RegisterAppInterface setLanguageDesired(@NonNull Language languageDesired) {
setParameters(KEY_LANGUAGE_DESIRED, languageDesired);
return this;
}
- /**
- * Gets an enumeration indicating what language the application intends to
- * use for user interaction ( Display)
- *
- * @return Language - a Language value representing an enumeration
- * indicating what language the application intends to use for user
- * interaction ( Display)
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets an enumeration indicating what language the application intends to
+ * use for user interaction ( Display)
+ *
+ * @return Language - a Language value representing an enumeration
+ * indicating what language the application intends to use for user
+ * interaction ( Display)
+ * @since SmartDeviceLink 2.0
+ */
public Language getHmiDisplayLanguageDesired() {
return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE_DESIRED);
}
- /**
- * Sets an enumeration indicating what language the application intends to
- * use for user interaction ( Display)
- *
- * @param hmiDisplayLanguageDesired the requested language to be used on the HMI/Display
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Sets an enumeration indicating what language the application intends to
+ * use for user interaction ( Display)
+ *
+ * @param hmiDisplayLanguageDesired the requested language to be used on the HMI/Display
+ * @since SmartDeviceLink 2.0
+ */
public RegisterAppInterface setHmiDisplayLanguageDesired(@NonNull Language hmiDisplayLanguageDesired) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE_DESIRED, hmiDisplayLanguageDesired);
return this;
}
- /**
- * Gets a list of all applicable app types stating which classifications to
- * be given to the app.e.g. for platforms , like GEN2, this will determine
- * which "corner(s)" the app can populate
- *
- * @return List<AppHMIType> - a List value representing a list of all
- * applicable app types stating which classifications to be given to
- * the app
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets a list of all applicable app types stating which classifications to
+ * be given to the app.e.g. for platforms , like GEN2, this will determine
+ * which "corner(s)" the app can populate
+ *
+ * @return List<AppHMIType> - a List value representing a list of all
+ * applicable app types stating which classifications to be given to
+ * the app
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<AppHMIType> getAppHMIType() {
return (List<AppHMIType>) getObject(AppHMIType.class, KEY_APP_HMI_TYPE);
}
- /**
- * Sets a a list of all applicable app types stating which classifications
- * to be given to the app. e.g. for platforms , like GEN2, this will
- * determine which "corner(s)" the app can populate
- *
- * @param appHMIType
- * a List<AppHMIType>
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Array Minsize: = 1</li>
- * <li>Array Maxsize = 100</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public RegisterAppInterface setAppHMIType( List<AppHMIType> appHMIType) {
+ /**
+ * Sets a a list of all applicable app types stating which classifications
+ * to be given to the app. e.g. for platforms , like GEN2, this will
+ * determine which "corner(s)" the app can populate
+ *
+ * @param appHMIType a List<AppHMIType>
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Array Minsize: = 1</li>
+ * <li>Array Maxsize = 100</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public RegisterAppInterface setAppHMIType(List<AppHMIType> appHMIType) {
setParameters(KEY_APP_HMI_TYPE, appHMIType);
return this;
}
-
+
public String getHashID() {
return getString(KEY_HASH_ID);
}
-
- public RegisterAppInterface setHashID( String hashID) {
+
+ public RegisterAppInterface setHashID(String hashID) {
setParameters(KEY_HASH_ID, hashID);
return this;
}
- /**
- * Gets the detailed information about the registered application
- * @return appInfo - detailed information about the registered application
- */
- public AppInfo getAppInfo() {
- return (AppInfo) getObject(AppInfo.class, KEY_APP_INFO);
- }
+ /**
+ * Gets the detailed information about the registered application
+ *
+ * @return appInfo - detailed information about the registered application
+ */
+ public AppInfo getAppInfo() {
+ return (AppInfo) getObject(AppInfo.class, KEY_APP_INFO);
+ }
- /**
- * Sets detailed information about the registered application
- * @param appInfo - detailed information about the registered application
- */
- public RegisterAppInterface setAppInfo( AppInfo appInfo) {
+ /**
+ * Sets detailed information about the registered application
+ *
+ * @param appInfo - detailed information about the registered application
+ */
+ public RegisterAppInterface setAppInfo(AppInfo appInfo) {
setParameters(KEY_APP_INFO, appInfo);
return this;
}
- /**
- * Gets the unique ID, which an app will be given when approved
- *
- * @return String - a String value representing the unique ID, which an app
- * will be given when approved
- * @since SmartDeviceLink 2.0
- */
- public String getAppID() {
- return getString(KEY_APP_ID);
- }
-
- /**
- * Sets a unique ID, which an app will be given when approved
- *
- * @param appID
- * a String value representing a unique ID, which an app will be
- * given when approved
- * <p></p>
- * <b>Notes: </b>maxLength = 100
- * @since SmartDeviceLink 2.0
- */
- public RegisterAppInterface setAppID(@NonNull String appID) {
+ /**
+ * Gets the unique ID, which an app will be given when approved
+ *
+ * @return String - a String value representing the unique ID, which an app
+ * will be given when approved
+ * @since SmartDeviceLink 2.0
+ */
+ public String getAppID() {
+ return getString(KEY_APP_ID);
+ }
+
+ /**
+ * Sets a unique ID, which an app will be given when approved
+ *
+ * @param appID a String value representing a unique ID, which an app will be
+ * given when approved
+ * <p></p>
+ * <b>Notes: </b>maxLength = 100
+ * @since SmartDeviceLink 2.0
+ */
+ public RegisterAppInterface setAppID(@NonNull String appID) {
if (appID != null) {
- setParameters(KEY_APP_ID, appID.toLowerCase());
- } else {
- setParameters(KEY_APP_ID, appID);
- }
+ setParameters(KEY_APP_ID, appID.toLowerCase());
+ } else {
+ setParameters(KEY_APP_ID, appID);
+ }
return this;
}
- /**
- * Gets the unique ID, which an app will be given when approved
- *
- * @return String - a String value representing the unique ID, which an app
- * will be given when approved
- * @since SmartDeviceLink 5.0
- */
- public String getFullAppID() {
- return getString(KEY_FULL_APP_ID);
- }
-
- /**
- * Sets a unique ID, which an app will be given when approved <br>
- * Note: this will automatically parse the fullAppID into the smaller appId and set the appId value as well
- * @param fullAppID
- * a String value representing a unique ID, which an app will be
- * given when approved
- * <p></p>
- * <b>Notes: </b>maxLength = 100
- * @since SmartDeviceLink 5.0
- */
- public RegisterAppInterface setFullAppID( String fullAppID) {
+ /**
+ * Gets the unique ID, which an app will be given when approved
+ *
+ * @return String - a String value representing the unique ID, which an app
+ * will be given when approved
+ * @since SmartDeviceLink 5.0
+ */
+ public String getFullAppID() {
+ return getString(KEY_FULL_APP_ID);
+ }
+
+ /**
+ * Sets a unique ID, which an app will be given when approved <br>
+ * Note: this will automatically parse the fullAppID into the smaller appId and set the appId value as well
+ *
+ * @param fullAppID a String value representing a unique ID, which an app will be
+ * given when approved
+ * <p></p>
+ * <b>Notes: </b>maxLength = 100
+ * @since SmartDeviceLink 5.0
+ */
+ public RegisterAppInterface setFullAppID(String fullAppID) {
if (fullAppID != null) {
- fullAppID = fullAppID.toLowerCase();
- setParameters(KEY_FULL_APP_ID, fullAppID);
- String appID;
- if (fullAppID.length() <= APP_ID_MAX_LENGTH) {
- appID = fullAppID;
- } else {
- appID = fullAppID.replace("-", "").substring(0, APP_ID_MAX_LENGTH);
- }
- setAppID(appID);
- } else {
- setParameters(KEY_FULL_APP_ID, null);
- }
+ fullAppID = fullAppID.toLowerCase();
+ setParameters(KEY_FULL_APP_ID, fullAppID);
+ String appID;
+ if (fullAppID.length() <= APP_ID_MAX_LENGTH) {
+ appID = fullAppID;
+ } else {
+ appID = fullAppID.replace("-", "").substring(0, APP_ID_MAX_LENGTH);
+ }
+ setAppID(appID);
+ } else {
+ setParameters(KEY_FULL_APP_ID, null);
+ }
return this;
}
- @Override
- public void format(Version rpcVersion, boolean formatParams) {
- if(rpcVersion == null || rpcVersion.getMajor() >= 5) {
- if (getFullAppID() == null) {
- setFullAppID(getAppID());
- }
- }
- super.format(rpcVersion, formatParams);
- }
-
- /**
- * Gets the color scheme that is currently used for day
- *
- * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
- * for day color scheme
- * @since SmartDeviceLink 5.0
- */
- public TemplateColorScheme getDayColorScheme(){
- return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
- }
-
- /**
- * Sets the color scheme that is intended to be used for day
- *
- * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
- * used for day color scheme
- * @since SmartDeviceLink 5.0
- */
- public RegisterAppInterface setDayColorScheme( TemplateColorScheme templateColorScheme) {
+ @Override
+ public void format(Version rpcVersion, boolean formatParams) {
+ if (rpcVersion == null || rpcVersion.getMajor() >= 5) {
+ if (getFullAppID() == null) {
+ setFullAppID(getAppID());
+ }
+ }
+ super.format(rpcVersion, formatParams);
+ }
+
+ /**
+ * Gets the color scheme that is currently used for day
+ *
+ * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
+ * for day color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public TemplateColorScheme getDayColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the color scheme that is intended to be used for day
+ *
+ * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
+ * used for day color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public RegisterAppInterface setDayColorScheme(TemplateColorScheme templateColorScheme) {
setParameters(KEY_DAY_COLOR_SCHEME, templateColorScheme);
return this;
}
- /**
- * Gets the color scheme that is currently used for night
- *
- * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
- * for night color scheme
- * @since SmartDeviceLink 5.0
- */
- public TemplateColorScheme getNightColorScheme(){
- return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
- }
-
- /**
- * Sets the color scheme that is intended to be used for night
- *
- * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
- * used for night color scheme
- * @since SmartDeviceLink 5.0
- */
- public RegisterAppInterface setNightColorScheme( TemplateColorScheme templateColorScheme) {
+ /**
+ * Gets the color scheme that is currently used for night
+ *
+ * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
+ * for night color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public TemplateColorScheme getNightColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the color scheme that is intended to be used for night
+ *
+ * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
+ * used for night color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public RegisterAppInterface setNightColorScheme(TemplateColorScheme templateColorScheme) {
setParameters(KEY_NIGHT_COLOR_SCHEME, templateColorScheme);
return this;
}
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 7bb247e2b..c18cbd38b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,403 +49,424 @@ import java.util.List;
/**
* Register AppInterface Response is sent, when RegisterAppInterface has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class RegisterAppInterfaceResponse extends RPCResponse {
- public static final String KEY_VEHICLE_TYPE = "vehicleType";
- public static final String KEY_SPEECH_CAPABILITIES = "speechCapabilities";
- public static final String KEY_VR_CAPABILITIES = "vrCapabilities";
- public static final String KEY_AUDIO_PASS_THRU_CAPABILITIES = "audioPassThruCapabilities";
- public static final String KEY_HMI_ZONE_CAPABILITIES = "hmiZoneCapabilities";
- public static final String KEY_PRERECORDED_SPEECH = "prerecordedSpeech";
- public static final String KEY_SUPPORTED_DIAG_MODES = "supportedDiagModes";
- public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
- public static final String KEY_LANGUAGE = "language";
- @Deprecated public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
- @Deprecated public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
- public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
- @Deprecated public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
- @Deprecated public static final String KEY_PRESET_BANK_CAPABILITIES = "presetBankCapabilities";
- public static final String KEY_HMI_CAPABILITIES = "hmiCapabilities"; //As of v4.0
- public static final String KEY_SDL_VERSION = "sdlVersion"; //As of v4.0
- public static final String KEY_SYSTEM_SOFTWARE_VERSION = "systemSoftwareVersion"; //As of v4.0
- public static final String KEY_ICON_RESUMED = "iconResumed";
- public static final String KEY_PCM_STREAM_CAPABILITIES = "pcmStreamCapabilities";
-
- /**
- * Constructs a new RegisterAppInterfaceResponse object
- */
+ public static final String KEY_VEHICLE_TYPE = "vehicleType";
+ public static final String KEY_SPEECH_CAPABILITIES = "speechCapabilities";
+ public static final String KEY_VR_CAPABILITIES = "vrCapabilities";
+ public static final String KEY_AUDIO_PASS_THRU_CAPABILITIES = "audioPassThruCapabilities";
+ public static final String KEY_HMI_ZONE_CAPABILITIES = "hmiZoneCapabilities";
+ public static final String KEY_PRERECORDED_SPEECH = "prerecordedSpeech";
+ public static final String KEY_SUPPORTED_DIAG_MODES = "supportedDiagModes";
+ public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
+ public static final String KEY_LANGUAGE = "language";
+ @Deprecated
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ @Deprecated
+ public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
+ public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
+ @Deprecated
+ public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
+ @Deprecated
+ public static final String KEY_PRESET_BANK_CAPABILITIES = "presetBankCapabilities";
+ public static final String KEY_HMI_CAPABILITIES = "hmiCapabilities"; //As of v4.0
+ public static final String KEY_SDL_VERSION = "sdlVersion"; //As of v4.0
+ public static final String KEY_SYSTEM_SOFTWARE_VERSION = "systemSoftwareVersion"; //As of v4.0
+ public static final String KEY_ICON_RESUMED = "iconResumed";
+ public static final String KEY_PCM_STREAM_CAPABILITIES = "pcmStreamCapabilities";
+
+ /**
+ * Constructs a new RegisterAppInterfaceResponse object
+ */
public RegisterAppInterfaceResponse() {
super(FunctionID.REGISTER_APP_INTERFACE.toString());
}
- /**
- * Constructs a new RegisterAppInterfaceResponse object indicated by the Hashtable
- * parameter
- * <p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new RegisterAppInterfaceResponse object indicated by the Hashtable
+ * parameter
+ * <p>
+ *
+ * @param hash The Hashtable to use
+ */
public RegisterAppInterfaceResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new RegisterAppInterfaceResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public RegisterAppInterfaceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
-
- @Override
- public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams){
- //Add in 5.0.0 of the rpc spec
- if(getIconResumed() == null){
- setIconResumed(Boolean.FALSE);
- }
-
- List<ButtonCapabilities> capabilities = getButtonCapabilities();
- if(capabilities != null){
- List<ButtonCapabilities> additions = new ArrayList<>();
- for(ButtonCapabilities capability : capabilities){
- if(ButtonName.OK.equals(capability.getName())){
- if(rpcVersion == null || rpcVersion.getMajor() < 5){
- //If version is < 5, the play pause button must also be added
- additions.add(new ButtonCapabilities(ButtonName.PLAY_PAUSE, capability.getShortPressAvailable(), capability.getLongPressAvailable(), capability.getUpDownAvailable()));
- }
- }
- }
- capabilities.addAll(additions);
- setButtonCapabilities(capabilities);
- }
-
-
- super.format(rpcVersion,formatParams);
- }
-
-
- /**
- * Gets the version of the SDL&reg; SmartDeviceLink interface
- *
- * @return SdlMsgVersion -a SdlMsgVersion object representing version of
- * the SDL&reg; SmartDeviceLink interface
- */
+ /**
+ * Constructs a new RegisterAppInterfaceResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public RegisterAppInterfaceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ @Override
+ public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) {
+ //Add in 5.0.0 of the rpc spec
+ if (getIconResumed() == null) {
+ setIconResumed(Boolean.FALSE);
+ }
+
+ List<ButtonCapabilities> capabilities = getButtonCapabilities();
+ if (capabilities != null) {
+ List<ButtonCapabilities> additions = new ArrayList<>();
+ for (ButtonCapabilities capability : capabilities) {
+ if (ButtonName.OK.equals(capability.getName())) {
+ if (rpcVersion == null || rpcVersion.getMajor() < 5) {
+ //If version is < 5, the play pause button must also be added
+ additions.add(new ButtonCapabilities(ButtonName.PLAY_PAUSE, capability.getShortPressAvailable(), capability.getLongPressAvailable(), capability.getUpDownAvailable()));
+ }
+ }
+ }
+ capabilities.addAll(additions);
+ setButtonCapabilities(capabilities);
+ }
+
+
+ super.format(rpcVersion, formatParams);
+ }
+
+
+ /**
+ * Gets the version of the SDL&reg; SmartDeviceLink interface
+ *
+ * @return SdlMsgVersion -a SdlMsgVersion object representing version of
+ * the SDL&reg; SmartDeviceLink interface
+ */
public SdlMsgVersion getSdlMsgVersion() {
- return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
- }
-
- /**
- * Sets the version of the SDL&reg; SmartDeviceLink interface
- *
- * @param sdlMsgVersion
- * a SdlMsgVersion object representing version of the SDL&reg;
- * SmartDeviceLink interface
- * <p></p>
- * <b>Notes: </b>To be compatible, app msg major version number
- * must be less than or equal to SDL&reg; major version number.
- * If msg versions are incompatible, app has 20 seconds to
- * attempt successful RegisterAppInterface (w.r.t. msg version)
- * on underlying protocol session, else will be terminated. Major
- * version number is a compatibility declaration. Minor version
- * number indicates minor functional variations (e.g. features,
- * capabilities, bug fixes) when sent from SDL&reg; to app (in
- * RegisterAppInterface response). However, the minor version
- * number sent from the app to SDL&reg; (in RegisterAppInterface
- * request) is ignored by SDL&reg;
- */
- public RegisterAppInterfaceResponse setSdlMsgVersion( SdlMsgVersion sdlMsgVersion) {
+ return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
+ }
+
+ /**
+ * Sets the version of the SDL&reg; SmartDeviceLink interface
+ *
+ * @param sdlMsgVersion a SdlMsgVersion object representing version of the SDL&reg;
+ * SmartDeviceLink interface
+ * <p></p>
+ * <b>Notes: </b>To be compatible, app msg major version number
+ * must be less than or equal to SDL&reg; major version number.
+ * If msg versions are incompatible, app has 20 seconds to
+ * attempt successful RegisterAppInterface (w.r.t. msg version)
+ * on underlying protocol session, else will be terminated. Major
+ * version number is a compatibility declaration. Minor version
+ * number indicates minor functional variations (e.g. features,
+ * capabilities, bug fixes) when sent from SDL&reg; to app (in
+ * RegisterAppInterface response). However, the minor version
+ * number sent from the app to SDL&reg; (in RegisterAppInterface
+ * request) is ignored by SDL&reg;
+ */
+ public RegisterAppInterfaceResponse setSdlMsgVersion(SdlMsgVersion sdlMsgVersion) {
setParameters(KEY_SDL_MSG_VERSION, sdlMsgVersion);
return this;
}
- /**
- * Gets a Language enumeration indicating what language the application
- * intends to use for user interaction (Display, TTS and VR)
- *
- * @return Enumeration -a language enumeration
- */
+ /**
+ * Gets a Language enumeration indicating what language the application
+ * intends to use for user interaction (Display, TTS and VR)
+ *
+ * @return Enumeration -a language enumeration
+ */
public Language getLanguage() {
- return (Language) getObject(Language.class, KEY_LANGUAGE);
- }
-
- /**
- * Sets an enumeration indicating what language the application intends to
- * use for user interaction (Display, TTS and VR)
- *
- * @param language
- * a Language Enumeration
- *
- *
- */
- public RegisterAppInterfaceResponse setLanguage( Language language) {
+ return (Language) getObject(Language.class, KEY_LANGUAGE);
+ }
+
+ /**
+ * Sets an enumeration indicating what language the application intends to
+ * use for user interaction (Display, TTS and VR)
+ *
+ * @param language a Language Enumeration
+ */
+ public RegisterAppInterfaceResponse setLanguage(Language language) {
setParameters(KEY_LANGUAGE, language);
return this;
}
- /**
- * Gets an enumeration indicating what language the application intends to
- * use for user interaction ( Display)
- *
- * @return Language - a Language value representing an enumeration
- * indicating what language the application intends to use for user
- * interaction ( Display)
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets an enumeration indicating what language the application intends to
+ * use for user interaction ( Display)
+ *
+ * @return Language - a Language value representing an enumeration
+ * indicating what language the application intends to use for user
+ * interaction ( Display)
+ * @since SmartDeviceLink 2.0
+ */
public Language getHmiDisplayLanguage() {
- return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE);
+ return (Language) getObject(Language.class, KEY_HMI_DISPLAY_LANGUAGE);
}
- /**
- * Sets an enumeration indicating what language the application intends to
- * use for user interaction ( Display)
- *
- * @param hmiDisplayLanguage
- * @since SmartDeviceLink 2.0
- */
- public RegisterAppInterfaceResponse setHmiDisplayLanguage( Language hmiDisplayLanguage) {
+ /**
+ * Sets an enumeration indicating what language the application intends to
+ * use for user interaction ( Display)
+ *
+ * @param hmiDisplayLanguage
+ * @since SmartDeviceLink 2.0
+ */
+ public RegisterAppInterfaceResponse setHmiDisplayLanguage(Language hmiDisplayLanguage) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE, hmiDisplayLanguage);
return this;
}
- /**
- * Gets getDisplayCapabilities set when application interface is registered.
- *
- * @return DisplayCapabilities
- */
+ /**
+ * Gets getDisplayCapabilities set when application interface is registered.
+ *
+ * @return DisplayCapabilities
+ */
@Deprecated
public DisplayCapabilities getDisplayCapabilities() {
- return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
+ return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
}
+
/**
* Sets Display Capabilities
+ *
* @param displayCapabilities
*/
@Deprecated
- public RegisterAppInterfaceResponse setDisplayCapabilities( DisplayCapabilities displayCapabilities) {
+ public RegisterAppInterfaceResponse setDisplayCapabilities(DisplayCapabilities displayCapabilities) {
setParameters(KEY_DISPLAY_CAPABILITIES, displayCapabilities);
return this;
}
- /**
- * Gets buttonCapabilities set when application interface is registered.
- *
- * @return buttonCapabilities
- */
+ /**
+ * Gets buttonCapabilities set when application interface is registered.
+ *
+ * @return buttonCapabilities
+ */
@Deprecated
@SuppressWarnings("unchecked")
public List<ButtonCapabilities> getButtonCapabilities() {
- return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
+ return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
}
+
/**
* Sets Button Capabilities
+ *
* @param buttonCapabilities
*/
@Deprecated
- public RegisterAppInterfaceResponse setButtonCapabilities( List<ButtonCapabilities> buttonCapabilities) {
+ public RegisterAppInterfaceResponse setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setParameters(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
return this;
}
+
/**
- * Gets getSoftButtonCapabilities set when application interface is registered.
- *
- * @return SoftButtonCapabilities
- */
+ * Gets getSoftButtonCapabilities set when application interface is registered.
+ *
+ * @return SoftButtonCapabilities
+ */
@Deprecated
@SuppressWarnings("unchecked")
public List<SoftButtonCapabilities> getSoftButtonCapabilities() {
- return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
+ return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
}
+
/**
* Sets softButtonCapabilities
+ *
* @param softButtonCapabilities
*/
@Deprecated
- public RegisterAppInterfaceResponse setSoftButtonCapabilities( List<SoftButtonCapabilities> softButtonCapabilities) {
+ public RegisterAppInterfaceResponse setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
setParameters(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
return this;
}
- /**
- * Gets getPresetBankCapabilities set when application interface is registered.
- *
- * @return PresetBankCapabilities
- */
+ /**
+ * Gets getPresetBankCapabilities set when application interface is registered.
+ *
+ * @return PresetBankCapabilities
+ */
@Deprecated
public PresetBankCapabilities getPresetBankCapabilities() {
- return (PresetBankCapabilities) getObject(PresetBankCapabilities.class, KEY_PRESET_BANK_CAPABILITIES);
+ return (PresetBankCapabilities) getObject(PresetBankCapabilities.class, KEY_PRESET_BANK_CAPABILITIES);
}
+
/**
* Sets presetBankCapabilities
- * @param presetBankCapabilities
+ *
+ * @param presetBankCapabilities
*/
@Deprecated
- public RegisterAppInterfaceResponse setPresetBankCapabilities( PresetBankCapabilities presetBankCapabilities) {
+ public RegisterAppInterfaceResponse setPresetBankCapabilities(PresetBankCapabilities presetBankCapabilities) {
setParameters(KEY_PRESET_BANK_CAPABILITIES, presetBankCapabilities);
return this;
}
-
- /**
- * Gets hmiZoneCapabilities set when application interface is registered.
- *
- * @return HmiZoneCapabilities
- */
+
+ /**
+ * Gets hmiZoneCapabilities set when application interface is registered.
+ *
+ * @return HmiZoneCapabilities
+ */
@SuppressWarnings("unchecked")
public List<HmiZoneCapabilities> getHmiZoneCapabilities() {
- return (List<HmiZoneCapabilities>) getObject(HmiZoneCapabilities.class, KEY_HMI_ZONE_CAPABILITIES);
+ return (List<HmiZoneCapabilities>) getObject(HmiZoneCapabilities.class, KEY_HMI_ZONE_CAPABILITIES);
}
+
/**
* Sets hmiZoneCapabilities
+ *
* @param hmiZoneCapabilities
*/
- public RegisterAppInterfaceResponse setHmiZoneCapabilities( List<HmiZoneCapabilities> hmiZoneCapabilities) {
+ public RegisterAppInterfaceResponse setHmiZoneCapabilities(List<HmiZoneCapabilities> hmiZoneCapabilities) {
setParameters(KEY_HMI_ZONE_CAPABILITIES, hmiZoneCapabilities);
return this;
}
-
- /**
- * Gets speechCapabilities set when application interface is registered.
- *
- * @return SpeechCapabilities
- */
+
+ /**
+ * Gets speechCapabilities set when application interface is registered.
+ *
+ * @return SpeechCapabilities
+ */
@SuppressWarnings("unchecked")
public List<SpeechCapabilities> getSpeechCapabilities() {
- Object speechCapabilities = getObject(SpeechCapabilities.class, KEY_SPEECH_CAPABILITIES);
- if (speechCapabilities instanceof List<?>) {
- return (List<SpeechCapabilities>) speechCapabilities;
- } else if (speechCapabilities instanceof SpeechCapabilities) {
- // this is a known issue observed with some core implementations
- List<SpeechCapabilities> newSpeechCapList = new ArrayList<>();
- newSpeechCapList.add((SpeechCapabilities) speechCapabilities);
- return newSpeechCapList;
- }
- return null;
+ Object speechCapabilities = getObject(SpeechCapabilities.class, KEY_SPEECH_CAPABILITIES);
+ if (speechCapabilities instanceof List<?>) {
+ return (List<SpeechCapabilities>) speechCapabilities;
+ } else if (speechCapabilities instanceof SpeechCapabilities) {
+ // this is a known issue observed with some core implementations
+ List<SpeechCapabilities> newSpeechCapList = new ArrayList<>();
+ newSpeechCapList.add((SpeechCapabilities) speechCapabilities);
+ return newSpeechCapList;
+ }
+ return null;
}
+
/**
* Sets speechCapabilities
+ *
* @param speechCapabilities
*/
- public RegisterAppInterfaceResponse setSpeechCapabilities( List<SpeechCapabilities> speechCapabilities) {
+ public RegisterAppInterfaceResponse setSpeechCapabilities(List<SpeechCapabilities> speechCapabilities) {
setParameters(KEY_SPEECH_CAPABILITIES, speechCapabilities);
return this;
}
-
+
@SuppressWarnings("unchecked")
public List<PrerecordedSpeech> getPrerecordedSpeech() {
- return (List<PrerecordedSpeech>) getObject(PrerecordedSpeech.class, KEY_PRERECORDED_SPEECH);
+ return (List<PrerecordedSpeech>) getObject(PrerecordedSpeech.class, KEY_PRERECORDED_SPEECH);
}
- public RegisterAppInterfaceResponse setPrerecordedSpeech( List<PrerecordedSpeech> prerecordedSpeech) {
+ public RegisterAppInterfaceResponse setPrerecordedSpeech(List<PrerecordedSpeech> prerecordedSpeech) {
setParameters(KEY_PRERECORDED_SPEECH, prerecordedSpeech);
return this;
}
-
-
- /**
- * Gets vrCapabilities set when application interface is registered.
- *
- * @return VrCapabilities
- */
+
+
+ /**
+ * Gets vrCapabilities set when application interface is registered.
+ *
+ * @return VrCapabilities
+ */
@SuppressWarnings("unchecked")
public List<VrCapabilities> getVrCapabilities() {
- return (List<VrCapabilities>) getObject(VrCapabilities.class, KEY_VR_CAPABILITIES);
+ return (List<VrCapabilities>) getObject(VrCapabilities.class, KEY_VR_CAPABILITIES);
}
+
/**
* Sets VrCapabilities
+ *
* @param vrCapabilities
*/
- public RegisterAppInterfaceResponse setVrCapabilities( List<VrCapabilities> vrCapabilities) {
+ public RegisterAppInterfaceResponse setVrCapabilities(List<VrCapabilities> vrCapabilities) {
setParameters(KEY_VR_CAPABILITIES, vrCapabilities);
return this;
}
-
- /**
- * Gets getVehicleType set when application interface is registered.
- *
- * @return vehicleType
- */
+
+ /**
+ * Gets getVehicleType set when application interface is registered.
+ *
+ * @return vehicleType
+ */
public VehicleType getVehicleType() {
- return (VehicleType) getObject(VehicleType.class, KEY_VEHICLE_TYPE);
+ return (VehicleType) getObject(VehicleType.class, KEY_VEHICLE_TYPE);
}
+
/**
* Sets vehicleType
+ *
* @param vehicleType
*/
- public RegisterAppInterfaceResponse setVehicleType( VehicleType vehicleType) {
+ public RegisterAppInterfaceResponse setVehicleType(VehicleType vehicleType) {
setParameters(KEY_VEHICLE_TYPE, vehicleType);
return this;
}
-
- /**
- * Gets AudioPassThruCapabilities set when application interface is registered.
- *
- * @return AudioPassThruCapabilities
- */
+
+ /**
+ * Gets AudioPassThruCapabilities set when application interface is registered.
+ *
+ * @return AudioPassThruCapabilities
+ */
@SuppressWarnings("unchecked")
public List<AudioPassThruCapabilities> getAudioPassThruCapabilities() {
- return (List<AudioPassThruCapabilities>) getObject(AudioPassThruCapabilities.class, KEY_AUDIO_PASS_THRU_CAPABILITIES);
+ return (List<AudioPassThruCapabilities>) getObject(AudioPassThruCapabilities.class, KEY_AUDIO_PASS_THRU_CAPABILITIES);
}
+
/**
* Sets AudioPassThruCapabilities
+ *
* @param audioPassThruCapabilities
*/
- public RegisterAppInterfaceResponse setAudioPassThruCapabilities( List<AudioPassThruCapabilities> audioPassThruCapabilities) {
+ public RegisterAppInterfaceResponse setAudioPassThruCapabilities(List<AudioPassThruCapabilities> audioPassThruCapabilities) {
setParameters(KEY_AUDIO_PASS_THRU_CAPABILITIES, audioPassThruCapabilities);
return this;
}
- /**
- * Gets pcmStreamingCapabilities set when application interface is registered.
- *
- * @return pcmStreamingCapabilities
- */
- public AudioPassThruCapabilities getPcmStreamingCapabilities() {
- return (AudioPassThruCapabilities) getObject(AudioPassThruCapabilities.class, KEY_PCM_STREAM_CAPABILITIES);
- }
- /**
- * Sets pcmStreamingCapabilities
- * @param pcmStreamingCapabilities
- */
- public RegisterAppInterfaceResponse setPcmStreamingCapabilities( AudioPassThruCapabilities pcmStreamingCapabilities) {
+ /**
+ * Gets pcmStreamingCapabilities set when application interface is registered.
+ *
+ * @return pcmStreamingCapabilities
+ */
+ public AudioPassThruCapabilities getPcmStreamingCapabilities() {
+ return (AudioPassThruCapabilities) getObject(AudioPassThruCapabilities.class, KEY_PCM_STREAM_CAPABILITIES);
+ }
+
+ /**
+ * Sets pcmStreamingCapabilities
+ *
+ * @param pcmStreamingCapabilities
+ */
+ public RegisterAppInterfaceResponse setPcmStreamingCapabilities(AudioPassThruCapabilities pcmStreamingCapabilities) {
setParameters(KEY_PCM_STREAM_CAPABILITIES, pcmStreamingCapabilities);
return this;
}
- public RegisterAppInterfaceResponse setSupportedDiagModes( List<Integer> supportedDiagModes) {
+ public RegisterAppInterfaceResponse setSupportedDiagModes(List<Integer> supportedDiagModes) {
setParameters(KEY_SUPPORTED_DIAG_MODES, supportedDiagModes);
return this;
}
@SuppressWarnings("unchecked")
public List<Integer> getSupportedDiagModes() {
- return (List<Integer>) getObject(Integer.class, KEY_SUPPORTED_DIAG_MODES);
+ return (List<Integer>) getObject(Integer.class, KEY_SUPPORTED_DIAG_MODES);
}
-
- public RegisterAppInterfaceResponse setHmiCapabilities( HMICapabilities hmiCapabilities) {
+
+ public RegisterAppInterfaceResponse setHmiCapabilities(HMICapabilities hmiCapabilities) {
setParameters(KEY_HMI_CAPABILITIES, hmiCapabilities);
return this;
}
public HMICapabilities getHmiCapabilities() {
- return (HMICapabilities) getObject(HMICapabilities.class, KEY_HMI_CAPABILITIES);
- }
-
- public RegisterAppInterfaceResponse setSdlVersion( String sdlVersion) {
+ return (HMICapabilities) getObject(HMICapabilities.class, KEY_HMI_CAPABILITIES);
+ }
+
+ public RegisterAppInterfaceResponse setSdlVersion(String sdlVersion) {
setParameters(KEY_SDL_VERSION, sdlVersion);
return this;
}
- public String getSdlVersion() {
- return getString(KEY_SDL_VERSION);
- }
-
- public RegisterAppInterfaceResponse setSystemSoftwareVersion( String systemSoftwareVersion) {
+ public String getSdlVersion() {
+ return getString(KEY_SDL_VERSION);
+ }
+
+ public RegisterAppInterfaceResponse setSystemSoftwareVersion(String systemSoftwareVersion) {
setParameters(KEY_SYSTEM_SOFTWARE_VERSION, systemSoftwareVersion);
return this;
}
@@ -454,23 +475,25 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
return getString(KEY_SYSTEM_SOFTWARE_VERSION);
}
- /**
- * Sets Icon Resumed Boolean
- * @param iconResumed - if param not included, set to false
- */
- public RegisterAppInterfaceResponse setIconResumed(Boolean iconResumed){
- if(iconResumed == null){
- iconResumed = false;
- }
- setParameters(KEY_ICON_RESUMED, iconResumed);
- return this;
- }
-
- /**
- * Tells developer whether or not their app icon has been resumed on core.
- * @return boolean - true if icon was resumed, false if not
- */
- public Boolean getIconResumed() {
- return getBoolean(KEY_ICON_RESUMED);
- }
+ /**
+ * Sets Icon Resumed Boolean
+ *
+ * @param iconResumed - if param not included, set to false
+ */
+ public RegisterAppInterfaceResponse setIconResumed(Boolean iconResumed) {
+ if (iconResumed == null) {
+ iconResumed = false;
+ }
+ setParameters(KEY_ICON_RESUMED, iconResumed);
+ return this;
+ }
+
+ /**
+ * Tells developer whether or not their app icon has been resumed on core.
+ *
+ * @return boolean - true if icon was resumed, false if not
+ */
+ public Boolean getIconResumed() {
+ return getBoolean(KEY_ICON_RESUMED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
index 0c52a9e0a..7870aad28 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
@@ -23,13 +23,14 @@ public class ReleaseInteriorVehicleDataModule extends RPCRequest {
/**
* @param moduleType Sets the Module Type for this class
*/
- public ReleaseInteriorVehicleDataModule(@NonNull ModuleType moduleType){
+ public ReleaseInteriorVehicleDataModule(@NonNull ModuleType moduleType) {
this();
setModuleType(moduleType);
}
/**
* Sets the Module Type for this class
+ *
* @param type the Module Type to be set
*/
public ReleaseInteriorVehicleDataModule setModuleType(@NonNull ModuleType type) {
@@ -39,6 +40,7 @@ public class ReleaseInteriorVehicleDataModule extends RPCRequest {
/**
* Gets the Module Type of this class
+ *
* @return the Module Type of this class
*/
public ModuleType getModuleType() {
@@ -47,15 +49,17 @@ public class ReleaseInteriorVehicleDataModule extends RPCRequest {
/**
* Sets the Module Ids for this class
+ *
* @param id the ids to be set
*/
- public ReleaseInteriorVehicleDataModule setModuleId( String id) {
+ public ReleaseInteriorVehicleDataModule setModuleId(String id) {
setParameters(KEY_MODULE_ID, id);
return this;
}
/**
* Gets the Module Id of this class
+ *
* @return the Module Ids
*/
public String getModuleId() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java
index 31fd12534..aac91a535 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,160 +37,160 @@ import java.util.Hashtable;
import java.util.List;
public class RemoteControlCapabilities extends RPCStruct {
- public static final String KEY_CLIMATE_CONTROL_CAPABILITIES = "climateControlCapabilities";
- public static final String KEY_RADIO_CONTROL_CAPABILITIES = "radioControlCapabilities";
- public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
- public static final String KEY_SEAT_CONTROL_CAPABILITIES = "seatControlCapabilities";
- public static final String KEY_AUDIO_CONTROL_CAPABILITIES = "audioControlCapabilities";
- public static final String KEY_HMI_SETTINGS_CONTROL_CAPABILITIES = "hmiSettingsControlCapabilities";
- public static final String KEY_LIGHT_CONTROL_CAPABILITIES = "lightControlCapabilities";
-
- public RemoteControlCapabilities() {
- }
-
- public RemoteControlCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Sets the climateControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param climateControlCapabilities If included, the platform supports RC climate controls.
- * For this baseline version, maxsize=1. i.e. only one climate control module is supported.
- */
- public RemoteControlCapabilities setClimateControlCapabilities( List<ClimateControlCapabilities> climateControlCapabilities) {
+ public static final String KEY_CLIMATE_CONTROL_CAPABILITIES = "climateControlCapabilities";
+ public static final String KEY_RADIO_CONTROL_CAPABILITIES = "radioControlCapabilities";
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ public static final String KEY_SEAT_CONTROL_CAPABILITIES = "seatControlCapabilities";
+ public static final String KEY_AUDIO_CONTROL_CAPABILITIES = "audioControlCapabilities";
+ public static final String KEY_HMI_SETTINGS_CONTROL_CAPABILITIES = "hmiSettingsControlCapabilities";
+ public static final String KEY_LIGHT_CONTROL_CAPABILITIES = "lightControlCapabilities";
+
+ public RemoteControlCapabilities() {
+ }
+
+ public RemoteControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the climateControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param climateControlCapabilities If included, the platform supports RC climate controls.
+ * For this baseline version, maxsize=1. i.e. only one climate control module is supported.
+ */
+ public RemoteControlCapabilities setClimateControlCapabilities(List<ClimateControlCapabilities> climateControlCapabilities) {
setValue(KEY_CLIMATE_CONTROL_CAPABILITIES, climateControlCapabilities);
return this;
}
- /**
- * Gets the climateControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return List<ClimateControlCapabilities>
- * If included, the platform supports RC climate controls.
- * For this baseline version, maxsize=1. i.e. only one climate control module is supported.
- */
- public List<ClimateControlCapabilities> getClimateControlCapabilities() {
- return (List<ClimateControlCapabilities>) getObject(ClimateControlCapabilities.class, KEY_CLIMATE_CONTROL_CAPABILITIES);
- }
-
- /**
- * Sets the radioControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param radioControlCapabilities If included, the platform supports RC climate controls.
- * For this baseline version, maxsize=1. i.e. only one radio control module is supported.
- */
- public RemoteControlCapabilities setRadioControlCapabilities( List<RadioControlCapabilities> radioControlCapabilities) {
+ /**
+ * Gets the climateControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return List<ClimateControlCapabilities>
+ * If included, the platform supports RC climate controls.
+ * For this baseline version, maxsize=1. i.e. only one climate control module is supported.
+ */
+ public List<ClimateControlCapabilities> getClimateControlCapabilities() {
+ return (List<ClimateControlCapabilities>) getObject(ClimateControlCapabilities.class, KEY_CLIMATE_CONTROL_CAPABILITIES);
+ }
+
+ /**
+ * Sets the radioControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param radioControlCapabilities If included, the platform supports RC climate controls.
+ * For this baseline version, maxsize=1. i.e. only one radio control module is supported.
+ */
+ public RemoteControlCapabilities setRadioControlCapabilities(List<RadioControlCapabilities> radioControlCapabilities) {
setValue(KEY_RADIO_CONTROL_CAPABILITIES, radioControlCapabilities);
return this;
}
- /**
- * Gets the radioControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return List<RadioControlCapabilities>
- * If included, the platform supports RC climate controls.
- * For this baseline version, maxsize=1. i.e. only one radio control module is supported.
- */
- public List<RadioControlCapabilities> getRadioControlCapabilities() {
- return (List<RadioControlCapabilities>) getObject(RadioControlCapabilities.class, KEY_RADIO_CONTROL_CAPABILITIES);
- }
-
- /**
- * Sets the buttonCapabilities portion of the RemoteControlCapabilities class
- *
- * @param buttonCapabilities If included, the platform supports RC button controls with the included button names.
- */
- public RemoteControlCapabilities setButtonCapabilities( List<ButtonCapabilities> buttonCapabilities) {
+ /**
+ * Gets the radioControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return List<RadioControlCapabilities>
+ * If included, the platform supports RC climate controls.
+ * For this baseline version, maxsize=1. i.e. only one radio control module is supported.
+ */
+ public List<RadioControlCapabilities> getRadioControlCapabilities() {
+ return (List<RadioControlCapabilities>) getObject(RadioControlCapabilities.class, KEY_RADIO_CONTROL_CAPABILITIES);
+ }
+
+ /**
+ * Sets the buttonCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param buttonCapabilities If included, the platform supports RC button controls with the included button names.
+ */
+ public RemoteControlCapabilities setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
return this;
}
- /**
- * Gets the buttonCapabilities portion of the RemoteControlCapabilities class
- *
- * @return List<ButtonCapabilities>
- * If included, the platform supports RC button controls with the included button names.
- */
- public List<ButtonCapabilities> getButtonCapabilities() {
- return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
- }
-
- /**
- * Sets the seatControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param seatControlCapabilities If included, the platform supports seat controls.
- */
- public RemoteControlCapabilities setSeatControlCapabilities( List<SeatControlCapabilities> seatControlCapabilities) {
+ /**
+ * Gets the buttonCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return List<ButtonCapabilities>
+ * If included, the platform supports RC button controls with the included button names.
+ */
+ public List<ButtonCapabilities> getButtonCapabilities() {
+ return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
+ }
+
+ /**
+ * Sets the seatControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param seatControlCapabilities If included, the platform supports seat controls.
+ */
+ public RemoteControlCapabilities setSeatControlCapabilities(List<SeatControlCapabilities> seatControlCapabilities) {
setValue(KEY_SEAT_CONTROL_CAPABILITIES, seatControlCapabilities);
return this;
}
- /**
- * Gets the seatControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return List<SeatControlCapabilities>
- * If included, the platform supports seat controls.
- */
- public List<SeatControlCapabilities> getSeatControlCapabilities() {
- return (List<SeatControlCapabilities>) getObject(SeatControlCapabilities.class, KEY_SEAT_CONTROL_CAPABILITIES);
- }
-
- /**
- * Sets the audioControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param audioControlCapabilities If included, the platform supports audio controls.
- */
- public RemoteControlCapabilities setAudioControlCapabilities( List<AudioControlCapabilities> audioControlCapabilities) {
+ /**
+ * Gets the seatControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return List<SeatControlCapabilities>
+ * If included, the platform supports seat controls.
+ */
+ public List<SeatControlCapabilities> getSeatControlCapabilities() {
+ return (List<SeatControlCapabilities>) getObject(SeatControlCapabilities.class, KEY_SEAT_CONTROL_CAPABILITIES);
+ }
+
+ /**
+ * Sets the audioControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param audioControlCapabilities If included, the platform supports audio controls.
+ */
+ public RemoteControlCapabilities setAudioControlCapabilities(List<AudioControlCapabilities> audioControlCapabilities) {
setValue(KEY_AUDIO_CONTROL_CAPABILITIES, audioControlCapabilities);
return this;
}
- /**
- * Gets the audioControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return List<AudioControlCapabilities>
- * If included, the platform supports audio controls.
- */
- public List<AudioControlCapabilities> getAudioControlCapabilities() {
- return (List<AudioControlCapabilities>) getObject(AudioControlCapabilities.class, KEY_AUDIO_CONTROL_CAPABILITIES);
- }
-
- /**
- * Sets the hmiSettingsControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param hmiSettingsControlCapabilities If included, the platform supports hmi setting controls.
- */
- public RemoteControlCapabilities setHmiSettingsControlCapabilities( HMISettingsControlCapabilities hmiSettingsControlCapabilities) {
+ /**
+ * Gets the audioControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return List<AudioControlCapabilities>
+ * If included, the platform supports audio controls.
+ */
+ public List<AudioControlCapabilities> getAudioControlCapabilities() {
+ return (List<AudioControlCapabilities>) getObject(AudioControlCapabilities.class, KEY_AUDIO_CONTROL_CAPABILITIES);
+ }
+
+ /**
+ * Sets the hmiSettingsControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param hmiSettingsControlCapabilities If included, the platform supports hmi setting controls.
+ */
+ public RemoteControlCapabilities setHmiSettingsControlCapabilities(HMISettingsControlCapabilities hmiSettingsControlCapabilities) {
setValue(KEY_HMI_SETTINGS_CONTROL_CAPABILITIES, hmiSettingsControlCapabilities);
return this;
}
- /**
- * Gets the hmiSettingsControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return HMISettingsControlCapabilities - If included, the platform supports hmi setting controls.
- */
- public HMISettingsControlCapabilities getHmiSettingsControlCapabilities() {
- return (HMISettingsControlCapabilities) getObject(HMISettingsControlCapabilities.class, KEY_HMI_SETTINGS_CONTROL_CAPABILITIES);
- }
-
- /**
- * Sets the lightControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @param lightControlCapabilities If included, the platform supports light controls.
- */
- public RemoteControlCapabilities setLightControlCapabilities( LightControlCapabilities lightControlCapabilities) {
+ /**
+ * Gets the hmiSettingsControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return HMISettingsControlCapabilities - If included, the platform supports hmi setting controls.
+ */
+ public HMISettingsControlCapabilities getHmiSettingsControlCapabilities() {
+ return (HMISettingsControlCapabilities) getObject(HMISettingsControlCapabilities.class, KEY_HMI_SETTINGS_CONTROL_CAPABILITIES);
+ }
+
+ /**
+ * Sets the lightControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @param lightControlCapabilities If included, the platform supports light controls.
+ */
+ public RemoteControlCapabilities setLightControlCapabilities(LightControlCapabilities lightControlCapabilities) {
setValue(KEY_LIGHT_CONTROL_CAPABILITIES, lightControlCapabilities);
return this;
}
- /**
- * Gets the lightControlCapabilities portion of the RemoteControlCapabilities class
- *
- * @return LightControlCapabilities - If included, the platform supports light controls.
- */
- public LightControlCapabilities getLightControlCapabilities() {
- return (LightControlCapabilities) getObject(LightControlCapabilities.class, KEY_LIGHT_CONTROL_CAPABILITIES);
- }
+ /**
+ * Gets the lightControlCapabilities portion of the RemoteControlCapabilities class
+ *
+ * @return LightControlCapabilities - If included, the platform supports light controls.
+ */
+ public LightControlCapabilities getLightControlCapabilities() {
+ return (LightControlCapabilities) getObject(LightControlCapabilities.class, KEY_LIGHT_CONTROL_CAPABILITIES);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
index 1bd508186..ef84adc85 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,10 +49,10 @@ import java.util.List;
* pressed
* <p>The TIMEOUTPROMPT global property default value is the same as the HELPPROMPT
* global property default value</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
- *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -74,72 +74,78 @@ import java.util.List;
*
* </table>
* <p><b>Response</b></p>
- *
+ *
* <p>Indicates whether the Global Properties were successfully set to their default values.</p>
- *
+ *
* <p><b>Non-default Result Codes:</b></p>
- *
+ *
* <p> SUCCESS</p>
* <p>INVALID_DATA</p>
* <p> OUT_OF_MEMORY</p>
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
- * <p> GENERIC_ERROR </p>
+ * <p> GENERIC_ERROR </p>
* <p> REJECTED </p>
* <p>DISALLOWED </p>
- * @since SmartDeviceLink 1.0
+ *
* @see SetGlobalProperties
+ * @since SmartDeviceLink 1.0
*/
public class ResetGlobalProperties extends RPCRequest {
- public static final String KEY_PROPERTIES = "properties";
- /**
- * Constructs a new ResetGlobalProperties object
- */
+ public static final String KEY_PROPERTIES = "properties";
+
+ /**
+ * Constructs a new ResetGlobalProperties object
+ */
public ResetGlobalProperties() {
super(FunctionID.RESET_GLOBAL_PROPERTIES.toString());
}
- /**
- * Constructs a new ResetGlobalProperties object indicated by the Hashtable
- * parameter
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new ResetGlobalProperties object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
public ResetGlobalProperties(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ResetGlobalProperties object
- * @param properties a List<GlobalProperty> An array of one or more
- * GlobalProperty enumeration elements indicating which global
- * properties to reset to their default value <br>
- * <b>Notes: </b>Array must have at least one element
- */
- public ResetGlobalProperties(@NonNull List<GlobalProperty> properties) {
- this();
- setProperties(properties);
- }
- /**
- * Gets an array of one or more GlobalProperty enumeration elements
- * indicating which global properties to reset to their default value
- *
- * @return List<GlobalProperty> -an array of one or more GlobalProperty
- * enumeration elements
- */
+
+ /**
+ * Constructs a new ResetGlobalProperties object
+ *
+ * @param properties a List<GlobalProperty> An array of one or more
+ * GlobalProperty enumeration elements indicating which global
+ * properties to reset to their default value <br>
+ * <b>Notes: </b>Array must have at least one element
+ */
+ public ResetGlobalProperties(@NonNull List<GlobalProperty> properties) {
+ this();
+ setProperties(properties);
+ }
+
+ /**
+ * Gets an array of one or more GlobalProperty enumeration elements
+ * indicating which global properties to reset to their default value
+ *
+ * @return List<GlobalProperty> -an array of one or more GlobalProperty
+ * enumeration elements
+ */
@SuppressWarnings("unchecked")
public List<GlobalProperty> getProperties() {
- return (List<GlobalProperty>) getObject(GlobalProperty.class, KEY_PROPERTIES);
+ return (List<GlobalProperty>) getObject(GlobalProperty.class, KEY_PROPERTIES);
}
- /**
- * Sets an array of one or more GlobalProperty enumeration elements
- * indicating which global properties to reset to their default value
- *
- * @param properties
- * a List<GlobalProperty> An array of one or more
- * GlobalProperty enumeration elements indicating which global
- * properties to reset to their default value
- * <p></p>
- * <b>Notes: </b>Array must have at least one element
- */
+
+ /**
+ * Sets an array of one or more GlobalProperty enumeration elements
+ * indicating which global properties to reset to their default value
+ *
+ * @param properties a List<GlobalProperty> An array of one or more
+ * GlobalProperty enumeration elements indicating which global
+ * properties to reset to their default value
+ * <p></p>
+ * <b>Notes: </b>Array must have at least one element
+ */
public ResetGlobalProperties setProperties(@NonNull List<GlobalProperty> properties) {
setParameters(KEY_PROPERTIES, properties);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
index 70abb374d..0d1045845 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.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 androidx.annotation.NonNull;
@@ -41,37 +41,37 @@ import java.util.Hashtable;
/**
* Reset Global Properties Response is sent, when ResetGlobalProperties has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class ResetGlobalPropertiesResponse extends RPCResponse {
- /**
- * Constructs a new ResetGlobalPropertiesResponse object
- */
+ /**
+ * Constructs a new ResetGlobalPropertiesResponse object
+ */
public ResetGlobalPropertiesResponse() {
super(FunctionID.RESET_GLOBAL_PROPERTIES.toString());
}
- /**
- * Constructs a new ResetGlobalPropertiesResponse object indicated by the Hashtable
- * parameter
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new ResetGlobalPropertiesResponse object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
public ResetGlobalPropertiesResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ResetGlobalPropertiesResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public ResetGlobalPropertiesResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+
+ /**
+ * Constructs a new ResetGlobalPropertiesResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ResetGlobalPropertiesResponse(@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/ScreenParams.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
index bf42b7079..5f1d049f0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,8 +36,10 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-/** The resolution of the prescribed screen area.
- *
+
+/**
+ * The resolution of the prescribed screen area.
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -66,27 +68,29 @@ import java.util.Hashtable;
* </tr>
*
* </table>
- * @since SmartDeviceLink 2.3.2
*
+ * @since SmartDeviceLink 2.3.2
*/
public class ScreenParams extends RPCStruct {
public static final String KEY_RESOLUTION = "resolution";
public static final String KEY_TOUCH_EVENT_AVAILABLE = "touchEventAvailable";
- /**
- * Constructs a new ScreenParams object
- */
- public ScreenParams() { }
- /**
- * <p>
- * Constructs a new ScreenParams object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new ScreenParams object
+ */
+
+ public ScreenParams() {
+ }
+
+ /**
+ * <p>
+ * Constructs a new ScreenParams object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public ScreenParams(Hashtable<String, Object> hash) {
super(hash);
@@ -103,15 +107,18 @@ public class ScreenParams extends RPCStruct {
public ImageResolution getImageResolution() {
return (ImageResolution) getObject(ImageResolution.class, KEY_RESOLUTION);
- }
+ }
+
public ScreenParams setImageResolution(@NonNull ImageResolution resolution) {
setValue(KEY_RESOLUTION, resolution);
return this;
}
+
public TouchEventCapabilities getTouchEventAvailable() {
- return (TouchEventCapabilities) getObject(TouchEventCapabilities.class, KEY_TOUCH_EVENT_AVAILABLE);
- }
- public ScreenParams setTouchEventAvailable( TouchEventCapabilities touchEventAvailable) {
+ return (TouchEventCapabilities) getObject(TouchEventCapabilities.class, KEY_TOUCH_EVENT_AVAILABLE);
+ }
+
+ public ScreenParams setTouchEventAvailable(TouchEventCapabilities touchEventAvailable) {
setValue(KEY_TOUCH_EVENT_AVAILABLE, touchEventAvailable);
return this;
}
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 5e1080182..019b3d55f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,11 +42,11 @@ 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
- *
+ * <p>
* 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>
- *
+ *
* <p><b>HMILevel needs to be FULL</b></p>
*
* <p><b>Parameter List</b></p>
@@ -93,144 +93,141 @@ import java.util.List;
* </tr>
* </table>
* <p> <b>Response</b></p>
- *<b>Non-default Result Codes:</b>
- * <p>SUCCESS</p>
- * <p>INVALID_DATA </p>
- * <p>OUT_OF_MEMORY</p>
- * <p>CHAR_LIMIT_EXCEEDED</p>
- * <p>TOO_MANY_PENDING_REQUESTS</p>
- * <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR </p>
- * <p>DISALLOWED</p>
- * <p>UNSUPPORTED_RESOURCE</p>
- * <p>REJECTED </p>
- * <p>ABORTED</p>
- *
+ * <b>Non-default Result Codes:</b>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA </p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>CHAR_LIMIT_EXCEEDED</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR </p>
+ * <p>DISALLOWED</p>
+ * <p>UNSUPPORTED_RESOURCE</p>
+ * <p>REJECTED </p>
+ * <p>ABORTED</p>
+ * <p>
* @see com.smartdevicelink.proxy.rpc.SoftButton
*/
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";
+ 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
- */
+ /**
+ * Constructs a new ScrollableMessage object
+ */
public ScrollableMessage() {
super(FunctionID.SCROLLABLE_MESSAGE.toString());
}
- /**
- * Constructs a new ScrollableMessage object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new ScrollableMessage object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public ScrollableMessage(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ScrollableMessage object
- * @param scrollableMessageBody a String value representing the Body of text that can include newlines and tabs <br>
- * <b>Notes: </b>Maxlength=500
- */
- public ScrollableMessage(@NonNull String scrollableMessageBody) {
- this();
- setScrollableMessageBody(scrollableMessageBody);
- }
+ /**
+ * Constructs a new ScrollableMessage object
+ *
+ * @param scrollableMessageBody a String value representing the Body of text that can include newlines and tabs <br>
+ * <b>Notes: </b>Maxlength=500
+ */
+ public ScrollableMessage(@NonNull String scrollableMessageBody) {
+ this();
+ setScrollableMessageBody(scrollableMessageBody);
+ }
- /**
- * Sets a Body of text that can include newlines and tabs
- *
- * @param scrollableMessageBody
- * a String value representing the Body of text that can include
- * newlines and tabs
- * <p></p>
- * <b>Notes: </b>Maxlength=500
- */
+ /**
+ * Sets a Body of text that can include newlines and tabs
+ *
+ * @param scrollableMessageBody a String value representing the Body of text that can include
+ * newlines and tabs
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
+ */
public ScrollableMessage setScrollableMessageBody(@NonNull String scrollableMessageBody) {
setParameters(KEY_SCROLLABLE_MESSAGE_BODY, scrollableMessageBody);
return this;
}
- /**
- * Gets a Body of text that can include newlines and tabs
- *
- * @return String -a String value
- */
+ /**
+ * Gets a Body of text that can include newlines and tabs
+ *
+ * @return String -a String value
+ */
public String getScrollableMessageBody() {
return getString(KEY_SCROLLABLE_MESSAGE_BODY);
}
- /**
- * Sets an App defined timeout. Indicates how long of a timeout from the
- * last action
- *
- * @param timeout
- * an Integer value representing an App defined timeout
- * <p></p>
- * <b>Notes</b>:Minval=0; Maxval=65535;Default=30000
- */
- public ScrollableMessage setTimeout( Integer timeout) {
+ /**
+ * Sets an App defined timeout. Indicates how long of a timeout from the
+ * last action
+ *
+ * @param timeout an Integer value representing an App defined timeout
+ * <p></p>
+ * <b>Notes</b>:Minval=0; Maxval=65535;Default=30000
+ */
+ public ScrollableMessage setTimeout(Integer timeout) {
setParameters(KEY_TIMEOUT, timeout);
return this;
}
- /**
- * Gets an App defined timeout
- *
- * @return Integer -an Integer value representing an App defined timeout
- */
+ /**
+ * Gets an App defined timeout
+ *
+ * @return Integer -an Integer value representing an App defined timeout
+ */
public Integer getTimeout() {
return getInteger(KEY_TIMEOUT);
}
- /**
- * Sets App defined SoftButtons.If omitted on supported displays, only the
- * system defined "Close" SoftButton will be displayed
- *
- * @param softButtons
- * a List<SoftButton> value representing App defined
- * SoftButtons
- * <p></p>
- * <b>Notes: </b>Minsize=0, Maxsize=8
- */
- public ScrollableMessage setSoftButtons( List<SoftButton> softButtons) {
+ /**
+ * Sets App defined SoftButtons.If omitted on supported displays, only the
+ * system defined "Close" SoftButton will be displayed
+ *
+ * @param softButtons a List<SoftButton> value representing App defined
+ * SoftButtons
+ * <p></p>
+ * <b>Notes: </b>Minsize=0, Maxsize=8
+ */
+ public ScrollableMessage setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
- /**
- * Gets App defined soft button
- * @return List -List<SoftButton> value
- */
+ /**
+ * Gets App defined soft button
+ *
+ * @return List -List<SoftButton> value
+ */
@SuppressWarnings("unchecked")
public List<SoftButton> getSoftButtons() {
- return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
+ 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);
- }
+ /**
+ * 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 ScrollableMessage setCancelID( Integer cancelID) {
+ /**
+ * 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 ScrollableMessage setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
index 2ed8ff352..cc1b49470 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.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 androidx.annotation.NonNull;
@@ -41,37 +41,38 @@ import java.util.Hashtable;
/**
* Scrollable Message Response is sent, when ScrollableMessage has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class ScrollableMessageResponse extends RPCResponse {
- /**
- * Constructs a new ScrollableMessageResponse object
- */
+ /**
+ * Constructs a new ScrollableMessageResponse object
+ */
public ScrollableMessageResponse() {
super(FunctionID.SCROLLABLE_MESSAGE.toString());
}
- /**
- * Constructs a new ScrollableMessageResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new ScrollableMessageResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public ScrollableMessageResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ScrollableMessageResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public ScrollableMessageResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+
+ /**
+ * Constructs a new ScrollableMessageResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ScrollableMessageResponse(@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/SdlMsgVersion.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
index 0e8f9453f..f67d3caf0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -55,8 +55,8 @@ import java.util.Hashtable;
* <ul>
* <li>minvalue="1"</li>
* <li>maxvalue="10"</li>
- * </ul>
- * </td>
+ * </ul>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
@@ -66,32 +66,37 @@ import java.util.Hashtable;
* <ul>
* <li>minvalue="0"</li>
* <li>maxvalue="1000"</li>
- * </ul>
- * </td>
+ * </ul>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
- * </table>
+ * </table>
+ *
* @since SmartDeviceLink 1.0
*/
public class SdlMsgVersion extends RPCStruct {
- public static final String KEY_MAJOR_VERSION = "majorVersion";
- public static final String KEY_MINOR_VERSION = "minorVersion";
- public static final String KEY_PATCH_VERSION = "patchVersion";
-
- /**
- * Constructs a newly allocated SdlMsgVersion object
- */
- public SdlMsgVersion() { }
+ public static final String KEY_MAJOR_VERSION = "majorVersion";
+ public static final String KEY_MINOR_VERSION = "minorVersion";
+ public static final String KEY_PATCH_VERSION = "patchVersion";
+
+ /**
+ * Constructs a newly allocated SdlMsgVersion object
+ */
+ public SdlMsgVersion() {
+ }
+
/**
* Constructs a newly allocated SdlMsgVersion object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
- public SdlMsgVersion(Hashtable<String, Object> hash) {
+ */
+ public SdlMsgVersion(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a newly allocated SdlMsgVersion object
+ *
* @param majorVersion minvalue="1" and maxvalue="10"
* @param minorVersion min: 0; max: 1000
*/
@@ -101,8 +106,10 @@ public class SdlMsgVersion extends RPCStruct {
setMinorVersion(minorVersion);
}
+
/**
* Constructs a newly allocated SdlMsgVersion object
+ *
* @param version Creates a new RPC struct SdlMsgVersion based on the utility class
*/
public SdlMsgVersion(@NonNull Version version) {
@@ -115,52 +122,59 @@ public class SdlMsgVersion extends RPCStruct {
@Override
public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) {
- if(getPatchVersion() == null){
+ if (getPatchVersion() == null) {
setPatchVersion(0);
}
- super.format(rpcVersion,formatParams);
+ super.format(rpcVersion, formatParams);
}
/**
* Get major version
- * <ul>
- * <li>minvalue="1"</li>
- * <li>maxvalue="10"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="1"</li>
+ * <li>maxvalue="10"</li>
+ * </ul>
+ *
* @return the major version
*/
public Integer getMajorVersion() {
- return getInteger( KEY_MAJOR_VERSION );
+ return getInteger(KEY_MAJOR_VERSION);
}
+
/**
* Set major version
- * <ul>
- * <li>minvalue="1"</li>
- * <li>maxvalue="10"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="1"</li>
+ * <li>maxvalue="10"</li>
+ * </ul>
+ *
* @param majorVersion minvalue="1" and maxvalue="10"
*/
public SdlMsgVersion setMajorVersion(@NonNull Integer majorVersion) {
setValue(KEY_MAJOR_VERSION, majorVersion);
return this;
}
+
/**
* Get minor version
- * <ul>
- * <li>minvalue="0"</li>
- * <li>maxvalue="1000"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="0"</li>
+ * <li>maxvalue="1000"</li>
+ * </ul>
+ *
* @return the minor version
- */
+ */
public Integer getMinorVersion() {
- return getInteger( KEY_MINOR_VERSION );
+ return getInteger(KEY_MINOR_VERSION);
}
+
/**
* Set minor version
- * <ul>
- * <li>minvalue="0"</li>
- * <li>maxvalue="1000"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="0"</li>
+ * <li>maxvalue="1000"</li>
+ * </ul>
+ *
* @param minorVersion min: 0; max: 1000
*/
public SdlMsgVersion setMinorVersion(@NonNull Integer minorVersion) {
@@ -170,24 +184,27 @@ public class SdlMsgVersion extends RPCStruct {
/**
* Get patch version
- * <ul>
- * <li>minvalue="0"</li>
- * <li>maxvalue="1000"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="0"</li>
+ * <li>maxvalue="1000"</li>
+ * </ul>
+ *
* @return the patch version
*/
public Integer getPatchVersion() {
- return getInteger( KEY_PATCH_VERSION );
+ return getInteger(KEY_PATCH_VERSION);
}
+
/**
* Set patch version
- * <ul>
- * <li>minvalue="0"</li>
- * <li>maxvalue="1000"</li>
- * </ul>
+ * <ul>
+ * <li>minvalue="0"</li>
+ * <li>maxvalue="1000"</li>
+ * </ul>
+ *
* @param patchVersion min: 0; max: 1000
*/
- public SdlMsgVersion setPatchVersion( Integer patchVersion) {
+ public SdlMsgVersion setPatchVersion(Integer patchVersion) {
setValue(KEY_PATCH_VERSION, patchVersion);
return this;
}
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 82d3cf72c..ef82a3686 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,367 +38,370 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
public class SeatControlCapabilities extends RPCStruct {
- public static final String KEY_MODULE_NAME = "moduleName";
- public static final String KEY_HEATING_ENABLED_AVAILABLE = "heatingEnabledAvailable";
- public static final String KEY_COOLING_ENABLED_AVAILABLE = "coolingEnabledAvailable";
- public static final String KEY_HEATING_LEVEL_AVAILABLE = "heatingLevelAvailable";
- public static final String KEY_COOLING_LEVEL_AVAILABLE = "coolingLevelAvailable";
- public static final String KEY_HORIZONTAL_POSITION_AVAILABLE = "horizontalPositionAvailable";
- public static final String KEY_VERTICAL_POSITION_AVAILABLE = "verticalPositionAvailable";
- public static final String KEY_FRONT_VERTICAL_POSITION_AVAILABLE = "frontVerticalPositionAvailable";
- public static final String KEY_BACK_VERTICAL_POSITION_AVAILABLE = "backVerticalPositionAvailable";
- public static final String KEY_BACK_TILT_ANGLE_AVAILABLE = "backTiltAngleAvailable";
- public static final String KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE = "headSupportHorizontalPositionAvailable";
- public static final String KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE = "headSupportVerticalPositionAvailable";
- public static final String KEY_MASSAGE_ENABLED_AVAILABLE = "massageEnabledAvailable";
- 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
- */
- public SeatControlCapabilities() {
- }
-
- /**
- * <p>Constructs a new SeatControlCapabilities object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public SeatControlCapabilities(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a newly allocated SeatControlCapabilities object
- * @param moduleName short friendly name of the light control module.
- */
- public SeatControlCapabilities(@NonNull String moduleName) {
- this();
- setModuleName(moduleName);
- }
-
- /**
- * Get the moduleName portion of the SeatControlCapabilities class
- *
- * @return String
- */
- public String getModuleName() {
- return getString(KEY_MODULE_NAME);
- }
-
- /**
- * Sets the moduleName portion of the SeatControlCapabilities class
- *
- * @param moduleName - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
- */
- public SeatControlCapabilities setModuleName(@NonNull String moduleName) {
+ public static final String KEY_MODULE_NAME = "moduleName";
+ public static final String KEY_HEATING_ENABLED_AVAILABLE = "heatingEnabledAvailable";
+ public static final String KEY_COOLING_ENABLED_AVAILABLE = "coolingEnabledAvailable";
+ public static final String KEY_HEATING_LEVEL_AVAILABLE = "heatingLevelAvailable";
+ public static final String KEY_COOLING_LEVEL_AVAILABLE = "coolingLevelAvailable";
+ public static final String KEY_HORIZONTAL_POSITION_AVAILABLE = "horizontalPositionAvailable";
+ public static final String KEY_VERTICAL_POSITION_AVAILABLE = "verticalPositionAvailable";
+ public static final String KEY_FRONT_VERTICAL_POSITION_AVAILABLE = "frontVerticalPositionAvailable";
+ public static final String KEY_BACK_VERTICAL_POSITION_AVAILABLE = "backVerticalPositionAvailable";
+ public static final String KEY_BACK_TILT_ANGLE_AVAILABLE = "backTiltAngleAvailable";
+ public static final String KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE = "headSupportHorizontalPositionAvailable";
+ public static final String KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE = "headSupportVerticalPositionAvailable";
+ public static final String KEY_MASSAGE_ENABLED_AVAILABLE = "massageEnabledAvailable";
+ 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
+ */
+ public SeatControlCapabilities() {
+ }
+
+ /**
+ * <p>Constructs a new SeatControlCapabilities object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SeatControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated SeatControlCapabilities object
+ *
+ * @param moduleName short friendly name of the light control module.
+ */
+ public SeatControlCapabilities(@NonNull String moduleName) {
+ this();
+ setModuleName(moduleName);
+ }
+
+ /**
+ * Get the moduleName portion of the SeatControlCapabilities class
+ *
+ * @return String
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
+
+ /**
+ * Sets the moduleName portion of the SeatControlCapabilities class
+ *
+ * @param moduleName - The short friendly name of the light control module. It should not be used to identify a module by mobile application.
+ */
+ public SeatControlCapabilities setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
return this;
}
- /**
- * Sets the heatingEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @param heatingEnabledAvailable
- */
- public SeatControlCapabilities setHeatingEnabledAvailable( Boolean heatingEnabledAvailable) {
+ /**
+ * Sets the heatingEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @param heatingEnabledAvailable
+ */
+ public SeatControlCapabilities setHeatingEnabledAvailable(Boolean heatingEnabledAvailable) {
setValue(KEY_HEATING_ENABLED_AVAILABLE, heatingEnabledAvailable);
return this;
}
- /**
- * Gets the heatingEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getHeatingEnabledAvailable() {
- return getBoolean(KEY_HEATING_ENABLED_AVAILABLE);
- }
-
- /**
- * Sets the coolingEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @param coolingEnabledAvailable
- */
- public SeatControlCapabilities setCoolingEnabledAvailable( Boolean coolingEnabledAvailable) {
+ /**
+ * Gets the heatingEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHeatingEnabledAvailable() {
+ return getBoolean(KEY_HEATING_ENABLED_AVAILABLE);
+ }
+
+ /**
+ * Sets the coolingEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @param coolingEnabledAvailable
+ */
+ public SeatControlCapabilities setCoolingEnabledAvailable(Boolean coolingEnabledAvailable) {
setValue(KEY_COOLING_ENABLED_AVAILABLE, coolingEnabledAvailable);
return this;
}
- /**
- * Gets the coolingEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getCoolingEnabledAvailable() {
- return getBoolean(KEY_COOLING_ENABLED_AVAILABLE);
- }
-
- /**
- * Sets the heatingLevelAvailable portion of the SeatControlCapabilities class
- *
- * @param heatingLevelAvailable
- */
- public SeatControlCapabilities setHeatingLevelAvailable( Boolean heatingLevelAvailable) {
+ /**
+ * Gets the coolingEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getCoolingEnabledAvailable() {
+ return getBoolean(KEY_COOLING_ENABLED_AVAILABLE);
+ }
+
+ /**
+ * Sets the heatingLevelAvailable portion of the SeatControlCapabilities class
+ *
+ * @param heatingLevelAvailable
+ */
+ public SeatControlCapabilities setHeatingLevelAvailable(Boolean heatingLevelAvailable) {
setValue(KEY_HEATING_LEVEL_AVAILABLE, heatingLevelAvailable);
return this;
}
- /**
- * Gets the heatingLevelAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getHeatingLevelAvailable() {
- return getBoolean(KEY_HEATING_LEVEL_AVAILABLE);
- }
-
- /**
- * Sets the coolingLevelAvailable portion of the SeatControlCapabilities class
- *
- * @param coolingLevelAvailable
- */
- public SeatControlCapabilities setCoolingLevelAvailable( Boolean coolingLevelAvailable) {
+ /**
+ * Gets the heatingLevelAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHeatingLevelAvailable() {
+ return getBoolean(KEY_HEATING_LEVEL_AVAILABLE);
+ }
+
+ /**
+ * Sets the coolingLevelAvailable portion of the SeatControlCapabilities class
+ *
+ * @param coolingLevelAvailable
+ */
+ public SeatControlCapabilities setCoolingLevelAvailable(Boolean coolingLevelAvailable) {
setValue(KEY_COOLING_LEVEL_AVAILABLE, coolingLevelAvailable);
return this;
}
- /**
- * Gets the coolingLevelAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getCoolingLevelAvailable() {
- return getBoolean(KEY_COOLING_LEVEL_AVAILABLE);
- }
-
- /**
- * Sets the horizontalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param horizontalPositionAvailable
- */
- public SeatControlCapabilities setHorizontalPositionAvailable( Boolean horizontalPositionAvailable) {
+ /**
+ * Gets the coolingLevelAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getCoolingLevelAvailable() {
+ return getBoolean(KEY_COOLING_LEVEL_AVAILABLE);
+ }
+
+ /**
+ * Sets the horizontalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param horizontalPositionAvailable
+ */
+ public SeatControlCapabilities setHorizontalPositionAvailable(Boolean horizontalPositionAvailable) {
setValue(KEY_HORIZONTAL_POSITION_AVAILABLE, horizontalPositionAvailable);
return this;
}
- /**
- * Gets the horizontalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getHorizontalPositionAvailable() {
- return getBoolean(KEY_HORIZONTAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the verticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param verticalPositionAvailable
- */
- public SeatControlCapabilities setVerticalPositionAvailable( Boolean verticalPositionAvailable) {
+ /**
+ * Gets the horizontalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHorizontalPositionAvailable() {
+ return getBoolean(KEY_HORIZONTAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the verticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param verticalPositionAvailable
+ */
+ public SeatControlCapabilities setVerticalPositionAvailable(Boolean verticalPositionAvailable) {
setValue(KEY_VERTICAL_POSITION_AVAILABLE, verticalPositionAvailable);
return this;
}
- /**
- * Gets the verticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getVerticalPositionAvailable() {
- return getBoolean(KEY_VERTICAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the frontVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param frontVerticalPositionAvailable
- */
- public SeatControlCapabilities setFrontVerticalPositionAvailable( Boolean frontVerticalPositionAvailable) {
+ /**
+ * Gets the verticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getVerticalPositionAvailable() {
+ return getBoolean(KEY_VERTICAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the frontVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param frontVerticalPositionAvailable
+ */
+ public SeatControlCapabilities setFrontVerticalPositionAvailable(Boolean frontVerticalPositionAvailable) {
setValue(KEY_FRONT_VERTICAL_POSITION_AVAILABLE, frontVerticalPositionAvailable);
return this;
}
- /**
- * Gets the frontVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getFrontVerticalPositionAvailable() {
- return getBoolean(KEY_FRONT_VERTICAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the backVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param backVerticalPositionAvailable
- */
- public SeatControlCapabilities setBackVerticalPositionAvailable( Boolean backVerticalPositionAvailable) {
+ /**
+ * Gets the frontVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getFrontVerticalPositionAvailable() {
+ return getBoolean(KEY_FRONT_VERTICAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the backVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param backVerticalPositionAvailable
+ */
+ public SeatControlCapabilities setBackVerticalPositionAvailable(Boolean backVerticalPositionAvailable) {
setValue(KEY_BACK_VERTICAL_POSITION_AVAILABLE, backVerticalPositionAvailable);
return this;
}
- /**
- * Gets the backVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getBackVerticalPositionAvailable() {
- return getBoolean(KEY_BACK_VERTICAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the backTiltAngleAvailable portion of the SeatControlCapabilities class
- *
- * @param backTiltAngleAvailable
- */
- public SeatControlCapabilities setBackTiltAngleAvailable( Boolean backTiltAngleAvailable) {
+ /**
+ * Gets the backVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getBackVerticalPositionAvailable() {
+ return getBoolean(KEY_BACK_VERTICAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the backTiltAngleAvailable portion of the SeatControlCapabilities class
+ *
+ * @param backTiltAngleAvailable
+ */
+ public SeatControlCapabilities setBackTiltAngleAvailable(Boolean backTiltAngleAvailable) {
setValue(KEY_BACK_TILT_ANGLE_AVAILABLE, backTiltAngleAvailable);
return this;
}
- /**
- * Gets the backTiltAngleAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getBackTiltAngleAvailable() {
- return getBoolean(KEY_BACK_TILT_ANGLE_AVAILABLE);
- }
-
- /**
- * Sets the headSupportHorizontalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param headSupportHorizontalPositionAvailable
- */
- public SeatControlCapabilities setHeadSupportHorizontalPositionAvailable( Boolean headSupportHorizontalPositionAvailable) {
+ /**
+ * Gets the backTiltAngleAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getBackTiltAngleAvailable() {
+ return getBoolean(KEY_BACK_TILT_ANGLE_AVAILABLE);
+ }
+
+ /**
+ * Sets the headSupportHorizontalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param headSupportHorizontalPositionAvailable
+ */
+ public SeatControlCapabilities setHeadSupportHorizontalPositionAvailable(Boolean headSupportHorizontalPositionAvailable) {
setValue(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE, headSupportHorizontalPositionAvailable);
return this;
}
- /**
- * Gets the headSupportHorizontalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getHeadSupportHorizontalPositionAvailable() {
- return getBoolean(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the headSupportVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @param headSupportVerticalPositionAvailable
- */
- public SeatControlCapabilities setHeadSupportVerticalPositionAvailable( Boolean headSupportVerticalPositionAvailable) {
+ /**
+ * Gets the headSupportHorizontalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHeadSupportHorizontalPositionAvailable() {
+ return getBoolean(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the headSupportVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @param headSupportVerticalPositionAvailable
+ */
+ public SeatControlCapabilities setHeadSupportVerticalPositionAvailable(Boolean headSupportVerticalPositionAvailable) {
setValue(KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE, headSupportVerticalPositionAvailable);
return this;
}
- /**
- * Gets the headSupportVerticalPositionAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getHeadSupportVerticalPositionAvailable() {
- return getBoolean(KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE);
- }
-
- /**
- * Sets the massageEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @param massageEnabledAvailable
- */
- public SeatControlCapabilities setMassageEnabledAvailable( Boolean massageEnabledAvailable) {
+ /**
+ * Gets the headSupportVerticalPositionAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHeadSupportVerticalPositionAvailable() {
+ return getBoolean(KEY_HEAD_SUPPORT_VERTICAL_POSITION_AVAILABLE);
+ }
+
+ /**
+ * Sets the massageEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @param massageEnabledAvailable
+ */
+ public SeatControlCapabilities setMassageEnabledAvailable(Boolean massageEnabledAvailable) {
setValue(KEY_MASSAGE_ENABLED_AVAILABLE, massageEnabledAvailable);
return this;
}
- /**
- * Gets the massageEnabledAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getMassageEnabledAvailable() {
- return getBoolean(KEY_MASSAGE_ENABLED_AVAILABLE);
- }
-
- /**
- * Sets the massageModeAvailable portion of the SeatControlCapabilities class
- *
- * @param massageModeAvailable
- */
- public SeatControlCapabilities setMassageModeAvailable( Boolean massageModeAvailable) {
+ /**
+ * Gets the massageEnabledAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getMassageEnabledAvailable() {
+ return getBoolean(KEY_MASSAGE_ENABLED_AVAILABLE);
+ }
+
+ /**
+ * Sets the massageModeAvailable portion of the SeatControlCapabilities class
+ *
+ * @param massageModeAvailable
+ */
+ public SeatControlCapabilities setMassageModeAvailable(Boolean massageModeAvailable) {
setValue(KEY_MASSAGE_MODE_AVAILABLE, massageModeAvailable);
return this;
}
- /**
- * Gets the massageModeAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getMassageModeAvailable() {
- return getBoolean(KEY_MASSAGE_MODE_AVAILABLE);
- }
-
- /**
- * Sets the massageCushionFirmnessAvailable portion of the SeatControlCapabilities class
- *
- * @param massageCushionFirmnessAvailable
- */
- public SeatControlCapabilities setMassageCushionFirmnessAvailable( Boolean massageCushionFirmnessAvailable) {
+ /**
+ * Gets the massageModeAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getMassageModeAvailable() {
+ return getBoolean(KEY_MASSAGE_MODE_AVAILABLE);
+ }
+
+ /**
+ * Sets the massageCushionFirmnessAvailable portion of the SeatControlCapabilities class
+ *
+ * @param massageCushionFirmnessAvailable
+ */
+ public SeatControlCapabilities setMassageCushionFirmnessAvailable(Boolean massageCushionFirmnessAvailable) {
setValue(KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE, massageCushionFirmnessAvailable);
return this;
}
- /**
- * Gets the massageCushionFirmnessAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getMassageCushionFirmnessAvailable() {
- return getBoolean(KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE);
- }
-
- /**
- * Sets the memoryAvailable portion of the SeatControlCapabilities class
- *
- * @param memoryAvailable
- */
- public SeatControlCapabilities setMemoryAvailable( Boolean memoryAvailable) {
+ /**
+ * Gets the massageCushionFirmnessAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getMassageCushionFirmnessAvailable() {
+ return getBoolean(KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE);
+ }
+
+ /**
+ * Sets the memoryAvailable portion of the SeatControlCapabilities class
+ *
+ * @param memoryAvailable
+ */
+ public SeatControlCapabilities setMemoryAvailable(Boolean memoryAvailable) {
setValue(KEY_MEMORY_AVAILABLE, memoryAvailable);
return this;
}
- /**
- * Gets the memoryAvailable portion of the SeatControlCapabilities class
- *
- * @return Boolean.
- */
- public Boolean getMemoryAvailable() {
- return getBoolean(KEY_MEMORY_AVAILABLE);
- }
-
- /**
- * Sets ModuleInfo for this capability
- * @param info the ModuleInfo to be set
- */
- public SeatControlCapabilities setModuleInfo( ModuleInfo info) {
+ /**
+ * Gets the memoryAvailable portion of the SeatControlCapabilities class
+ *
+ * @return Boolean.
+ */
+ public Boolean getMemoryAvailable() {
+ return getBoolean(KEY_MEMORY_AVAILABLE);
+ }
+
+ /**
+ * Sets ModuleInfo for this capability
+ *
+ * @param info the ModuleInfo to be set
+ */
+ public SeatControlCapabilities setModuleInfo(ModuleInfo info) {
setValue(KEY_MODULE_INFO, info);
return this;
}
- /**
- * Gets a ModuleInfo of this capability
- * @return module info of this capability
- */
- public ModuleInfo getModuleInfo() {
- return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_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/SeatControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlData.java
index ad883e310..93e118987 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,351 +43,352 @@ import java.util.List;
* Seat control data corresponds to "SEAT" ModuleType.
*/
public class SeatControlData extends RPCStruct {
- public static final String KEY_ID = "id";
- public static final String KEY_HEATING_ENABLED = "heatingEnabled";
- public static final String KEY_COOLING_ENABLED = "coolingEnabled";
- public static final String KEY_HEATING_LEVEL = "heatingLevel";
- public static final String KEY_COOLING_LEVEL = "coolingLevel";
- public static final String KEY_HORIZONTAL_POSITION = "horizontalPosition";
- public static final String KEY_VERTICAL_POSITION = "verticalPosition";
- public static final String KEY_FRONT_VERTICAL_POSITION = "frontVerticalPosition";
- public static final String KEY_BACK_VERTICAL_POSITION = "backVerticalPosition";
- public static final String KEY_BACK_TILT_ANGLE = "backTiltAngle";
- public static final String KEY_HEAD_SUPPORT_HORIZONTAL_POSITION = "headSupportHorizontalPosition";
- public static final String KEY_HEAD_SUPPORT_VERTICAL_POSITION = "headSupportVerticalPosition";
- public static final String KEY_MASSAGE_ENABLED = "massageEnabled";
- public static final String KEY_MASSAGE_MODE = "massageMode";
- public static final String KEY_MASSAGE_CUSHION_FIRMNESS = "massageCushionFirmness";
- public static final String KEY_MEMORY = "memory";
-
- /**
- * Constructs a new SeatControlData object
- */
- public SeatControlData() {
- }
-
- /**
- * <p>Constructs a new SeatControlData object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public SeatControlData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- /**
- * Constructs a newly allocated SeatControlData object
- * @param id type of SupportedSeat.
- */
- public SeatControlData(@NonNull SupportedSeat id) {
- this();
- setId(id);
- }
-
- /**
- * Sets the id portion of the SeatControlData class
- *
- * @param id
- */
- public SeatControlData setId(@NonNull SupportedSeat id) {
+ public static final String KEY_ID = "id";
+ public static final String KEY_HEATING_ENABLED = "heatingEnabled";
+ public static final String KEY_COOLING_ENABLED = "coolingEnabled";
+ public static final String KEY_HEATING_LEVEL = "heatingLevel";
+ public static final String KEY_COOLING_LEVEL = "coolingLevel";
+ public static final String KEY_HORIZONTAL_POSITION = "horizontalPosition";
+ public static final String KEY_VERTICAL_POSITION = "verticalPosition";
+ public static final String KEY_FRONT_VERTICAL_POSITION = "frontVerticalPosition";
+ public static final String KEY_BACK_VERTICAL_POSITION = "backVerticalPosition";
+ public static final String KEY_BACK_TILT_ANGLE = "backTiltAngle";
+ public static final String KEY_HEAD_SUPPORT_HORIZONTAL_POSITION = "headSupportHorizontalPosition";
+ public static final String KEY_HEAD_SUPPORT_VERTICAL_POSITION = "headSupportVerticalPosition";
+ public static final String KEY_MASSAGE_ENABLED = "massageEnabled";
+ public static final String KEY_MASSAGE_MODE = "massageMode";
+ public static final String KEY_MASSAGE_CUSHION_FIRMNESS = "massageCushionFirmness";
+ public static final String KEY_MEMORY = "memory";
+
+ /**
+ * Constructs a new SeatControlData object
+ */
+ public SeatControlData() {
+ }
+
+ /**
+ * <p>Constructs a new SeatControlData object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SeatControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated SeatControlData object
+ *
+ * @param id type of SupportedSeat.
+ */
+ public SeatControlData(@NonNull SupportedSeat id) {
+ this();
+ setId(id);
+ }
+
+ /**
+ * Sets the id portion of the SeatControlData class
+ *
+ * @param id
+ */
+ public SeatControlData setId(@NonNull SupportedSeat id) {
setValue(KEY_ID, id);
return this;
}
- /**
- * Gets the id portion of the SeatControlData class
- *
- * @return SupportedSeat.
- */
- public SupportedSeat getId() {
- return (SupportedSeat) getObject(SupportedSeat.class, KEY_ID);
- }
-
- /**
- * Sets the heatingEnabled portion of the SeatControlData class
- *
- * @param heatingEnabled
- */
- public SeatControlData setHeatingEnabled( Boolean heatingEnabled) {
+ /**
+ * Gets the id portion of the SeatControlData class
+ *
+ * @return SupportedSeat.
+ */
+ public SupportedSeat getId() {
+ return (SupportedSeat) getObject(SupportedSeat.class, KEY_ID);
+ }
+
+ /**
+ * Sets the heatingEnabled portion of the SeatControlData class
+ *
+ * @param heatingEnabled
+ */
+ public SeatControlData setHeatingEnabled(Boolean heatingEnabled) {
setValue(KEY_HEATING_ENABLED, heatingEnabled);
return this;
}
- /**
- * Gets the heatingEnabled portion of the SeatControlData class
- *
- * @return Boolean.
- */
- public Boolean getHeatingEnabled() {
- return getBoolean(KEY_HEATING_ENABLED);
- }
-
- /**
- * Sets the coolingEnabled portion of the SeatControlData class
- *
- * @param coolingEnabled
- */
- public SeatControlData setCoolingEnabled( Boolean coolingEnabled) {
+ /**
+ * Gets the heatingEnabled portion of the SeatControlData class
+ *
+ * @return Boolean.
+ */
+ public Boolean getHeatingEnabled() {
+ return getBoolean(KEY_HEATING_ENABLED);
+ }
+
+ /**
+ * Sets the coolingEnabled portion of the SeatControlData class
+ *
+ * @param coolingEnabled
+ */
+ public SeatControlData setCoolingEnabled(Boolean coolingEnabled) {
setValue(KEY_COOLING_ENABLED, coolingEnabled);
return this;
}
- /**
- * Gets the coolingEnabled portion of the SeatControlData class
- *
- * @return Boolean.
- */
- public Boolean getCoolingEnabled() {
- return getBoolean(KEY_COOLING_ENABLED);
- }
-
- /**
- * Sets the heatingLevel portion of the SeatControlData class
- *
- * @param heatingLevel
- */
- public SeatControlData setHeatingLevel( Integer heatingLevel) {
+ /**
+ * Gets the coolingEnabled portion of the SeatControlData class
+ *
+ * @return Boolean.
+ */
+ public Boolean getCoolingEnabled() {
+ return getBoolean(KEY_COOLING_ENABLED);
+ }
+
+ /**
+ * Sets the heatingLevel portion of the SeatControlData class
+ *
+ * @param heatingLevel
+ */
+ public SeatControlData setHeatingLevel(Integer heatingLevel) {
setValue(KEY_HEATING_LEVEL, heatingLevel);
return this;
}
- /**
- * Gets the heatingLevel portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getHeatingLevel() {
- return getInteger(KEY_HEATING_LEVEL);
- }
-
- /**
- * Sets the coolingLevel portion of the SeatControlData class
- *
- * @param coolingLevel
- */
- public SeatControlData setCoolingLevel( Integer coolingLevel) {
+ /**
+ * Gets the heatingLevel portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getHeatingLevel() {
+ return getInteger(KEY_HEATING_LEVEL);
+ }
+
+ /**
+ * Sets the coolingLevel portion of the SeatControlData class
+ *
+ * @param coolingLevel
+ */
+ public SeatControlData setCoolingLevel(Integer coolingLevel) {
setValue(KEY_COOLING_LEVEL, coolingLevel);
return this;
}
- /**
- * Gets the coolingLevel portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getCoolingLevel() {
- return getInteger(KEY_COOLING_LEVEL);
- }
-
- /**
- * Sets the horizontalPosition portion of the SeatControlData class
- *
- * @param horizontalPosition
- */
- public SeatControlData setHorizontalPosition( Integer horizontalPosition) {
+ /**
+ * Gets the coolingLevel portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getCoolingLevel() {
+ return getInteger(KEY_COOLING_LEVEL);
+ }
+
+ /**
+ * Sets the horizontalPosition portion of the SeatControlData class
+ *
+ * @param horizontalPosition
+ */
+ public SeatControlData setHorizontalPosition(Integer horizontalPosition) {
setValue(KEY_HORIZONTAL_POSITION, horizontalPosition);
return this;
}
- /**
- * Gets the horizontalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getHorizontalPosition() {
- return getInteger(KEY_HORIZONTAL_POSITION);
- }
-
- /**
- * Sets the verticalPosition portion of the SeatControlData class
- *
- * @param verticalPosition
- */
- public SeatControlData setVerticalPosition( Integer verticalPosition) {
+ /**
+ * Gets the horizontalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getHorizontalPosition() {
+ return getInteger(KEY_HORIZONTAL_POSITION);
+ }
+
+ /**
+ * Sets the verticalPosition portion of the SeatControlData class
+ *
+ * @param verticalPosition
+ */
+ public SeatControlData setVerticalPosition(Integer verticalPosition) {
setValue(KEY_VERTICAL_POSITION, verticalPosition);
return this;
}
- /**
- * Gets the verticalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getVerticalPosition() {
- return getInteger(KEY_VERTICAL_POSITION);
- }
-
- /**
- * Sets the frontVerticalPosition portion of the SeatControlData class
- *
- * @param frontVerticalPosition
- */
- public SeatControlData setFrontVerticalPosition( Integer frontVerticalPosition) {
+ /**
+ * Gets the verticalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getVerticalPosition() {
+ return getInteger(KEY_VERTICAL_POSITION);
+ }
+
+ /**
+ * Sets the frontVerticalPosition portion of the SeatControlData class
+ *
+ * @param frontVerticalPosition
+ */
+ public SeatControlData setFrontVerticalPosition(Integer frontVerticalPosition) {
setValue(KEY_FRONT_VERTICAL_POSITION, frontVerticalPosition);
return this;
}
- /**
- * Gets the frontVerticalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getFrontVerticalPosition() {
- return getInteger(KEY_FRONT_VERTICAL_POSITION);
- }
-
- /**
- * Sets the backVerticalPosition portion of the SeatControlData class
- *
- * @param backVerticalPosition
- */
- public SeatControlData setBackVerticalPosition( Integer backVerticalPosition) {
+ /**
+ * Gets the frontVerticalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getFrontVerticalPosition() {
+ return getInteger(KEY_FRONT_VERTICAL_POSITION);
+ }
+
+ /**
+ * Sets the backVerticalPosition portion of the SeatControlData class
+ *
+ * @param backVerticalPosition
+ */
+ public SeatControlData setBackVerticalPosition(Integer backVerticalPosition) {
setValue(KEY_BACK_VERTICAL_POSITION, backVerticalPosition);
return this;
}
- /**
- * Gets the backVerticalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getBackVerticalPosition() {
- return getInteger(KEY_BACK_VERTICAL_POSITION);
- }
-
- /**
- * Sets the backTiltAngle portion of the SeatControlData class
- *
- * @param backTiltAngle
- */
- public SeatControlData setBackTiltAngle( Integer backTiltAngle) {
+ /**
+ * Gets the backVerticalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getBackVerticalPosition() {
+ return getInteger(KEY_BACK_VERTICAL_POSITION);
+ }
+
+ /**
+ * Sets the backTiltAngle portion of the SeatControlData class
+ *
+ * @param backTiltAngle
+ */
+ public SeatControlData setBackTiltAngle(Integer backTiltAngle) {
setValue(KEY_BACK_TILT_ANGLE, backTiltAngle);
return this;
}
- /**
- * Gets the backTiltAngle portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getBackTiltAngle() {
- return getInteger(KEY_BACK_TILT_ANGLE);
- }
-
- /**
- * Sets the headSupportHorizontalPosition portion of the SeatControlData class
- *
- * @param headSupportHorizontalPosition
- */
- public SeatControlData setHeadSupportHorizontalPosition( Integer headSupportHorizontalPosition) {
+ /**
+ * Gets the backTiltAngle portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getBackTiltAngle() {
+ return getInteger(KEY_BACK_TILT_ANGLE);
+ }
+
+ /**
+ * Sets the headSupportHorizontalPosition portion of the SeatControlData class
+ *
+ * @param headSupportHorizontalPosition
+ */
+ public SeatControlData setHeadSupportHorizontalPosition(Integer headSupportHorizontalPosition) {
setValue(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION, headSupportHorizontalPosition);
return this;
}
- /**
- * Gets the headSupportHorizontalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getHeadSupportHorizontalPosition() {
- return getInteger(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION);
- }
-
- /**
- * Sets the headSupportVerticalPosition portion of the SeatControlData class
- *
- * @param headSupportVerticalPosition
- */
- public SeatControlData setHeadSupportVerticalPosition( Integer headSupportVerticalPosition) {
+ /**
+ * Gets the headSupportHorizontalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getHeadSupportHorizontalPosition() {
+ return getInteger(KEY_HEAD_SUPPORT_HORIZONTAL_POSITION);
+ }
+
+ /**
+ * Sets the headSupportVerticalPosition portion of the SeatControlData class
+ *
+ * @param headSupportVerticalPosition
+ */
+ public SeatControlData setHeadSupportVerticalPosition(Integer headSupportVerticalPosition) {
setValue(KEY_HEAD_SUPPORT_VERTICAL_POSITION, headSupportVerticalPosition);
return this;
}
- /**
- * Gets the headSupportVerticalPosition portion of the SeatControlData class
- *
- * @return Integer
- */
- public Integer getHeadSupportVerticalPosition() {
- return getInteger(KEY_HEAD_SUPPORT_VERTICAL_POSITION);
- }
-
- /**
- * Sets the massageEnabled portion of the SeatControlData class
- *
- * @param massageEnabled
- */
- public SeatControlData setMassageEnabled( Boolean massageEnabled) {
+ /**
+ * Gets the headSupportVerticalPosition portion of the SeatControlData class
+ *
+ * @return Integer
+ */
+ public Integer getHeadSupportVerticalPosition() {
+ return getInteger(KEY_HEAD_SUPPORT_VERTICAL_POSITION);
+ }
+
+ /**
+ * Sets the massageEnabled portion of the SeatControlData class
+ *
+ * @param massageEnabled
+ */
+ public SeatControlData setMassageEnabled(Boolean massageEnabled) {
setValue(KEY_MASSAGE_ENABLED, massageEnabled);
return this;
}
- /**
- * Gets the massageEnabled portion of the SeatControlData class
- *
- * @return Boolean.
- */
- public Boolean getMassageEnabled() {
- return getBoolean(KEY_MASSAGE_ENABLED);
- }
-
- /**
- * Gets the List<MassageModeData> portion of the SeatControlData class
- *
- * @return List<MassageModeData>.
- */
- @SuppressWarnings("unchecked")
- public List<MassageModeData> getMassageMode() {
- return (List<MassageModeData>) getObject(MassageModeData.class, KEY_MASSAGE_MODE);
- }
-
- /**
- * Sets the massageMode portion of the SeatControlData class
- *
- * @param massageMode
- */
- public SeatControlData setMassageMode( List<MassageModeData> massageMode) {
+ /**
+ * Gets the massageEnabled portion of the SeatControlData class
+ *
+ * @return Boolean.
+ */
+ public Boolean getMassageEnabled() {
+ return getBoolean(KEY_MASSAGE_ENABLED);
+ }
+
+ /**
+ * Gets the List<MassageModeData> portion of the SeatControlData class
+ *
+ * @return List<MassageModeData>.
+ */
+ @SuppressWarnings("unchecked")
+ public List<MassageModeData> getMassageMode() {
+ return (List<MassageModeData>) getObject(MassageModeData.class, KEY_MASSAGE_MODE);
+ }
+
+ /**
+ * Sets the massageMode portion of the SeatControlData class
+ *
+ * @param massageMode
+ */
+ public SeatControlData setMassageMode(List<MassageModeData> massageMode) {
setValue(KEY_MASSAGE_MODE, massageMode);
return this;
}
- /**
- * Gets the List<MassageCushionFirmness> portion of the SeatControlData class
- *
- * @return List<MassageCushionFirmness>.
- */
- @SuppressWarnings("unchecked")
- public List<MassageCushionFirmness> getMassageCushionFirmness() {
- return (List<MassageCushionFirmness>) getObject(MassageCushionFirmness.class, KEY_MASSAGE_CUSHION_FIRMNESS);
- }
-
- /**
- * Sets the massageCushionFirmness portion of the SeatControlData class
- *
- * @param massageCushionFirmness
- */
- public SeatControlData setMassageCushionFirmness( List<MassageCushionFirmness> massageCushionFirmness) {
+ /**
+ * Gets the List<MassageCushionFirmness> portion of the SeatControlData class
+ *
+ * @return List<MassageCushionFirmness>.
+ */
+ @SuppressWarnings("unchecked")
+ public List<MassageCushionFirmness> getMassageCushionFirmness() {
+ return (List<MassageCushionFirmness>) getObject(MassageCushionFirmness.class, KEY_MASSAGE_CUSHION_FIRMNESS);
+ }
+
+ /**
+ * Sets the massageCushionFirmness portion of the SeatControlData class
+ *
+ * @param massageCushionFirmness
+ */
+ public SeatControlData setMassageCushionFirmness(List<MassageCushionFirmness> massageCushionFirmness) {
setValue(KEY_MASSAGE_CUSHION_FIRMNESS, massageCushionFirmness);
return this;
}
- /**
- * Sets the memory portion of the SeatControlData class
- *
- * @param memory
- */
- public SeatControlData setMemory( SeatMemoryAction memory) {
+ /**
+ * Sets the memory portion of the SeatControlData class
+ *
+ * @param memory
+ */
+ public SeatControlData setMemory(SeatMemoryAction memory) {
setValue(KEY_MEMORY, memory);
return this;
}
- /**
- * Gets the memory portion of the SeatControlData class
- *
- * @return SeatMemoryAction.
- */
- public SeatMemoryAction getMemory() {
- return (SeatMemoryAction) getObject(SeatMemoryAction.class, KEY_MEMORY);
- }
+ /**
+ * Gets the memory portion of the SeatControlData class
+ *
+ * @return SeatMemoryAction.
+ */
+ public SeatMemoryAction getMemory() {
+ return (SeatMemoryAction) getObject(SeatMemoryAction.class, KEY_MEMORY);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
index a0b1338e7..d7e3b6f53 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
@@ -7,7 +7,8 @@ import java.util.Hashtable;
public class SeatLocation extends RPCStruct {
public static final String KEY_GRID = "grid";
- public SeatLocation(){}
+ public SeatLocation() {
+ }
public SeatLocation(Hashtable<String, Object> hash) {
super(hash);
@@ -15,15 +16,17 @@ public class SeatLocation extends RPCStruct {
/**
* Sets grid data for this seat location
+ *
* @param grid the grid to be set
*/
- public SeatLocation setGrid( Grid grid) {
+ public SeatLocation setGrid(Grid grid) {
setValue(KEY_GRID, grid);
return this;
}
/**
* Gets the Grid of this seat location
+ *
* @return the grid of this seat location
*/
public Grid getGrid() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
index 003e3095a..95179f78a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
@@ -12,7 +12,8 @@ public class SeatLocationCapability extends RPCStruct {
public static final String KEY_LEVELS = "levels";
public static final String KEY_SEATS = "seats";
- public SeatLocationCapability(){}
+ public SeatLocationCapability() {
+ }
public SeatLocationCapability(Hashtable<String, Object> hash) {
super(hash);
@@ -20,15 +21,17 @@ public class SeatLocationCapability extends RPCStruct {
/**
* Sets the seat rows for this capability
+ *
* @param rows rows to be set
*/
- public SeatLocationCapability setRows( Integer rows) {
+ public SeatLocationCapability setRows(Integer rows) {
setValue(KEY_ROWS, rows);
return this;
}
/**
* Gets the seat rows of this capability
+ *
* @return the seat rows
*/
public Integer getRows() {
@@ -37,15 +40,17 @@ public class SeatLocationCapability extends RPCStruct {
/**
* Sets the seat columns for this capability
+ *
* @param cols the seat columns to be set
*/
- public SeatLocationCapability setCols( Integer cols) {
+ public SeatLocationCapability setCols(Integer cols) {
setValue(KEY_COLS, cols);
return this;
}
/**
* Gets the seat columns of this capability
+ *
* @return the seat columns
*/
public Integer getCols() {
@@ -54,15 +59,17 @@ public class SeatLocationCapability extends RPCStruct {
/**
* Sets the levels for this capability
+ *
* @param levels the levels to be set
*/
- public SeatLocationCapability setLevels( Integer levels) {
+ public SeatLocationCapability setLevels(Integer levels) {
setValue(KEY_LEVELS, levels);
return this;
}
/**
* Gets the seat levels of this capability
+ *
* @return the seat levels
*/
public Integer getLevels() {
@@ -71,15 +78,17 @@ public class SeatLocationCapability extends RPCStruct {
/**
* Sets the seat locations for this capability
+ *
* @param locations the locations to be set
*/
- public SeatLocationCapability setSeats( List<SeatLocation> locations) {
+ public SeatLocationCapability setSeats(List<SeatLocation> locations) {
setValue(KEY_SEATS, locations);
return this;
}
/**
* Gets the seat locations of this capability
+ *
* @return the seat locations
* @deprecated use {@link #getSeats()} instead.
*/
@@ -91,6 +100,7 @@ public class SeatLocationCapability extends RPCStruct {
/**
* Gets the seat locations of this capability
+ *
* @return the seat locations
*/
public List<SeatLocation> getSeats() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatMemoryAction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatMemoryAction.java
index 1dc2411ba..b8f23e940 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatMemoryAction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatMemoryAction.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,91 +39,92 @@ import com.smartdevicelink.proxy.rpc.enums.SeatMemoryActionType;
import java.util.Hashtable;
public class SeatMemoryAction extends RPCStruct {
- public static final String KEY_ID = "id";
- public static final String KEY_LABEL = "label";
- public static final String KEY_ACTION = "action";
+ public static final String KEY_ID = "id";
+ public static final String KEY_LABEL = "label";
+ public static final String KEY_ACTION = "action";
- /**
- * Constructs a new SeatMemoryAction object
- */
- public SeatMemoryAction() {
- }
+ /**
+ * Constructs a new SeatMemoryAction object
+ */
+ public SeatMemoryAction() {
+ }
- /**
- * <p>Constructs a new SeatMemoryAction object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public SeatMemoryAction(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new SeatMemoryAction object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SeatMemoryAction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a newly allocated SeatMemoryAction object
- * @param id Min: 0 Max: 10
- * @param action type of SeatMemoryActionType.
- */
- public SeatMemoryAction(@NonNull Integer id, @NonNull SeatMemoryActionType action) {
- this();
- setId(id);
- setAction(action);
- }
+ /**
+ * Constructs a newly allocated SeatMemoryAction object
+ *
+ * @param id Min: 0 Max: 10
+ * @param action type of SeatMemoryActionType.
+ */
+ public SeatMemoryAction(@NonNull Integer id, @NonNull SeatMemoryActionType action) {
+ this();
+ setId(id);
+ setAction(action);
+ }
- /**
- * Sets the id portion of the SeatMemoryAction class
- *
- * @param id
- */
- public SeatMemoryAction setId(@NonNull Integer id) {
+ /**
+ * Sets the id portion of the SeatMemoryAction class
+ *
+ * @param id
+ */
+ public SeatMemoryAction setId(@NonNull Integer id) {
setValue(KEY_ID, id);
return this;
}
- /**
- * Gets the id portion of the SeatMemoryAction class
- *
- * @return Integer
- */
- public Integer getId() {
- return getInteger(KEY_ID);
- }
+ /**
+ * Gets the id portion of the SeatMemoryAction class
+ *
+ * @return Integer
+ */
+ public Integer getId() {
+ return getInteger(KEY_ID);
+ }
- /**
- * Sets the label portion of the SeatMemoryAction class
- *
- * @param label
- */
- public SeatMemoryAction setLabel( String label) {
+ /**
+ * Sets the label portion of the SeatMemoryAction class
+ *
+ * @param label
+ */
+ public SeatMemoryAction setLabel(String label) {
setValue(KEY_LABEL, label);
return this;
}
- /**
- * Gets the label portion of the SeatMemoryAction class
- *
- * @return String
- */
- public String getLabel() {
- return getString(KEY_LABEL);
- }
+ /**
+ * Gets the label portion of the SeatMemoryAction class
+ *
+ * @return String
+ */
+ public String getLabel() {
+ return getString(KEY_LABEL);
+ }
- /**
- * Sets the action portion of the SeatMemoryAction class
- *
- * @param action
- */
- public SeatMemoryAction setAction(@NonNull SeatMemoryActionType action) {
+ /**
+ * Sets the action portion of the SeatMemoryAction class
+ *
+ * @param action
+ */
+ public SeatMemoryAction setAction(@NonNull SeatMemoryActionType action) {
setValue(KEY_ACTION, action);
return this;
}
- /**
- * Gets the action portion of the SeatMemoryAction class
- *
- * @return SeatMemoryActionType.
- */
- public SeatMemoryActionType getAction() {
- return (SeatMemoryActionType) getObject(SeatMemoryActionType.class, KEY_ACTION);
- }
+ /**
+ * Gets the action portion of the SeatMemoryAction class
+ *
+ * @return SeatMemoryActionType.
+ */
+ public SeatMemoryActionType getAction() {
+ return (SeatMemoryActionType) getObject(SeatMemoryActionType.class, KEY_ACTION);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
index 34295d9c5..39911f737 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
@@ -40,49 +40,51 @@ import java.util.List;
/**
* Request to describe UI elements boundaries to a connected modules.
+ *
* @since SmartDeviceLink 4.5.0
*/
public class SendHapticData extends RPCRequest {
- public static final String KEY_HAPTIC_RECT_DATA = "hapticRectData";
+ public static final String KEY_HAPTIC_RECT_DATA = "hapticRectData";
- /**
- * Constructs a new SendHapticData object
- */
- public SendHapticData(){
- super(FunctionID.SEND_HAPTIC_DATA.toString());
- }
+ /**
+ * Constructs a new SendHapticData object
+ */
+ public SendHapticData() {
+ super(FunctionID.SEND_HAPTIC_DATA.toString());
+ }
- /**
- * <p>
- * Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI.
- * This data will be utilized by the HMI to determine how and when haptic events should occur
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public SendHapticData(Hashtable<String, Object> hash){
- super(hash);
- }
+ /**
+ * <p>
+ * Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI.
+ * This data will be utilized by the HMI to determine how and when haptic events should occur
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SendHapticData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Array of spatial data structures that represent the locations of all user controls present on the app's layout.
- * This data should be updated if/when the application presents a new screen.
+ /**
+ * Array of spatial data structures that represent the locations of all user controls present on the app's layout.
+ * This data should be updated if/when the application presents a new screen.
* When a request is sent, if successful, it will replace all spatial data previously sent through RPC.
- * If an empty array is sent, the existing spatial data will be cleared
- */
- public SendHapticData setHapticRectData( List<HapticRect> hapticRectData) {
+ * If an empty array is sent, the existing spatial data will be cleared
+ */
+ public SendHapticData setHapticRectData(List<HapticRect> hapticRectData) {
setParameters(KEY_HAPTIC_RECT_DATA, hapticRectData);
return this;
}
- /**
- * Get the haptic data
- * @return array of spatial data structures that represent the locations of all user controls present on the app's layout.
- */
- @SuppressWarnings("unchecked")
- public List<HapticRect> getHapticRectData() {
- return (List<HapticRect>) getObject(HapticRect.class, KEY_HAPTIC_RECT_DATA);
- }
+ /**
+ * Get the haptic data
+ *
+ * @return array of spatial data structures that represent the locations of all user controls present on the app's layout.
+ */
+ @SuppressWarnings("unchecked")
+ public List<HapticRect> getHapticRectData() {
+ return (List<HapticRect>) getObject(HapticRect.class, KEY_HAPTIC_RECT_DATA);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
index 6fcdd4b2c..6a7e3c60a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
@@ -42,26 +42,29 @@ import java.util.Hashtable;
/**
* Response to request that described UI elements boundaries to a connected modules.
+ *
* @since SmartDeviceLink 4.5.0
*/
public class SendHapticDataResponse extends RPCResponse {
- public SendHapticDataResponse(){
- super(FunctionID.SEND_HAPTIC_DATA.toString());
- }
+ public SendHapticDataResponse() {
+ super(FunctionID.SEND_HAPTIC_DATA.toString());
+ }
+
+ public SendHapticDataResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public SendHapticDataResponse(Hashtable<String, Object> hash){
- super(hash);
- }
- /**
- * Constructs a new SendHapticDataResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SendHapticDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SendHapticDataResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SendHapticDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java
index 02cff3664..9b549b58d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocation.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,25 +44,24 @@ import java.util.List;
* Sends a location to the head-unit to display on a map or list.
*
* @since SmartDeviceLink 3.0
- *
*/
-public class SendLocation extends RPCRequest{
+public class SendLocation extends RPCRequest {
- public static final String KEY_LAT_DEGREES = "latitudeDegrees";
- public static final String KEY_LON_DEGREES = "longitudeDegrees";
- public static final String KEY_LOCATION_NAME = "locationName";
+ public static final String KEY_LAT_DEGREES = "latitudeDegrees";
+ public static final String KEY_LON_DEGREES = "longitudeDegrees";
+ public static final String KEY_LOCATION_NAME = "locationName";
public static final String KEY_LOCATION_DESCRIPTION = "locationDescription";
- public static final String KEY_PHONE_NUMBER = "phoneNumber";
- public static final String KEY_ADDRESS_LINES = "addressLines";
- public static final String KEY_LOCATION_IMAGE = "locationImage";
- public static final String KEY_DELIVERY_MODE = "deliveryMode";
- public static final String KEY_TIME_STAMP = "timeStamp";
- public static final String KEY_ADDRESS = "address";
+ public static final String KEY_PHONE_NUMBER = "phoneNumber";
+ public static final String KEY_ADDRESS_LINES = "addressLines";
+ public static final String KEY_LOCATION_IMAGE = "locationImage";
+ public static final String KEY_DELIVERY_MODE = "deliveryMode";
+ public static final String KEY_TIME_STAMP = "timeStamp";
+ public static final String KEY_ADDRESS = "address";
/**
* Constructs a new SendLocation object
*/
- public SendLocation(){
+ public SendLocation() {
super(FunctionID.SEND_LOCATION.toString());
}
@@ -70,171 +69,182 @@ public class SendLocation extends RPCRequest{
* <p>
* Constructs a new SendLocation object indicated by the Hashtable parameter
* </p>
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @param hash The Hashtable to use
*/
- public SendLocation(Hashtable<String, Object> hash){
+ public SendLocation(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Getter for longitude of the location to send.
- *
+ *
* <p><b>IMPORTANT NOTE:</b> </p><p>A previous version of this method call returned a Float
- * value, however, it has been changed to return a Double.</p> This will compile,
+ * value, however, it has been changed to return a Double.</p> This will compile,
* but cause a ClassCastException if your value is not also a Double type.
- * @since SmartDeviceLink v4.0
- *
+ *
* @return The longitude of the location
+ * @since SmartDeviceLink v4.0
*/
- public Double getLongitudeDegrees(){
- Object value = getParameters(KEY_LON_DEGREES);
- return SdlDataTypeConverter.objectToDouble(value);
+ public Double getLongitudeDegrees() {
+ Object value = getParameters(KEY_LON_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(value);
}
/**
* Setter for longitude of the location to send.
+ *
* @param longitudeDegrees degrees of the longitudinal position
*/
- public SendLocation setLongitudeDegrees( Double longitudeDegrees) {
+ public SendLocation setLongitudeDegrees(Double longitudeDegrees) {
setParameters(KEY_LON_DEGREES, longitudeDegrees);
return this;
}
/**
* Getter for latitude of the location to send.
- *
+ *
* <p><b>IMPORTANT NOTE:</b> </p><p>A previous version of this method call returned a Float
- * value, however, it has been changed to return a Double.</p> This will compile,
+ * value, however, it has been changed to return a Double.</p> This will compile,
* but cause a ClassCastException if your value is not also a Double type.
- * @since SmartDeviceLink v4.0
- *
+ *
* @return The latitude of the location
+ * @since SmartDeviceLink v4.0
*/
- public Double getLatitudeDegrees(){
- Object value = getParameters(KEY_LAT_DEGREES);
- return SdlDataTypeConverter.objectToDouble(value);
+ public Double getLatitudeDegrees() {
+ Object value = getParameters(KEY_LAT_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(value);
}
/**
* Setter for latitude of the location to send.
+ *
* @param latitudeDegrees degrees of the latitudinal position
*/
- public SendLocation setLatitudeDegrees( Double latitudeDegrees) {
+ public SendLocation setLatitudeDegrees(Double latitudeDegrees) {
setParameters(KEY_LAT_DEGREES, latitudeDegrees);
return this;
}
/**
* Getter for name of the location to send.
+ *
* @return The name of the location
*/
- public String getLocationName(){
+ public String getLocationName() {
return getString(KEY_LOCATION_NAME);
}
/**
* Setter for name of the location to send.
+ *
* @param locationName The name of the location
*/
- public SendLocation setLocationName( String locationName) {
+ public SendLocation setLocationName(String locationName) {
setParameters(KEY_LOCATION_NAME, locationName);
return this;
}
/**
* Getter for description of the location to send.
+ *
* @return The description of the location to send
*/
- public String getLocationDescription(){
+ public String getLocationDescription() {
return getString(KEY_LOCATION_DESCRIPTION);
}
/**
* Setter for description of the location to send.
+ *
* @param locationDescription The description of the location
*/
- public SendLocation setLocationDescription( String locationDescription) {
+ public SendLocation setLocationDescription(String locationDescription) {
setParameters(KEY_LOCATION_DESCRIPTION, locationDescription);
return this;
}
/**
* Getter for phone number of the location to send.
+ *
* @return
*/
- public String getPhoneNumber(){
+ public String getPhoneNumber() {
return getString(KEY_PHONE_NUMBER);
}
/**
* Setter for phone number of the location to send.
+ *
* @param phoneNumber The phone number of the location
*/
- public SendLocation setPhoneNumber( String phoneNumber) {
+ public SendLocation setPhoneNumber(String phoneNumber) {
setParameters(KEY_PHONE_NUMBER, phoneNumber);
return this;
}
/**
* Getter for address lines of the location to send.
+ *
* @return The address lines of the location
*/
@SuppressWarnings("unchecked")
- public List<String> getAddressLines(){
+ public List<String> getAddressLines() {
return (List<String>) getObject(String.class, KEY_ADDRESS_LINES);
}
/**
* Setter for address lines of the location to send.
+ *
* @param addressLines The address lines of the location
*/
- public SendLocation setAddressLines( List<String> addressLines) {
+ public SendLocation setAddressLines(List<String> addressLines) {
setParameters(KEY_ADDRESS_LINES, addressLines);
return this;
}
/**
* Getter for image of the location to send.
+ *
* @return The image of the location to send
*/
- public Image getLocationImage(){
+ public Image getLocationImage() {
return (Image) getObject(Image.class, KEY_LOCATION_IMAGE);
}
/**
* Setter for image of the location to send.
+ *
* @param locationImage The image of the location to send
*/
- public SendLocation setLocationImage( Image locationImage) {
+ public SendLocation setLocationImage(Image locationImage) {
setParameters(KEY_LOCATION_IMAGE, locationImage);
return this;
}
- public DeliveryMode getDeliveryMode() {
+ public DeliveryMode getDeliveryMode() {
return (DeliveryMode) getObject(DeliveryMode.class, KEY_DELIVERY_MODE);
- }
+ }
- public SendLocation setDeliveryMode( DeliveryMode deliveryMode) {
+ public SendLocation setDeliveryMode(DeliveryMode deliveryMode) {
setParameters(KEY_DELIVERY_MODE, deliveryMode);
return this;
}
public DateTime getTimeStamp() {
return (DateTime) getObject(DateTime.class, KEY_TIME_STAMP);
- }
+ }
- public SendLocation setTimeStamp( DateTime timeStamp) {
+ public SendLocation setTimeStamp(DateTime timeStamp) {
setParameters(KEY_TIME_STAMP, timeStamp);
return this;
}
public OasisAddress getAddress() {
return (OasisAddress) getObject(OasisAddress.class, KEY_ADDRESS);
- }
+ }
- public SendLocation setAddress( OasisAddress address) {
+ public SendLocation setAddress(OasisAddress address) {
setParameters(KEY_ADDRESS, address);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
index ad2bca9b2..a3e4c6fa4 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,22 +41,23 @@ import java.util.Hashtable;
/**
* Add SendLocation Response is sent, when SendLocation has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
-public class SendLocationResponse extends RPCResponse{
+public class SendLocationResponse extends RPCResponse {
- public SendLocationResponse(){
+ public SendLocationResponse() {
super(FunctionID.SEND_LOCATION.toString());
}
- public SendLocationResponse(Hashtable<String, Object> hash){
+ public SendLocationResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new SendLocationResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public SendLocationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
index 084332432..4b68de127 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,9 +41,9 @@ import java.util.Hashtable;
/**
* Used to set existing local file on SDL as the app's icon. Not supported on
* first generation SDL vehicles
- *
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -63,67 +63,68 @@ import java.util.Hashtable;
* </tr>
*
* </table>
- *
- *<p><b>Response </b></p>
- *<p><b> Non-default Result Codes: </b></p>
- *<p>SUCCESS</p>
- * <p> INVALID_DATA</p>
- * <p> OUT_OF_MEMORY</p>
+ *
+ * <p><b>Response </b></p>
+ * <p><b> Non-default Result Codes: </b></p>
+ * <p>SUCCESS</p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
* <p> REJECTED</p>
*
- * @since SmartDeviceLink 2.0
* @see Image
+ * @since SmartDeviceLink 2.0
*/
public class SetAppIcon extends RPCRequest {
- public static final String KEY_SDL_FILE_NAME = "syncFileName";
+ public static final String KEY_SDL_FILE_NAME = "syncFileName";
- /**
- * Constructs a new SetAppIcon object
- */
+ /**
+ * Constructs a new SetAppIcon object
+ */
public SetAppIcon() {
super(FunctionID.SET_APP_ICON.toString());
}
- /**
- * Constructs a new SetAppIcon object indicated by the Hashtable parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new SetAppIcon object indicated by the Hashtable parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetAppIcon(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetAppIcon object
- * @param sdlFileName a String value representing a file reference name <br>
- * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
- */
- public SetAppIcon(@NonNull String sdlFileName) {
- this();
- setSdlFileName(sdlFileName);
- }
+ /**
+ * Constructs a new SetAppIcon object
+ *
+ * @param sdlFileName a String value representing a file reference name <br>
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
+ */
+ public SetAppIcon(@NonNull String sdlFileName) {
+ this();
+ setSdlFileName(sdlFileName);
+ }
- /**
- * Sets a file reference name
- *
- * @param sdlFileName
- * a String value representing a file reference name
- * <p></p>
- * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
- */
+ /**
+ * Sets a file reference name
+ *
+ * @param sdlFileName a String value representing a file reference name
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
+ */
public SetAppIcon setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
return this;
}
- /**
- * Gets a file reference name
- * @return String -a String value
- */
+ /**
+ * Gets a file reference name
+ *
+ * @return String -a String value
+ */
public String getSdlFileName() {
return getString(KEY_SDL_FILE_NAME);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
index 887d8564b..e0862d2c7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,39 @@ import java.util.Hashtable;
/**
* Set App Icon Response is sent, when SetAppIcon has been called.
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class SetAppIconResponse extends RPCResponse {
- /**
- * Constructs a new SetAppIconResponse object
- */
+ /**
+ * Constructs a new SetAppIconResponse object
+ */
public SetAppIconResponse() {
super(FunctionID.SET_APP_ICON.toString());
}
+
/**
- * Constructs a new SetAppIconResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * Constructs a new SetAppIconResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetAppIconResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ResetGlobalPropertiesResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SetAppIconResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new ResetGlobalPropertiesResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetAppIconResponse(@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/SetCloudAppProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java
index 48bc1196d..6d4a7bf30 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java
@@ -40,9 +40,9 @@ import java.util.Hashtable;
public class SetCloudAppProperties extends RPCRequest {
- public static final String KEY_PROPERTIES = "properties";
+ public static final String KEY_PROPERTIES = "properties";
- public SetCloudAppProperties(){
+ public SetCloudAppProperties() {
super(FunctionID.SET_CLOUD_APP_PROPERTIES.toString());
}
@@ -50,7 +50,7 @@ public class SetCloudAppProperties extends RPCRequest {
super(hash);
}
- public SetCloudAppProperties(@NonNull CloudAppProperties cloudAppProperties){
+ public SetCloudAppProperties(@NonNull CloudAppProperties cloudAppProperties) {
this();
setParameters(KEY_PROPERTIES, cloudAppProperties);
}
@@ -60,7 +60,7 @@ public class SetCloudAppProperties extends RPCRequest {
return this;
}
- public CloudAppProperties getProperties(){
+ public CloudAppProperties getProperties() {
return (CloudAppProperties) getObject(CloudAppProperties.class, KEY_PROPERTIES);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java
index e4851b399..2bdf1d34c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java
@@ -41,7 +41,7 @@ import java.util.Hashtable;
public class SetCloudAppPropertiesResponse extends RPCResponse {
- public SetCloudAppPropertiesResponse(){
+ public SetCloudAppPropertiesResponse() {
super(FunctionID.SET_CLOUD_APP_PROPERTIES.toString());
}
@@ -51,7 +51,8 @@ public class SetCloudAppPropertiesResponse extends RPCResponse {
/**
* Constructs a new SetCloudAppPropertiesResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public SetCloudAppPropertiesResponse(@NonNull Boolean success, @NonNull Result resultCode) {
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 1b07d047a..db27f8f35 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,8 +42,8 @@ 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
- *
- *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -81,114 +81,114 @@ import java.util.Hashtable;
* </tr>
*
* </table>
- *<p><b>Response </b></p>
+ * <p><b>Response </b></p>
*
- *<p><b> Non-default Result Codes: </b></p>
- *<p> SUCCESS </p>
- *<p> INVALID_DATA</p>
- *<p> OUT_OF_MEMORY</p>
- *<p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p><b> Non-default Result Codes: </b></p>
+ * <p> SUCCESS </p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
* <p> REJECTED</p>
+ *
* @since SmartDeviceLink 2.0
*/
public class SetDisplayLayout extends RPCRequest {
- public static final String KEY_DISPLAY_LAYOUT = "displayLayout";
- public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
- public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
- /**
- * Constructs a new SetDisplayLayout object
- */
+ public static final String KEY_DISPLAY_LAYOUT = "displayLayout";
+ public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
+ public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
+
+ /**
+ * Constructs a new SetDisplayLayout object
+ */
public SetDisplayLayout() {
super(FunctionID.SET_DISPLAY_LAYOUT.toString());
}
- /**
- * Constructs a new SetDisplayLayout object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SetDisplayLayout object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetDisplayLayout(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetDisplayLayout object
- * @param displayLayout
- * a String value representing a display layout
- */
- public SetDisplayLayout(@NonNull String displayLayout) {
- this();
- setDisplayLayout(displayLayout);
- }
+ /**
+ * Constructs a new SetDisplayLayout object
+ *
+ * @param displayLayout a String value representing a display layout
+ */
+ public SetDisplayLayout(@NonNull String displayLayout) {
+ this();
+ setDisplayLayout(displayLayout);
+ }
- /**
- * Sets a display layout. Predefined or dynamically created screen layout.
- * Currently only predefined screen layouts are defined. Predefined layouts
- * include: "ONSCREEN_PRESETS" Custom screen containing app-defined onscreen
- * presets. Currently defined for GEN2
- *
- * @param displayLayout
- * a String value representing a display layout
- */
+ /**
+ * Sets a display layout. Predefined or dynamically created screen layout.
+ * Currently only predefined screen layouts are defined. Predefined layouts
+ * include: "ONSCREEN_PRESETS" Custom screen containing app-defined onscreen
+ * presets. Currently defined for GEN2
+ *
+ * @param displayLayout a String value representing a display layout
+ */
public SetDisplayLayout setDisplayLayout(@NonNull String displayLayout) {
setParameters(KEY_DISPLAY_LAYOUT, displayLayout);
return this;
}
- /**
- * Gets a display layout.
- */
+ /**
+ * Gets a display layout.
+ */
public String getDisplayLayout() {
- return getString(KEY_DISPLAY_LAYOUT);
+ return getString(KEY_DISPLAY_LAYOUT);
}
- /**
- * Gets the color scheme that is currently used for day
- *
- * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
- * for day color scheme
- * @since SmartDeviceLink 5.0
- */
- public TemplateColorScheme getDayColorScheme(){
- return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
- }
+ /**
+ * Gets the color scheme that is currently used for day
+ *
+ * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
+ * for day color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public TemplateColorScheme getDayColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
+ }
- /**
- * Sets the color scheme that is intended to be used for day
- *
- * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
- * used for day color scheme
- * @since SmartDeviceLink 5.0
- */
- public SetDisplayLayout setDayColorScheme( TemplateColorScheme templateColorScheme) {
+ /**
+ * Sets the color scheme that is intended to be used for day
+ *
+ * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
+ * used for day color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public SetDisplayLayout setDayColorScheme(TemplateColorScheme templateColorScheme) {
setParameters(KEY_DAY_COLOR_SCHEME, templateColorScheme);
return this;
}
- /**
- * Gets the color scheme that is currently used for night
- *
- * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
- * for night color scheme
- * @since SmartDeviceLink 5.0
- */
- public TemplateColorScheme getNightColorScheme(){
- return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
- }
+ /**
+ * Gets the color scheme that is currently used for night
+ *
+ * @return TemplateColorScheme - a TemplateColorScheme object representing the colors that are used
+ * for night color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public TemplateColorScheme getNightColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
+ }
- /**
- * Sets the color scheme that is intended to be used for night
- *
- * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
- * used for night color scheme
- * @since SmartDeviceLink 5.0
- */
- public SetDisplayLayout setNightColorScheme( TemplateColorScheme templateColorScheme) {
+ /**
+ * Sets the color scheme that is intended to be used for night
+ *
+ * @param templateColorScheme a TemplateColorScheme object representing the colors that will be
+ * used for night color scheme
+ * @since SmartDeviceLink 5.0
+ */
+ public SetDisplayLayout setNightColorScheme(TemplateColorScheme templateColorScheme) {
setParameters(KEY_NIGHT_COLOR_SCHEME, templateColorScheme);
return this;
}
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 de955a5d0..82d012446 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,37 +43,37 @@ 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
*/
public class SetDisplayLayoutResponse extends RPCResponse {
- public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
- public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
public static final String KEY_PRESET_BANK_CAPABILITIES = "presetBankCapabilities";
- /**
- * Constructs a new SetDisplayLayoutResponse object
- */
+ /**
+ * Constructs a new SetDisplayLayoutResponse object
+ */
public SetDisplayLayoutResponse() {
super(FunctionID.SET_DISPLAY_LAYOUT.toString());
}
- /**
- * Constructs a new SetDisplayLayoutResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SetDisplayLayoutResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetDisplayLayoutResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new SetDisplayLayoutResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public SetDisplayLayoutResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -86,7 +86,7 @@ public class SetDisplayLayoutResponse extends RPCResponse {
return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
}
- public SetDisplayLayoutResponse setDisplayCapabilities( DisplayCapabilities displayCapabilities) {
+ public SetDisplayLayoutResponse setDisplayCapabilities(DisplayCapabilities displayCapabilities) {
setParameters(KEY_DISPLAY_CAPABILITIES, displayCapabilities);
return this;
}
@@ -96,7 +96,7 @@ public class SetDisplayLayoutResponse extends RPCResponse {
return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
}
- public SetDisplayLayoutResponse setButtonCapabilities( List<ButtonCapabilities> buttonCapabilities) {
+ public SetDisplayLayoutResponse setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setParameters(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
return this;
}
@@ -106,7 +106,7 @@ public class SetDisplayLayoutResponse extends RPCResponse {
return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
}
- public SetDisplayLayoutResponse setSoftButtonCapabilities( List<SoftButtonCapabilities> softButtonCapabilities) {
+ public SetDisplayLayoutResponse setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
setParameters(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
return this;
}
@@ -115,9 +115,9 @@ public class SetDisplayLayoutResponse extends RPCResponse {
return (PresetBankCapabilities) getObject(PresetBankCapabilities.class, KEY_PRESET_BANK_CAPABILITIES);
}
- public SetDisplayLayoutResponse setPresetBankCapabilities( PresetBankCapabilities presetBankCapabilities) {
+ public SetDisplayLayoutResponse setPresetBankCapabilities(PresetBankCapabilities presetBankCapabilities) {
setParameters(KEY_PRESET_BANK_CAPABILITIES, presetBankCapabilities);
return this;
}
-
+
}
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 e38b38e10..9941542fa 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,19 +40,19 @@ import java.util.List;
/**
* Sets value(s) for the specified global property(ies)
- *
+ *
* <p>Function Group: Base </p>
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>AudioStreamingState:</b></p>
* Any
- *
+ *
* <p><b>SystemContext:</b></p>
* Any
- *
- *
+ *
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -128,11 +128,11 @@ import java.util.List;
* </tr>
*
* </table>
- *
+ *
* <p><b>Note: </b>Your application shall send a SetGlobalProperties to establish an advanced help prompt before sending any voice commands.</p>
- *
+ *
* <p><b>Response</b></p>
- * Indicates whether the requested Global Properties were successfully set.
+ * Indicates whether the requested Global Properties were successfully set.
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
* <p>INVALID_DATA</p>
@@ -142,221 +142,227 @@ import java.util.List;
* <p>GENERIC_ERROR</p>
* <p>REJECTED</p>
* <p>DISALLOWED</p>
- * @since SmartDeviceLink 1.0
+ *
* @see ResetGlobalProperties
+ * @since SmartDeviceLink 1.0
*/
public class SetGlobalProperties extends RPCRequest {
- public static final String KEY_VR_HELP_TITLE = "vrHelpTitle";
- public static final String KEY_MENU_TITLE = "menuTitle";
- public static final String KEY_MENU_ICON = "menuIcon";
- public static final String KEY_KEYBOARD_PROPERTIES = "keyboardProperties";
- 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
- */
+ public static final String KEY_VR_HELP_TITLE = "vrHelpTitle";
+ public static final String KEY_MENU_TITLE = "menuTitle";
+ public static final String KEY_MENU_ICON = "menuIcon";
+ public static final String KEY_KEYBOARD_PROPERTIES = "keyboardProperties";
+ 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
+ */
public SetGlobalProperties() {
super(FunctionID.SET_GLOBAL_PROPERTIES.toString());
}
- /**
- * Constructs a new SetGlobalProperties object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * Constructs a new SetGlobalProperties object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetGlobalProperties(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Gets a List<TTSChunk> for Help Prompt representing Array of one or more
- * TTSChunk elements specifying the help prompt used in an interaction
- * started by PTT
- *
- * @return List<TTSChunk> -an Array of one or more TTSChunk elements
- * specifying the help prompt used in an interaction started by PTT
- */
+
+ /**
+ * Gets a List<TTSChunk> for Help Prompt representing Array of one or more
+ * TTSChunk elements specifying the help prompt used in an interaction
+ * started by PTT
+ *
+ * @return List<TTSChunk> -an Array of one or more TTSChunk elements
+ * specifying the help prompt used in an interaction started by PTT
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getHelpPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_HELP_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_HELP_PROMPT);
}
- /**
- * Sets a List<TTSChunk> for Help Prompt that Array of one or more
- * TTSChunk elements specifying the help prompt used in an interaction
- * started by PTT
- *
- * @param helpPrompt
- * a List<TTSChunk> of one or more TTSChunk elements
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Array must have at least one element</li>
- * <li>Only optional it timeoutPrompt has been specified</li>
- * </ul>
- */
- public SetGlobalProperties setHelpPrompt( List<TTSChunk> helpPrompt) {
+
+ /**
+ * Sets a List<TTSChunk> for Help Prompt that Array of one or more
+ * TTSChunk elements specifying the help prompt used in an interaction
+ * started by PTT
+ *
+ * @param helpPrompt a List<TTSChunk> of one or more TTSChunk elements
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Array must have at least one element</li>
+ * <li>Only optional it timeoutPrompt has been specified</li>
+ * </ul>
+ */
+ public SetGlobalProperties setHelpPrompt(List<TTSChunk> helpPrompt) {
setParameters(KEY_HELP_PROMPT, helpPrompt);
return this;
}
- /**
- * Gets a List<TTSChunk> for Timeout Prompt representing Array of one or
- * more TTSChunk elements specifying the help prompt used in an interaction
- * started by PTT
- *
- * @return List<TTSChunk> -an Array of one or more TTSChunk elements
- * specifying the help prompt used in an interaction started by PTT
- */
+
+ /**
+ * Gets a List<TTSChunk> for Timeout Prompt representing Array of one or
+ * more TTSChunk elements specifying the help prompt used in an interaction
+ * started by PTT
+ *
+ * @return List<TTSChunk> -an Array of one or more TTSChunk elements
+ * specifying the help prompt used in an interaction started by PTT
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getTimeoutPrompt() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TIMEOUT_PROMPT);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TIMEOUT_PROMPT);
}
- /**
- * Sets a List<TTSChunk> for Timeout Prompt representing Array of one or
- * more TTSChunk elements specifying the help prompt used in an interaction
- * started by PTT
- *
- */
- public SetGlobalProperties setTimeoutPrompt( List<TTSChunk> timeoutPrompt) {
+
+ /**
+ * Sets a List<TTSChunk> for Timeout Prompt representing Array of one or
+ * more TTSChunk elements specifying the help prompt used in an interaction
+ * started by PTT
+ */
+ public SetGlobalProperties setTimeoutPrompt(List<TTSChunk> timeoutPrompt) {
setParameters(KEY_TIMEOUT_PROMPT, timeoutPrompt);
return this;
}
- /**
- * Gets a voice recognition Help Title
- *
- * @return String - a String value representing the text, which is shown as
- * title of the VR help screen used in an interaction started by PTT
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets a voice recognition Help Title
+ *
+ * @return String - a String value representing the text, which is shown as
+ * title of the VR help screen used in an interaction started by PTT
+ * @since SmartDeviceLink 2.0
+ */
public String getVrHelpTitle() {
return getString(KEY_VR_HELP_TITLE);
}
- /**
- * Sets a voice recognition Help Title
- *
- * @param vrHelpTitle
- * a String value representing a voice recognition Help Title
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If omitted on supported displays, the default SDL help
- * title will be used</li>
- * <li>If omitted and one or more vrHelp items are provided, the
- * request will be rejected.</li>
- * <li>String Maxlength = 500</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public SetGlobalProperties setVrHelpTitle( String vrHelpTitle) {
+ /**
+ * Sets a voice recognition Help Title
+ *
+ * @param vrHelpTitle a String value representing a voice recognition Help Title
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If omitted on supported displays, the default SDL help
+ * title will be used</li>
+ * <li>If omitted and one or more vrHelp items are provided, the
+ * request will be rejected.</li>
+ * <li>String Maxlength = 500</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public SetGlobalProperties setVrHelpTitle(String vrHelpTitle) {
setParameters(KEY_VR_HELP_TITLE, vrHelpTitle);
return this;
}
- /**
- * Gets items listed in the VR help screen used in an interaction started by
- * PTT
- *
- * @return List<VrHelpItem> - a List value representing items listed in
- * the VR help screen used in an interaction started by PTT
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets items listed in the VR help screen used in an interaction started by
+ * PTT
+ *
+ * @return List<VrHelpItem> - a List value representing items listed in
+ * the VR help screen used in an interaction started by PTT
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<VrHelpItem> getVrHelp() {
- return (List<VrHelpItem>) getObject(VrHelpItem.class, KEY_VR_HELP);
+ return (List<VrHelpItem>) getObject(VrHelpItem.class, KEY_VR_HELP);
}
- /**
- * Sets the items listed in the VR help screen used in an interaction
- * started by PTT
- *
- * @param vrHelp
- * a List value representing items listed in the VR help screen
- * used in an interaction started by PTT
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If omitted on supported displays, the default SmartDeviceLink VR
- * help / What Can I Say? screen will be used</li>
- * <li>If the list of VR Help Items contains non-sequential
- * positions (e.g. [1,2,4]), the RPC will be rejected</li>
- * <li>If omitted and a vrHelpTitle is provided, the request
- * will be rejected</li>
- * <li>Array Minsize: = 1</li>
- * <li>Array Maxsize = 100</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public SetGlobalProperties setVrHelp( List<VrHelpItem> vrHelp) {
+ /**
+ * Sets the items listed in the VR help screen used in an interaction
+ * started by PTT
+ *
+ * @param vrHelp a List value representing items listed in the VR help screen
+ * used in an interaction started by PTT
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If omitted on supported displays, the default SmartDeviceLink VR
+ * help / What Can I Say? screen will be used</li>
+ * <li>If the list of VR Help Items contains non-sequential
+ * positions (e.g. [1,2,4]), the RPC will be rejected</li>
+ * <li>If omitted and a vrHelpTitle is provided, the request
+ * will be rejected</li>
+ * <li>Array Minsize: = 1</li>
+ * <li>Array Maxsize = 100</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public SetGlobalProperties setVrHelp(List<VrHelpItem> vrHelp) {
setParameters(KEY_VR_HELP, vrHelp);
return this;
}
-
+
public String getMenuTitle() {
return getString(KEY_MENU_TITLE);
}
- public SetGlobalProperties setMenuTitle( String menuTitle) {
+ public SetGlobalProperties setMenuTitle(String menuTitle) {
setParameters(KEY_MENU_TITLE, menuTitle);
return this;
}
- public SetGlobalProperties setMenuIcon( Image menuIcon) {
+ public SetGlobalProperties setMenuIcon(Image menuIcon) {
setParameters(KEY_MENU_ICON, menuIcon);
return this;
}
public Image getMenuIcon() {
- return (Image) getObject(Image.class, KEY_MENU_ICON);
+ return (Image) getObject(Image.class, KEY_MENU_ICON);
}
-
- public SetGlobalProperties setKeyboardProperties( KeyboardProperties keyboardProperties) {
+
+ public SetGlobalProperties setKeyboardProperties(KeyboardProperties keyboardProperties) {
setParameters(KEY_KEYBOARD_PROPERTIES, keyboardProperties);
return this;
}
- /**
- * Sets the user seat location
- * @param location the location to be set
- */
- public SetGlobalProperties setUserLocation( SeatLocation location) {
+ /**
+ * Sets the user seat location
+ *
+ * @param location the location to be set
+ */
+ public SetGlobalProperties setUserLocation(SeatLocation location) {
setParameters(KEY_USER_LOCATION, location);
return this;
}
- /**
- * Gets the user seat location
- * @return the user seat location
- */
- public SeatLocation getUserLocation() {
- return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION);
- }
+ /**
+ * Gets the user seat location
+ *
+ * @return the user seat location
+ */
+ public SeatLocation getUserLocation() {
+ return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION);
+ }
public KeyboardProperties getKeyboardProperties() {
- return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
+ return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
}
- /**
- * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
- * the head unit will change the display to the new layout type.
- * @param menuLayout - the menuLayout
- */
- public SetGlobalProperties setMenuLayout( MenuLayout menuLayout) {
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ *
+ * @param menuLayout - the menuLayout
+ */
+ public SetGlobalProperties setMenuLayout(MenuLayout menuLayout) {
setParameters(KEY_MENU_LAYOUT, menuLayout);
return this;
}
- /**
- * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
- * the head unit will change the display to the new layout type.
- * @return the MenuLayout
- */
- public MenuLayout getMenuLayout() {
- return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
- }
-
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ *
+ * @return the MenuLayout
+ */
+ public MenuLayout getMenuLayout() {
+ return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
+ }
+
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
index e2a24a2cd..0e89ee052 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,38 @@ import java.util.Hashtable;
/**
* Set Global Properties Response is sent, when SetGlobalProperties has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class SetGlobalPropertiesResponse extends RPCResponse {
- /**
- * Constructs a new SetGlobalPropertiesResponse object
- */
+ /**
+ * Constructs a new SetGlobalPropertiesResponse object
+ */
public SetGlobalPropertiesResponse() {
super(FunctionID.SET_GLOBAL_PROPERTIES.toString());
}
- /**
- * Constructs a new SetGlobalPropertiesResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SetGlobalPropertiesResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetGlobalPropertiesResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetGlobalPropertiesResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SetGlobalPropertiesResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SetGlobalPropertiesResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetGlobalPropertiesResponse(@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/SetInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java
index 60e792023..0ebf18399 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,7 +43,7 @@ import java.util.Hashtable;
* of a specific remote control module.
*/
public class SetInteriorVehicleData extends RPCRequest {
- public static final String KEY_MODULE_DATA = "moduleData";
+ public static final String KEY_MODULE_DATA = "moduleData";
/**
* Constructs a new SetInteriorVehicleData object
@@ -56,9 +56,7 @@ public class SetInteriorVehicleData extends RPCRequest {
* <p>Constructs a new SetInteriorVehicleData object indicated by the
* Hashtable parameter</p>
*
- *
- * @param hash
- * The Hashtable to use
+ * @param hash The Hashtable to use
*/
public SetInteriorVehicleData(Hashtable<String, Object> hash) {
super(hash);
@@ -66,6 +64,7 @@ public class SetInteriorVehicleData extends RPCRequest {
/**
* Constructs a new SetInteriorVehicleData object
+ *
* @param moduleData
*/
public SetInteriorVehicleData(@NonNull ModuleData moduleData) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
index 01ceed4ea..ef18b214c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,53 +40,52 @@ import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
public class SetInteriorVehicleDataResponse extends RPCResponse {
- public static final String KEY_MODULE_DATA = "moduleData";
+ public static final String KEY_MODULE_DATA = "moduleData";
- /**
- * Constructs a new SetInteriorVehicleDataResponse object
- */
+ /**
+ * Constructs a new SetInteriorVehicleDataResponse object
+ */
public SetInteriorVehicleDataResponse() {
super(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString());
}
- /**
- * <p>Constructs a new SetInteriorVehicleDataResponse object indicated by the
- * Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new SetInteriorVehicleDataResponse object indicated by the
+ * Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetInteriorVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetInteriorVehicleDataResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
- this();
- setResultCode(resultCode);
- setSuccess(success);
- }
+ /**
+ * Constructs a new SetInteriorVehicleDataResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
- /**
- * Gets the moduleData
- *
- * @return ModuleData
- */
- public ModuleData getModuleData() {
- return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
- }
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
- /**
- * Sets the moduleData
- *
- * @param moduleData
- */
- public SetInteriorVehicleDataResponse setModuleData( ModuleData moduleData) {
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData
+ */
+ public SetInteriorVehicleDataResponse setModuleData(ModuleData moduleData) {
setParameters(KEY_MODULE_DATA, moduleData);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
index af8ad974a..cba5d0445 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,12 +44,12 @@ import java.util.Hashtable;
/**
* Sets the media clock/timer value and the update method (e.g.count-up,
* count-down, etc.)
- *
+ *
* <p>Function Group: Base </p>
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -96,242 +96,257 @@ import java.util.Hashtable;
* </tr>
*
* </table>
- *
- *<p><b>Response </b></p>
*
- *<p><b> Non-default Result Codes: </b></p>
+ * <p><b>Response </b></p>
*
- * <p> SUCCESS </p>
- * <p> INVALID_DATA</p>
- * <p> OUT_OF_MEMORY</p>
+ * <p><b> Non-default Result Codes: </b></p>
+ *
+ * <p> SUCCESS </p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p> APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
* <p> REJECTED </p>
* <p> IGNORED </p>
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class SetMediaClockTimer extends RPCRequest {
- public static final String KEY_START_TIME = "startTime";
- public static final String KEY_END_TIME = "endTime";
- public static final String KEY_UPDATE_MODE = "updateMode";
- public static final String KEY_AUDIO_STREAMING_INDICATOR = "audioStreamingIndicator";
- /**
- * Constructs a new SetMediaClockTimer object
- */
+ public static final String KEY_START_TIME = "startTime";
+ public static final String KEY_END_TIME = "endTime";
+ public static final String KEY_UPDATE_MODE = "updateMode";
+ public static final String KEY_AUDIO_STREAMING_INDICATOR = "audioStreamingIndicator";
+
+ /**
+ * Constructs a new SetMediaClockTimer object
+ */
public SetMediaClockTimer() {
super(FunctionID.SET_MEDIA_CLOCK_TIMER.toString());
}
- /**
- * Constructs a new SetMediaClockTimer object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new SetMediaClockTimer object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetMediaClockTimer(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetMediaClockTimer object
- * @param updateMode a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME) <br>
- * <b>Notes: </b>
- * <ul>
- * <li>When updateMode is PAUSE, RESUME or CLEAR, the start time value
- * is ignored</li>
- * <li>When updateMode is RESUME, the timer resumes counting from
- * the timer's value when it was paused</li>
- * </ul>
- */
- public SetMediaClockTimer(@NonNull UpdateMode updateMode) {
- this();
- setUpdateMode(updateMode);
- }
- private SetMediaClockTimer(@NonNull UpdateMode updateMode, @Nullable StartTime startTime, @Nullable StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator){
- this();
- this.setUpdateMode(updateMode);
- if (startTime != null) {
- this.setStartTime(startTime);
- }
- if (endTime != null) {
- this.setEndTime(endTime);
- }
- if (audioStreamingIndicator != null) {
- this.setAudioStreamingIndicator(audioStreamingIndicator);
- }
- }
- /**
- * Create a media clock timer that counts up, e.g from 0:00 to 4:18.
- *
- * @param startTimeInterval The start time interval, e.g. (0) 0:00
- * @param endTimeInterval The end time interval, e.g. (258) 4:18
- * @param audioStreamingIndicator playPauseIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer countUpFromStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.COUNTUP, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
- }
- /**
- * Create a media clock timer that counts up, e.g from 0:00 to 4:18.
- *
- * @param startTime The start time interval, e.g. 0:00
- * @param endTime The end time interval, e.g. 4:18
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer countUpFromStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.COUNTUP, startTime, endTime, audioStreamingIndicator);
- }
- /**
- * Create a media clock timer that counts down, e.g. from 4:18 to 0:00
- * This will fail if endTime is greater than startTime
- *
- * @param startTimeInterval The start time interval, e.g. (258) 4:18
- * @param endTimeInterval The end time interval, e.g. (0) 0:00
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer countDownFromStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.COUNTDOWN, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
- }
- /**
- * Create a media clock timer that counts down, e.g. from 4:18 to 0:00
- * This will fail if endTime is greater than startTime
- *
- * @param startTime The start time interval, e.g. 4:18
- * @param endTime The end time interval, e.g. 0:00
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer countDownFromStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.COUNTDOWN, startTime, endTime, audioStreamingIndicator);
- }
- /**
- * Pause an existing (counting up / down) media clock timer
- *
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer pauseWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.PAUSE, null, null, audioStreamingIndicator);
- }
- /**
- * Update a pause time (or pause and update the time) on a media clock timer
- *
- * @param startTimeInterval The new start time interval
- * @param endTimeInterval The new end time interval
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer updatePauseWithNewStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.PAUSE, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
- }
- /**
- * Update a pause time (or pause and update the time) on a media clock timer
- *
- * @param startTime The new start time
- * @param endTime The new end time
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer updatePauseWithNewStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.PAUSE, startTime, endTime, audioStreamingIndicator);
- }
- /**
- * Resume a paused media clock timer. It resumes at the same time at which it was paused.
- *
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer resumeWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.RESUME, null, null, audioStreamingIndicator);
- }
- /**
- * Remove a media clock timer from the screen
- *
- * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
- * @return An object of SetMediaClockTimer
- */
- public static SetMediaClockTimer clearWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
- return new SetMediaClockTimer(UpdateMode.CLEAR, null, null, audioStreamingIndicator);
- }
- /**
- * Gets the Start Time which media clock timer is set
- *
- * @return StartTime -a StartTime object specifying hour, minute, second
- * values
- */
+
+ /**
+ * Constructs a new SetMediaClockTimer object
+ *
+ * @param updateMode a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME) <br>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>When updateMode is PAUSE, RESUME or CLEAR, the start time value
+ * is ignored</li>
+ * <li>When updateMode is RESUME, the timer resumes counting from
+ * the timer's value when it was paused</li>
+ * </ul>
+ */
+ public SetMediaClockTimer(@NonNull UpdateMode updateMode) {
+ this();
+ setUpdateMode(updateMode);
+ }
+
+ private SetMediaClockTimer(@NonNull UpdateMode updateMode, @Nullable StartTime startTime, @Nullable StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ this();
+ this.setUpdateMode(updateMode);
+ if (startTime != null) {
+ this.setStartTime(startTime);
+ }
+ if (endTime != null) {
+ this.setEndTime(endTime);
+ }
+ if (audioStreamingIndicator != null) {
+ this.setAudioStreamingIndicator(audioStreamingIndicator);
+ }
+ }
+
+ /**
+ * Create a media clock timer that counts up, e.g from 0:00 to 4:18.
+ *
+ * @param startTimeInterval The start time interval, e.g. (0) 0:00
+ * @param endTimeInterval The end time interval, e.g. (258) 4:18
+ * @param audioStreamingIndicator playPauseIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer countUpFromStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.COUNTUP, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
+ }
+
+ /**
+ * Create a media clock timer that counts up, e.g from 0:00 to 4:18.
+ *
+ * @param startTime The start time interval, e.g. 0:00
+ * @param endTime The end time interval, e.g. 4:18
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer countUpFromStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.COUNTUP, startTime, endTime, audioStreamingIndicator);
+ }
+
+ /**
+ * Create a media clock timer that counts down, e.g. from 4:18 to 0:00
+ * This will fail if endTime is greater than startTime
+ *
+ * @param startTimeInterval The start time interval, e.g. (258) 4:18
+ * @param endTimeInterval The end time interval, e.g. (0) 0:00
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer countDownFromStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.COUNTDOWN, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
+ }
+
+ /**
+ * Create a media clock timer that counts down, e.g. from 4:18 to 0:00
+ * This will fail if endTime is greater than startTime
+ *
+ * @param startTime The start time interval, e.g. 4:18
+ * @param endTime The end time interval, e.g. 0:00
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer countDownFromStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.COUNTDOWN, startTime, endTime, audioStreamingIndicator);
+ }
+
+ /**
+ * Pause an existing (counting up / down) media clock timer
+ *
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer pauseWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.PAUSE, null, null, audioStreamingIndicator);
+ }
+
+ /**
+ * Update a pause time (or pause and update the time) on a media clock timer
+ *
+ * @param startTimeInterval The new start time interval
+ * @param endTimeInterval The new end time interval
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer updatePauseWithNewStartTimeInterval(@NonNull Integer startTimeInterval, @NonNull Integer endTimeInterval, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.PAUSE, new StartTime(startTimeInterval), new StartTime(endTimeInterval), audioStreamingIndicator);
+ }
+
+ /**
+ * Update a pause time (or pause and update the time) on a media clock timer
+ *
+ * @param startTime The new start time
+ * @param endTime The new end time
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer updatePauseWithNewStartTime(@NonNull StartTime startTime, @NonNull StartTime endTime, @Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.PAUSE, startTime, endTime, audioStreamingIndicator);
+ }
+
+ /**
+ * Resume a paused media clock timer. It resumes at the same time at which it was paused.
+ *
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer resumeWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.RESUME, null, null, audioStreamingIndicator);
+ }
+
+ /**
+ * Remove a media clock timer from the screen
+ *
+ * @param audioStreamingIndicator An optional audio indicator to change the play/pause button
+ * @return An object of SetMediaClockTimer
+ */
+ public static SetMediaClockTimer clearWithPlayPauseIndicator(@Nullable AudioStreamingIndicator audioStreamingIndicator) {
+ return new SetMediaClockTimer(UpdateMode.CLEAR, null, null, audioStreamingIndicator);
+ }
+
+ /**
+ * Gets the Start Time which media clock timer is set
+ *
+ * @return StartTime -a StartTime object specifying hour, minute, second
+ * values
+ */
public StartTime getStartTime() {
- return (StartTime) getObject(StartTime.class, KEY_START_TIME);
+ return (StartTime) getObject(StartTime.class, KEY_START_TIME);
}
- /**
- * Sets a Start Time with specifying hour, minute, second values
- *
- * @param startTime
- * a startTime object with specifying hour, minute, second values
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If "updateMode" is COUNTUP or COUNTDOWN, this parameter
- * must be provided</li>
- * <li>Will be ignored for PAUSE/RESUME and CLEAR</li>
- * </ul>
- */
- public SetMediaClockTimer setStartTime( StartTime startTime) {
+
+ /**
+ * Sets a Start Time with specifying hour, minute, second values
+ *
+ * @param startTime a startTime object with specifying hour, minute, second values
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If "updateMode" is COUNTUP or COUNTDOWN, this parameter
+ * must be provided</li>
+ * <li>Will be ignored for PAUSE/RESUME and CLEAR</li>
+ * </ul>
+ */
+ public SetMediaClockTimer setStartTime(StartTime startTime) {
setParameters(KEY_START_TIME, startTime);
return this;
}
-
+
public StartTime getEndTime() {
- return (StartTime) getObject(StartTime.class, KEY_END_TIME);
+ return (StartTime) getObject(StartTime.class, KEY_END_TIME);
}
-
- public SetMediaClockTimer setEndTime( StartTime endTime) {
+
+ public SetMediaClockTimer setEndTime(StartTime endTime) {
setParameters(KEY_END_TIME, endTime);
return this;
}
-
- /**
- * Gets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME)
- *
- * @return UpdateMode -a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME)
- */
+
+ /**
+ * Gets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME)
+ *
+ * @return UpdateMode -a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME)
+ */
public UpdateMode getUpdateMode() {
- return (UpdateMode) getObject(UpdateMode.class, KEY_UPDATE_MODE);
+ return (UpdateMode) getObject(UpdateMode.class, KEY_UPDATE_MODE);
}
- /**
- * Sets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME)
- *
- * @param updateMode
- * a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME)
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>When updateMode is PAUSE, RESUME or CLEAR, the start time value
- * is ignored</li>
- * <li>When updateMode is RESUME, the timer resumes counting from
- * the timer's value when it was paused</li>
- * </ul>
- */
+
+ /**
+ * Sets the media clock/timer update mode (COUNTUP/COUNTDOWN/PAUSE/RESUME)
+ *
+ * @param updateMode a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME)
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>When updateMode is PAUSE, RESUME or CLEAR, the start time value
+ * is ignored</li>
+ * <li>When updateMode is RESUME, the timer resumes counting from
+ * the timer's value when it was paused</li>
+ * </ul>
+ */
public SetMediaClockTimer setUpdateMode(@NonNull UpdateMode updateMode) {
setParameters(KEY_UPDATE_MODE, updateMode);
return this;
}
- /**
- * Gets the playback status of a media app
- *
- * @return AudioStreamingIndicator - a Enumeration value
- */
- public AudioStreamingIndicator getAudioStreamingIndicator() {
- return (AudioStreamingIndicator) getObject(AudioStreamingIndicator.class, KEY_AUDIO_STREAMING_INDICATOR);
- }
+ /**
+ * Gets the playback status of a media app
+ *
+ * @return AudioStreamingIndicator - a Enumeration value
+ */
+ public AudioStreamingIndicator getAudioStreamingIndicator() {
+ return (AudioStreamingIndicator) getObject(AudioStreamingIndicator.class, KEY_AUDIO_STREAMING_INDICATOR);
+ }
- /**
- * Sets the playback status of a media app
- */
- public SetMediaClockTimer setAudioStreamingIndicator( AudioStreamingIndicator audioStreamingIndicator) {
+ /**
+ * Sets the playback status of a media app
+ */
+ public SetMediaClockTimer setAudioStreamingIndicator(AudioStreamingIndicator audioStreamingIndicator) {
setParameters(KEY_AUDIO_STREAMING_INDICATOR, audioStreamingIndicator);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
index e9d189350..f509228c7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.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 androidx.annotation.NonNull;
@@ -41,37 +41,38 @@ import java.util.Hashtable;
/**
* Set Media Clock Timer Response is sent, when SetMediaClockTimer has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class SetMediaClockTimerResponse extends RPCResponse {
- /**
- * Constructs a new SetMediaClockTimerResponse object
- */
+ /**
+ * Constructs a new SetMediaClockTimerResponse object
+ */
public SetMediaClockTimerResponse() {
super(FunctionID.SET_MEDIA_CLOCK_TIMER.toString());
}
- /**
- * Constructs a new SetMediaClockTimerResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SetMediaClockTimerResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SetMediaClockTimerResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SetMediaClockTimerResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SetMediaClockTimerResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+
+ /**
+ * Constructs a new SetMediaClockTimerResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetMediaClockTimerResponse(@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/Show.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
index f49b3ec0e..e11ac0009 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -53,9 +53,9 @@ import java.util.List;
* The Show operation cannot be used to create an animated scrolling screen. To
* avoid distracting the driver, Show commands cannot be issued more than once
* every 4 seconds. Requests made more frequently than this will be rejected
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -172,501 +172,502 @@ import java.util.List;
* </tr>
*
* </table>
- *<p><b>Response </b></p>
+ * <p><b>Response </b></p>
*
- *<p><b> Non-default Result Codes: </b></p>
- * <p>SUCCESS </p>
- * <p>INVALID_DATA</p>
- * <p>OUT_OF_MEMORY</p>
+ * <p><b> Non-default Result Codes: </b></p>
+ * <p>SUCCESS </p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
* <p> TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
* <p> GENERIC_ERROR</p>
* <p> REJECTED</p>
* <p> DISALLOWED</p>
- * <p> UNSUPPORTED_RESOURCE </p>
+ * <p> UNSUPPORTED_RESOURCE </p>
* <p>ABORTED</p>
- *
- * @since SmartDeviceLink 1.0
+ *
* @see Alert
* @see SetMediaClockTimer
+ * @since SmartDeviceLink 1.0
*/
public class Show extends RPCRequest {
- public static final String KEY_GRAPHIC = "graphic";
- public static final String KEY_CUSTOM_PRESETS = "customPresets";
- public static final String KEY_MAIN_FIELD_1 = "mainField1";
- public static final String KEY_MAIN_FIELD_2 = "mainField2";
- public static final String KEY_MAIN_FIELD_3 = "mainField3";
- public static final String KEY_MAIN_FIELD_4 = "mainField4";
- public static final String KEY_STATUS_BAR = "statusBar";
- @Deprecated public static final String KEY_MEDIA_CLOCK = "mediaClock";
- public static final String KEY_ALIGNMENT = "alignment";
- public static final String KEY_MEDIA_TRACK = "mediaTrack";
- 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";
-
- /**
- * Constructs a new Show object
- */
- public Show() {
+ public static final String KEY_GRAPHIC = "graphic";
+ public static final String KEY_CUSTOM_PRESETS = "customPresets";
+ public static final String KEY_MAIN_FIELD_1 = "mainField1";
+ public static final String KEY_MAIN_FIELD_2 = "mainField2";
+ public static final String KEY_MAIN_FIELD_3 = "mainField3";
+ public static final String KEY_MAIN_FIELD_4 = "mainField4";
+ public static final String KEY_STATUS_BAR = "statusBar";
+ @Deprecated
+ public static final String KEY_MEDIA_CLOCK = "mediaClock";
+ public static final String KEY_ALIGNMENT = "alignment";
+ public static final String KEY_MEDIA_TRACK = "mediaTrack";
+ 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";
+
+ /**
+ * Constructs a new Show object
+ */
+ public Show() {
super(FunctionID.SHOW.toString());
}
- /**
- * Constructs a new Show object indicated by the Hashtable parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * Constructs a new Show object indicated by the Hashtable parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public Show(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Gets the text displayed in a single-line display, or in the upper display
- * line in a two-line display
- *
- * @return String -a String value representing the text displayed in a
- * single-line display, or in the upper display line in a two-line
- * display
- */
+
+ /**
+ * Gets the text displayed in a single-line display, or in the upper display
+ * line in a two-line display
+ *
+ * @return String -a String value representing the text displayed in a
+ * single-line display, or in the upper display line in a two-line
+ * display
+ */
public String getMainField1() {
return getString(KEY_MAIN_FIELD_1);
}
- /**
- * Sets the text displayed in a single-line display, or in the upper display
- * line in a two-line display
- *
- * @param mainField1
- * the String value representing the text displayed in a
- * single-line display, or in the upper display line in a
- * two-line display
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If this parameter is omitted, the text of mainField1 does
- * not change</li>
- * <li>If this parameter is an empty string, the field will be
- * cleared</li>
- * </ul>
- */
- public Show setMainField1( String mainField1) {
+
+ /**
+ * Sets the text displayed in a single-line display, or in the upper display
+ * line in a two-line display
+ *
+ * @param mainField1 the String value representing the text displayed in a
+ * single-line display, or in the upper display line in a
+ * two-line display
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If this parameter is omitted, the text of mainField1 does
+ * not change</li>
+ * <li>If this parameter is an empty string, the field will be
+ * cleared</li>
+ * </ul>
+ */
+ public Show setMainField1(String mainField1) {
setParameters(KEY_MAIN_FIELD_1, mainField1);
return this;
}
- /**
- * Gets the text displayed on the second display line of a two-line display
- *
- * @return String -a String value representing the text displayed on the
- * second display line of a two-line display
- */
+
+ /**
+ * Gets the text displayed on the second display line of a two-line display
+ *
+ * @return String -a String value representing the text displayed on the
+ * second display line of a two-line display
+ */
public String getMainField2() {
return getString(KEY_MAIN_FIELD_2);
}
- /**
- * Sets the text displayed on the second display line of a two-line display
- *
- * @param mainField2
- * the String value representing the text displayed on the second
- * display line of a two-line display
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If this parameter is omitted, the text of mainField2 does
- * not change</li>
- * <li>If this parameter is an empty string, the field will be
- * cleared</li>
- * <li>If provided and the display is a single-line display, the
- * parameter is ignored</li>
- * <li>Maxlength = 500</li>
- * </ul>
- */
- public Show setMainField2( String mainField2) {
+
+ /**
+ * Sets the text displayed on the second display line of a two-line display
+ *
+ * @param mainField2 the String value representing the text displayed on the second
+ * display line of a two-line display
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If this parameter is omitted, the text of mainField2 does
+ * not change</li>
+ * <li>If this parameter is an empty string, the field will be
+ * cleared</li>
+ * <li>If provided and the display is a single-line display, the
+ * parameter is ignored</li>
+ * <li>Maxlength = 500</li>
+ * </ul>
+ */
+ public Show setMainField2(String mainField2) {
setParameters(KEY_MAIN_FIELD_2, mainField2);
return this;
}
- /**
- * Gets the text displayed on the first display line of the second page
- *
- * @return String -a String value representing the text displayed on the
- * first display line of the second page
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets the text displayed on the first display line of the second page
+ *
+ * @return String -a String value representing the text displayed on the
+ * first display line of the second page
+ * @since SmartDeviceLink 2.0
+ */
public String getMainField3() {
return getString(KEY_MAIN_FIELD_3);
}
- /**
- * Sets the text displayed on the first display line of the second page
- *
- * @param mainField3
- * the String value representing the text displayed on the first
- * display line of the second page
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If this parameter is omitted, the text of mainField3 does
- * not change</li>
- * <li>If this parameter is an empty string, the field will be
- * cleared</li>
- * <li>If provided and the display is a single-line display, the
- * parameter is ignored</li>
- * <li>Maxlength = 500</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public Show setMainField3( String mainField3) {
+ /**
+ * Sets the text displayed on the first display line of the second page
+ *
+ * @param mainField3 the String value representing the text displayed on the first
+ * display line of the second page
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If this parameter is omitted, the text of mainField3 does
+ * not change</li>
+ * <li>If this parameter is an empty string, the field will be
+ * cleared</li>
+ * <li>If provided and the display is a single-line display, the
+ * parameter is ignored</li>
+ * <li>Maxlength = 500</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Show setMainField3(String mainField3) {
setParameters(KEY_MAIN_FIELD_3, mainField3);
return this;
}
- /**
- * Gets the text displayed on the second display line of the second page
- *
- * @return String -a String value representing the text displayed on the
- * first display line of the second page
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets the text displayed on the second display line of the second page
+ *
+ * @return String -a String value representing the text displayed on the
+ * first display line of the second page
+ * @since SmartDeviceLink 2.0
+ */
public String getMainField4() {
return getString(KEY_MAIN_FIELD_4);
}
- /**
- * Sets the text displayed on the second display line of the second page
- *
- * @param mainField4
- * the String value representing the text displayed on the second
- * display line of the second page
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If this parameter is omitted, the text of mainField4 does
- * not change</li>
- * <li>If this parameter is an empty string, the field will be
- * cleared</li>
- * <li>If provided and the display is a single-line display, the
- * parameter is ignored</li>
- * <li>Maxlength = 500</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public Show setMainField4( String mainField4) {
+ /**
+ * Sets the text displayed on the second display line of the second page
+ *
+ * @param mainField4 the String value representing the text displayed on the second
+ * display line of the second page
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If this parameter is omitted, the text of mainField4 does
+ * not change</li>
+ * <li>If this parameter is an empty string, the field will be
+ * cleared</li>
+ * <li>If provided and the display is a single-line display, the
+ * parameter is ignored</li>
+ * <li>Maxlength = 500</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Show setMainField4(String mainField4) {
setParameters(KEY_MAIN_FIELD_4, mainField4);
return this;
}
- /**
- * Gets the alignment that Specifies how mainField1 and mainField2 text
- * should be aligned on display
- *
- * @return TextAlignment -an Enumeration value
- */
+
+ /**
+ * Gets the alignment that Specifies how mainField1 and mainField2 text
+ * should be aligned on display
+ *
+ * @return TextAlignment -an Enumeration value
+ */
public TextAlignment getAlignment() {
- return (TextAlignment) getObject(TextAlignment.class, KEY_ALIGNMENT);
- }
- /**
- * Sets the alignment that Specifies how mainField1 and mainField2 text
- * should be aligned on display
- *
- * @param alignment
- * an Enumeration value
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Applies only to mainField1 and mainField2 provided on this
- * call, not to what is already showing in display</li>
- * <li>If this parameter is omitted, text in both mainField1 and
- * mainField2 will be centered</li>
- * <li>Has no effect with navigation display</li>
- * </ul>
- */
- public Show setAlignment( TextAlignment alignment) {
+ return (TextAlignment) getObject(TextAlignment.class, KEY_ALIGNMENT);
+ }
+
+ /**
+ * Sets the alignment that Specifies how mainField1 and mainField2 text
+ * should be aligned on display
+ *
+ * @param alignment an Enumeration value
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Applies only to mainField1 and mainField2 provided on this
+ * call, not to what is already showing in display</li>
+ * <li>If this parameter is omitted, text in both mainField1 and
+ * mainField2 will be centered</li>
+ * <li>Has no effect with navigation display</li>
+ * </ul>
+ */
+ public Show setAlignment(TextAlignment alignment) {
setParameters(KEY_ALIGNMENT, alignment);
return this;
}
- /**
- * Gets text in the Status Bar
- *
- * @return String -the value in the Status Bar
- */
+
+ /**
+ * Gets text in the Status Bar
+ *
+ * @return String -the value in the Status Bar
+ */
public String getStatusBar() {
return getString(KEY_STATUS_BAR);
}
- /**
- * Sets text in the Status Bar
- *
- * @param statusBar
- * a String representing the text you want to add in the Status
- * Bar
- * <p></p>
- * <b>Notes: </b><i>The status bar only exists on navigation
- * displays</i>
- * <ul>
- * <li>If this parameter is omitted, the status bar text will
- * remain unchanged</li>
- * <li>If this parameter is an empty string, the field will be
- * cleared</li>
- * <li>If provided and the display has no status bar, this
- * parameter is ignored</li>
- * </ul>
- */
- public Show setStatusBar( String statusBar) {
+
+ /**
+ * Sets text in the Status Bar
+ *
+ * @param statusBar a String representing the text you want to add in the Status
+ * Bar
+ * <p></p>
+ * <b>Notes: </b><i>The status bar only exists on navigation
+ * displays</i>
+ * <ul>
+ * <li>If this parameter is omitted, the status bar text will
+ * remain unchanged</li>
+ * <li>If this parameter is an empty string, the field will be
+ * cleared</li>
+ * <li>If provided and the display has no status bar, this
+ * parameter is ignored</li>
+ * </ul>
+ */
+ public Show setStatusBar(String statusBar) {
setParameters(KEY_STATUS_BAR, statusBar);
return this;
}
- /**
- * Gets the String value of the MediaClock
- *
- * @return String -a String value of the MediaClock
- */
- @Deprecated
+
+ /**
+ * Gets the String value of the MediaClock
+ *
+ * @return String -a String value of the MediaClock
+ */
+ @Deprecated
public String getMediaClock() {
return getString(KEY_MEDIA_CLOCK);
}
- /**
- * Sets the value for the MediaClock field using a format described in the
- * MediaClockFormat enumeration
- *
- * @param mediaClock
- * a String value for the MediaClock
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>Must be properly formatted as described in the
- * MediaClockFormat enumeration</li>
- * <li>If a value of five spaces is provided, this will clear
- * that field on the display (i.e. the media clock timer field
- * will not display anything)</li>
- * </ul>
- */
- @Deprecated
- public Show setMediaClock( String mediaClock) {
+
+ /**
+ * Sets the value for the MediaClock field using a format described in the
+ * MediaClockFormat enumeration
+ *
+ * @param mediaClock a String value for the MediaClock
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>Must be properly formatted as described in the
+ * MediaClockFormat enumeration</li>
+ * <li>If a value of five spaces is provided, this will clear
+ * that field on the display (i.e. the media clock timer field
+ * will not display anything)</li>
+ * </ul>
+ */
+ @Deprecated
+ public Show setMediaClock(String mediaClock) {
setParameters(KEY_MEDIA_CLOCK, mediaClock);
return this;
}
- /**
- * Gets the text in the track field
- *
- * @return String -a String displayed in the track field
- */
+
+ /**
+ * Gets the text in the track field
+ *
+ * @return String -a String displayed in the track field
+ */
public String getMediaTrack() {
return getString(KEY_MEDIA_TRACK);
}
- /**
- * Sets the text in the track field
- *
- * @param mediaTrack
- * a String value displayed in the track field
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If parameter is omitted, the track field remains unchanged</li>
- * <li>If an empty string is provided, the field will be cleared</li>
- * <li>This field is only valid for media applications on navigation displays</li>
- * </ul>
- */
- public Show setMediaTrack( String mediaTrack) {
+
+ /**
+ * Sets the text in the track field
+ *
+ * @param mediaTrack a String value displayed in the track field
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If parameter is omitted, the track field remains unchanged</li>
+ * <li>If an empty string is provided, the field will be cleared</li>
+ * <li>This field is only valid for media applications on navigation displays</li>
+ * </ul>
+ */
+ public Show setMediaTrack(String mediaTrack) {
setParameters(KEY_MEDIA_TRACK, mediaTrack);
return this;
}
- /**
- * Sets an image to be shown on supported displays
- *
- * @param graphic
- * the value representing the image shown on supported displays
- * <p></p>
- * <b>Notes: </b>If omitted on supported displays, the displayed
- * graphic shall not change
- * @since SmartDeviceLink 2.0
- */
- public Show setGraphic( Image graphic) {
+ /**
+ * Sets an image to be shown on supported displays
+ *
+ * @param graphic the value representing the image shown on supported displays
+ * <p></p>
+ * <b>Notes: </b>If omitted on supported displays, the displayed
+ * graphic shall not change
+ * @since SmartDeviceLink 2.0
+ */
+ public Show setGraphic(Image graphic) {
setParameters(KEY_GRAPHIC, graphic);
return this;
}
- /**
- * Gets an image to be shown on supported displays
- *
- * @return Image -the value representing the image shown on supported
- * displays
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets an image to be shown on supported displays
+ *
+ * @return Image -the value representing the image shown on supported
+ * displays
+ * @since SmartDeviceLink 2.0
+ */
public Image getGraphic() {
- return (Image) getObject(Image.class, KEY_GRAPHIC);
+ return (Image) getObject(Image.class, KEY_GRAPHIC);
}
-
- public Show setSecondaryGraphic( Image secondaryGraphic) {
+
+ public Show setSecondaryGraphic(Image secondaryGraphic) {
setParameters(KEY_SECONDARY_GRAPHIC, secondaryGraphic);
return this;
}
public Image getSecondaryGraphic() {
- return (Image) getObject(Image.class, KEY_SECONDARY_GRAPHIC);
- }
-
-
- /**
- * Gets the Soft buttons defined by the App
- *
- * @return List<SoftButton> -a List value representing the Soft buttons
- * defined by the App
- * @since SmartDeviceLink 2.0
- */
+ return (Image) getObject(Image.class, KEY_SECONDARY_GRAPHIC);
+ }
+
+
+ /**
+ * Gets the Soft buttons defined by the App
+ *
+ * @return List<SoftButton> -a List value representing the Soft buttons
+ * defined by the App
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<SoftButton> getSoftButtons() {
- return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
- }
-
- /**
- * Sets the the Soft buttons defined by the App
- *
- * @param softButtons
- * a List value representing the Soft buttons defined by the
- * App
- * <p></p>
- * <b>Notes: </b>
- * <ul>
- * <li>If omitted on supported displays, the currently displayed
- * SoftButton values will not change</li>
- * <li>Array Minsize: 0</li>
- * <li>Array Maxsize: 8</li>
- * </ul>
- *
- * @since SmartDeviceLink 2.0
- */
- public Show setSoftButtons( List<SoftButton> softButtons) {
+ return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
+ }
+
+ /**
+ * Sets the the Soft buttons defined by the App
+ *
+ * @param softButtons a List value representing the Soft buttons defined by the
+ * App
+ * <p></p>
+ * <b>Notes: </b>
+ * <ul>
+ * <li>If omitted on supported displays, the currently displayed
+ * SoftButton values will not change</li>
+ * <li>Array Minsize: 0</li>
+ * <li>Array Maxsize: 8</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Show setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
- /**
- * Gets the Custom Presets defined by the App
- *
- * @return List<String> - a List value representing the Custom presets
- * defined by the App
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * Gets the Custom Presets defined by the App
+ *
+ * @return List<String> - a List value representing the Custom presets
+ * defined by the App
+ * @since SmartDeviceLink 2.0
+ */
@SuppressWarnings("unchecked")
public List<String> getCustomPresets() {
- return (List<String>) getObject(String.class, KEY_CUSTOM_PRESETS);
- }
-
- /**
- * Sets the Custom Presets defined by the App
- *
- * @param customPresets
- * a List value representing the Custom Presets defined by the
- * App
- * <p></p>
- * <ul>
- * <li>If omitted on supported displays, the presets will be shown as not defined</li>
- * <li>Array Minsize: 0</li>
- * <li>Array Maxsize: 6</li>
- * </ul>
- * @since SmartDeviceLink 2.0
- */
- public Show setCustomPresets( List<String> customPresets) {
+ return (List<String>) getObject(String.class, KEY_CUSTOM_PRESETS);
+ }
+
+ /**
+ * Sets the Custom Presets defined by the App
+ *
+ * @param customPresets a List value representing the Custom Presets defined by the
+ * App
+ * <p></p>
+ * <ul>
+ * <li>If omitted on supported displays, the presets will be shown as not defined</li>
+ * <li>Array Minsize: 0</li>
+ * <li>Array Maxsize: 6</li>
+ * </ul>
+ * @since SmartDeviceLink 2.0
+ */
+ public Show setCustomPresets(List<String> customPresets) {
setParameters(KEY_CUSTOM_PRESETS, customPresets);
return this;
}
- /**
- * Sets text field metadata defined by the App
- *
- * @param metadataTags
- * A Struct containing metadata pertaining to the main text fields
- * <p></p>
- * <ul>
- * @since SmartDeviceLink 4.5.0
- */
- public Show setMetadataTags( MetadataTags metadataTags) {
+ /**
+ * Sets text field metadata defined by the App
+ *
+ * @param metadataTags A Struct containing metadata pertaining to the main text fields
+ * <p></p>
+ * <ul>
+ * @since SmartDeviceLink 4.5.0
+ */
+ public Show setMetadataTags(MetadataTags metadataTags) {
setParameters(KEY_METADATA_TAGS, metadataTags);
return this;
}
- /**
- * Gets text field metadata defined by the App
- *
- * @return metadataTags - App defined metadata information. See MetadataTags. Uses mainField1, mainField2, mainField3, mainField4.
- * If omitted on supported displays, the currently set metadata tags will not change.
- * If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.
- * @since SmartDeviceLink 4.5.0
- */
- public MetadataTags getMetadataTags() {
- return (MetadataTags) getObject(MetadataTags.class, KEY_METADATA_TAGS);
- }
-
- /**
- * 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 Show setWindowID( Integer windowID) {
+ /**
+ * Gets text field metadata defined by the App
+ *
+ * @return metadataTags - App defined metadata information. See MetadataTags. Uses mainField1, mainField2, mainField3, mainField4.
+ * If omitted on supported displays, the currently set metadata tags will not change.
+ * If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.
+ * @since SmartDeviceLink 4.5.0
+ */
+ public MetadataTags getMetadataTags() {
+ return (MetadataTags) getObject(MetadataTags.class, KEY_METADATA_TAGS);
+ }
+
+ /**
+ * 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 Show setWindowID(Integer windowID) {
setParameters(KEY_WINDOW_ID, windowID);
return this;
}
- /**
- * 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
- */
- 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 Show setTemplateConfiguration( TemplateConfiguration templateConfiguration) {
+ /**
+ * 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
+ */
+ 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 Show setTemplateConfiguration(TemplateConfiguration templateConfiguration) {
setParameters(KEY_TEMPLATE_CONFIGURATION, templateConfiguration);
return this;
}
-
- /**
- * 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
- * <p></p>
- * <ul>
- * <li>Minlength: 0</li>
- * <li>Maxlength: 100</li>
- * </ul>
- * @since SmartDeviceLink 6.0.0
- */
- public Show setTemplateTitle( String templateTitle) {
+
+ /**
+ * 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
+ * <p></p>
+ * <ul>
+ * <li>Minlength: 0</li>
+ * <li>Maxlength: 100</li>
+ * </ul>
+ * @since SmartDeviceLink 6.0.0
+ */
+ public Show setTemplateTitle(String templateTitle) {
setParameters(KEY_TEMPLATE_TITLE, templateTitle);
return this;
}
- /**
- * Gets 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.
- * @return templateTitle - String value that represents the title of the new template that will be displayed
- * @since SmartDeviceLink 6.0.0
- */
- public String getTemplateTitle(){
- return getString(KEY_TEMPLATE_TITLE);
- }
+ /**
+ * Gets 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.
+ *
+ * @return templateTitle - String value that represents the title of the new template that will be displayed
+ * @since SmartDeviceLink 6.0.0
+ */
+ public String getTemplateTitle() {
+ return getString(KEY_TEMPLATE_TITLE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
index 6531427d8..bd7d008bb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
@@ -42,45 +42,47 @@ import java.util.Hashtable;
public class ShowAppMenu extends RPCRequest {
- public static final String KEY_MENU_ID = "menuID";
+ 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
+ */
+ 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);
- }
+ /**
+ * 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
+ // 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 ShowAppMenu setMenuID( Integer 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`.
+ *
+ * @param menuID - The SubMenu ID to open
+ */
+ public ShowAppMenu setMenuID(Integer menuID) {
setParameters(KEY_MENU_ID, menuID);
return this;
}
- /**
- * 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);
- }
+ /**
+ * 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
index 749daaf13..7fe0220f5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
@@ -47,30 +47,31 @@ 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
+ */
+ 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);
- }
+ /**
+ * Constructs a new ShowAppMenuResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenuResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a new ShowAppMenuResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public ShowAppMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new ShowAppMenuResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ShowAppMenuResponse(@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/ShowConstantTbt.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
index b6c050739..d0bbd0222 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,217 +40,207 @@ import java.util.List;
/**
* <p>This RPC is used to update the user with navigation information for the constantly shown screen (base screen), but
* also for the alert type screen</p>
- *
+ *
* <p>Function Group: Navigation</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
- *
- * @since SmartDeviceLink 2.0
+ *
* @see AlertManeuver
* @see UpdateTurnList
+ * @since SmartDeviceLink 2.0
*/
-public class ShowConstantTbt extends RPCRequest{
+public class ShowConstantTbt extends RPCRequest {
- public static final String KEY_TEXT1 = "navigationText1";
- public static final String KEY_TEXT2 = "navigationText2";
- public static final String KEY_ETA = "eta";
- public static final String KEY_TOTAL_DISTANCE = "totalDistance";
- public static final String KEY_MANEUVER_DISTANCE = "distanceToManeuver";
+ public static final String KEY_TEXT1 = "navigationText1";
+ public static final String KEY_TEXT2 = "navigationText2";
+ public static final String KEY_ETA = "eta";
+ public static final String KEY_TOTAL_DISTANCE = "totalDistance";
+ public static final String KEY_MANEUVER_DISTANCE = "distanceToManeuver";
public static final String KEY_MANEUVER_DISTANCE_SCALE = "distanceToManeuverScale";
- public static final String KEY_MANEUVER_IMAGE = "turnIcon";
- public static final String KEY_NEXT_MANEUVER_IMAGE = "nextTurnIcon";
- public static final String KEY_MANEUVER_COMPLETE = "maneuverComplete";
- public static final String KEY_SOFT_BUTTONS = "softButtons";
- public static final String KEY_TIME_TO_DESTINATION = "timeToDestination";
+ public static final String KEY_MANEUVER_IMAGE = "turnIcon";
+ public static final String KEY_NEXT_MANEUVER_IMAGE = "nextTurnIcon";
+ public static final String KEY_MANEUVER_COMPLETE = "maneuverComplete";
+ public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_TIME_TO_DESTINATION = "timeToDestination";
/**
* Constructs a new ShowConstantTbt object
*/
- public ShowConstantTbt(){
+ public ShowConstantTbt() {
super(FunctionID.SHOW_CONSTANT_TBT.toString());
}
/**
* Constructs a new ShowConstantTbt object indicated by the Hashtable parameter
* <p>
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @param hash The Hashtable to use
*/
- public ShowConstantTbt(Hashtable<String, Object> hash){
+ public ShowConstantTbt(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Sets a text for navigation text field 1
*
- * @param navigationText1
- * a String value representing a text for navigation text field 1
- * <p></p>
- * <b>Notes: </b>Maxlength=500
+ * @param navigationText1 a String value representing a text for navigation text field 1
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
*/
- public ShowConstantTbt setNavigationText1( String navigationText1) {
+ public ShowConstantTbt setNavigationText1(String navigationText1) {
setParameters(KEY_TEXT1, navigationText1);
return this;
}
/**
* Gets a text for navigation text field 1
- *
+ *
* @return String -a String value representing a text for navigation text field 1
*/
- public String getNavigationText1(){
+ public String getNavigationText1() {
return getString(KEY_TEXT1);
}
/**
* Sets a text for navigation text field 2
*
- * @param navigationText2
- * a String value representing a text for navigation text field 2
- * <p></p>
- * <b>Notes: </b>Maxlength=500
+ * @param navigationText2 a String value representing a text for navigation text field 2
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
*/
- public ShowConstantTbt setNavigationText2( String navigationText2) {
+ public ShowConstantTbt setNavigationText2(String navigationText2) {
setParameters(KEY_TEXT2, navigationText2);
return this;
}
/**
* Gets a text for navigation text field 2
- *
+ *
* @return String -a String value representing a text for navigation text field 2
*/
- public String getNavigationText2(){
+ public String getNavigationText2() {
return getString(KEY_TEXT2);
}
/**
* Sets a text field for estimated time of arrival
*
- * @param eta
- * a String value representing a text field for estimated time of arrival
+ * @param eta a String value representing a text field for estimated time of arrival
* <p></p>
* <b>Notes: </b>Maxlength=500
*/
- public ShowConstantTbt setEta( String eta) {
+ public ShowConstantTbt setEta(String eta) {
setParameters(KEY_ETA, eta);
return this;
}
/**
* Gets a text field for estimated time of arrival
- *
+ *
* @return String -a String value representing a text field for estimated time of arrival
*/
- public String getEta(){
+ public String getEta() {
return getString(KEY_ETA);
}
/**
* Sets a text field for total distance
*
- * @param totalDistance
- * a String value representing a text field for total distance
- * <p></p>
- * <b>Notes: </b>Maxlength=500
+ * @param totalDistance a String value representing a text field for total distance
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
*/
- public ShowConstantTbt setTotalDistance( String totalDistance) {
+ public ShowConstantTbt setTotalDistance(String totalDistance) {
setParameters(KEY_TOTAL_DISTANCE, totalDistance);
return this;
}
/**
* Gets a text field for total distance
- *
+ *
* @return String -a String value representing a text field for total distance
*/
- public String getTotalDistance(){
+ public String getTotalDistance() {
return getString(KEY_TOTAL_DISTANCE);
}
/**
* Sets an Image for turn icon
*
- * @param turnIcon
- * an Image value
+ * @param turnIcon an Image value
*/
- public ShowConstantTbt setTurnIcon( Image turnIcon) {
+ public ShowConstantTbt setTurnIcon(Image turnIcon) {
setParameters(KEY_MANEUVER_IMAGE, turnIcon);
return this;
}
/**
* Gets an Image for turn icon
- *
+ *
* @return Image -an Image value representing an Image for turnicon
*/
- public Image getTurnIcon(){
+ public Image getTurnIcon() {
return (Image) getObject(Image.class, KEY_MANEUVER_IMAGE);
}
/**
* Sets an Image for nextTurnIcon
*
- * @param nextTurnIcon
- * an Image value
+ * @param nextTurnIcon an Image value
*/
- public ShowConstantTbt setNextTurnIcon( Image nextTurnIcon) {
+ public ShowConstantTbt setNextTurnIcon(Image nextTurnIcon) {
setParameters(KEY_NEXT_MANEUVER_IMAGE, nextTurnIcon);
return this;
}
/**
* Gets an Image for nextTurnIcon
- *
+ *
* @return Image -an Image value representing an Image for nextTurnIcon
*/
- public Image getNextTurnIcon(){
+ public Image getNextTurnIcon() {
return (Image) getObject(Image.class, KEY_NEXT_MANEUVER_IMAGE);
}
/**
* Sets a Fraction of distance till next maneuver
*
- * @param distanceToManeuver
- * a Double value representing a Fraction of distance till next maneuver
- * <p></p>
- * <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
+ * @param distanceToManeuver a Double value representing a Fraction of distance till next maneuver
+ * <p></p>
+ * <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
*/
- public ShowConstantTbt setDistanceToManeuver( Double distanceToManeuver) {
+ public ShowConstantTbt setDistanceToManeuver(Double distanceToManeuver) {
setParameters(KEY_MANEUVER_DISTANCE, distanceToManeuver);
return this;
}
/**
* Gets a Fraction of distance till next maneuver
- *
+ *
* @return Double -a Double value representing a Fraction of distance till next maneuver
*/
- public Double getDistanceToManeuver(){
+ public Double getDistanceToManeuver() {
return getDouble(KEY_MANEUVER_DISTANCE);
}
/**
* Sets a Distance till next maneuver (starting from) from previous maneuver
*
- * @param distanceToManeuverScale
- * a Double value representing a Distance till next maneuver (starting from) from previous maneuver
- * <p></p>
- * <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
+ * @param distanceToManeuverScale a Double value representing a Distance till next maneuver (starting from) from previous maneuver
+ * <p></p>
+ * <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
*/
- public ShowConstantTbt setDistanceToManeuverScale( Double distanceToManeuverScale) {
+ public ShowConstantTbt setDistanceToManeuverScale(Double distanceToManeuverScale) {
setParameters(KEY_MANEUVER_DISTANCE_SCALE, distanceToManeuverScale);
return this;
}
/**
* Gets a Distance till next maneuver (starting from) from previous maneuver
- *
+ *
* @return Double -a Double value representing a Distance till next maneuver (starting from) from previous maneuver
*/
- public Double getDistanceToManeuverScale(){
+ public Double getDistanceToManeuverScale() {
return getDouble(KEY_MANEUVER_DISTANCE_SCALE);
}
@@ -259,21 +249,19 @@ public class ShowConstantTbt extends RPCRequest{
* must send this value set to TRUE in order to clear the AlertManeuver overlay
* If omitted the value will be assumed as FALSE</p>
*
- *
- * @param maneuverComplete
- * a Boolean value
+ * @param maneuverComplete a Boolean value
*/
- public ShowConstantTbt setManeuverComplete( Boolean maneuverComplete) {
+ public ShowConstantTbt setManeuverComplete(Boolean maneuverComplete) {
setParameters(KEY_MANEUVER_COMPLETE, maneuverComplete);
return this;
}
/**
* Gets a maneuver complete flag
- *
+ *
* @return Boolean -a Boolean value
*/
- public Boolean getManeuverComplete(){
+ public Boolean getManeuverComplete() {
return getBoolean(KEY_MANEUVER_COMPLETE);
}
@@ -283,10 +271,9 @@ public class ShowConstantTbt extends RPCRequest{
*
* <p><b>Notes: </b>Minsize=0; Maxsize=3</p>
*
- * @param softButtons
- * a List<SoftButton> value
+ * @param softButtons a List<SoftButton> value
*/
- public ShowConstantTbt setSoftButtons( List<SoftButton> softButtons) {
+ public ShowConstantTbt setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
@@ -294,20 +281,20 @@ public class ShowConstantTbt extends RPCRequest{
/**
* Gets Three dynamic SoftButtons available (first SoftButton is fixed to "Turns"). If omitted on supported
* displays, the currently displayed SoftButton values will not change
- *
+ *
* @return Vector<SoftButton> -a Vector<SoftButton> value
*/
@SuppressWarnings("unchecked")
- public List<SoftButton> getSoftButtons(){
+ public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
- public ShowConstantTbt setTimeToDestination( String timeToDestination) {
+ public ShowConstantTbt setTimeToDestination(String timeToDestination) {
setParameters(KEY_TIME_TO_DESTINATION, timeToDestination);
return this;
}
- public String getTimeToDestination(){
+ public String getTimeToDestination() {
return getString(KEY_TIME_TO_DESTINATION);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
index 6af6a2d49..0e4cc7f33 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,22 +41,23 @@ import java.util.Hashtable;
/**
* Show Constant TBT Response is sent, when ShowConstantTBT has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
-public class ShowConstantTbtResponse extends RPCResponse{
+public class ShowConstantTbtResponse extends RPCResponse {
public ShowConstantTbtResponse() {
super(FunctionID.SHOW_CONSTANT_TBT.toString());
}
-
+
public ShowConstantTbtResponse(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a new ShowConstantTbtResponse object
- * @param success whether the request is successfully processed
+ *
+ * @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
*/
public ShowConstantTbtResponse(@NonNull Boolean success, @NonNull Result resultCode) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java
index 44c67260c..420a2bc7e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,38 @@ import java.util.Hashtable;
/**
* Show Response is sent, when Show has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class ShowResponse extends RPCResponse {
- /**
- * Constructs a new ShowResponse object
- */
+ /**
+ * Constructs a new ShowResponse object
+ */
public ShowResponse() {
super(FunctionID.SHOW.toString());
}
- /**
- * Constructs a new ShowResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new ShowResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public ShowResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new ShowResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public ShowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new ShowResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ShowResponse(@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/SingleTireStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
index faadb2406..d68abf738 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -72,81 +72,89 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 5.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class SingleTireStatus extends RPCStruct {
- public static final String KEY_STATUS = "status";
- public static final String KEY_TPMS = "tpms";
- public static final String KEY_PRESSURE = "pressure";
+ public static final String KEY_STATUS = "status";
+ public static final String KEY_TPMS = "tpms";
+ public static final String KEY_PRESSURE = "pressure";
+
+ /**
+ * Constructs a newly allocated SingleTireStatus object
+ */
+ public SingleTireStatus() {
+ }
- /**
- * Constructs a newly allocated SingleTireStatus object
- */
- public SingleTireStatus() { }
-
/**
* Constructs a newly allocated SingleTireStatus object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public SingleTireStatus(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a newly allocated SingleTireStatus object
- * @param status Describes the volume status of a single tire
- */
- public SingleTireStatus(@NonNull ComponentVolumeStatus status){
- this();
- setStatus(status);
- }
-
+ /**
+ * Constructs a newly allocated SingleTireStatus object
+ *
+ * @param status Describes the volume status of a single tire
+ */
+ public SingleTireStatus(@NonNull ComponentVolumeStatus status) {
+ this();
+ setStatus(status);
+ }
+
/**
* set the volume status of a single tire
+ *
* @param status the volume status of a single tire
*/
public SingleTireStatus setStatus(@NonNull ComponentVolumeStatus status) {
setValue(KEY_STATUS, status);
return this;
}
-
+
/**
* get the volume status of a single tire
+ *
* @return the volume status of a single tire
*/
public ComponentVolumeStatus getStatus() {
return (ComponentVolumeStatus) getObject(ComponentVolumeStatus.class, KEY_STATUS);
}
- /**
- * Set the status of TPMS according to the particular tire.
- * @param tpms The status of TPMS
- */
- public SingleTireStatus setTPMS(@NonNull TPMS tpms) {
+ /**
+ * Set the status of TPMS according to the particular tire.
+ *
+ * @param tpms The status of TPMS
+ */
+ public SingleTireStatus setTPMS(@NonNull TPMS tpms) {
setValue(KEY_TPMS, tpms);
return this;
}
- /**
- * Get the status of TPMS according to the particular tire.
- * @return the TPMS status
- */
- public TPMS getTPMS() {
- return (TPMS) getObject(TPMS.class, KEY_TPMS);
- }
+ /**
+ * Get the status of TPMS according to the particular tire.
+ *
+ * @return the TPMS status
+ */
+ public TPMS getTPMS() {
+ return (TPMS) getObject(TPMS.class, KEY_TPMS);
+ }
- /**
- * @param pressure The pressure value of the particular tire in kilo pascal.
- */
- public SingleTireStatus setPressure(@NonNull Float pressure) {
+ /**
+ * @param pressure The pressure value of the particular tire in kilo pascal.
+ */
+ public SingleTireStatus setPressure(@NonNull Float pressure) {
setValue(KEY_PRESSURE, pressure);
return this;
}
- /**
- * @return the pressure value of the particular tire in kilo pascal.
- */
- public Float getPressure() {
- return getFloat(KEY_PRESSURE);
- }
+ /**
+ * @return the pressure value of the particular tire in kilo pascal.
+ */
+ public Float getPressure() {
+ return getFloat(KEY_PRESSURE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SisData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SisData.java
index 0862ccc5e..acc813c52 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SisData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SisData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,122 +36,122 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
public class SisData extends RPCStruct {
- public static final String KEY_STATION_SHORT_NAME = "stationShortName";
- public static final String KEY_STATION_ID_NUMBER = "stationIDNumber";
- public static final String KEY_STATION_LONG_NAME = "stationLongName";
- public static final String KEY_STATION_LOCATION = "stationLocation";
- public static final String KEY_STATION_MESSAGE = "stationMessage";
+ public static final String KEY_STATION_SHORT_NAME = "stationShortName";
+ public static final String KEY_STATION_ID_NUMBER = "stationIDNumber";
+ public static final String KEY_STATION_LONG_NAME = "stationLongName";
+ public static final String KEY_STATION_LOCATION = "stationLocation";
+ public static final String KEY_STATION_MESSAGE = "stationMessage";
- /**
- * Constructs a new SisData object
- */
- public SisData() {
- }
+ /**
+ * Constructs a new SisData object
+ */
+ public SisData() {
+ }
- /**
- * <p>Constructs a new SisData object indicated by the Hashtable parameter
- * </p>
- *
- * @param hash The Hashtable to use
- */
- public SisData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * <p>Constructs a new SisData object indicated by the Hashtable parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SisData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Sets the stationShortName portion of the SisData class
- *
- * @param stationShortName Identifies the 4-alpha-character station call sign plus an optional (-FM) extension.
- */
- public SisData setStationShortName( String stationShortName) {
+ /**
+ * Sets the stationShortName portion of the SisData class
+ *
+ * @param stationShortName Identifies the 4-alpha-character station call sign plus an optional (-FM) extension.
+ */
+ public SisData setStationShortName(String stationShortName) {
setValue(KEY_STATION_SHORT_NAME, stationShortName);
return this;
}
- /**
- * Gets the stationShortName portion of the SisData class
- *
- * @return String - Identifies the 4-alpha-character station call sign plus an optional (-FM) extension.
- */
- public String getStationShortName() {
- return getString(KEY_STATION_SHORT_NAME);
- }
+ /**
+ * Gets the stationShortName portion of the SisData class
+ *
+ * @return String - Identifies the 4-alpha-character station call sign plus an optional (-FM) extension.
+ */
+ public String getStationShortName() {
+ return getString(KEY_STATION_SHORT_NAME);
+ }
- /**
- * Sets the stationIDNumber which is used for network Application. Consists of Country Code and FCC Facility ID
- *
- * @param stationIDNumber Consists of Country Code and FCC Facility ID
- */
- public SisData setStationIDNumber( StationIDNumber stationIDNumber) {
+ /**
+ * Sets the stationIDNumber which is used for network Application. Consists of Country Code and FCC Facility ID
+ *
+ * @param stationIDNumber Consists of Country Code and FCC Facility ID
+ */
+ public SisData setStationIDNumber(StationIDNumber stationIDNumber) {
setValue(KEY_STATION_ID_NUMBER, stationIDNumber);
return this;
}
- /**
- * Gets the stationIDNumber which is used for network Application. Consists of Country Code and FCC Facility ID
- *
- * @return StationIDNumber.
- */
- public StationIDNumber getStationIDNumber() {
- return (StationIDNumber) getObject(StationIDNumber.class, KEY_STATION_ID_NUMBER);
- }
+ /**
+ * Gets the stationIDNumber which is used for network Application. Consists of Country Code and FCC Facility ID
+ *
+ * @return StationIDNumber.
+ */
+ public StationIDNumber getStationIDNumber() {
+ return (StationIDNumber) getObject(StationIDNumber.class, KEY_STATION_ID_NUMBER);
+ }
- /**
- * Sets the stationLongName portion of the SisData class
- *
- * @param stationLongName Identifies the station call sign or other identifying information in the long format.
- */
- public SisData setStationLongName( String stationLongName) {
+ /**
+ * Sets the stationLongName portion of the SisData class
+ *
+ * @param stationLongName Identifies the station call sign or other identifying information in the long format.
+ */
+ public SisData setStationLongName(String stationLongName) {
setValue(KEY_STATION_LONG_NAME, stationLongName);
return this;
}
- /**
- * Gets the stationLongName portion of the SisData class
- *
- * @return String - Identifies the station call sign or other identifying information in the long format.
- */
- public String getStationLongName() {
- return getString(KEY_STATION_LONG_NAME);
- }
+ /**
+ * Gets the stationLongName portion of the SisData class
+ *
+ * @return String - Identifies the station call sign or other identifying information in the long format.
+ */
+ public String getStationLongName() {
+ return getString(KEY_STATION_LONG_NAME);
+ }
- /**
- * Sets the stationLocation portion of the SisData class
- *
- * @param stationLocation Provides the 3-dimensional geographic station location.
- */
- public SisData setStationLocation( GPSData stationLocation) {
+ /**
+ * Sets the stationLocation portion of the SisData class
+ *
+ * @param stationLocation Provides the 3-dimensional geographic station location.
+ */
+ public SisData setStationLocation(GPSData stationLocation) {
setValue(KEY_STATION_LOCATION, stationLocation);
return this;
}
- /**
- * Gets the stationLocation portion of the SisData class
- *
- * @return GPSData - Provides the 3-dimensional geographic station location.
- */
- public GPSData getStationLocation() {
- return (GPSData) getObject(GPSData.class, KEY_STATION_LOCATION);
- }
+ /**
+ * Gets the stationLocation portion of the SisData class
+ *
+ * @return GPSData - Provides the 3-dimensional geographic station location.
+ */
+ public GPSData getStationLocation() {
+ return (GPSData) getObject(GPSData.class, KEY_STATION_LOCATION);
+ }
- /**
- * Sets the stationMessage portion of the SisData class
- *
- * @param stationMessage May be used to convey textual information of general interest to the consumer such as weather forecasts or public service announcements.
- * Includes a high priority delivery feature to convey emergencies that may be in the listening area.
- */
- public SisData setStationMessage( String stationMessage) {
+ /**
+ * Sets the stationMessage portion of the SisData class
+ *
+ * @param stationMessage May be used to convey textual information of general interest to the consumer such as weather forecasts or public service announcements.
+ * Includes a high priority delivery feature to convey emergencies that may be in the listening area.
+ */
+ public SisData setStationMessage(String stationMessage) {
setValue(KEY_STATION_MESSAGE, stationMessage);
return this;
}
- /**
- * Gets the stationMessage portion of the SisData class
- *
- * @return String - May be used to convey textual information of general interest to the consumer such as weather forecasts or public service announcements.
- * Includes a high priority delivery feature to convey emergencies that may be in the listening area.
- */
- public String getStationMessage() {
- return getString(KEY_STATION_MESSAGE);
- }
+ /**
+ * Gets the stationMessage portion of the SisData class
+ *
+ * @return String - May be used to convey textual information of general interest to the consumer such as weather forecasts or public service announcements.
+ * Includes a high priority delivery feature to convey emergencies that may be in the listening area.
+ */
+ public String getStationMessage() {
+ return getString(KEY_STATION_MESSAGE);
+ }
}
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 0b9f10491..fae2a8165 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,13 +41,13 @@ import java.util.List;
/**
* Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.
- *
+ * <p>
* 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>
- *
+ *
* <p><b>HMILevel needs to be FULL</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -109,196 +109,189 @@ import java.util.List;
* <td>SmartDeviceLink 6.0</td>
* </tr>
* </table>
-*<p><b>Response </b></p>
-*
-*<p><b>Non-default Result Codes:</b></p>
-* <p> SAVED </p>
-* <p> INVALID_DATA</p>
-* <p>OUT_OF_MEMORY</p>
-* <p>TOO_MANY_PENDING_REQUESTS</p>
-* <p>APPLICATION_NOT_REGISTERED</p>
-* <p>GENERIC_ERROR</p>
-*<p> DISALLOWED</p>
-*<p> UNSUPPORTED_RESOURCE </p>
-*<p> REJECTED </p>
-* <p>ABORTED </p>
-*
+ * <p><b>Response </b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p> SAVED </p>
+ * <p> INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p> DISALLOWED</p>
+ * <p> UNSUPPORTED_RESOURCE </p>
+ * <p> REJECTED </p>
+ * <p>ABORTED </p>
+ *
* @since SmartDeviceLink 2.0
- *
*/
public class Slider extends RPCRequest {
- public static final String KEY_NUM_TICKS = "numTicks";
- public static final String KEY_SLIDER_HEADER = "sliderHeader";
- 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";
+ public static final String KEY_NUM_TICKS = "numTicks";
+ public static final String KEY_SLIDER_HEADER = "sliderHeader";
+ 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
- */
+ /**
+ * Constructs a new Slider object
+ */
public Slider() {
super(FunctionID.SLIDER.toString());
}
- /**
- * Constructs a new Slider object indicated by the Hashtable parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new Slider object indicated by the Hashtable parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public Slider(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new Slider object \
- * @param numTicks Number of selectable items on a horizontal axis.
- * @param position Initial position of slider control (cannot exceed numTicks)
- * @param sliderHeader Text header to display
- */
- public Slider(@NonNull Integer numTicks, @NonNull Integer position, @NonNull String sliderHeader){
- this();
- setNumTicks(numTicks);
- setPosition(position);
- setSliderHeader(sliderHeader);
- }
+ /**
+ * Constructs a new Slider object \
+ *
+ * @param numTicks Number of selectable items on a horizontal axis.
+ * @param position Initial position of slider control (cannot exceed numTicks)
+ * @param sliderHeader Text header to display
+ */
+ public Slider(@NonNull Integer numTicks, @NonNull Integer position, @NonNull String sliderHeader) {
+ this();
+ setNumTicks(numTicks);
+ setPosition(position);
+ setSliderHeader(sliderHeader);
+ }
- /**
- * Sets a number of selectable items on a horizontal axis
- *
- * @param numTicks
- * an Integer value representing a number of selectable items on
- * a horizontal axis
- * <p></p>
- * <b>Notes: </b>Minvalue=2; Maxvalue=26
- */
+ /**
+ * Sets a number of selectable items on a horizontal axis
+ *
+ * @param numTicks an Integer value representing a number of selectable items on
+ * a horizontal axis
+ * <p></p>
+ * <b>Notes: </b>Minvalue=2; Maxvalue=26
+ */
public Slider setNumTicks(@NonNull Integer numTicks) {
setParameters(KEY_NUM_TICKS, numTicks);
return this;
}
- /**
- * Gets a number of selectable items on a horizontal axis
- *
- * @return Integer -an Integer value representing a number of selectable
- * items on a horizontal axis
- */
+ /**
+ * Gets a number of selectable items on a horizontal axis
+ *
+ * @return Integer -an Integer value representing a number of selectable
+ * items on a horizontal axis
+ */
public Integer getNumTicks() {
- return getInteger(KEY_NUM_TICKS);
+ return getInteger(KEY_NUM_TICKS);
}
- /**
- * Sets an Initial position of slider control
- *
- * @param position
- * an Integer value representing an Initial position of slider
- * control
- * <p></p>
- * <b>Notes: </b>Minvalue=1; Maxvalue=26
- */
+ /**
+ * Sets an Initial position of slider control
+ *
+ * @param position an Integer value representing an Initial position of slider
+ * control
+ * <p></p>
+ * <b>Notes: </b>Minvalue=1; Maxvalue=26
+ */
public Slider setPosition(@NonNull Integer position) {
setParameters(KEY_POSITION, position);
return this;
}
- /**
- * Gets an Initial position of slider control
- *
- * @return Integer -an Integer value representing an Initial position of
- * slider control
- */
+ /**
+ * Gets an Initial position of slider control
+ *
+ * @return Integer -an Integer value representing an Initial position of
+ * slider control
+ */
public Integer getPosition() {
- return getInteger(KEY_POSITION);
+ return getInteger(KEY_POSITION);
}
- /**
- * Sets a text header to display
- *
- * @param sliderHeader
- * a String value
- * <p></p>
- * <b>Notes: </b>Maxlength=500
- */
+ /**
+ * Sets a text header to display
+ *
+ * @param sliderHeader a String value
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500
+ */
public Slider setSliderHeader(@NonNull String sliderHeader) {
setParameters(KEY_SLIDER_HEADER, sliderHeader);
return this;
}
- /**
- * Gets a text header to display
- *
- * @return String -a String value representing a text header to display
- */
+ /**
+ * Gets a text header to display
+ *
+ * @return String -a String value representing a text header to display
+ */
public String getSliderHeader() {
- return getString(KEY_SLIDER_HEADER);
+ return getString(KEY_SLIDER_HEADER);
}
- /**
- * Sets a text footer to display
- *
- * @param sliderFooter
- * a List<String> value representing a text footer to display
- * <p></p>
- * <b>Notes: </b>Maxlength=500; Minvalue=1; Maxvalue=26
- */
- public Slider setSliderFooter( List<String> sliderFooter) {
+ /**
+ * Sets a text footer to display
+ *
+ * @param sliderFooter a List<String> value representing a text footer to display
+ * <p></p>
+ * <b>Notes: </b>Maxlength=500; Minvalue=1; Maxvalue=26
+ */
+ public Slider setSliderFooter(List<String> sliderFooter) {
setParameters(KEY_SLIDER_FOOTER, sliderFooter);
return this;
}
- /**
- * Gets a text footer to display
- *
- * @return String -a String value representing a text footer to display
- */
+ /**
+ * Gets a text footer to display
+ *
+ * @return String -a String value representing a text footer to display
+ */
@SuppressWarnings("unchecked")
public List<String> getSliderFooter() {
- return (List<String>) getObject(String.class, KEY_SLIDER_FOOTER);
+ return (List<String>) getObject(String.class, KEY_SLIDER_FOOTER);
}
- /**
- * Sets an App defined timeout
- *
- * @param timeout
- * an Integer value representing an App defined timeout
- * <p></p>
- * <b>Notes: </b>Minvalue=0; Maxvalue=65535; Defvalue=10000
- */
- public Slider setTimeout( Integer timeout) {
+ /**
+ * Sets an App defined timeout
+ *
+ * @param timeout an Integer value representing an App defined timeout
+ * <p></p>
+ * <b>Notes: </b>Minvalue=0; Maxvalue=65535; Defvalue=10000
+ */
+ public Slider setTimeout(Integer timeout) {
setParameters(KEY_TIMEOUT, timeout);
return this;
}
- /**
- * Gets an App defined timeout
- * @return Integer -an Integer value representing an App defined timeout
- */
+ /**
+ * Gets an App defined timeout
+ *
+ * @return Integer -an Integer value representing an App defined timeout
+ */
public Integer getTimeout() {
- return getInteger(KEY_TIMEOUT);
+ 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);
- }
+ /**
+ * 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 Slider setCancelID( Integer cancelID) {
+ /**
+ * 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 Slider setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
index 5f802bd19..547bb2bfa 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,55 +41,58 @@ import java.util.Hashtable;
/**
* Slider Response is sent, when Slider has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class SliderResponse extends RPCResponse {
- public static final String KEY_SLIDER_POSITION = "sliderPosition";
+ public static final String KEY_SLIDER_POSITION = "sliderPosition";
- /**
- * Constructs a new SliderResponse object
- */
+ /**
+ * Constructs a new SliderResponse object
+ */
public SliderResponse() {
super(FunctionID.SLIDER.toString());
}
- /**
- * Constructs a new SliderResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SliderResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SliderResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SliderResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SliderResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SliderResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SliderResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
/**
* Sets an Initial position of slider control
+ *
* @param sliderPosition the starting position of the slider control
*/
- public SliderResponse setSliderPosition( Integer sliderPosition) {
+ public SliderResponse setSliderPosition(Integer sliderPosition) {
setParameters(KEY_SLIDER_POSITION, sliderPosition);
return this;
}
+
/**
* Gets an Initial position of slider control
+ *
* @return the starting position of the slider control
*/
public Integer getSliderPosition() {
- return getInteger(KEY_SLIDER_POSITION);
+ return getInteger(KEY_SLIDER_POSITION);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
index 8ff2868a6..873522c69 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,6 +38,7 @@ import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
import java.util.Hashtable;
+
/**
* <p> A simulated button or keyboard key that is displayed on a touch screen.</p>
*
@@ -98,83 +99,94 @@ import java.util.Hashtable;
* <td>N</td>
* <td>defvalue: DEFAULT_ACTION</td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
- *
- * </table>
+ * </tr>
*
+ * </table>
*/
public class SoftButton extends RPCStruct {
- public static final String KEY_IS_HIGHLIGHTED = "isHighlighted";
- public static final String KEY_SOFT_BUTTON_ID = "softButtonID";
- public static final String KEY_SYSTEM_ACTION = "systemAction";
- public static final String KEY_TEXT = "text";
- public static final String KEY_TYPE = "type";
- public static final String KEY_IMAGE = "image";
-
- public SoftButton() { }
-
- /**
- *
- * <p>Constructs a new SoftButton object indicated by the Hashtable
- * parameter</p>
- *
- * @param hash The Hashtable to use
- */
- public SoftButton(Hashtable<String, Object> hash) {
+ public static final String KEY_IS_HIGHLIGHTED = "isHighlighted";
+ public static final String KEY_SOFT_BUTTON_ID = "softButtonID";
+ public static final String KEY_SYSTEM_ACTION = "systemAction";
+ public static final String KEY_TEXT = "text";
+ public static final String KEY_TYPE = "type";
+ public static final String KEY_IMAGE = "image";
+
+ public SoftButton() {
+ }
+
+ /**
+ * <p>Constructs a new SoftButton object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SoftButton(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SoftButton object
- * @param type Describes, whether it is text, highlighted text, icon, or dynamic image.
- * @param softButtonID Value which is returned via OnButtonPress / OnButtonEvent
- */
- public SoftButton(@NonNull SoftButtonType type, @NonNull Integer softButtonID){
- this();
- setType(type);
- setSoftButtonID(softButtonID);
- }
+ /**
+ * Constructs a new SoftButton object
+ *
+ * @param type Describes, whether it is text, highlighted text, icon, or dynamic image.
+ * @param softButtonID Value which is returned via OnButtonPress / OnButtonEvent
+ */
+ public SoftButton(@NonNull SoftButtonType type, @NonNull Integer softButtonID) {
+ this();
+ setType(type);
+ setSoftButtonID(softButtonID);
+ }
public SoftButton setType(@NonNull SoftButtonType type) {
setValue(KEY_TYPE, type);
return this;
}
+
public SoftButtonType getType() {
- return (SoftButtonType) getObject(SoftButtonType.class, KEY_TYPE);
+ return (SoftButtonType) getObject(SoftButtonType.class, KEY_TYPE);
}
- public SoftButton setText( String text) {
+
+ public SoftButton setText(String text) {
setValue(KEY_TEXT, text);
return this;
}
+
public String getText() {
return getString(KEY_TEXT);
}
- public SoftButton setImage( Image image) {
+
+ public SoftButton setImage(Image image) {
setValue(KEY_IMAGE, image);
return this;
}
+
public Image getImage() {
- return (Image) getObject(Image.class, KEY_IMAGE);
+ return (Image) getObject(Image.class, KEY_IMAGE);
}
- public SoftButton setIsHighlighted( Boolean isHighlighted) {
+
+ public SoftButton setIsHighlighted(Boolean isHighlighted) {
setValue(KEY_IS_HIGHLIGHTED, isHighlighted);
return this;
}
+
public Boolean getIsHighlighted() {
return getBoolean(KEY_IS_HIGHLIGHTED);
}
+
public SoftButton setSoftButtonID(@NonNull Integer softButtonID) {
setValue(KEY_SOFT_BUTTON_ID, softButtonID);
return this;
}
+
public Integer getSoftButtonID() {
return getInteger(KEY_SOFT_BUTTON_ID);
}
- public SoftButton setSystemAction( SystemAction systemAction) {
+
+ public SoftButton setSystemAction(SystemAction systemAction) {
setValue(KEY_SYSTEM_ACTION, systemAction);
return this;
}
+
public SystemAction getSystemAction() {
return (SystemAction) getObject(SystemAction.class, KEY_SYSTEM_ACTION);
}
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 baac6ecda..c02ba15ed 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -52,7 +52,7 @@ import java.util.Hashtable;
* <td>shortPressAvailable</td>
* <td>Boolean</td>
* <td>The button supports a short press.
- * Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
+ * Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -68,8 +68,8 @@ import java.util.Hashtable;
* <td>upDownAvailable</td>
* <td>Boolean</td>
* <td>The button supports "button down" and "button up". Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
- * Whenever the button is released, onButtonEvent( UP) will be invoked. *
- * </td>
+ * Whenever the button is released, onButtonEvent( UP) will be invoked. *
+ * </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* <tr>
@@ -78,49 +78,53 @@ import java.util.Hashtable;
* <td>The button supports referencing a static or dynamic image.
* </td>
* <td>SmartDeviceLink 2.0</td>
- * </tr>
+ * </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class SoftButtonCapabilities extends RPCStruct {
- public static final String KEY_IMAGE_SUPPORTED = "imageSupported";
- 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
- */
- public SoftButtonCapabilities() { }
-
+ public static final String KEY_IMAGE_SUPPORTED = "imageSupported";
+ 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
+ */
+ public SoftButtonCapabilities() {
+ }
+
/**
* Constructs a newly allocated SoftButtonCapabilities object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public SoftButtonCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a newly allocated SoftButtonCapabilities object
- * @param shortPressAvailable The button supports a short press.
- * @param longPressAvailable The button supports a LONG press
- * @param upDownAvailable The button supports "button down" and "button up".
- * @param imageSupported The button supports referencing a static or dynamic image.
- */
- public SoftButtonCapabilities(@NonNull Boolean shortPressAvailable, @NonNull Boolean longPressAvailable, @NonNull Boolean upDownAvailable, @NonNull Boolean imageSupported){
- this();
- setShortPressAvailable(shortPressAvailable);
- setLongPressAvailable(longPressAvailable);
- setUpDownAvailable(upDownAvailable);
- setImageSupported(imageSupported);
- }
+ /**
+ * Constructs a newly allocated SoftButtonCapabilities object
+ *
+ * @param shortPressAvailable The button supports a short press.
+ * @param longPressAvailable The button supports a LONG press
+ * @param upDownAvailable The button supports "button down" and "button up".
+ * @param imageSupported The button supports referencing a static or dynamic image.
+ */
+ public SoftButtonCapabilities(@NonNull Boolean shortPressAvailable, @NonNull Boolean longPressAvailable, @NonNull Boolean upDownAvailable, @NonNull Boolean imageSupported) {
+ this();
+ setShortPressAvailable(shortPressAvailable);
+ setLongPressAvailable(longPressAvailable);
+ setUpDownAvailable(upDownAvailable);
+ setImageSupported(imageSupported);
+ }
@Override
public void format(Version rpcVersion, boolean formatParams) {
super.format(rpcVersion, formatParams);
- if(!store.containsKey(KEY_IMAGE_SUPPORTED)){
+ if (!store.containsKey(KEY_IMAGE_SUPPORTED)) {
// At some point this was added to the RPC spec as mandatory but at least in v1.0.0
// it was not included.
store.put(KEY_IMAGE_SUPPORTED, Boolean.FALSE);
@@ -129,87 +133,97 @@ public class SoftButtonCapabilities extends RPCStruct {
/**
* set the button supports a short press.
+ *
* @param shortPressAvailable whether the button supports a short press.
*/
public SoftButtonCapabilities setShortPressAvailable(@NonNull Boolean shortPressAvailable) {
setValue(KEY_SHORT_PRESS_AVAILABLE, shortPressAvailable);
return this;
}
-
+
/**
* get whether the button supports a short press.
+ *
* @return whether the button supports a short press
*/
public Boolean getShortPressAvailable() {
- return getBoolean( KEY_SHORT_PRESS_AVAILABLE);
+ return getBoolean(KEY_SHORT_PRESS_AVAILABLE);
}
-
+
/**
* set the button supports a LONG press.
+ *
* @param longPressAvailable whether the button supports a long press
*/
public SoftButtonCapabilities setLongPressAvailable(@NonNull Boolean longPressAvailable) {
setValue(KEY_LONG_PRESS_AVAILABLE, longPressAvailable);
return this;
}
-
+
/**
* get whether the button supports a LONG press.
+ *
* @return whether the button supports a LONG press
*/
public Boolean getLongPressAvailable() {
- return getBoolean( KEY_LONG_PRESS_AVAILABLE);
+ return getBoolean(KEY_LONG_PRESS_AVAILABLE);
}
-
+
/**
* set the button supports "button down" and "button up".
+ *
* @param upDownAvailable the button supports "button down" and "button up".
*/
public SoftButtonCapabilities setUpDownAvailable(@NonNull Boolean upDownAvailable) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
return this;
}
-
+
/**
* get the button supports "button down" and "button up".
+ *
* @return the button supports "button down" and "button up".
*/
public Boolean getUpDownAvailable() {
- return getBoolean( KEY_UP_DOWN_AVAILABLE);
+ return getBoolean(KEY_UP_DOWN_AVAILABLE);
}
-
+
/**
* set the button supports referencing a static or dynamic image.
+ *
* @param imageSupported whether the button supports referencing a static or dynamic image.
*/
public SoftButtonCapabilities setImageSupported(@NonNull Boolean imageSupported) {
setValue(KEY_IMAGE_SUPPORTED, imageSupported);
return this;
}
-
+
/**
* get the button supports referencing a static or dynamic image.
+ *
* @return the button supports referencing a static or dynamic image.
*/
public Boolean getImageSupported() {
- return getBoolean( KEY_IMAGE_SUPPORTED);
+ 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 SoftButtonCapabilities setTextSupported( Boolean textSupported) {
+ public SoftButtonCapabilities setTextSupported(Boolean textSupported) {
setValue(KEY_TEXT_SUPPORTED, textSupported);
return this;
}
/**
* get the text support.
+ *
* @return Boolean - the text is supported or not.
*/
public Boolean getTextSupported() {
- return getBoolean( KEY_TEXT_SUPPORTED);
+ return getBoolean(KEY_TEXT_SUPPORTED);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
index d48e6e757..651cdb8bc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -81,12 +81,12 @@ import java.util.List;
* to be sent by SDL) and begin the requested <i>
* {@linkplain PerformInteraction}</i> operation
* <p></p>
- *
+ *
* <p><b>HMI Status Requirements:</b></p>
* <p>HMILevel: FULL, Limited</p>
- *<p> AudioStreamingState: Any</p>
+ * <p> AudioStreamingState: Any</p>
* <p>SystemContext: MAIN, MENU, VR</p>
- *
+ *
* <p><b>Notes: </b></p>
* <ul>
* <li>When <i>{@linkplain Alert}</i> is issued with MENU in effect, <i>
@@ -99,8 +99,8 @@ import java.util.List;
* VR, they are "played" back in the order in which they were queued, with all
* existing rules for "collisions" still in effect</li>
* </ul>
- *
- *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -122,77 +122,80 @@ import java.util.List;
* </table>
* <p><b>Response</b> </p>
* <p>This Response notifies the application of the completion, interruption, or failure of a Speak Request.</p>
- *
+ *
* <p><b>Non-default Result Codes:</b> </p>
- *
- * <p> SUCCESS </p>
- *<p> INVALID_DATA</p>
- * <p> OUT_OF_MEMORY </p>
- * <p>APPLICATION_NOT_REGISTERED </p>
- * <p>TOO_MANY_PENDING_REQUESTS </p>
- *<p> GENERIC_ERROR </p>
- * <p>REJECTED </p>
- * <p>DISALLOWED </p>
- * <p>ABORTED </p>
- *
- * <p><b>Additional Notes:</b></p><ul>Total character limit depends on platform. Chunks are limited to 500 characters; however you can have multiple TTS chunks. On Gen 1.1 there is a total character limit of 500 characters across all chunks. This could vary according to the VCA.
- *
- * @since SmartDeviceLink 1.0
+ *
+ * <p> SUCCESS </p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY </p>
+ * <p>APPLICATION_NOT_REGISTERED </p>
+ * <p>TOO_MANY_PENDING_REQUESTS </p>
+ * <p> GENERIC_ERROR </p>
+ * <p>REJECTED </p>
+ * <p>DISALLOWED </p>
+ * <p>ABORTED </p>
+ *
+ * <p><b>Additional Notes:</b></p><ul>Total character limit depends on platform. Chunks are limited to 500 characters; however you can have multiple TTS chunks. On Gen 1.1 there is a total character limit of 500 characters across all chunks. This could vary according to the VCA.
+ *
* @see Alert
+ * @since SmartDeviceLink 1.0
*/
public class Speak extends RPCRequest {
- public static final String KEY_TTS_CHUNKS = "ttsChunks";
+ public static final String KEY_TTS_CHUNKS = "ttsChunks";
- /**
- * Constructs a new Speak object
- */
- public Speak() {
+ /**
+ * Constructs a new Speak object
+ */
+ public Speak() {
super(FunctionID.SPEAK.toString());
}
- /**
- * Constructs a new Speak object indicated by the Hashtable parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new Speak object indicated by the Hashtable parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public Speak(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new Speak object
- * @param ttsChunks An array of 1-100 TTSChunk structs which, taken together, specify the phrase to be spoken.
- */
- public Speak(@NonNull List<TTSChunk> ttsChunks){
- this();
- setTtsChunks(ttsChunks);
- }
- /**
- * Gets a List<TTSChunk> representing an array of 1-100 TTSChunk structs
- * which, taken together, specify the phrase to be spoken
- *
- * @return List<TTSChunk> -an Array of 1-100 TTSChunk specify the phrase to be spoken
- */
+ /**
+ * Constructs a new Speak object
+ *
+ * @param ttsChunks An array of 1-100 TTSChunk structs which, taken together, specify the phrase to be spoken.
+ */
+ public Speak(@NonNull List<TTSChunk> ttsChunks) {
+ this();
+ setTtsChunks(ttsChunks);
+ }
+
+ /**
+ * Gets a List<TTSChunk> representing an array of 1-100 TTSChunk structs
+ * which, taken together, specify the phrase to be spoken
+ *
+ * @return List<TTSChunk> -an Array of 1-100 TTSChunk specify the phrase to be spoken
+ */
@SuppressWarnings("unchecked")
public List<TTSChunk> getTtsChunks() {
- return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
+ return (List<TTSChunk>) getObject(TTSChunk.class, KEY_TTS_CHUNKS);
}
- /**
- * Sets a List<TTSChunk> representing an array of 1-100 TTSChunk structs
- * which, taken together, specify the phrase to be spoken
- *
- * @param ttsChunks
- * a List<TTSChunk> value representing an array of 1-100 TTSChunk structs
- * which specify the phrase to be spoken
- * <p></p>
- * <ul>
- * <li>The array must have 1-100 elements</li>
- * <li>The total length of the phrase composed from the ttsChunks
- * provided must be less than 500 characters or the request will
- * be rejected</li>
- * <li>Each chunk can be no more than 500 characters</li>
- * </ul>
- */
+
+ /**
+ * Sets a List<TTSChunk> representing an array of 1-100 TTSChunk structs
+ * which, taken together, specify the phrase to be spoken
+ *
+ * @param ttsChunks a List<TTSChunk> value representing an array of 1-100 TTSChunk structs
+ * which specify the phrase to be spoken
+ * <p></p>
+ * <ul>
+ * <li>The array must have 1-100 elements</li>
+ * <li>The total length of the phrase composed from the ttsChunks
+ * provided must be less than 500 characters or the request will
+ * be rejected</li>
+ * <li>Each chunk can be no more than 500 characters</li>
+ * </ul>
+ */
public Speak setTtsChunks(@NonNull List<TTSChunk> ttsChunks) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java
index 2fb47b6e0..e36ca5234 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.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 androidx.annotation.NonNull;
@@ -41,39 +41,39 @@ import java.util.Hashtable;
/**
* Speak Response is sent, when Speak has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class SpeakResponse extends RPCResponse {
- /**
- * Constructs a new SpeakResponse object
- */
+ /**
+ * Constructs a new SpeakResponse object
+ */
public SpeakResponse() {
super(FunctionID.SPEAK.toString());
}
- /**
- * Constructs a new SpeakResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new SpeakResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public SpeakResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SpeakResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SpeakResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SpeakResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SpeakResponse(@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/StabilityControlsStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java
index 78eb84149..aa009a075 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java
@@ -37,7 +37,6 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
import java.util.Hashtable;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -66,6 +65,7 @@ import java.util.Hashtable;
* <td></td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 7.0.0
*/
public class StabilityControlsStatus extends RPCStruct {
@@ -76,7 +76,8 @@ public class StabilityControlsStatus extends RPCStruct {
/**
* Constructs a new StabilityControlsStatus object
*/
- public StabilityControlsStatus() { }
+ public StabilityControlsStatus() {
+ }
/**
* Constructs a new StabilityControlsStatus object indicated by the Hashtable parameter
@@ -101,7 +102,7 @@ public class StabilityControlsStatus extends RPCStruct {
*
* @param escSystem true if vehicle stability control is ON, else false
*/
- public StabilityControlsStatus setEscSystem( VehicleDataStatus escSystem) {
+ public StabilityControlsStatus setEscSystem(VehicleDataStatus escSystem) {
setValue(KEY_ESC_SYSTEM, escSystem);
return this;
}
@@ -111,7 +112,7 @@ public class StabilityControlsStatus extends RPCStruct {
*
* @param trailerSwayControl true if vehicle trailer sway control is ON, else false
*/
- public StabilityControlsStatus setTrailerSwayControl( VehicleDataStatus trailerSwayControl) {
+ public StabilityControlsStatus setTrailerSwayControl(VehicleDataStatus trailerSwayControl) {
setValue(KEY_TRAILER_SWAY_CONTROL, trailerSwayControl);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
index fd7f640bf..e2cdd6be9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -51,11 +51,11 @@ import java.util.Hashtable;
* <td>hours</td>
* <td>Integer</td>
* <td>The hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
- * </td>
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
- * <tr>
+ * <tr>
* <td>minutes</td>
* <td>Integer</td>
* <td>The minute. Minvalue="0", maxvalue="59".</td>
@@ -68,91 +68,110 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 1.0
*/
public class StartTime extends RPCStruct {
- public static final String KEY_MINUTES = "minutes";
- public static final String KEY_SECONDS = "seconds";
- public static final String KEY_HOURS = "hours";
+ public static final String KEY_MINUTES = "minutes";
+ public static final String KEY_SECONDS = "seconds";
+ public static final String KEY_HOURS = "hours";
+
+ /**
+ * Constructs a newly allocated StartTime object
+ */
+ public StartTime() {
+ }
- /**
- * Constructs a newly allocated StartTime object
- */
- public StartTime() { }
/**
* Constructs a newly allocated StartTime object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public StartTime(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a newly allocated StartTime object
- * @param timeInterval time interval in seconds
- */
- public StartTime(@NonNull Integer timeInterval){
- this();
- int hours = timeInterval / 3600;
- int minutes = (timeInterval % 3600) / 60;
- int seconds = timeInterval % 60;
- setHours(hours);
- setMinutes(minutes);
- setSeconds(seconds);
- }
- /**
- * Constructs a newly allocated StartTime object
- * @param hours The hour
- * @param minutes The minute
- * @param seconds The second
- */
- public StartTime(@NonNull Integer hours, @NonNull Integer minutes, @NonNull Integer seconds){
- this();
- setHours(hours);
- setMinutes(minutes);
- setSeconds(seconds);
- }
+ /**
+ * Constructs a newly allocated StartTime object
+ *
+ * @param timeInterval time interval in seconds
+ */
+ public StartTime(@NonNull Integer timeInterval) {
+ this();
+ int hours = timeInterval / 3600;
+ int minutes = (timeInterval % 3600) / 60;
+ int seconds = timeInterval % 60;
+ setHours(hours);
+ setMinutes(minutes);
+ setSeconds(seconds);
+ }
+
+ /**
+ * Constructs a newly allocated StartTime object
+ *
+ * @param hours The hour
+ * @param minutes The minute
+ * @param seconds The second
+ */
+ public StartTime(@NonNull Integer hours, @NonNull Integer minutes, @NonNull Integer seconds) {
+ this();
+ setHours(hours);
+ setMinutes(minutes);
+ setSeconds(seconds);
+ }
+
/**
* Get the hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
+ *
* @return hours Minvalue="0", maxvalue="59"
- */
+ */
public Integer getHours() {
- return getInteger( KEY_HOURS );
+ return getInteger(KEY_HOURS);
}
+
/**
* Set the hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
+ *
* @param hours min: 0; max: 59
*/
public StartTime setHours(@NonNull Integer hours) {
setValue(KEY_HOURS, hours);
return this;
}
+
/**
* Get the minute. Minvalue="0", maxvalue="59".
+ *
* @return minutes Minvalue="0", maxvalue="59"
- */
+ */
public Integer getMinutes() {
- return getInteger( KEY_MINUTES );
+ return getInteger(KEY_MINUTES);
}
+
/**
* Set the minute. Minvalue="0", maxvalue="59".
+ *
* @param minutes min: 0; max: 59
*/
public StartTime setMinutes(@NonNull Integer minutes) {
setValue(KEY_MINUTES, minutes);
return this;
}
+
/**
* Get the second. Minvalue="0", maxvalue="59".
+ *
* @return seconds. Minvalue="0", maxvalue="59".
- */
+ */
public Integer getSeconds() {
- return getInteger( KEY_SECONDS );
+ return getInteger(KEY_SECONDS);
}
+
/**
* Set the second. Minvalue="0", maxvalue="59".
+ *
* @param seconds min: 0 max: 59
*/
public StartTime setSeconds(@NonNull Integer seconds) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/StationIDNumber.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/StationIDNumber.java
index fd0365e66..e96e88061 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/StationIDNumber.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/StationIDNumber.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,52 +36,52 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
public class StationIDNumber extends RPCStruct {
- public static final String KEY_COUNTRY_CODE = "countryCode";
- public static final String KEY_FCC_FACILITY_ID = "fccFacilityId";
+ public static final String KEY_COUNTRY_CODE = "countryCode";
+ public static final String KEY_FCC_FACILITY_ID = "fccFacilityId";
- public StationIDNumber() {
- }
+ public StationIDNumber() {
+ }
- public StationIDNumber(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public StationIDNumber(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Sets the countryCode portion of the StationIDNumber class
- *
- * @param countryCode Binary Representation of ITU Country Code. USA Code is 001.
- */
- public StationIDNumber setCountryCode( Integer countryCode) {
+ /**
+ * Sets the countryCode portion of the StationIDNumber class
+ *
+ * @param countryCode Binary Representation of ITU Country Code. USA Code is 001.
+ */
+ public StationIDNumber setCountryCode(Integer countryCode) {
setValue(KEY_COUNTRY_CODE, countryCode);
return this;
}
- /**
- * Gets the countryCode portion of the StationIDNumber class
- *
- * @return Integer - Binary Representation of ITU Country Code. USA Code is 001.
- */
- public Integer getCountryCode() {
- return getInteger(KEY_COUNTRY_CODE);
- }
+ /**
+ * Gets the countryCode portion of the StationIDNumber class
+ *
+ * @return Integer - Binary Representation of ITU Country Code. USA Code is 001.
+ */
+ public Integer getCountryCode() {
+ return getInteger(KEY_COUNTRY_CODE);
+ }
- /**
- * Sets the fccFacilityId portion of the StationIDNumber class
- *
- * @param fccFacilityId Binary representation of unique facility ID assigned by the FCC; FCC controlled for U.S. territory.
- */
- public StationIDNumber setFccFacilityId( Integer fccFacilityId) {
+ /**
+ * Sets the fccFacilityId portion of the StationIDNumber class
+ *
+ * @param fccFacilityId Binary representation of unique facility ID assigned by the FCC; FCC controlled for U.S. territory.
+ */
+ public StationIDNumber setFccFacilityId(Integer fccFacilityId) {
setValue(KEY_FCC_FACILITY_ID, fccFacilityId);
return this;
}
- /**
- * Gets the fccFacilityId portion of the StationIDNumber class
- *
- * @return Integer - Binary representation of unique facility ID assigned by the FCC; FCC controlled for U.S. territory.
- */
- public Integer getFccFacilityId() {
- return getInteger(KEY_FCC_FACILITY_ID);
- }
+ /**
+ * Gets the fccFacilityId portion of the StationIDNumber class
+ *
+ * @return Integer - Binary representation of unique facility ID assigned by the FCC; FCC controlled for U.S. territory.
+ */
+ public Integer getFccFacilityId() {
+ return getInteger(KEY_FCC_FACILITY_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
index 171c4b18e..2c99a035a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,7 +40,7 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import java.util.Hashtable;
/**
- *<p> Establishes a subscription to button notifications for HMI buttons. Buttons
+ * <p> Establishes a subscription to button notifications for HMI buttons. Buttons
* are not necessarily physical buttons, but can also be "soft" buttons on a
* touch screen, depending on the display in the vehicle. Once subscribed to a
* particular button, an application will receive both
@@ -48,12 +48,12 @@ import java.util.Hashtable;
* whenever that button is pressed. The application may also unsubscribe from
* notifications for a button by invoking the {@linkplain UnsubscribeButton}
* operation</p>
- *
+ *
* <p>When a button is depressed, an {@linkplain OnButtonEvent} notification is
* sent to the application with a ButtonEventMode of BUTTONDOWN. When that same
* button is released, an {@linkplain OnButtonEvent} notification is sent to the
* application with a ButtonEventMode of BUTTONUP</p>
- *
+ *
* <p>When the duration of a button depression (that is, time between depression
* and release) is less than two seconds, an {@linkplain OnButtonPress}
* notification is sent to the application (at the moment the button is
@@ -61,30 +61,30 @@ import java.util.Hashtable;
* seconds, an {@linkplain OnButtonPress} notification is sent to the
* application (at the moment the two seconds have elapsed) with a
* ButtonPressMode of LONG</p>
- *
+ * <p>
* The purpose of {@linkplain OnButtonPress} notifications is to allow for
* programmatic detection of long button presses similar to those used to store
* presets while listening to the radio, for example
- *
+ *
* <p>When a button is depressed and released, the sequence in which notifications
* will be sent to the application is as follows:</p>
- *
+ *
* <p>For short presses:</p>
* <ul>
* <li>OnButtonEvent (ButtonEventMode = BUTTONDOWN)</li>
* <li>OnButtonEvent (ButtonEventMode = BUTTONUP)</li>
* <li>OnButtonPress (ButtonPressMode = SHORT)</li>
* </ul>
- *
+ *
* <p>For long presses:</p>
* <ul>
* <li>OnButtonEvent (ButtonEventMode = BUTTONDOWN)</li>
* <li>OnButtonEvent (ButtonEventMode = BUTTONUP)</li>
* <li>OnButtonPress (ButtonPressMode = LONG)</li>
* </ul>
- *
- *<p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
+ * <p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -104,48 +104,54 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0 </td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
+ *
* @see UnsubscribeButton
+ * @since SmartDeviceLink 1.0
*/
public class SubscribeButton extends RPCRequest {
- public static final String KEY_BUTTON_NAME = "buttonName";
+ public static final String KEY_BUTTON_NAME = "buttonName";
- /**
- * Constructs a new SubscribeButton object
- */
+ /**
+ * Constructs a new SubscribeButton object
+ */
public SubscribeButton() {
super(FunctionID.SUBSCRIBE_BUTTON.toString());
}
- /**
- * <p>Constructs a new SubscribeButton object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a new SubscribeButton object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public SubscribeButton(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SubscribeButton object
- * @param buttonName Name of the button to subscribe.
- */
- public SubscribeButton(@NonNull ButtonName buttonName){
- this();
- setButtonName(buttonName);
- }
- /**
- * Gets the name of the button to subscribe to
- * @return ButtonName -an enum value, see <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
- */
+ /**
+ * Constructs a new SubscribeButton object
+ *
+ * @param buttonName Name of the button to subscribe.
+ */
+ public SubscribeButton(@NonNull ButtonName buttonName) {
+ this();
+ setButtonName(buttonName);
+ }
+
+ /**
+ * Gets the name of the button to subscribe to
+ *
+ * @return ButtonName -an enum value, see <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
+ */
public ButtonName getButtonName() {
- return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
+ return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
}
- /**
- * Sets a name of the button to subscribe to
- * @param buttonName a <i>{@linkplain ButtonName}</i> value
- */
+
+ /**
+ * Sets a name of the button to subscribe to
+ *
+ * @param buttonName a <i>{@linkplain ButtonName}</i> value
+ */
public SubscribeButton setButtonName(@NonNull ButtonName buttonName) {
setParameters(KEY_BUTTON_NAME, buttonName);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
index 1ffa58e57..fe1cbdd92 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.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 androidx.annotation.NonNull;
@@ -41,37 +41,37 @@ import java.util.Hashtable;
/**
* Sub scribeButton Response is sent, when SubscribeButton has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class SubscribeButtonResponse extends RPCResponse {
- /**
- * Constructs a new SubscribeButtonResponse object
- */
+ /**
+ * Constructs a new SubscribeButtonResponse object
+ */
public SubscribeButtonResponse() {
super(FunctionID.SUBSCRIBE_BUTTON.toString());
}
- /**
- * <p>Constructs a new SubscribeButtonResponse object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new SubscribeButtonResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public SubscribeButtonResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SubscribeButtonResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SubscribeButtonResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SubscribeButtonResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SubscribeButtonResponse(@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/SubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index 437b42de7..99e881202 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,11 +42,11 @@ import java.util.Hashtable;
* onVehicleData notification whenever new data is available. The update rate is
* very much dependent on sensors, vehicle architecture and vehicle type. Be
* also prepared for the situation that a signal is not available on a vehicle
- *
+ *
* <p>Function Group: Location, VehicleInfo and DrivingChara</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -275,16 +275,16 @@ import java.util.Hashtable;
* <td>turnSignal</td>
* <td>Boolean</td>
* <td>@see TurnSignal</td>
- * <td>N</td>
- * <td>Subscribable</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
* <td>SmartDeviceLink 5.0 </td>
* </tr>
* <tr>
* <td>cloudAppVehicleID</td>
* <td>Boolean</td>
* <td>ID for the vehicle when connecting to cloud applications</td>
- * <td>N</td>
- * <td>Subscribable</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
* <td>SmartDeviceLink 5.1 </td>
* </tr>
* <tr>
@@ -309,168 +309,163 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
* </table>
- *
+ *
* <p> <b>Response</b></p>
- *<p><b>Non-default Result Codes:</b></p>
- *<p>SUCCESS</p>
- *<p>WARNINGS </p>
- *<p>INVALID_DATA</p>
- * <p>OUT_OF_MEMORY</p>
- * <p>TOO_MANY_PENDING_REQUESTS</p>
- * <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR</p>
- * <p>IGNORED </p>
- * <p>DISALLOWED</p>
- * <p>USER_DISALLOWED </p>
- *
- * @since SmartDeviceLink 2.0
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>WARNINGS </p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>IGNORED </p>
+ * <p>DISALLOWED</p>
+ * <p>USER_DISALLOWED </p>
+ *
* @see UnsubscribeVehicleData
* @see GetVehicleData
+ * @since SmartDeviceLink 2.0
*/
public class SubscribeVehicleData extends RPCRequest {
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_SPEED = "speed";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
- public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
- public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
- public static final String KEY_WINDOW_STATUS = "windowStatus";
- public static final String KEY_GEAR_STATUS = "gearStatus";
- /**
- * @deprecated
- */
- @Deprecated
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
- /**
- * @deprecated
- */
- @Deprecated
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
+ public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
+ public static final String KEY_WINDOW_STATUS = "windowStatus";
+ public static final String KEY_GEAR_STATUS = "gearStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new SubscribeVehicleData object
- */
+ /**
+ * Constructs a new SubscribeVehicleData object
+ */
public SubscribeVehicleData() {
super(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString());
}
- /**
- * <p>Constructs a new SubscribeVehicleData object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * <p>Constructs a new SubscribeVehicleData object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public SubscribeVehicleData(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Sets a boolean value. If true, subscribes Gps data
- *
- * @param gps
- * a boolean value
- */
- public SubscribeVehicleData setGps( Boolean gps) {
+ /**
+ * Sets a boolean value. If true, subscribes Gps data
+ *
+ * @param gps a boolean value
+ */
+ public SubscribeVehicleData setGps(Boolean gps) {
setParameters(KEY_GPS, gps);
return this;
}
- /**
- * Gets a boolean value. If true, means the Gps data has been subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Gps data has been
- * subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Gps data has been subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Gps data has been
+ * subscribed.
+ */
public Boolean getGps() {
return getBoolean(KEY_GPS);
}
- /**
- * Sets a boolean value. If true, subscribes speed data
- *
- * @param speed
- * a boolean value
- */
- public SubscribeVehicleData setSpeed( Boolean speed) {
+ /**
+ * Sets a boolean value. If true, subscribes speed data
+ *
+ * @param speed a boolean value
+ */
+ public SubscribeVehicleData setSpeed(Boolean speed) {
setParameters(KEY_SPEED, speed);
return this;
}
- /**
- * Gets a boolean value. If true, means the Speed data has been subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Speed data has been
- * subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Speed data has been subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Speed data has been
+ * subscribed.
+ */
public Boolean getSpeed() {
return getBoolean(KEY_SPEED);
}
- /**
- * Sets a boolean value. If true, subscribes rpm data
- *
- * @param rpm
- * a boolean value
- */
- public SubscribeVehicleData setRpm( Boolean rpm) {
+ /**
+ * Sets a boolean value. If true, subscribes rpm data
+ *
+ * @param rpm a boolean value
+ */
+ public SubscribeVehicleData setRpm(Boolean rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
- /**
- * Gets a boolean value. If true, means the rpm data has been subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the rpm data has been
- * subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the rpm data has been subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the rpm data has been
+ * subscribed.
+ */
public Boolean getRpm() {
return getBoolean(KEY_RPM);
}
- /**
- * Sets the fuelLevel.
- *
- * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
- */
- @Deprecated
- public SubscribeVehicleData setFuelLevel( Boolean fuelLevel) {
+ /**
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
+ public SubscribeVehicleData setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
- /**
- * Gets the fuelLevel.
- *
- * @return Float The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
- */
- @Deprecated
+ /**
+ * Gets the fuelLevel.
+ *
+ * @return Float The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public Boolean getFuelLevel() {
return getBoolean(KEY_FUEL_LEVEL);
}
@@ -478,11 +473,10 @@ public class SubscribeVehicleData extends RPCRequest {
/**
* Sets a boolean value. If true, subscribes fuelLevelState data
*
- * @param fuelLevelState
- * a boolean value
+ * @param fuelLevelState a boolean value
*/
@Deprecated
- public SubscribeVehicleData setFuelLevelState( Boolean fuelLevelState) {
+ public SubscribeVehicleData setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
@@ -490,55 +484,53 @@ public class SubscribeVehicleData extends RPCRequest {
/**
* Gets a boolean value. If true, means the fuelLevelState data has been
* subscribed.
- *
+ *
* @return Boolean -a Boolean value. If true, means the fuelLevelState data
- * has been subscribed.
+ * has been subscribed.
*/
- @Deprecated
- public Boolean getFuelLevelState() {
+ @Deprecated
+ public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
- /**
- * Sets a boolean value. If true, subscribes instantFuelConsumption data
- *
- * @param instantFuelConsumption
- * a boolean value
- */
- public SubscribeVehicleData setInstantFuelConsumption( Boolean instantFuelConsumption) {
+ /**
+ * Sets a boolean value. If true, subscribes instantFuelConsumption data
+ *
+ * @param instantFuelConsumption a boolean value
+ */
+ public SubscribeVehicleData setInstantFuelConsumption(Boolean instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
- /**
- * Gets a boolean value. If true, means the getInstantFuelConsumption data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the getInstantFuelConsumption data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the getInstantFuelConsumption data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the getInstantFuelConsumption data
+ * has been subscribed.
+ */
public Boolean getInstantFuelConsumption() {
return getBoolean(KEY_INSTANT_FUEL_CONSUMPTION);
}
- /**
- * Sets a boolean value. If true, subscribes externalTemperature data
- *
- * @param externalTemperature
- * a boolean value
- */
- public SubscribeVehicleData setExternalTemperature( Boolean externalTemperature) {
+ /**
+ * Sets a boolean value. If true, subscribes externalTemperature data
+ *
+ * @param externalTemperature a boolean value
+ */
+ public SubscribeVehicleData setExternalTemperature(Boolean externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
- /**
- * Gets a boolean value. If true, means the externalTemperature data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the externalTemperature data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the externalTemperature data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the externalTemperature data
+ * has been subscribed.
+ */
public Boolean getExternalTemperature() {
return getBoolean(KEY_EXTERNAL_TEMPERATURE);
}
@@ -549,7 +541,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleData setGearStatus( Boolean gearStatus) {
+ public SubscribeVehicleData setGearStatus(Boolean gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -571,7 +563,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public SubscribeVehicleData setPrndl( Boolean prndl) {
+ public SubscribeVehicleData setPrndl(Boolean prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
@@ -587,381 +579,390 @@ public class SubscribeVehicleData extends RPCRequest {
return getBoolean(KEY_PRNDL);
}
- /**
- * Sets a boolean value. If true, subscribes tire pressure status data
- *
- * @param tirePressure
- * a boolean value
- */
- public SubscribeVehicleData setTirePressure( Boolean tirePressure) {
+ /**
+ * Sets a boolean value. If true, subscribes tire pressure status data
+ *
+ * @param tirePressure a boolean value
+ */
+ public SubscribeVehicleData setTirePressure(Boolean tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
- /**
- * Gets a boolean value. If true, means the tire pressure status data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the tire pressure status data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the tire pressure status data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the tire pressure status data
+ * has been subscribed.
+ */
public Boolean getTirePressure() {
return getBoolean(KEY_TIRE_PRESSURE);
}
- /**
- * Sets a boolean value. If true, subscribes odometer data
- *
- * @param odometer
- * a boolean value
- */
- public SubscribeVehicleData setOdometer( Boolean odometer) {
+ /**
+ * Sets a boolean value. If true, subscribes odometer data
+ *
+ * @param odometer a boolean value
+ */
+ public SubscribeVehicleData setOdometer(Boolean odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
- /**
- * Gets a boolean value. If true, means the odometer data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the odometer data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the odometer data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the odometer data
+ * has been subscribed.
+ */
public Boolean getOdometer() {
return getBoolean(KEY_ODOMETER);
}
- /**
- * Sets a boolean value. If true, subscribes belt Status data
- *
- * @param beltStatus
- * a boolean value
- */
- public SubscribeVehicleData setBeltStatus( Boolean beltStatus) {
+ /**
+ * Sets a boolean value. If true, subscribes belt Status data
+ *
+ * @param beltStatus a boolean value
+ */
+ public SubscribeVehicleData setBeltStatus(Boolean beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the belt Status data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the belt Status data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the belt Status data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the belt Status data
+ * has been subscribed.
+ */
public Boolean getBeltStatus() {
return getBoolean(KEY_BELT_STATUS);
}
- /**
- * Sets a boolean value. If true, subscribes body Information data
- *
- * @param bodyInformation
- * a boolean value
- */
- public SubscribeVehicleData setBodyInformation( Boolean bodyInformation) {
+ /**
+ * Sets a boolean value. If true, subscribes body Information data
+ *
+ * @param bodyInformation a boolean value
+ */
+ public SubscribeVehicleData setBodyInformation(Boolean bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
- /**
- * Gets a boolean value. If true, means the body Information data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the body Information data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the body Information data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the body Information data
+ * has been subscribed.
+ */
public Boolean getBodyInformation() {
return getBoolean(KEY_BODY_INFORMATION);
}
- /**
- * Sets a boolean value. If true, subscribes device Status data
- *
- * @param deviceStatus
- * a boolean value
- */
- public SubscribeVehicleData setDeviceStatus( Boolean deviceStatus) {
+ /**
+ * Sets a boolean value. If true, subscribes device Status data
+ *
+ * @param deviceStatus a boolean value
+ */
+ public SubscribeVehicleData setDeviceStatus(Boolean deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the device Status data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the device Status data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the device Status data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the device Status data
+ * has been subscribed.
+ */
public Boolean getDeviceStatus() {
return getBoolean(KEY_DEVICE_STATUS);
}
- /**
- * Sets a boolean value. If true, subscribes driver Braking data
- *
- * @param driverBraking
- * a boolean value
- */
- public SubscribeVehicleData setDriverBraking( Boolean driverBraking) {
+ /**
+ * Sets a boolean value. If true, subscribes driver Braking data
+ *
+ * @param driverBraking a boolean value
+ */
+ public SubscribeVehicleData setDriverBraking(Boolean driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
- /**
- * Gets a boolean value. If true, means the driver Braking data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the driver Braking data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the driver Braking data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the driver Braking data
+ * has been subscribed.
+ */
public Boolean getDriverBraking() {
return getBoolean(KEY_DRIVER_BRAKING);
}
- /**
- * Sets a boolean value. If true, subscribes wiper Status data
- *
- * @param wiperStatus
- * a boolean value
- */
- public SubscribeVehicleData setWiperStatus( Boolean wiperStatus) {
+ /**
+ * Sets a boolean value. If true, subscribes wiper Status data
+ *
+ * @param wiperStatus a boolean value
+ */
+ public SubscribeVehicleData setWiperStatus(Boolean wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the wiper Status data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the wiper Status data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the wiper Status data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the wiper Status data
+ * has been subscribed.
+ */
public Boolean getWiperStatus() {
return getBoolean(KEY_WIPER_STATUS);
}
- /**
- * Sets a boolean value. If true, subscribes Head Lamp Status data
- *
- * @param headLampStatus
- * a boolean value
- */
- public SubscribeVehicleData setHeadLampStatus( Boolean headLampStatus) {
+ /**
+ * Sets a boolean value. If true, subscribes Head Lamp Status data
+ *
+ * @param headLampStatus a boolean value
+ */
+ public SubscribeVehicleData setHeadLampStatus(Boolean headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the Head Lamp Status data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Head Lamp Status data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Head Lamp Status data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Head Lamp Status data
+ * has been subscribed.
+ */
public Boolean getHeadLampStatus() {
return getBoolean(KEY_HEAD_LAMP_STATUS);
}
- /**
- * Sets a boolean value. If true, subscribes Engine Torque data
- *
- * @param engineTorque
- * a boolean value
- */
- public SubscribeVehicleData setEngineTorque( Boolean engineTorque) {
+ /**
+ * Sets a boolean value. If true, subscribes Engine Torque data
+ *
+ * @param engineTorque a boolean value
+ */
+ public SubscribeVehicleData setEngineTorque(Boolean engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
- /**
- * Gets a boolean value. If true, means the Engine Oil Life data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Engine Oil Life data
- * has been subscribed.
- */
- public Boolean getEngineOilLife() {
- return getBoolean(KEY_ENGINE_OIL_LIFE);
- }
-
- /**
- * Sets a boolean value. If true, subscribes Engine Oil Life data
- *
- * @param engineOilLife
- * a boolean value
- */
- public SubscribeVehicleData setEngineOilLife( Boolean engineOilLife) {
+ /**
+ * Gets a boolean value. If true, means the Engine Oil Life data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Engine Oil Life data
+ * has been subscribed.
+ */
+ public Boolean getEngineOilLife() {
+ return getBoolean(KEY_ENGINE_OIL_LIFE);
+ }
+
+ /**
+ * Sets a boolean value. If true, subscribes Engine Oil Life data
+ *
+ * @param engineOilLife a boolean value
+ */
+ public SubscribeVehicleData setEngineOilLife(Boolean engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
- /**
- * Gets a boolean value. If true, means the Engine Torque data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Engine Torque data
- * has been subscribed.
- */
- public Boolean getEngineTorque() {
- return getBoolean(KEY_ENGINE_TORQUE);
- }
-
- /**
- * Sets a boolean value. If true, subscribes accPedalPosition data
- *
- * @param accPedalPosition
- * a boolean value
- */
- public SubscribeVehicleData setAccPedalPosition( Boolean accPedalPosition) {
+ /**
+ * Gets a boolean value. If true, means the Engine Torque data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Engine Torque data
+ * has been subscribed.
+ */
+ public Boolean getEngineTorque() {
+ return getBoolean(KEY_ENGINE_TORQUE);
+ }
+
+ /**
+ * Sets a boolean value. If true, subscribes accPedalPosition data
+ *
+ * @param accPedalPosition a boolean value
+ */
+ public SubscribeVehicleData setAccPedalPosition(Boolean accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
- /**
- * Gets a boolean value. If true, means the accPedalPosition data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the accPedalPosition data
- * has been subscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the accPedalPosition data has been
+ * subscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the accPedalPosition data
+ * has been subscribed.
+ */
public Boolean getAccPedalPosition() {
return getBoolean(KEY_ACC_PEDAL_POSITION);
}
-
- public SubscribeVehicleData setSteeringWheelAngle( Boolean steeringWheelAngle) {
+
+ public SubscribeVehicleData setSteeringWheelAngle(Boolean steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
public Boolean getSteeringWheelAngle() {
return getBoolean(KEY_STEERING_WHEEL_ANGLE);
- }
- public SubscribeVehicleData setECallInfo( Boolean eCallInfo) {
+ }
+
+ public SubscribeVehicleData setECallInfo(Boolean eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public Boolean getECallInfo() {
return getBoolean(KEY_E_CALL_INFO);
}
- public SubscribeVehicleData setAirbagStatus( Boolean airbagStatus) {
+
+ public SubscribeVehicleData setAirbagStatus(Boolean airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public Boolean getAirbagStatus() {
return getBoolean(KEY_AIRBAG_STATUS);
}
- public SubscribeVehicleData setEmergencyEvent( Boolean emergencyEvent) {
+
+ public SubscribeVehicleData setEmergencyEvent(Boolean emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public Boolean getEmergencyEvent() {
return getBoolean(KEY_EMERGENCY_EVENT);
}
- public SubscribeVehicleData setClusterModeStatus( Boolean clusterModeStatus) {
+
+ public SubscribeVehicleData setClusterModeStatus(Boolean clusterModeStatus) {
setParameters(KEY_CLUSTER_MODE_STATUS, clusterModeStatus);
return this;
}
+
public Boolean getClusterModeStatus() {
return getBoolean(KEY_CLUSTER_MODE_STATUS);
}
- public SubscribeVehicleData setMyKey( Boolean myKey) {
+
+ public SubscribeVehicleData setMyKey(Boolean myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public Boolean getMyKey() {
return getBoolean(KEY_MY_KEY);
}
- /**
- * Sets the fuelRange.
- *
- * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
- * @since SmartDeviceLink 5.0.0
- */
- public SubscribeVehicleData setFuelRange( Boolean fuelRange) {
+ /**
+ * Sets the fuelRange.
+ *
+ * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
+ public SubscribeVehicleData setFuelRange(Boolean fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
- /**
- * Gets the fuelRange.
- *
- * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
- * @since SmartDeviceLink 5.0.0
- */
- public Boolean getFuelRange() {
- return getBoolean(KEY_FUEL_RANGE);
- }
-
- /**
- * Sets a boolean value. If true, subscribes turnSignal data
- * @param turnSignal a boolean value
- */
- public SubscribeVehicleData setTurnSignal( Boolean turnSignal) {
+ /**
+ * Gets the fuelRange.
+ *
+ * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
+ public Boolean getFuelRange() {
+ return getBoolean(KEY_FUEL_RANGE);
+ }
+
+ /**
+ * Sets a boolean value. If true, subscribes turnSignal data
+ *
+ * @param turnSignal a boolean value
+ */
+ public SubscribeVehicleData setTurnSignal(Boolean turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
- /**
- * Gets a boolean value. If true, means the turnSignal data has been subscribed.
- * @return a Boolean value.
- */
- public Boolean getTurnSignal() { return getBoolean(KEY_TURN_SIGNAL); }
+ /**
+ * Gets a boolean value. If true, means the turnSignal data has been subscribed.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getTurnSignal() {
+ return getBoolean(KEY_TURN_SIGNAL);
+ }
- /**
- * Sets a boolean value. If true, subscribes electronicParkBrakeStatus data
- * @param electronicParkBrakeStatus a boolean value
- */
- public SubscribeVehicleData setElectronicParkBrakeStatus( boolean electronicParkBrakeStatus) {
+ /**
+ * Sets a boolean value. If true, subscribes electronicParkBrakeStatus data
+ *
+ * @param electronicParkBrakeStatus a boolean value
+ */
+ public SubscribeVehicleData setElectronicParkBrakeStatus(boolean electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the electronicParkBrakeStatus data has been subscribed.
- * @return a Boolean value.
- */
- public Boolean getElectronicParkBrakeStatus(){
- return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
- }
+ /**
+ * Gets a boolean value. If true, means the electronicParkBrakeStatus data has been subscribed.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getElectronicParkBrakeStatus() {
+ return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
+ }
- /**
- * Sets a boolean value. If true, subscribes cloudAppVehicleID data
- * @param cloudAppVehicleID a boolean value
- */
- public SubscribeVehicleData setCloudAppVehicleID( boolean cloudAppVehicleID) {
+ /**
+ * Sets a boolean value. If true, subscribes cloudAppVehicleID data
+ *
+ * @param cloudAppVehicleID a boolean value
+ */
+ public SubscribeVehicleData setCloudAppVehicleID(boolean cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
- /**
- * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been subscribed.
- * @return a Boolean value.
- */
- 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 SubscribeVehicleData setOEMCustomVehicleData( String vehicleDataName, Boolean vehicleDataState) {
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been subscribed.
+ *
+ * @return a Boolean value.
+ */
+ 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 SubscribeVehicleData setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
- /**
- * Gets a boolean value for OEM Custom VehicleData.
- * @return a Boolean value.
- */
- public Boolean getOEMCustomVehicleData(String vehicleDataName){
- return getBoolean(vehicleDataName);
- }
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName) {
+ return getBoolean(vehicleDataName);
+ }
/**
* Sets the windowStatus.
@@ -969,7 +970,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleData setWindowStatus( Boolean windowStatus) {
+ public SubscribeVehicleData setWindowStatus(Boolean windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -990,7 +991,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleData setHandsOffSteering( Boolean handsOffSteering) {
+ public SubscribeVehicleData setHandsOffSteering(Boolean handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -1021,7 +1022,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleData setStabilityControlsStatus( Boolean stabilityControlsStatus) {
+ public SubscribeVehicleData setStabilityControlsStatus(Boolean stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
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 b54d21491..9d82940d5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,37 +41,38 @@ import java.util.Hashtable;
/**
* Subscribe Vehicle Data Response is sent, when SubscribeVehicleData has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class SubscribeVehicleDataResponse extends RPCResponse {
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- @Deprecated public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ @Deprecated
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
public static final String KEY_CLUSTER_MODES = "clusterModes";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_GEAR_STATUS = "gearStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
@@ -88,89 +89,104 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new SubscribeVehicleDataResponse object
- */
+ /**
+ * Constructs a new SubscribeVehicleDataResponse object
+ */
public SubscribeVehicleDataResponse() {
super(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString());
}
- /**
- * <p>Constructs a new SubscribeVehicleDataResponse object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new SubscribeVehicleDataResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public SubscribeVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SubscribeVehicleDataResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+
+ /**
+ * Constructs a new SubscribeVehicleDataResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
/**
* Sets Gps
+ *
* @param gps a VehicleDataResult related to GPS
*/
- public SubscribeVehicleDataResponse setGps( VehicleDataResult gps) {
+ public SubscribeVehicleDataResponse setGps(VehicleDataResult gps) {
setParameters(KEY_GPS, gps);
return this;
}
+
/**
* Gets Gps
+ *
* @return a VehicleDataResult related to GPS
*/
public VehicleDataResult getGps() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_GPS);
}
+
/**
* Sets Speed
+ *
* @param speed a VehicleDataResult related to speed
*/
- public SubscribeVehicleDataResponse setSpeed( VehicleDataResult speed) {
+ public SubscribeVehicleDataResponse setSpeed(VehicleDataResult speed) {
setParameters(KEY_SPEED, speed);
return this;
}
+
/**
* Gets Speed
+ *
* @return a VehicleDataResult related to speed
*/
public VehicleDataResult getSpeed() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_SPEED);
}
+
/**
* Sets rpm
+ *
* @param rpm a VehicleDataResult related to RPM
*/
- public SubscribeVehicleDataResponse setRpm( VehicleDataResult rpm) {
+ public SubscribeVehicleDataResponse setRpm(VehicleDataResult rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
+
/**
* Gets rpm
+ *
* @return a VehicleDataResult related to RPM
*/
public VehicleDataResult getRpm() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_RPM);
}
+
/**
* Sets the fuelLevel.
*
* @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
+ * 7.0, please see fuelRange.
*/
@Deprecated
- public SubscribeVehicleDataResponse setFuelLevel( VehicleDataResult fuelLevel) {
+ public SubscribeVehicleDataResponse setFuelLevel(VehicleDataResult fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
+
/**
* Gets the fuelLevel.
*
@@ -181,53 +197,66 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getFuelLevel() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL);
}
+
/**
* Sets Fuel Level State
+ *
* @param fuelLevelState a VehicleDataResult related to FuelLevel State
*/
@Deprecated
- public SubscribeVehicleDataResponse setFuelLevelState( VehicleDataResult fuelLevelState) {
+ public SubscribeVehicleDataResponse setFuelLevelState(VehicleDataResult fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
+
/**
* Gets Fuel Level State
+ *
* @return a VehicleDataResult related to FuelLevel State
*/
@Deprecated
public VehicleDataResult getFuelLevelState() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL_STATE);
}
+
/**
* Sets Instant Fuel Consumption
+ *
* @param instantFuelConsumption a VehicleDataResult related to instant fuel consumption
*/
- public SubscribeVehicleDataResponse setInstantFuelConsumption( VehicleDataResult instantFuelConsumption) {
+ public SubscribeVehicleDataResponse setInstantFuelConsumption(VehicleDataResult instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
+
/**
* Gets Instant Fuel Consumption
+ *
* @return a VehicleDataResult related to instant fuel consumption
*/
public VehicleDataResult getInstantFuelConsumption() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_INSTANT_FUEL_CONSUMPTION);
}
+
/**
* Sets External Temperature
+ *
* @param externalTemperature a VehicleDataResult related to external temperature
*/
- public SubscribeVehicleDataResponse setExternalTemperature( VehicleDataResult externalTemperature) {
+ public SubscribeVehicleDataResponse setExternalTemperature(VehicleDataResult externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
+
/**
* Gets External Temperature
+ *
* @return a VehicleDataResult related to external temperature
*/
public VehicleDataResult getExternalTemperature() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_EXTERNAL_TEMPERATURE);
}
+
/**
* Sets the prndl.
*
@@ -235,10 +264,11 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public SubscribeVehicleDataResponse setPrndl( VehicleDataResult prndl) {
+ public SubscribeVehicleDataResponse setPrndl(VehicleDataResult prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
+
/**
* Gets the prndl.
*
@@ -249,173 +279,217 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getPrndl() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_PRNDL);
}
+
/**
* Sets Tire Pressure
+ *
* @param tirePressure a VehicleDataResult related to tire pressure
*/
- public SubscribeVehicleDataResponse setTirePressure( VehicleDataResult tirePressure) {
+ public SubscribeVehicleDataResponse setTirePressure(VehicleDataResult tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
+
/**
* Gets Tire Pressure
+ *
* @return a VehicleDataResult related to tire pressure
*/
public VehicleDataResult getTirePressure() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_TIRE_PRESSURE);
}
+
/**
* Sets Odometer
+ *
* @param odometer a VehicleDataResult related to the odometer
*/
- public SubscribeVehicleDataResponse setOdometer( VehicleDataResult odometer) {
+ public SubscribeVehicleDataResponse setOdometer(VehicleDataResult odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
+
/**
* Gets Odometer
+ *
* @return a VehicleDataResult related to the odometer
*/
public VehicleDataResult getOdometer() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ODOMETER);
}
+
/**
* Sets Belt Status
+ *
* @param beltStatus a VehicleDataResult related to the seat belt status
*/
- public SubscribeVehicleDataResponse setBeltStatus( VehicleDataResult beltStatus) {
+ public SubscribeVehicleDataResponse setBeltStatus(VehicleDataResult beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
+
/**
* Gets Belt Status
+ *
* @return a VehicleDataResult related to the seat belt status
*/
public VehicleDataResult getBeltStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_BELT_STATUS);
}
+
/**
* Sets Body Information
+ *
* @param bodyInformation a VehicleDataResult related to the body info
*/
- public SubscribeVehicleDataResponse setBodyInformation( VehicleDataResult bodyInformation) {
+ public SubscribeVehicleDataResponse setBodyInformation(VehicleDataResult bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
+
/**
* Gets Body Information
+ *
* @return a VehicleDataResult related to the body info
*/
public VehicleDataResult getBodyInformation() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_BODY_INFORMATION);
}
+
/**
* Sets Device Status
+ *
* @param deviceStatus a VehicleDataResult related to the device status of the connected device
*/
- public SubscribeVehicleDataResponse setDeviceStatus( VehicleDataResult deviceStatus) {
+ public SubscribeVehicleDataResponse setDeviceStatus(VehicleDataResult deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
+
/**
* Gets Device Status
+ *
* @return a VehicleDataResult related to the device status of the connected device
*/
public VehicleDataResult getDeviceStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_DEVICE_STATUS);
}
+
/**
* Sets Driver Braking
+ *
* @param driverBraking a VehicleDataResult related to the driver breaking status
*/
- public SubscribeVehicleDataResponse setDriverBraking( VehicleDataResult driverBraking) {
+ public SubscribeVehicleDataResponse setDriverBraking(VehicleDataResult driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
+
/**
* Gets Driver Braking
+ *
* @return a VehicleDataResult related to the driver breaking status
*/
public VehicleDataResult getDriverBraking() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_DRIVER_BRAKING);
}
+
/**
* Sets Wiper Status
+ *
* @param wiperStatus a VehicleDataResult related to the wiper status
*/
- public SubscribeVehicleDataResponse setWiperStatus( VehicleDataResult wiperStatus) {
+ public SubscribeVehicleDataResponse setWiperStatus(VehicleDataResult wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
+
/**
* Gets Wiper Status
+ *
* @return a VehicleDataResult related to the wiper status
*/
public VehicleDataResult getWiperStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_WIPER_STATUS);
}
+
/**
* Sets Head Lamp Status
+ *
* @param headLampStatus a VehicleDataResult related to the headlamp status
*/
- public SubscribeVehicleDataResponse setHeadLampStatus( VehicleDataResult headLampStatus) {
+ public SubscribeVehicleDataResponse setHeadLampStatus(VehicleDataResult headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
+
/**
* Gets Head Lamp Status
+ *
* @return a VehicleDataResult related to the headlamp status
*/
public VehicleDataResult getHeadLampStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_HEAD_LAMP_STATUS);
}
+
/**
* Sets Engine Torque
+ *
* @param engineTorque a VehicleDataResult related to the engine's torque
*/
- public SubscribeVehicleDataResponse setEngineTorque( VehicleDataResult engineTorque) {
+ public SubscribeVehicleDataResponse setEngineTorque(VehicleDataResult engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
+
/**
* Gets Engine Torque
+ *
* @return a VehicleDataResult related to the engine's torque
*/
public VehicleDataResult getEngineTorque() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ENGINE_TORQUE);
}
+
/**
* Sets Engine Oil Life
+ *
* @param engineOilLife a VehicleDataResult related to the engine's oil life
*/
- public SubscribeVehicleDataResponse setEngineOilLife( VehicleDataResult engineOilLife) {
+ public SubscribeVehicleDataResponse setEngineOilLife(VehicleDataResult engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
+
/**
* Gets Engine Oil Life
+ *
* @return a VehicleDataResult related to the engine's oil life
*/
public VehicleDataResult getEngineOilLife() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ENGINE_OIL_LIFE);
}
+
/**
* Sets AccPedal Position
+ *
* @param accPedalPosition a VehicleDataResult related to the accelerator pedal's position
*/
- public SubscribeVehicleDataResponse setAccPedalPosition( VehicleDataResult accPedalPosition) {
+ public SubscribeVehicleDataResponse setAccPedalPosition(VehicleDataResult accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
+
/**
* Gets AccPedal Position
+ *
* @return a VehicleDataResult related to the accelerator pedal's position
*/
public VehicleDataResult getAccPedalPosition() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ACC_PEDAL_POSITION);
}
- public SubscribeVehicleDataResponse setSteeringWheelAngle( VehicleDataResult steeringWheelAngle) {
+ public SubscribeVehicleDataResponse setSteeringWheelAngle(VehicleDataResult steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
@@ -424,24 +498,29 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_STEERING_WHEEL_ANGLE);
}
- public SubscribeVehicleDataResponse setECallInfo( VehicleDataResult eCallInfo) {
+ public SubscribeVehicleDataResponse setECallInfo(VehicleDataResult eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public VehicleDataResult getECallInfo() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_E_CALL_INFO);
}
- public SubscribeVehicleDataResponse setAirbagStatus( VehicleDataResult airbagStatus) {
+
+ public SubscribeVehicleDataResponse setAirbagStatus(VehicleDataResult airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public VehicleDataResult getAirbagStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_AIRBAG_STATUS);
}
- public SubscribeVehicleDataResponse setEmergencyEvent( VehicleDataResult emergencyEvent) {
+
+ public SubscribeVehicleDataResponse setEmergencyEvent(VehicleDataResult emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public VehicleDataResult getEmergencyEvent() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_EMERGENCY_EVENT);
}
@@ -450,9 +529,10 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @deprecated use {@link #setClusterModes(VehicleDataResult clusterMode)} instead.
*/
@Deprecated
- public SubscribeVehicleDataResponse setClusterModeStatus( VehicleDataResult clusterModeStatus) {
+ public SubscribeVehicleDataResponse setClusterModeStatus(VehicleDataResult clusterModeStatus) {
return setClusterModes(clusterModeStatus);
}
+
/**
* @deprecated use {@link #getClusterModes()} instead.
*/
@@ -460,8 +540,10 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getClusterModeStatus() {
return getClusterModes();
}
+
/**
* Sets the status modes of the cluster
+ *
* @param clusterMode the status modes of the cluster
*/
public SubscribeVehicleDataResponse setClusterModes(VehicleDataResult clusterMode) {
@@ -471,15 +553,18 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
/**
* Gets the status modes of the cluster
+ *
* @return The status modes of the cluster
*/
public VehicleDataResult getClusterModes() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLUSTER_MODES);
}
- public SubscribeVehicleDataResponse setMyKey( VehicleDataResult myKey) {
+
+ public SubscribeVehicleDataResponse setMyKey(VehicleDataResult myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public VehicleDataResult getMyKey() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_MY_KEY);
}
@@ -488,10 +573,10 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* Sets the fuelRange.
*
* @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
+ * vehicle. See struct FuelRange for details.
* @since SmartDeviceLink 5.0.0
*/
- public SubscribeVehicleDataResponse setFuelRange( VehicleDataResult fuelRange) {
+ public SubscribeVehicleDataResponse setFuelRange(VehicleDataResult fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
@@ -509,15 +594,17 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
/**
* Sets turnSignal
+ *
* @param turnSignal a VehicleDataResult related to the turn signal status
*/
- public SubscribeVehicleDataResponse setTurnSignal( VehicleDataResult turnSignal) {
+ public SubscribeVehicleDataResponse setTurnSignal(VehicleDataResult turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
/**
* Gets turnSignal
+ *
* @return a VehicleDataResult related to the turn signal status
*/
public VehicleDataResult getTurnSignal() {
@@ -526,53 +613,59 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
/**
* Sets electronicParkBrakeStatus
+ *
* @param electronicParkBrakeStatus a VehicleDataResult related to the electronic park brake status
*/
- public SubscribeVehicleDataResponse setElectronicParkBrakeStatus( VehicleDataResult electronicParkBrakeStatus) {
+ public SubscribeVehicleDataResponse setElectronicParkBrakeStatus(VehicleDataResult electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
/**
* Gets electronicParkBrakeStatus
+ *
* @return a VehicleDataResult related to the electronic park brake status
*/
- public VehicleDataResult getElectronicParkBrakeStatus(){
+ public VehicleDataResult getElectronicParkBrakeStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
/**
* Sets cloudAppVehicleID
+ *
* @param cloudAppVehicleID a VehicleDataResult related to the cloud app vehicle ID
*/
- public SubscribeVehicleDataResponse setCloudAppVehicleID( VehicleDataResult cloudAppVehicleID) {
+ public SubscribeVehicleDataResponse setCloudAppVehicleID(VehicleDataResult cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
/**
* Gets a VehicleDataResult for the subscription response of the CloudAppVehicleID vehicle data item.
+ *
* @return a VehicleDataResult related to the cloud app vehicle ID
*/
- public VehicleDataResult getCloudAppVehicleID(){
+ 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 vehicleDataName a String value
* @param vehicleDataState a VehicleDataResult value
*/
- public SubscribeVehicleDataResponse setOEMCustomVehicleData( String vehicleDataName, VehicleDataResult vehicleDataState) {
+ public SubscribeVehicleDataResponse setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
/**
* Gets a VehicleDataResult for the vehicle data item.
+ *
* @return a VehicleDataResult related to the vehicle data
*/
- public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName) {
return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
}
@@ -582,7 +675,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleDataResponse setHandsOffSteering( VehicleDataResult handsOffSteering) {
+ public SubscribeVehicleDataResponse setHandsOffSteering(VehicleDataResult handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -596,13 +689,14 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getHandsOffSteering() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_HANDS_OFF_STEERING);
}
+
/**
* Sets the gearStatus.
*
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleDataResponse setGearStatus( VehicleDataResult gearStatus) {
+ public SubscribeVehicleDataResponse setGearStatus(VehicleDataResult gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -613,7 +707,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @return VehicleDataResult See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public VehicleDataResult getGearStatus(){
+ public VehicleDataResult getGearStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_GEAR_STATUS);
}
@@ -623,7 +717,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleDataResponse setWindowStatus( VehicleDataResult windowStatus) {
+ public SubscribeVehicleDataResponse setWindowStatus(VehicleDataResult windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -654,7 +748,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public SubscribeVehicleDataResponse setStabilityControlsStatus( VehicleDataResult stabilityControlsStatus) {
+ public SubscribeVehicleDataResponse setStabilityControlsStatus(VehicleDataResult stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPoints.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPoints.java
index 49b208e78..b1e9e808e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPoints.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPoints.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,10 +37,11 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
public class SubscribeWayPoints extends RPCRequest {
- public SubscribeWayPoints() {
+ public SubscribeWayPoints() {
super(FunctionID.SUBSCRIBE_WAY_POINTS.toString());
}
- public SubscribeWayPoints(Hashtable<String, Object> hash) {
+
+ public SubscribeWayPoints(Hashtable<String, Object> hash) {
super(hash);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
index f9a40fce7..c487e667e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,18 +44,20 @@ public class SubscribeWayPointsResponse extends RPCResponse {
public SubscribeWayPointsResponse() {
super(FunctionID.SUBSCRIBE_WAY_POINTS.toString());
}
+
public SubscribeWayPointsResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SubscribeWayPointsResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SubscribeWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SubscribeWayPointsResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SubscribeWayPointsResponse(@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/SubtleAlert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java
index cc0908f58..20025df88 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlert.java
@@ -142,7 +142,7 @@ public class SubtleAlert extends RPCRequest {
*
* @param alertText1 The first line of the alert text field
*/
- public SubtleAlert setAlertText1( String alertText1) {
+ public SubtleAlert setAlertText1(String alertText1) {
setParameters(KEY_ALERT_TEXT_1, alertText1);
return this;
}
@@ -161,7 +161,7 @@ public class SubtleAlert extends RPCRequest {
*
* @param alertText2 The second line of the alert text field
*/
- public SubtleAlert setAlertText2( String alertText2) {
+ public SubtleAlert setAlertText2(String alertText2) {
setParameters(KEY_ALERT_TEXT_2, alertText2);
return this;
}
@@ -179,9 +179,9 @@ public class SubtleAlert extends RPCRequest {
* Sets the alertIcon.
*
* @param alertIcon Image to be displayed for the corresponding alert. See Image. If omitted on supported
- * displays, no (or the default if applicable) icon should be displayed.
+ * displays, no (or the default if applicable) icon should be displayed.
*/
- public SubtleAlert setAlertIcon( Image alertIcon) {
+ public SubtleAlert setAlertIcon(Image alertIcon) {
setParameters(KEY_ALERT_ICON, alertIcon);
return this;
}
@@ -200,9 +200,9 @@ public class SubtleAlert extends RPCRequest {
* Sets the ttsChunks.
*
* @param ttsChunks An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one
- * item.
+ * item.
*/
- public SubtleAlert setTtsChunks( List<TTSChunk> ttsChunks) {
+ public SubtleAlert setTtsChunks(List<TTSChunk> ttsChunks) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
return this;
}
@@ -222,9 +222,9 @@ public class SubtleAlert extends RPCRequest {
* Sets the duration.
*
* @param duration Timeout in milliseconds. Typical timeouts are 3-5 seconds. If omitted, timeout is set to
- * 5s.
+ * 5s.
*/
- public SubtleAlert setDuration( Integer duration) {
+ public SubtleAlert setDuration(Integer duration) {
setParameters(KEY_DURATION, duration);
return this;
}
@@ -243,9 +243,9 @@ public class SubtleAlert extends RPCRequest {
* Sets the softButtons.
*
* @param softButtons App defined SoftButtons. If omitted on supported displays, the displayed alert shall not
- * have any SoftButtons.
+ * have any SoftButtons.
*/
- public SubtleAlert setSoftButtons( List<SoftButton> softButtons) {
+ public SubtleAlert setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
@@ -266,7 +266,7 @@ public class SubtleAlert extends RPCRequest {
*
* @param cancelID An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
*/
- public SubtleAlert setCancelID( Integer cancelID) {
+ public SubtleAlert setCancelID(Integer cancelID) {
setParameters(KEY_CANCEL_ID, cancelID);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java
index 9e1e5b2c3..0bf9d410a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubtleAlertResponse.java
@@ -64,7 +64,7 @@ public class SubtleAlertResponse extends RPCResponse {
/**
* Constructs a new SubtleAlertResponse object
*
- * @param success whether the request is successfully processed
+ * @param success whether the request is successfully processed
* @param resultCode additional information about a response returning a failed outcome
*/
public SubtleAlertResponse(@NonNull Boolean success, @NonNull Result resultCode) {
@@ -77,10 +77,10 @@ public class SubtleAlertResponse extends RPCResponse {
* Sets the tryAgainTime.
*
* @param tryAgainTime Amount of time (in milliseconds) that an app must wait before resending an alert.
- * If provided, another system event or overlay currently has a higher priority than this alert.
- * An app must not send an alert without waiting at least the amount of time dictated.
+ * If provided, another system event or overlay currently has a higher priority than this alert.
+ * An app must not send an alert without waiting at least the amount of time dictated.
*/
- public SubtleAlertResponse setTryAgainTime( Integer tryAgainTime) {
+ public SubtleAlertResponse setTryAgainTime(Integer tryAgainTime) {
setParameters(KEY_TRY_AGAIN_TIME, tryAgainTime);
return this;
}
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 6ae6fa914..e930bf533 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
@@ -53,7 +53,8 @@ public class SystemCapability extends RPCStruct {
public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
public static final String KEY_DRIVER_DISTRACTION_CAPABILITY = "driverDistractionCapability";
- public SystemCapability(){}
+ public SystemCapability() {
+ }
public SystemCapability(Hashtable<String, Object> hash) {
super(hash);
@@ -61,18 +62,18 @@ public class SystemCapability extends RPCStruct {
/**
* Create a systemCapability object
+ *
* @param systemCapabilityType The type
*/
- public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType) {
this();
setSystemCapabilityType(systemCapabilityType);
}
/**
- *
* @return The SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist
*/
- public SystemCapabilityType getSystemCapabilityType(){
+ public SystemCapabilityType getSystemCapabilityType() {
return (SystemCapabilityType) getObject(SystemCapabilityType.class, KEY_SYSTEM_CAPABILITY_TYPE);
}
@@ -108,7 +109,7 @@ public class SystemCapability extends RPCStruct {
}
}
- public SystemCapability setCapabilityForType( SystemCapabilityType type, Object capability) {
+ public SystemCapability setCapabilityForType(SystemCapabilityType type, Object capability) {
if (type == null) {
return this;
} else if (type.equals(SystemCapabilityType.NAVIGATION)) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
index 839d49953..8386c2c5a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,8 +40,9 @@ import com.smartdevicelink.proxy.rpc.enums.RequestType;
import java.util.Hashtable;
import java.util.List;
-/** An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as HTTP, Proprietary, or Authentication requests)
- *
+/**
+ * An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as HTTP, Proprietary, or Authentication requests)
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -77,57 +78,57 @@ import java.util.List;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- * @since SmartDeviceLink 3.0
- *
- *
*
+ * @since SmartDeviceLink 3.0
*/
public class SystemRequest extends RPCRequest {
- public static final String KEY_FILE_NAME = "fileName";
- public static final String KEY_REQUEST_TYPE = "requestType";
- public static final String KEY_REQUEST_SUB_TYPE = "requestSubType";
- public static final String KEY_DATA = "data";
- /**
- * Constructs a new SystemRequest object
- */
+ public static final String KEY_FILE_NAME = "fileName";
+ public static final String KEY_REQUEST_TYPE = "requestType";
+ public static final String KEY_REQUEST_SUB_TYPE = "requestSubType";
+ public static final String KEY_DATA = "data";
+
+ /**
+ * Constructs a new SystemRequest object
+ */
public SystemRequest() {
super(FunctionID.SYSTEM_REQUEST.toString());
}
- public SystemRequest(boolean bLegacy) {
+ public SystemRequest(boolean bLegacy) {
super(FunctionID.ENCODED_SYNC_P_DATA.toString());
}
-
+
public SystemRequest(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new SystemRequest object
- * @param requestType The type of system request.
- */
- public SystemRequest(@NonNull RequestType requestType){
- this();
- setRequestType(requestType);
- }
+ /**
+ * Constructs a new SystemRequest object
+ *
+ * @param requestType The type of system request.
+ */
+ public SystemRequest(@NonNull RequestType requestType) {
+ this();
+ setRequestType(requestType);
+ }
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public List<String> getLegacyData() {
return (List<String>) getObject(String.class, KEY_DATA);
}
-
- public SystemRequest setLegacyData( List<String> data) {
+
+ public SystemRequest setLegacyData(List<String> data) {
setParameters(KEY_DATA, data);
return this;
}
-
+
public String getFileName() {
return getString(KEY_FILE_NAME);
}
-
- public SystemRequest setFileName( String fileName) {
+
+ public SystemRequest setFileName(String fileName) {
setParameters(KEY_FILE_NAME, fileName);
return this;
}
@@ -145,7 +146,7 @@ public class SystemRequest extends RPCRequest {
return getString(KEY_REQUEST_SUB_TYPE);
}
- public SystemRequest setRequestSubType( String requestSubType) {
+ public SystemRequest setRequestSubType(String requestSubType) {
setParameters(KEY_REQUEST_SUB_TYPE, requestSubType);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
index d2e68a2d5..6bc4a3322 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.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 androidx.annotation.NonNull;
@@ -41,7 +41,7 @@ import java.util.Hashtable;
/**
* System Request Response is sent, when SystemRequest has been called
- *
+ *
* @since SmartDeviceLink 3.0
*/
public class SystemRequestResponse extends RPCResponse {
@@ -53,14 +53,15 @@ public class SystemRequestResponse extends RPCResponse {
super(hash);
}
- /**
- * Constructs a new SystemRequestResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public SystemRequestResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new SystemRequestResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SystemRequestResponse(@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/TTSChunk.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
index 438757bd1..1333fa7bf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,14 +40,14 @@ import java.util.Hashtable;
/**
* <p>Specifies what is to be spoken. This can be simply a text phrase, which SDL will speak according to its own rules.
- * It can also be phonemes from either the Microsoft SAPI phoneme set, or from the LHPLUS phoneme set.
- * It can also be a pre-recorded sound in WAV format (either developer-defined, or provided by the SDL platform).</p>
- *
- * <p>In SDL, words, and therefore sentences, can be built up from phonemes and are used to explicitly provide the proper pronunciation to the TTS engine.
- * For example, to have SDL pronounce the word "read" as "red", rather than as when it is pronounced like "reed",
- * the developer would use phonemes to express this desired pronunciation.</p>
- * <p>For more information about phonemes, see <a href="http://en.wikipedia.org/wiki/Phoneme">http://en.wikipedia.org/wiki/Phoneme</a></p>.
- * <p><b> Parameter List</b></p>
+ * It can also be phonemes from either the Microsoft SAPI phoneme set, or from the LHPLUS phoneme set.
+ * It can also be a pre-recorded sound in WAV format (either developer-defined, or provided by the SDL platform).</p>
+ *
+ * <p>In SDL, words, and therefore sentences, can be built up from phonemes and are used to explicitly provide the proper pronunciation to the TTS engine.
+ * For example, to have SDL pronounce the word "read" as "red", rather than as when it is pronounced like "reed",
+ * the developer would use phonemes to express this desired pronunciation.</p>
+ * <p>For more information about phonemes, see <a href="http://en.wikipedia.org/wiki/Phoneme">http://en.wikipedia.org/wiki/Phoneme</a></p>.
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -68,57 +68,71 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 1.0
*/
public class TTSChunk extends RPCStruct {
- public static final String KEY_TEXT = "text";
- public static final String KEY_TYPE = "type";
- /**
- * Constructs a newly allocated TTSChunk object
- */
- public TTSChunk() { }
+ public static final String KEY_TEXT = "text";
+ public static final String KEY_TYPE = "type";
+
+ /**
+ * Constructs a newly allocated TTSChunk object
+ */
+ public TTSChunk() {
+ }
+
/**
* Constructs a newly allocated TTSChunk object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public TTSChunk(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a newly allocated TTSChunk object
- * @param text Text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field.
- * @param type Indicates the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound).
- */
- public TTSChunk(@NonNull String text, @NonNull SpeechCapabilities type){
- this();
- setText(text);
- setType(type);
- }
+ /**
+ * Constructs a newly allocated TTSChunk object
+ *
+ * @param text Text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field.
+ * @param type Indicates the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound).
+ */
+ public TTSChunk(@NonNull String text, @NonNull SpeechCapabilities type) {
+ this();
+ setText(text);
+ setType(type);
+ }
+
/**
* Get text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field.
+ *
* @return text to be spoken, or a phoneme specification, or the name of a pre-recorded sound
*/
public String getText() {
- return getString( KEY_TEXT );
+ return getString(KEY_TEXT);
}
+
/**
* Set the text to be spoken, or a phoneme specification, or the name of a pre-recorded sound. The contents of this field are indicated by the "type" field.
+ *
* @param text to be spoken, or a phoneme specification, or the name of a pre-recorded sound.
*/
public TTSChunk setText(@NonNull String text) {
setValue(KEY_TEXT, text);
return this;
}
+
/**
- * Get the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound).
+ * Get the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound).
+ *
* @return the type of information in the "text" field
- */
+ */
public SpeechCapabilities getType() {
return (SpeechCapabilities) getObject(SpeechCapabilities.class, KEY_TYPE);
}
+
/**
* Set the type of information in the "text" field (e.g. phrase to be spoken, phoneme specification, name of pre-recorded sound).
+ *
* @param type the type of information in the "text" field
*/
public TTSChunk setType(@NonNull SpeechCapabilities type) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java
index 9bd23d4a0..d5b77f970 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,31 +39,33 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
-public class Temperature extends RPCStruct{
+public class Temperature extends RPCStruct {
public static final String KEY_UNIT = "unit";
public static final String KEY_VALUE = "value";
- public Temperature() { }
+ public Temperature() {
+ }
+
public Temperature(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Create the temperature object
- * @param unit Temperature Unit.
- * @param value Temperature Value in TemperatureUnit specified unit
- */
- public Temperature(@NonNull TemperatureUnit unit, @NonNull Float value){
- this();
- setUnit(unit);
- setValue(value);
- }
+ /**
+ * Create the temperature object
+ *
+ * @param unit Temperature Unit.
+ * @param value Temperature Value in TemperatureUnit specified unit
+ */
+ public Temperature(@NonNull TemperatureUnit unit, @NonNull Float value) {
+ this();
+ setUnit(unit);
+ setValue(value);
+ }
/**
* Sets the unit portion of the Temperature class
*
- * @param unit
- * Temperature Unit.
+ * @param unit Temperature Unit.
*/
public Temperature setUnit(@NonNull TemperatureUnit unit) {
setValue(KEY_UNIT, unit);
@@ -92,8 +94,7 @@ public class Temperature extends RPCStruct{
/**
* Sets the value portion of the Temperature class
*
- * @param value
- * Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.
+ * @param value Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.
*/
public Temperature setValue(@NonNull Float value) {
setValue(KEY_VALUE, value);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateColorScheme.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateColorScheme.java
index e65f25659..e8b3c9acb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateColorScheme.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateColorScheme.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,7 +36,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- * A color scheme for all display layout templates.
+ * A color scheme for all display layout templates.
* <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -68,6 +68,7 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 5.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 5.0
*/
public class TemplateColorScheme extends RPCStruct {
@@ -79,11 +80,12 @@ public class TemplateColorScheme extends RPCStruct {
/**
* Constructs a new TemplateColorScheme object
*/
- public TemplateColorScheme(){
+ public TemplateColorScheme() {
}
/**
* Constructs a new TemplateColorScheme object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public TemplateColorScheme(Hashtable<String, Object> hash) {
@@ -92,15 +94,17 @@ public class TemplateColorScheme extends RPCStruct {
/**
* Sets the primaryColor of the scheme
+ *
* @param color an RGBColor object representing the primaryColor
*/
- public TemplateColorScheme setPrimaryColor( RGBColor color) {
+ public TemplateColorScheme setPrimaryColor(RGBColor color) {
setValue(KEY_PRIMARY_COLOR, color);
return this;
}
/**
* Gets the primaryColor of the scheme
+ *
* @return an RGBColor object representing the primaryColor
*/
public RGBColor getPrimaryColor() {
@@ -109,15 +113,17 @@ public class TemplateColorScheme extends RPCStruct {
/**
* Sets the secondaryColor of the scheme
+ *
* @param color an RGBColor object representing the secondaryColor
*/
- public TemplateColorScheme setSecondaryColor( RGBColor color) {
+ public TemplateColorScheme setSecondaryColor(RGBColor color) {
setValue(KEY_SECONDARY_COLOR, color);
return this;
}
/**
* Gets the secondaryColor of the scheme
+ *
* @return an RGBColor object representing the secondaryColor
*/
public RGBColor getSecondaryColor() {
@@ -126,15 +132,17 @@ public class TemplateColorScheme extends RPCStruct {
/**
* Sets the backgroundColor of the scheme
+ *
* @param color an RGBColor object representing the backgroundColor
*/
- public TemplateColorScheme setBackgroundColor( RGBColor color) {
+ public TemplateColorScheme setBackgroundColor(RGBColor color) {
setValue(KEY_BACKGROUND_COLOR, color);
return this;
}
/**
* Gets the backgroundColor of the scheme
+ *
* @return an RGBColor object representing the backgroundColor
*/
public RGBColor getBackgroundColor() {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
index fdde09f13..37021e995 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
@@ -8,6 +8,7 @@ import java.util.Hashtable;
/**
* Used to set an alternate template layout to a window.
+ *
* @since 6.0
*/
public class TemplateConfiguration extends RPCStruct {
@@ -17,8 +18,9 @@ public class TemplateConfiguration extends RPCStruct {
/**
* Constructs a new TemplateConfiguration object
+ *
* @param template Predefined or dynamically created window template.
- * Currently only predefined window template layouts are defined.
+ * Currently only predefined window template layouts are defined.
*/
public TemplateConfiguration(@NonNull String template) {
this();
@@ -74,7 +76,7 @@ public class TemplateConfiguration extends RPCStruct {
*
* @param dayColorScheme TemplateColorScheme for the day
*/
- public TemplateConfiguration setDayColorScheme( TemplateColorScheme dayColorScheme) {
+ public TemplateConfiguration setDayColorScheme(TemplateColorScheme dayColorScheme) {
setValue(KEY_DAY_COLOR_SCHEME, dayColorScheme);
return this;
}
@@ -93,7 +95,7 @@ public class TemplateConfiguration extends RPCStruct {
*
* @param nightColorScheme TemplateColorScheme for the night
*/
- public TemplateConfiguration setNightColorScheme( TemplateColorScheme nightColorScheme) {
+ public TemplateConfiguration setNightColorScheme(TemplateColorScheme nightColorScheme) {
setValue(KEY_NIGHT_COLOR_SCHEME, nightColorScheme);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
index 317138936..4b0b8a94e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -66,10 +66,10 @@ import java.util.Hashtable;
* <td>Integer</td>
* <td>The number of characters in one row of this field.
* <ul>
- * <li>Minvalue="1"</li>
- * <li>maxvalue="500"</li>
- * </ul>
- * </td>
+ * <li>Minvalue="1"</li>
+ * <li>maxvalue="500"</li>
+ * </ul>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
@@ -77,15 +77,14 @@ import java.util.Hashtable;
* <td>Integer</td>
* <td>The number of rows for this text field.
* <ul>
- * <li>Minvalue="1"</li>
- * <li>maxvalue="3"</li>
- * </ul>
- * </td>
+ * <li>Minvalue="1"</li>
+ * <li>maxvalue="3"</li>
+ * </ul>
+ * </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- * @since SmartDeviceLink 1.0
- *
+ *
* @see TextFieldName
* @see Alert
* @see Show
@@ -93,108 +92,129 @@ import java.util.Hashtable;
* @see ScrollableMessage
* @see PerformAudioPassThru
* @see ShowConstantTbt
- *
+ * @since SmartDeviceLink 1.0
*/
public class TextField extends RPCStruct {
- public static final String KEY_WIDTH = "width";
- public static final String KEY_CHARACTER_SET = "characterSet";
- public static final String KEY_ROWS = "rows";
- public static final String KEY_NAME = "name";
- /**
- * Constructs a newly allocated TextField object
- */
- public TextField() { }
+ public static final String KEY_WIDTH = "width";
+ public static final String KEY_CHARACTER_SET = "characterSet";
+ public static final String KEY_ROWS = "rows";
+ public static final String KEY_NAME = "name";
+
+ /**
+ * Constructs a newly allocated TextField object
+ */
+ public TextField() {
+ }
+
/**
* Constructs a newly allocated TextField object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
- */
+ */
public TextField(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a newly allocated TextField object
- * @param name Enumeration identifying the field.
- * @param characterSet The set of characters that are supported by this text field.
- * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
- * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
- * @param width The number of characters in one row of this field.
- * @param rows The number of rows for this text field.
- */
- public TextField(@NonNull TextFieldName name, @NonNull CharacterSet characterSet, @NonNull Integer width, @NonNull Integer rows){
- this();
- setName(name);
- setCharacterSet(characterSet);
- setWidth(width);
- setRows(rows);
- }
+
/**
- * Get the enumeration identifying the field.
+ * Constructs a newly allocated TextField object
+ *
+ * @param name Enumeration identifying the field.
+ * @param characterSet The set of characters that are supported by this text field.
+ * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
+ * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
+ * @param width The number of characters in one row of this field.
+ * @param rows The number of rows for this text field.
+ */
+ public TextField(@NonNull TextFieldName name, @NonNull CharacterSet characterSet, @NonNull Integer width, @NonNull Integer rows) {
+ this();
+ setName(name);
+ setCharacterSet(characterSet);
+ setWidth(width);
+ setRows(rows);
+ }
+
+ /**
+ * Get the enumeration identifying the field.
+ *
* @return the name of TextField
- */
+ */
public TextFieldName getName() {
return (TextFieldName) getObject(TextFieldName.class, KEY_NAME);
}
+
/**
* Set the enumeration identifying the field.
+ *
* @param name the name of TextField
*/
public TextField setName(@NonNull TextFieldName name) {
setValue(KEY_NAME, name);
return this;
}
+
/**
* Get the character set that is supported in this field.
+ *
* @return The set of characters that are supported by this text field.
* All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
* All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
- */
+ */
public CharacterSet getCharacterSet() {
return (CharacterSet) getObject(CharacterSet.class, KEY_CHARACTER_SET);
}
+
/**
* Set the character set that is supported in this field.
+ *
* @param characterSet - The set of characters that are supported by this text field.
- * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
- * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
+ * All text is sent in UTF-8 format, but not all systems may support all of the characters expressed by UTF-8.
+ * All systems will support at least ASCII, but they may support more, either the LATIN-1 character set, or the full UTF-8 character set.
*/
public TextField setCharacterSet(@NonNull CharacterSet characterSet) {
setValue(KEY_CHARACTER_SET, characterSet);
return this;
}
+
/**
* Get the number of characters in one row of this field.
- * <ul>
- * <li>Minvalue="1"</li>
- * <li>maxvalue="500"</li>
- * </ul>
+ * <ul>
+ * <li>Minvalue="1"</li>
+ * <li>maxvalue="500"</li>
+ * </ul>
+ *
* @return the number of characters in one row of this field
- */
+ */
public Integer getWidth() {
- return getInteger( KEY_WIDTH );
+ return getInteger(KEY_WIDTH);
}
+
/**
* Set the number of characters in one row of this field.
- * <ul>
- * <li>Minvalue="1"</li>
- * <li>maxvalue="500"</li>
- * </ul>
- * @param width the number of characters in one row of this field
+ * <ul>
+ * <li>Minvalue="1"</li>
+ * <li>maxvalue="500"</li>
+ * </ul>
+ *
+ * @param width the number of characters in one row of this field
*/
public TextField setWidth(@NonNull Integer width) {
setValue(KEY_WIDTH, width);
return this;
}
+
/**
- *Get the number of rows for this text field.
- * <ul>
- * <li>Minvalue="1"</li>
- * <li>maxvalue="3"</li>
- * </ul>
- * @return the number of rows for this text field
- */
+ * Get the number of rows for this text field.
+ * <ul>
+ * <li>Minvalue="1"</li>
+ * <li>maxvalue="3"</li>
+ * </ul>
+ *
+ * @return the number of rows for this text field
+ */
public Integer getRows() {
- return getInteger( KEY_ROWS );
+ return getInteger(KEY_ROWS);
}
+
public TextField setRows(@NonNull Integer rows) {
setValue(KEY_ROWS, rows);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
index 15d9f580a..5db768cb5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,9 +38,10 @@ import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
import java.util.Hashtable;
-/** <p>The status and pressure of the tires.</p>
- * <p><b> Parameter List:</b></p>
- *
+/**
+ * <p>The status and pressure of the tires.</p>
+ * <p><b> Parameter List:</b></p>
+ *
* <table border="1" rules="all">
* <tr>
* <th>Param Name</th>
@@ -91,63 +92,66 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ * <p>
* @since SmartDeviceLink 2.0
- *
+ *
* @see WarningLightStatus
* @see SingleTireStatus
- * @see GetVehicleData
+ * @see GetVehicleData
* @see OnVehicleData
*/
public class TireStatus extends RPCStruct {
- public static final String KEY_PRESSURE_TELL_TALE = "pressureTelltale";
- public static final String KEY_LEFT_FRONT = "leftFront";
- public static final String KEY_RIGHT_FRONT = "rightFront";
- public static final String KEY_LEFT_REAR = "leftRear";
- public static final String KEY_INNER_LEFT_REAR = "innerLeftRear";
- public static final String KEY_INNER_RIGHT_REAR = "innerRightRear";
- public static final String KEY_RIGHT_REAR = "rightRear";
-
- public TireStatus() { }
-
- /**
- * <p>Constructs a new TireStatus object indicated by the Hashtable parameter</p>
- *
- * @param hash The Hashtable to use
- */
- public TireStatus(Hashtable<String, Object> hash) {
+ public static final String KEY_PRESSURE_TELL_TALE = "pressureTelltale";
+ public static final String KEY_LEFT_FRONT = "leftFront";
+ public static final String KEY_RIGHT_FRONT = "rightFront";
+ public static final String KEY_LEFT_REAR = "leftRear";
+ public static final String KEY_INNER_LEFT_REAR = "innerLeftRear";
+ public static final String KEY_INNER_RIGHT_REAR = "innerRightRear";
+ public static final String KEY_RIGHT_REAR = "rightRear";
+
+ public TireStatus() {
+ }
+
+ /**
+ * <p>Constructs a new TireStatus object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public TireStatus(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new TireStatus object
- * @param pressureTellTale Status of the Tire Pressure TellTale
- * @param leftFront The status of the left front tire.
- * @param rightFront The status of the right front tire.
- * @param leftRear The status of the left rear tire.
- * @param rightRear The status of the right rear tire
- * @param innerLeftRear The status of the inner left rear tire.
- * @param innerRightRear The status of the inner right rear tire.
- */
- public TireStatus(@NonNull WarningLightStatus pressureTellTale, @NonNull SingleTireStatus leftFront, @NonNull SingleTireStatus rightFront, @NonNull SingleTireStatus leftRear, @NonNull SingleTireStatus rightRear, @NonNull SingleTireStatus innerLeftRear, @NonNull SingleTireStatus innerRightRear){
- this();
- setPressureTelltale(pressureTellTale);
- setLeftFront(leftFront);
- setRightFront(rightFront);
- setLeftRear(leftRear);
- setRightRear(rightRear);
- setInnerLeftRear(innerLeftRear);
- setInnerRightRear(innerRightRear);
- }
+ /**
+ * Constructs a new TireStatus object
+ *
+ * @param pressureTellTale Status of the Tire Pressure TellTale
+ * @param leftFront The status of the left front tire.
+ * @param rightFront The status of the right front tire.
+ * @param leftRear The status of the left rear tire.
+ * @param rightRear The status of the right rear tire
+ * @param innerLeftRear The status of the inner left rear tire.
+ * @param innerRightRear The status of the inner right rear tire.
+ */
+ public TireStatus(@NonNull WarningLightStatus pressureTellTale, @NonNull SingleTireStatus leftFront, @NonNull SingleTireStatus rightFront, @NonNull SingleTireStatus leftRear, @NonNull SingleTireStatus rightRear, @NonNull SingleTireStatus innerLeftRear, @NonNull SingleTireStatus innerRightRear) {
+ this();
+ setPressureTelltale(pressureTellTale);
+ setLeftFront(leftFront);
+ setRightFront(rightFront);
+ setLeftRear(leftRear);
+ setRightRear(rightRear);
+ setInnerLeftRear(innerLeftRear);
+ setInnerRightRear(innerRightRear);
+ }
/**
* @deprecated use {@link #setPressureTelltale(WarningLightStatus pressureTellTale)} instead.
*/
- @Deprecated
+ @Deprecated
public TireStatus setPressureTellTale(@NonNull WarningLightStatus pressureTellTale) {
return setPressureTelltale(pressureTellTale);
}
+
/**
* @deprecated use {@link #getPressureTelltale()} instead.
*/
@@ -158,6 +162,7 @@ public class TireStatus extends RPCStruct {
/**
* Sets the status of the tire pressure Telltale.
+ *
* @param pressureTellTale the status of the tire pressure Telltale.
*/
public TireStatus setPressureTelltale(@NonNull WarningLightStatus pressureTellTale) {
@@ -167,50 +172,63 @@ public class TireStatus extends RPCStruct {
/**
* Gets the status of the tire pressure Telltale.
+ *
* @return the status of the tire pressure Telltale.
*/
public WarningLightStatus getPressureTelltale() {
return (WarningLightStatus) getObject(WarningLightStatus.class, KEY_PRESSURE_TELL_TALE);
}
+
public TireStatus setLeftFront(@NonNull SingleTireStatus leftFront) {
setValue(KEY_LEFT_FRONT, leftFront);
return this;
}
+
public SingleTireStatus getLeftFront() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_FRONT);
}
+
public TireStatus setRightFront(@NonNull SingleTireStatus rightFront) {
setValue(KEY_RIGHT_FRONT, rightFront);
return this;
}
+
public SingleTireStatus getRightFront() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_FRONT);
}
+
public TireStatus setLeftRear(@NonNull SingleTireStatus leftRear) {
setValue(KEY_LEFT_REAR, leftRear);
return this;
}
+
public SingleTireStatus getLeftRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_REAR);
}
+
public TireStatus setRightRear(@NonNull SingleTireStatus rightRear) {
setValue(KEY_RIGHT_REAR, rightRear);
return this;
}
+
public SingleTireStatus getRightRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_REAR);
}
+
public TireStatus setInnerLeftRear(@NonNull SingleTireStatus innerLeftRear) {
setValue(KEY_INNER_LEFT_REAR, innerLeftRear);
return this;
}
+
public SingleTireStatus getInnerLeftRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_INNER_LEFT_REAR);
}
+
public TireStatus setInnerRightRear(@NonNull SingleTireStatus innerRightRear) {
setValue(KEY_INNER_RIGHT_REAR, innerRightRear);
return this;
}
+
public SingleTireStatus getInnerRightRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_INNER_RIGHT_REAR);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
index c2f71e09e..979adc303 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,11 +36,12 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
* <p>The x or y coordinate of the touch.</p>
- *
- *
- *
+ *
+ *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -68,55 +69,57 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- *@see SoftButtonCapabilities
- *@see ButtonCapabilities
- *@see OnButtonPress
*
- *@since SmartDeviceLink 3.0
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
+ * @since SmartDeviceLink 3.0
*/
public class TouchCoord extends RPCStruct {
public static final String KEY_X = "x";
public static final String KEY_Y = "y";
- public TouchCoord() {}
+ public TouchCoord() {
+ }
- /**
- * <p>Constructs a new TouchCoord object indicated by the Hashtable parameter</p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * <p>Constructs a new TouchCoord object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public TouchCoord(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new TouchCoord object
- * @param x The x coordinate of the touch.
- * @param y The y coordinate of the touch.
- */
- public TouchCoord(@NonNull Integer x, @NonNull Integer y){
- this();
- setX(x);
- setY(y);
- }
-
+ /**
+ * Constructs a new TouchCoord object
+ *
+ * @param x The x coordinate of the touch.
+ * @param y The y coordinate of the touch.
+ */
+ public TouchCoord(@NonNull Integer x, @NonNull Integer y) {
+ this();
+ setX(x);
+ setY(y);
+ }
+
public TouchCoord setX(@NonNull Integer x) {
setValue(KEY_X, x);
return this;
}
-
+
public Integer getX() {
return getInteger(KEY_X);
}
-
+
public TouchCoord setY(@NonNull Integer y) {
setValue(KEY_Y, y);
return this;
}
-
+
public Integer getY() {
return getInteger(KEY_Y);
}
-
+
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
index 86171a5da..42f4caad2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -43,7 +43,7 @@ import java.util.List;
* <p>For touchscreen interactions, the mode of how the choices are presented.</p>
*
* <p><b>Parameter List</b></p>
- *
+ *
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -80,9 +80,9 @@ import java.util.List;
* <td>SmartDeviceLink 3.0</td>
* </tr>
* </table>
- *
- * @since SmartDeviceLink 3.0
- *
+ * <p>
+ * @since SmartDeviceLink 3.0
+ * <p>
* @see SoftButtonCapabilities
* @see ButtonCapabilities
* @see OnButtonPress
@@ -92,112 +92,120 @@ public class TouchEvent extends RPCStruct {
public static final String KEY_ID = "id";
public static final String KEY_TS = "ts";
public static final String KEY_C = "c";
-
- public TouchEvent() { }
+
+ public TouchEvent() {
+ }
+
/**
- * <p>Constructs a new TouchEvent object indicated by the Hashtable parameter</p>
- *
- * @param hash The Hashtable to use
- */
+ * <p>Constructs a new TouchEvent object indicated by the Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public TouchEvent(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new TouchEvent object
- * @param id A touch's unique identifier.
- * @param ts The time that the touch was recorded.
- * @param c The coordinates of the screen area where the touch event occurred.
- */
- public TouchEvent(@NonNull Integer id, @NonNull List<Long> ts, @NonNull List<TouchCoord> c){
- this();
- setId(id);
- setTimestamps(ts);
- setTouchCoordinates(c);
- }
-
+ /**
+ * Constructs a new TouchEvent object
+ *
+ * @param id A touch's unique identifier.
+ * @param ts The time that the touch was recorded.
+ * @param c The coordinates of the screen area where the touch event occurred.
+ */
+ public TouchEvent(@NonNull Integer id, @NonNull List<Long> ts, @NonNull List<TouchCoord> c) {
+ this();
+ setId(id);
+ setTimestamps(ts);
+ setTouchCoordinates(c);
+ }
+
public TouchEvent setId(@NonNull Integer id) {
setValue(KEY_ID, id);
return this;
}
-
+
public Integer getId() {
return getInteger(KEY_ID);
}
-
+
/**
* Use getTimestamps
- * @deprecated 4.0.2
+ *
* @return
+ * @deprecated 4.0.2
*/
@Deprecated
public List<Long> getTs() {
- return getTimestamps();
+ return getTimestamps();
}
-
+
@SuppressWarnings("unchecked")
public List<Long> getTimestamps() {
- if(getValue(KEY_TS) instanceof List<?>){
- List<?> list = (List<?>) getValue(KEY_TS);
- if(list != null && list.size()>0){
- Object obj = list.get(0);
- if(obj instanceof Integer){ //Backwards case
- int size = list.size();
- List<Integer> listOfInt = (List<Integer>) list;
- List<Long> listOfLongs = new ArrayList<>(size);
- for(int i = 0; i<size;i++){
- listOfLongs.add(listOfInt.get(i).longValue());
- }
- return listOfLongs;
- }else if(obj instanceof Long){
- return (List<Long>) list;
- }
- }
- }
+ if (getValue(KEY_TS) instanceof List<?>) {
+ List<?> list = (List<?>) getValue(KEY_TS);
+ if (list != null && list.size() > 0) {
+ Object obj = list.get(0);
+ if (obj instanceof Integer) { //Backwards case
+ int size = list.size();
+ List<Integer> listOfInt = (List<Integer>) list;
+ List<Long> listOfLongs = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+ listOfLongs.add(listOfInt.get(i).longValue());
+ }
+ return listOfLongs;
+ } else if (obj instanceof Long) {
+ return (List<Long>) list;
+ }
+ }
+ }
return null;
}
-
+
public TouchEvent setTimestamps(@NonNull List<Long> ts) {
setValue(KEY_TS, ts);
return this;
}
-
+
/**
* Use setTimestamps.
- * @deprecated 4.0.2
+ *
* @param ts
+ * @deprecated 4.0.2
*/
@Deprecated
- public TouchEvent setTs( List<Long> ts) {
+ public TouchEvent setTs(List<Long> ts) {
setTimestamps(ts);
return this;
}
-
+
/**
* Use getTouchCoordinates
- * @deprecated 4.0.2
+ *
* @return
+ * @deprecated 4.0.2
*/
@Deprecated
public List<TouchCoord> getC() {
- return getTouchCoordinates();
+ return getTouchCoordinates();
}
- @SuppressWarnings("unchecked")
+
+ @SuppressWarnings("unchecked")
public List<TouchCoord> getTouchCoordinates() {
return (List<TouchCoord>) getObject(TouchCoord.class, KEY_C);
- }
-
+ }
+
/**
* Use setTouchCoordinates
- * @deprecated 4.0.2
+ *
* @return
+ * @deprecated 4.0.2
*/
@Deprecated
- public TouchEvent setC( List<TouchCoord> c) {
+ public TouchEvent setC(List<TouchCoord> c) {
setTouchCoordinates(c);
return this;
}
-
+
public TouchEvent setTouchCoordinates(@NonNull List<TouchCoord> c) {
setValue(KEY_C, c);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
index cb455bf59..c2e5ec216 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,9 +36,10 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
* Types of screen touch events available in screen area.
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -74,54 +75,56 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 3.0 </td>
* </tr>
* </table>
- *
*/
public class TouchEventCapabilities extends RPCStruct {
public static final String KEY_PRESS_AVAILABLE = "pressAvailable";
public static final String KEY_MULTI_TOUCH_AVAILABLE = "multiTouchAvailable";
public static final String KEY_DOUBLE_PRESS_AVAILABLE = "doublePressAvailable";
- public TouchEventCapabilities() {}
-
+
+ public TouchEventCapabilities() {
+ }
+
public TouchEventCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Types of screen touch events available in screen area.
- * @param pressAvailable if press is available
- * @param multiTouchAvailable if multi touch is available
- * @param doublePressAvailable if double press is available
- */
- public TouchEventCapabilities(@NonNull Boolean pressAvailable, @NonNull Boolean multiTouchAvailable, @NonNull Boolean doublePressAvailable){
- this();
- setPressAvailable(pressAvailable);
- setMultiTouchAvailable(multiTouchAvailable);
- setDoublePressAvailable(doublePressAvailable);
- }
-
+ /**
+ * Types of screen touch events available in screen area.
+ *
+ * @param pressAvailable if press is available
+ * @param multiTouchAvailable if multi touch is available
+ * @param doublePressAvailable if double press is available
+ */
+ public TouchEventCapabilities(@NonNull Boolean pressAvailable, @NonNull Boolean multiTouchAvailable, @NonNull Boolean doublePressAvailable) {
+ this();
+ setPressAvailable(pressAvailable);
+ setMultiTouchAvailable(multiTouchAvailable);
+ setDoublePressAvailable(doublePressAvailable);
+ }
+
public TouchEventCapabilities setPressAvailable(@NonNull Boolean pressAvailable) {
setValue(KEY_PRESS_AVAILABLE, pressAvailable);
return this;
}
-
+
public Boolean getPressAvailable() {
return getBoolean(KEY_PRESS_AVAILABLE);
}
-
+
public TouchEventCapabilities setMultiTouchAvailable(@NonNull Boolean multiTouchAvailable) {
setValue(KEY_MULTI_TOUCH_AVAILABLE, multiTouchAvailable);
return this;
}
-
+
public Boolean getMultiTouchAvailable() {
return getBoolean(KEY_MULTI_TOUCH_AVAILABLE);
}
-
+
public TouchEventCapabilities setDoublePressAvailable(@NonNull Boolean doublePressAvailable) {
setValue(KEY_DOUBLE_PRESS_AVAILABLE, doublePressAvailable);
return this;
}
-
+
public Boolean getDoublePressAvailable() {
return getBoolean(KEY_DOUBLE_PRESS_AVAILABLE);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Turn.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Turn.java
index bdfb7d4b4..de14fe075 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Turn.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Turn.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,7 +37,7 @@ import java.util.Hashtable;
/**
* Describes a navigation turn including an optional icon
- *
+ *
* <p><b>Parameter List</p>
* <table border="1" rules="all">
* <tr>
@@ -63,14 +63,16 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- *
+ *
* @since SmartDeviceLink 2.0
*/
-public class Turn extends RPCStruct{
+public class Turn extends RPCStruct {
public static final String KEY_NAVIGATION_TEXT = "navigationText";
public static final String KEY_TURN_IMAGE = "turnIcon";
-
- public Turn() { }
+
+ public Turn() {
+ }
+
public Turn(Hashtable<String, Object> hash) {
super(hash);
}
@@ -78,40 +80,38 @@ public class Turn extends RPCStruct{
/**
* set the text to describe the turn (e.g. street name)
*
- * @param navigationText
- * the text to describe the turn (e.g. street name)
+ * @param navigationText the text to describe the turn (e.g. street name)
*/
- public Turn setNavigationText( String navigationText) {
+ public Turn setNavigationText(String navigationText) {
setValue(KEY_NAVIGATION_TEXT, navigationText);
return this;
}
/**
* get the text to describe the turn (e.g. street name)
- *
+ *
* @return the text to describe the turn (e.g. street name)
*/
- public String getNavigationText(){
+ public String getNavigationText() {
return getString(KEY_NAVIGATION_TEXT);
}
/**
* set Image to be shown for a turn
*
- * @param turnIcon
- * the image to be shown for a turn
+ * @param turnIcon the image to be shown for a turn
*/
- public Turn setTurnIcon( Image turnIcon) {
+ public Turn setTurnIcon(Image turnIcon) {
setValue(KEY_TURN_IMAGE, turnIcon);
return this;
}
/**
* get the image to be shown for a turn
- *
+ *
* @return the image to be shown for a turn
*/
- public Image getTurnIcon(){
+ public Image getTurnIcon() {
return (Image) getObject(Image.class, KEY_TURN_IMAGE);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java
index 60a59f77b..2b9f8785f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java
@@ -47,50 +47,53 @@ import java.util.Hashtable;
*/
public class UnpublishAppService extends RPCRequest {
- public static final String KEY_SERVICE_ID = "serviceID";
+ public static final String KEY_SERVICE_ID = "serviceID";
- /**
- * Constructs a new UnpublishAppService object
- */
- public UnpublishAppService() {
- super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
- }
+ /**
+ * Constructs a new UnpublishAppService object
+ */
+ public UnpublishAppService() {
+ super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
+ }
- /**
- * Constructs a new UnpublishAppService object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public UnpublishAppService(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a new UnpublishAppService object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public UnpublishAppService(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a new UnpublishAppService object with the required serviceID
- * @param serviceID - set the service ID for the service to be unpublished
- */
- public UnpublishAppService(@NonNull String serviceID){
- this();
- setServiceID(serviceID);
- }
+ /**
+ * Constructs a new UnpublishAppService object with the required serviceID
+ *
+ * @param serviceID - set the service ID for the service to be unpublished
+ */
+ public UnpublishAppService(@NonNull String serviceID) {
+ this();
+ setServiceID(serviceID);
+ }
- // SETTERS AND GETTERS
+ // SETTERS AND GETTERS
- /**
- * The ID of the service to be unpublished.
- * @param serviceID - set the service ID for the service to be unpublished
- */
- public UnpublishAppService setServiceID( String serviceID) {
+ /**
+ * The ID of the service to be unpublished.
+ *
+ * @param serviceID - set the service ID for the service to be unpublished
+ */
+ public UnpublishAppService setServiceID(String serviceID) {
setParameters(KEY_SERVICE_ID, serviceID);
return this;
}
- /**
- * The ID of the service to be unpublished.
- * @return - get the service ID for the service to be unpublished
- */
- public String getServiceID(){
- return getString(KEY_SERVICE_ID);
- }
+ /**
+ * The ID of the service to be unpublished.
+ *
+ * @return - get the service ID for the service to be unpublished
+ */
+ public String getServiceID() {
+ return getString(KEY_SERVICE_ID);
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java
index a5b171930..1ed7857c2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java
@@ -47,30 +47,31 @@ import java.util.Hashtable;
* The response to UnpublishAppService
*/
public class UnpublishAppServiceResponse extends RPCResponse {
- /**
- * Constructs a new UnpublishAppServiceResponse object
- */
- public UnpublishAppServiceResponse() {
- super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
- }
+ /**
+ * Constructs a new UnpublishAppServiceResponse object
+ */
+ public UnpublishAppServiceResponse() {
+ super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
+ }
- /**
- * Constructs a new UnpublishAppServiceResponse object indicated by the Hashtable parameter
- *
- * @param hash The Hashtable to use
- */
- public UnpublishAppServiceResponse(Hashtable<String, Object> hash) {
- super(hash);
- }
+ /**
+ * Constructs a new UnpublishAppServiceResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public UnpublishAppServiceResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Constructs a new UnpublishAppServiceResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UnpublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new UnpublishAppServiceResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnpublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
index eb1675a11..894bbe531 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.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 com.smartdevicelink.protocol.enums.FunctionID;
@@ -41,7 +41,7 @@ import java.util.Hashtable;
* dispose of all resources associated with the application's interface
* registration (e.g. Command Menu items, Choice Sets, button subscriptions,
* etc.)
- *
+ *
* <p>After the UnregisterAppInterface operation is performed, no other operations
* can be performed until a new app interface registration is established by
* calling <i>{@linkplain RegisterAppInterface}</i></p>
@@ -50,20 +50,19 @@ import java.util.Hashtable;
* @see OnAppInterfaceUnregistered
*/
public class UnregisterAppInterface extends RPCRequest {
- /**
- * Constructs a new UnregisterAppInterface object
- */
+ /**
+ * Constructs a new UnregisterAppInterface object
+ */
public UnregisterAppInterface() {
super(FunctionID.UNREGISTER_APP_INTERFACE.toString());
}
- /**
- * <p>Constructs a new UnregisterAppInterface object indicated by the Hashtable
- * parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
- */
+
+ /**
+ * <p>Constructs a new UnregisterAppInterface object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
public UnregisterAppInterface(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
index 98e9121fe..001511587 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.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 androidx.annotation.NonNull;
@@ -41,38 +41,38 @@ import java.util.Hashtable;
/**
* Unregister AppInterface Response is sent, when UnregisterAppInterface has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class UnregisterAppInterfaceResponse extends RPCResponse {
- /**
- * Constructs a new UnregisterAppInterfaceResponse object
- */
+ /**
+ * Constructs a new UnregisterAppInterfaceResponse object
+ */
public UnregisterAppInterfaceResponse() {
super(FunctionID.UNREGISTER_APP_INTERFACE.toString());
}
- /**
- * Constructs a new UnregisterAppInterfaceResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new UnregisterAppInterfaceResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public UnregisterAppInterfaceResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new UnregisterAppInterfaceResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UnregisterAppInterfaceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new UnregisterAppInterfaceResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnregisterAppInterfaceResponse(@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/UnsubscribeButton.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
index 87dcc9cfb..e689689ca 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,12 +42,12 @@ import java.util.Hashtable;
/**
* Deletes a subscription to button notifications for the specified button. For
* more information about button subscriptions, see {@linkplain SubscribeButton}
- *
+ *
* <p>Application can unsubscribe from a button that is currently being pressed
* (i.e. has not yet been released), but app will not get button event</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -67,7 +67,7 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- *
+ *
* <p> <b>Response</b></p>
* <p><b>Non-default Result Codes:</b></p>
* <p>SUCCESS</p>
@@ -75,55 +75,59 @@ import java.util.Hashtable;
* <p>OUT_OF_MEMORY</p>
* <p>TOO_MANY_PENDING_REQUESTS</p>
* <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR </p>
+ * <p>GENERIC_ERROR </p>
* <p>UNSUPPORTED_RESOURCE</p>
* <p>IGNORED</p>
* <p>REJECTED</p>
- * @since SmartDeviceLink 1.0
+ *
* @see SubscribeButton
+ * @since SmartDeviceLink 1.0
*/
public class UnsubscribeButton extends RPCRequest {
- public static final String KEY_BUTTON_NAME = "buttonName";
+ public static final String KEY_BUTTON_NAME = "buttonName";
- /**
- * Constructs a new UnsubscribeButton object
- */
- public UnsubscribeButton() {
+ /**
+ * Constructs a new UnsubscribeButton object
+ */
+ public UnsubscribeButton() {
super(FunctionID.UNSUBSCRIBE_BUTTON.toString());
}
- /**
- * Constructs a new UnsubscribeButton object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+
+ /**
+ * Constructs a new UnsubscribeButton object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public UnsubscribeButton(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new UnsubscribeButton object
- * @param buttonName Name of the button to unsubscribe.
- */
- public UnsubscribeButton(@NonNull ButtonName buttonName){
- this();
- setButtonName(buttonName);
- }
+ /**
+ * Constructs a new UnsubscribeButton object
+ *
+ * @param buttonName Name of the button to unsubscribe.
+ */
+ public UnsubscribeButton(@NonNull ButtonName buttonName) {
+ this();
+ setButtonName(buttonName);
+ }
- /**
- * Gets a name of the button to unsubscribe from
- *
- * @return ButtonName -an Enumeration value, see <i> {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
- */
+ /**
+ * Gets a name of the button to unsubscribe from
+ *
+ * @return ButtonName -an Enumeration value, see <i> {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
+ */
public ButtonName getButtonName() {
- return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
+ return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
}
- /**
- * Sets the name of the button to unsubscribe from
- *
- * @param buttonName an enum value, see <i> {@linkplain ButtonName}</i>
- */
+
+ /**
+ * Sets the name of the button to unsubscribe from
+ *
+ * @param buttonName an enum value, see <i> {@linkplain ButtonName}</i>
+ */
public UnsubscribeButton setButtonName(@NonNull ButtonName buttonName) {
setParameters(KEY_BUTTON_NAME, buttonName);
return this;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
index af0281e8e..9e94ece35 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.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 androidx.annotation.NonNull;
@@ -41,37 +41,38 @@ import java.util.Hashtable;
/**
* Unsubscribe Button Response is sent, when UnsubscribeButton has been called
- *
+ *
* @since SmartDeviceLink 1.0
*/
public class UnsubscribeButtonResponse extends RPCResponse {
- /**
- * Constructs a new UnsubscribeButtonResponse object
- */
+ /**
+ * Constructs a new UnsubscribeButtonResponse object
+ */
public UnsubscribeButtonResponse() {
super(FunctionID.UNSUBSCRIBE_BUTTON.toString());
}
- /**
- * Constructs a new UnsubscribeButtonResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use
- */
+ /**
+ * Constructs a new UnsubscribeButtonResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public UnsubscribeButtonResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new UnsubscribeButtonResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UnsubscribeButtonResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new UnsubscribeButtonResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnsubscribeButtonResponse(@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/UnsubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index 751f9621f..226499364 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,7 +41,7 @@ import java.util.Hashtable;
* subscribeVehicleData function
* <p>Function Group: Location, VehicleInfo and DrivingChara</p>
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -270,8 +270,8 @@ import java.util.Hashtable;
* <td>turnSignal</td>
* <td>Boolean</td>
* <td>@see TurnSignal</td>
- * <td>N</td>
- * <td>Subscribable</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
* <td>SmartDeviceLink 5.0 </td>
* </tr>
* <tr>
@@ -295,238 +295,232 @@ import java.util.Hashtable;
* <td>N</td>
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
- *
-
+ *
+ *
* </table>
* <p><b> Response</b></p>
* <p><b>Non-default Result Codes:</b></p>
- * <p>SUCCESS</p>
- * <p>WARNINGS</p>
- * <p>INVALID_DATA</p>
- * <p>OUT_OF_MEMORY</p>
- * <p>TOO_MANY_PENDING_REQUESTS</p>
- * <p>APPLICATION_NOT_REGISTERED</p>
- * <p>GENERIC_ERROR</p>
- * <p>IGNORED</p>
- * <p>DISALLOWED</p>
+ * <p>SUCCESS</p>
+ * <p>WARNINGS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>IGNORED</p>
+ * <p>DISALLOWED</p>
*
- * @since SmartDeviceLink 2.0
* @see SubscribeVehicleData
* @see GetVehicleData
+ * @since SmartDeviceLink 2.0
*/
public class UnsubscribeVehicleData extends RPCRequest {
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
- public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
- public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
- public static final String KEY_GEAR_STATUS = "gearStatus";
- public static final String KEY_WINDOW_STATUS = "windowStatus";
- /**
- * @deprecated
- */
- @Deprecated
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
- /**
- * @deprecated
- */
- @Deprecated
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
+ public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
+ public static final String KEY_GEAR_STATUS = "gearStatus";
+ public static final String KEY_WINDOW_STATUS = "windowStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new UnsubscribeVehicleData object
- */
+ /**
+ * Constructs a new UnsubscribeVehicleData object
+ */
public UnsubscribeVehicleData() {
super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
}
- /**
- * Constructs a new UnsubscribeVehicleData object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash
- * The Hashtable to use
- */
+ /**
+ * Constructs a new UnsubscribeVehicleData object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use
+ */
public UnsubscribeVehicleData(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Sets a boolean value. If true, unsubscribes from Gps data
- *
- * @param gps
- * a boolean value
- */
- public UnsubscribeVehicleData setGps( Boolean gps) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from Gps data
+ *
+ * @param gps a boolean value
+ */
+ public UnsubscribeVehicleData setGps(Boolean gps) {
setParameters(KEY_GPS, gps);
return this;
}
- /**
- * Gets a boolean value. If true, means the Gps data has been unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Gps data has been
- * unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Gps data has been unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Gps data has been
+ * unsubscribed.
+ */
public Boolean getGps() {
return getBoolean(KEY_GPS);
}
- /**
- * Sets a boolean value. If true, unsubscribes from speed data
- *
- * @param speed
- * a boolean value
- */
- public UnsubscribeVehicleData setSpeed( Boolean speed) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from speed data
+ *
+ * @param speed a boolean value
+ */
+ public UnsubscribeVehicleData setSpeed(Boolean speed) {
setParameters(KEY_SPEED, speed);
return this;
}
- /**
- * Gets a boolean value. If true, means the Speed data has been unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Speed data has been
- * unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Speed data has been unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Speed data has been
+ * unsubscribed.
+ */
public Boolean getSpeed() {
return getBoolean(KEY_SPEED);
}
- /**
- * Sets a boolean value. If true, unsubscribe data
- *
- * @param rpm
- * a boolean value
- */
- public UnsubscribeVehicleData setRpm( Boolean rpm) {
+ /**
+ * Sets a boolean value. If true, unsubscribe data
+ *
+ * @param rpm a boolean value
+ */
+ public UnsubscribeVehicleData setRpm(Boolean rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
- /**
- * Gets a boolean value. If true, means the rpm data has been unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the rpm data has been
- * unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the rpm data has been unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the rpm data has been
+ * unsubscribed.
+ */
public Boolean getRpm() {
return getBoolean(KEY_RPM);
}
- /**
- * Sets the fuelLevel.
- *
- * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
- */
- @Deprecated
- public UnsubscribeVehicleData setFuelLevel( Boolean fuelLevel) {
+ /**
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
+ public UnsubscribeVehicleData setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
- /**
- * Gets the fuelLevel.
- *
- * @return Boolean The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
- */
- @Deprecated
+ /**
+ * Gets the fuelLevel.
+ *
+ * @return Boolean The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public Boolean getFuelLevel() {
return getBoolean(KEY_FUEL_LEVEL);
}
- /**
- * Sets the fuelRange.
- *
- * @param fuelLevelState The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
- * @since SmartDeviceLink 5.0.0
- */
+ /**
+ * Sets the fuelRange.
+ *
+ * @param fuelLevelState The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
@Deprecated
- public UnsubscribeVehicleData setFuelLevelState( Boolean fuelLevelState) {
+ public UnsubscribeVehicleData setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
- /**
- * Gets the fuelRange.
- *
- * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
- * @since SmartDeviceLink 5.0.0
- */
- @Deprecated
+ /**
+ * Gets the fuelRange.
+ *
+ * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
+ @Deprecated
public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
- /**
- * Sets a boolean value. If true, unsubscribes from instantFuelConsumption data
- *
- * @param instantFuelConsumption
- * a boolean value
- */
- public UnsubscribeVehicleData setInstantFuelConsumption( Boolean instantFuelConsumption) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from instantFuelConsumption data
+ *
+ * @param instantFuelConsumption a boolean value
+ */
+ public UnsubscribeVehicleData setInstantFuelConsumption(Boolean instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
- /**
- * Gets a boolean value. If true, means the getInstantFuelConsumption data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the getInstantFuelConsumption data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the getInstantFuelConsumption data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the getInstantFuelConsumption data
+ * has been unsubscribed.
+ */
public Boolean getInstantFuelConsumption() {
return getBoolean(KEY_INSTANT_FUEL_CONSUMPTION);
}
- /**
- * Sets a boolean value. If true, unsubscribes from externalTemperature data
- *
- * @param externalTemperature
- * a boolean value
- */
- public UnsubscribeVehicleData setExternalTemperature( Boolean externalTemperature) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from externalTemperature data
+ *
+ * @param externalTemperature a boolean value
+ */
+ public UnsubscribeVehicleData setExternalTemperature(Boolean externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
- /**
- * Gets a boolean value. If true, means the externalTemperature data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the externalTemperature data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the externalTemperature data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the externalTemperature data
+ * has been unsubscribed.
+ */
public Boolean getExternalTemperature() {
return getBoolean(KEY_EXTERNAL_TEMPERATURE);
}
@@ -538,7 +532,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public UnsubscribeVehicleData setPrndl( Boolean prndl) {
+ public UnsubscribeVehicleData setPrndl(Boolean prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
@@ -554,382 +548,389 @@ public class UnsubscribeVehicleData extends RPCRequest {
return getBoolean(KEY_PRNDL);
}
- /**
- * Sets a boolean value. If true, unsubscribes from tire pressure status data
- *
- * @param tirePressure
- * a boolean value
- */
- public UnsubscribeVehicleData setTirePressure( Boolean tirePressure) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from tire pressure status data
+ *
+ * @param tirePressure a boolean value
+ */
+ public UnsubscribeVehicleData setTirePressure(Boolean tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
- /**
- * Gets a boolean value. If true, means the tire pressure status data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the tire pressure status data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the tire pressure status data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the tire pressure status data
+ * has been unsubscribed.
+ */
public Boolean getTirePressure() {
return getBoolean(KEY_TIRE_PRESSURE);
}
- /**
- * Sets a boolean value. If true, unsubscribes from odometer data
- *
- * @param odometer
- * a boolean value
- */
- public UnsubscribeVehicleData setOdometer( Boolean odometer) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from odometer data
+ *
+ * @param odometer a boolean value
+ */
+ public UnsubscribeVehicleData setOdometer(Boolean odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
- /**
- * Gets a boolean value. If true, means the odometer data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the odometer data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the odometer data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the odometer data
+ * has been unsubscribed.
+ */
public Boolean getOdometer() {
return getBoolean(KEY_ODOMETER);
}
- /**
- * Sets a boolean value. If true, unsubscribes from belt Status data
- *
- * @param beltStatus
- * a boolean value
- */
- public UnsubscribeVehicleData setBeltStatus( Boolean beltStatus) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from belt Status data
+ *
+ * @param beltStatus a boolean value
+ */
+ public UnsubscribeVehicleData setBeltStatus(Boolean beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the belt Status data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the belt Status data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the belt Status data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the belt Status data
+ * has been unsubscribed.
+ */
public Boolean getBeltStatus() {
return getBoolean(KEY_BELT_STATUS);
}
- /**
- * Sets a boolean value. If true, unsubscribes from body Information data
- *
- * @param bodyInformation
- * a boolean value
- */
- public UnsubscribeVehicleData setBodyInformation( Boolean bodyInformation) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from body Information data
+ *
+ * @param bodyInformation a boolean value
+ */
+ public UnsubscribeVehicleData setBodyInformation(Boolean bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
- /**
- * Gets a boolean value. If true, means the body Information data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the body Information data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the body Information data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the body Information data
+ * has been unsubscribed.
+ */
public Boolean getBodyInformation() {
return getBoolean(KEY_BODY_INFORMATION);
}
- /**
- * Sets a boolean value. If true, unsubscribes from device Status data
- *
- * @param deviceStatus
- * a boolean value
- */
- public UnsubscribeVehicleData setDeviceStatus( Boolean deviceStatus) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from device Status data
+ *
+ * @param deviceStatus a boolean value
+ */
+ public UnsubscribeVehicleData setDeviceStatus(Boolean deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the device Status data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the device Status data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the device Status data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the device Status data
+ * has been unsubscribed.
+ */
public Boolean getDeviceStatus() {
return getBoolean(KEY_DEVICE_STATUS);
}
- /**
- * Sets a boolean value. If true, unsubscribes from driver Braking data
- *
- * @param driverBraking
- * a boolean value
- */
- public UnsubscribeVehicleData setDriverBraking( Boolean driverBraking) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from driver Braking data
+ *
+ * @param driverBraking a boolean value
+ */
+ public UnsubscribeVehicleData setDriverBraking(Boolean driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
- /**
- * Gets a boolean value. If true, means the driver Braking data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the driver Braking data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the driver Braking data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the driver Braking data
+ * has been unsubscribed.
+ */
public Boolean getDriverBraking() {
return getBoolean(KEY_DRIVER_BRAKING);
}
- /**
- * Sets a boolean value. If true, unsubscribes from wiper Status data
- *
- * @param wiperStatus
- * a boolean value
- */
- public UnsubscribeVehicleData setWiperStatus( Boolean wiperStatus) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from wiper Status data
+ *
+ * @param wiperStatus a boolean value
+ */
+ public UnsubscribeVehicleData setWiperStatus(Boolean wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the wiper Status data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the wiper Status data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the wiper Status data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the wiper Status data
+ * has been unsubscribed.
+ */
public Boolean getWiperStatus() {
return getBoolean(KEY_WIPER_STATUS);
}
- /**
- * Sets a boolean value. If true, unsubscribes from Head Lamp Status data
- *
- * @param headLampStatus
- * a boolean value
- */
- public UnsubscribeVehicleData setHeadLampStatus( Boolean headLampStatus) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from Head Lamp Status data
+ *
+ * @param headLampStatus a boolean value
+ */
+ public UnsubscribeVehicleData setHeadLampStatus(Boolean headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the Head Lamp Status data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Head Lamp Status data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the Head Lamp Status data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Head Lamp Status data
+ * has been unsubscribed.
+ */
public Boolean getHeadLampStatus() {
return getBoolean(KEY_HEAD_LAMP_STATUS);
}
- /**
- * Sets a boolean value. If true, unsubscribes from Engine Torque data
- *
- * @param engineTorque
- * a boolean value
- */
- public UnsubscribeVehicleData setEngineTorque( Boolean engineTorque) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from Engine Torque data
+ *
+ * @param engineTorque a boolean value
+ */
+ public UnsubscribeVehicleData setEngineTorque(Boolean engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
- /**
- * Gets a boolean value. If true, means the Engine Torque data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Engine Torque data
- * has been unsubscribed.
- */
- public Boolean getEngineTorque() {
- return getBoolean(KEY_ENGINE_TORQUE);
- }
-
- /**
- * Sets a boolean value. If true, unsubscribes from Engine Oil Life data
- *
- * @param engineOilLife
- * a boolean value
- */
- public UnsubscribeVehicleData setEngineOilLife( Boolean engineOilLife) {
+ /**
+ * Gets a boolean value. If true, means the Engine Torque data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Engine Torque data
+ * has been unsubscribed.
+ */
+ public Boolean getEngineTorque() {
+ return getBoolean(KEY_ENGINE_TORQUE);
+ }
+
+ /**
+ * Sets a boolean value. If true, unsubscribes from Engine Oil Life data
+ *
+ * @param engineOilLife a boolean value
+ */
+ public UnsubscribeVehicleData setEngineOilLife(Boolean engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
- /**
- * Gets a boolean value. If true, means the Engine Oil Life data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Engine Oil Life data
- * has been unsubscribed.
- */
- public Boolean getEngineOilLife() {
- return getBoolean(KEY_ENGINE_OIL_LIFE);
- }
+ /**
+ * Gets a boolean value. If true, means the Engine Oil Life data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the Engine Oil Life data
+ * has been unsubscribed.
+ */
+ public Boolean getEngineOilLife() {
+ return getBoolean(KEY_ENGINE_OIL_LIFE);
+ }
- /**
- * Sets a boolean value. If true, unsubscribes from accPedalPosition data
- *
- * @param accPedalPosition
- * a boolean value
- */
- public UnsubscribeVehicleData setAccPedalPosition( Boolean accPedalPosition) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from accPedalPosition data
+ *
+ * @param accPedalPosition a boolean value
+ */
+ public UnsubscribeVehicleData setAccPedalPosition(Boolean accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
- /**
- * Gets a boolean value. If true, means the accPedalPosition data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the accPedalPosition data
- * has been unsubscribed.
- */
+ /**
+ * Gets a boolean value. If true, means the accPedalPosition data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the accPedalPosition data
+ * has been unsubscribed.
+ */
public Boolean getAccPedalPosition() {
return getBoolean(KEY_ACC_PEDAL_POSITION);
}
- public UnsubscribeVehicleData setSteeringWheelAngle( Boolean steeringWheelAngle) {
+ public UnsubscribeVehicleData setSteeringWheelAngle(Boolean steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
public Boolean getSteeringWheelAngle() {
return getBoolean(KEY_STEERING_WHEEL_ANGLE);
- }
-
- public UnsubscribeVehicleData setECallInfo( Boolean eCallInfo) {
+ }
+
+ public UnsubscribeVehicleData setECallInfo(Boolean eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public Boolean getECallInfo() {
return getBoolean(KEY_E_CALL_INFO);
}
- public UnsubscribeVehicleData setAirbagStatus( Boolean airbagStatus) {
+
+ public UnsubscribeVehicleData setAirbagStatus(Boolean airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public Boolean getAirbagStatus() {
return getBoolean(KEY_AIRBAG_STATUS);
}
- public UnsubscribeVehicleData setEmergencyEvent( Boolean emergencyEvent) {
+
+ public UnsubscribeVehicleData setEmergencyEvent(Boolean emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public Boolean getEmergencyEvent() {
return getBoolean(KEY_EMERGENCY_EVENT);
}
- public UnsubscribeVehicleData setClusterModeStatus( Boolean clusterModeStatus) {
+
+ public UnsubscribeVehicleData setClusterModeStatus(Boolean clusterModeStatus) {
setParameters(KEY_CLUSTER_MODE_STATUS, clusterModeStatus);
return this;
}
+
public Boolean getClusterModeStatus() {
return getBoolean(KEY_CLUSTER_MODE_STATUS);
}
- public UnsubscribeVehicleData setMyKey( Boolean myKey) {
+
+ public UnsubscribeVehicleData setMyKey(Boolean myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public Boolean getMyKey() {
return getBoolean(KEY_MY_KEY);
}
- /**
- * Sets a boolean value. If true, unsubscribes from fuelRange data
- *
- * @param fuelRange
- * a boolean value
- */
- public UnsubscribeVehicleData setFuelRange( Boolean fuelRange) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from fuelRange data
+ *
+ * @param fuelRange a boolean value
+ */
+ public UnsubscribeVehicleData setFuelRange(Boolean fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
- /**
- * Gets a boolean value. If true, means the fuelRange data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the fuelRange data
- * has been unsubscribed.
- */
- public Boolean getFuelRange() {
- return getBoolean(KEY_FUEL_RANGE);
- }
+ /**
+ * Gets a boolean value. If true, means the fuelRange data has been
+ * unsubscribed.
+ *
+ * @return Boolean -a Boolean value. If true, means the fuelRange data
+ * has been unsubscribed.
+ */
+ public Boolean getFuelRange() {
+ return getBoolean(KEY_FUEL_RANGE);
+ }
- /**
- * Sets a boolean value. If true, unsubscribes from turnSignal data
- * @param turnSignal a boolean value
- */
- public UnsubscribeVehicleData setTurnSignal( Boolean turnSignal) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from turnSignal data
+ *
+ * @param turnSignal a boolean value
+ */
+ public UnsubscribeVehicleData setTurnSignal(Boolean turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
- /**
- * Gets a boolean value. If true, means the turnSignal data has been unsubscribed.
- * @return a Boolean value.
- */
- public Boolean getTurnSignal() { return getBoolean(KEY_TURN_SIGNAL); }
+ /**
+ * Gets a boolean value. If true, means the turnSignal data has been unsubscribed.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getTurnSignal() {
+ return getBoolean(KEY_TURN_SIGNAL);
+ }
- /**
- * Sets a boolean value. If true, unsubscribes from electronicParkBrakeStatus data
- * @param electronicParkBrakeStatus a boolean value
- */
- public UnsubscribeVehicleData setElectronicParkBrakeStatus( Boolean electronicParkBrakeStatus) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from electronicParkBrakeStatus data
+ *
+ * @param electronicParkBrakeStatus a boolean value
+ */
+ public UnsubscribeVehicleData setElectronicParkBrakeStatus(Boolean electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
- /**
- * Gets a boolean value. If true, means the electronicParkBrakeStatus data has been subscribed.
- * @return a Boolean value.
- */
- public Boolean getElectronicParkBrakeStatus() {
- return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
- }
+ /**
+ * Gets a boolean value. If true, means the electronicParkBrakeStatus data has been subscribed.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getElectronicParkBrakeStatus() {
+ return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
+ }
- /**
- * Sets a boolean value. If true, unsubscribes from cloudAppVehicleID data
- * @param cloudAppVehicleID a boolean value.
- */
- public UnsubscribeVehicleData setCloudAppVehicleID( boolean cloudAppVehicleID) {
+ /**
+ * Sets a boolean value. If true, unsubscribes from cloudAppVehicleID data
+ *
+ * @param cloudAppVehicleID a boolean value.
+ */
+ public UnsubscribeVehicleData setCloudAppVehicleID(boolean cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
- /**
- * Gets a boolean value. If true, means the cloudAppVehicleID data has been unsubscribed.
- * @return a Boolean value.
- */
- public Boolean getCloudAppVehicleID(){
- return getBoolean( KEY_CLOUD_APP_VEHICLE_ID);
- }
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleID data has been unsubscribed.
+ *
+ * @return a Boolean value.
+ */
+ 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 UnsubscribeVehicleData setOEMCustomVehicleData( String vehicleDataName, Boolean vehicleDataState) {
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ *
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public UnsubscribeVehicleData setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
- /**
- * Gets a boolean value for OEM Custom VehicleData.
- * @return a Boolean value.
- */
- public Boolean getOEMCustomVehicleData(String vehicleDataName){
- return getBoolean(vehicleDataName);
- }
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ *
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName) {
+ return getBoolean(vehicleDataName);
+ }
/**
* Sets the gearStatus.
@@ -937,7 +938,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleData setGearStatus( Boolean gearStatus) {
+ public UnsubscribeVehicleData setGearStatus(Boolean gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -958,7 +959,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleData setHandsOffSteering( Boolean handsOffSteering) {
+ public UnsubscribeVehicleData setHandsOffSteering(Boolean handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -979,7 +980,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleData setWindowStatus( Boolean windowStatus) {
+ public UnsubscribeVehicleData setWindowStatus(Boolean windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -1000,7 +1001,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleData setStabilityControlsStatus( Boolean stabilityControlsStatus) {
+ public UnsubscribeVehicleData setStabilityControlsStatus(Boolean stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
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 075994cd9..a9b59ce9b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,37 +41,38 @@ import java.util.Hashtable;
/**
* Unsubscribe Vehicle Data Response is sent, when UnsubscribeVehicleData has been called.
- *
+ *
* @since SmartDeviceLink 2.0
*/
public class UnsubscribeVehicleDataResponse extends RPCResponse {
- public static final String KEY_SPEED = "speed";
- public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_PRNDL = "prndl";
- public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
- public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
- public static final String KEY_BELT_STATUS = "beltStatus";
- public static final String KEY_BODY_INFORMATION = "bodyInformation";
- public static final String KEY_DEVICE_STATUS = "deviceStatus";
- public static final String KEY_DRIVER_BRAKING = "driverBraking";
- public static final String KEY_WIPER_STATUS = "wiperStatus";
- public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
- public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
- public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
- public static final String KEY_E_CALL_INFO = "eCallInfo";
- public static final String KEY_AIRBAG_STATUS = "airbagStatus";
- public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
- @Deprecated public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
+ public static final String KEY_SPEED = "speed";
+ public static final String KEY_RPM = "rpm";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_PRNDL = "prndl";
+ public static final String KEY_TIRE_PRESSURE = "tirePressure";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ODOMETER = "odometer";
+ public static final String KEY_GPS = "gps";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_BELT_STATUS = "beltStatus";
+ public static final String KEY_BODY_INFORMATION = "bodyInformation";
+ public static final String KEY_DEVICE_STATUS = "deviceStatus";
+ public static final String KEY_DRIVER_BRAKING = "driverBraking";
+ public static final String KEY_WIPER_STATUS = "wiperStatus";
+ public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
+ public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_E_CALL_INFO = "eCallInfo";
+ public static final String KEY_AIRBAG_STATUS = "airbagStatus";
+ public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
+ @Deprecated
+ public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
public static final String KEY_CLUSTER_MODES = "clusterModes";
- public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_MY_KEY = "myKey";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
@@ -88,91 +89,105 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
- /**
- * Constructs a new UnsubscribeVehicleDataResponse object
- */
- public UnsubscribeVehicleDataResponse() {
- super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
- }
-
- /**
- * Constructs a new UnsubscribeVehicleDataResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UnsubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
-
- /**
- * Constructs a new UnsubscribeVehicleDataResponse object indicated by the Hashtable
- * parameter
- * <p></p>
- *
- * @param hash The Hashtable to use to build this RPC
- *
- */
+ /**
+ * Constructs a new UnsubscribeVehicleDataResponse object
+ */
+ public UnsubscribeVehicleDataResponse() {
+ super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
+ }
+
+ /**
+ * Constructs a new UnsubscribeVehicleDataResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnsubscribeVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ /**
+ * Constructs a new UnsubscribeVehicleDataResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash The Hashtable to use to build this RPC
+ */
public UnsubscribeVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
/**
* Sets Gps
+ *
* @param gps a VehicleDataResult related to GPS
*/
- public UnsubscribeVehicleDataResponse setGps( VehicleDataResult gps) {
+ public UnsubscribeVehicleDataResponse setGps(VehicleDataResult gps) {
setParameters(KEY_GPS, gps);
return this;
}
+
/**
* Gets Gps
+ *
* @return a VehicleDataResult related to GPS
*/
public VehicleDataResult getGps() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_GPS);
}
+
/**
* Sets Speed
+ *
* @param speed a VehicleDataResult related to speed
*/
- public UnsubscribeVehicleDataResponse setSpeed( VehicleDataResult speed) {
+ public UnsubscribeVehicleDataResponse setSpeed(VehicleDataResult speed) {
setParameters(KEY_SPEED, speed);
return this;
}
+
/**
* Gets Speed
+ *
* @return a VehicleDataResult related to speed
*/
public VehicleDataResult getSpeed() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_SPEED);
}
+
/**
* Sets rpm
+ *
* @param rpm a VehicleDataResult related to RPM
*/
- public UnsubscribeVehicleDataResponse setRpm( VehicleDataResult rpm) {
+ public UnsubscribeVehicleDataResponse setRpm(VehicleDataResult rpm) {
setParameters(KEY_RPM, rpm);
return this;
}
+
/**
* Gets rpm
+ *
* @return a VehicleDataResult related to RPM
*/
public VehicleDataResult getRpm() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_RPM);
}
+
/**
* Sets the fuelLevel.
*
* @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
- * 7.0, please see fuelRange.
+ * 7.0, please see fuelRange.
*/
@Deprecated
- public UnsubscribeVehicleDataResponse setFuelLevel( VehicleDataResult fuelLevel) {
+ public UnsubscribeVehicleDataResponse setFuelLevel(VehicleDataResult fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
return this;
}
+
/**
* Gets the fuelLevel.
*
@@ -183,53 +198,66 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getFuelLevel() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL);
}
+
/**
* Sets Fuel Level State
+ *
* @param fuelLevelState a VehicleDataResult related to FuelLevel State
*/
@Deprecated
- public UnsubscribeVehicleDataResponse setFuelLevelState( VehicleDataResult fuelLevelState) {
+ public UnsubscribeVehicleDataResponse setFuelLevelState(VehicleDataResult fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
return this;
}
+
/**
* Gets Fuel Level State
+ *
* @return a VehicleDataResult related to FuelLevel State
*/
@Deprecated
public VehicleDataResult getFuelLevelState() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL_STATE);
}
+
/**
* Sets Instant Fuel Consumption
+ *
* @param instantFuelConsumption a VehicleDataResult related to instant fuel consumption
*/
- public UnsubscribeVehicleDataResponse setInstantFuelConsumption( VehicleDataResult instantFuelConsumption) {
+ public UnsubscribeVehicleDataResponse setInstantFuelConsumption(VehicleDataResult instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
return this;
}
+
/**
* Gets Instant Fuel Consumption
+ *
* @return a VehicleDataResult related to instant fuel consumption
*/
public VehicleDataResult getInstantFuelConsumption() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_INSTANT_FUEL_CONSUMPTION);
}
+
/**
* Sets External Temperature
+ *
* @param externalTemperature a VehicleDataResult related to external temperature
*/
- public UnsubscribeVehicleDataResponse setExternalTemperature( VehicleDataResult externalTemperature) {
+ public UnsubscribeVehicleDataResponse setExternalTemperature(VehicleDataResult externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
return this;
}
+
/**
* Gets External Temperature
+ *
* @return a VehicleDataResult related to external temperature
*/
public VehicleDataResult getExternalTemperature() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_EXTERNAL_TEMPERATURE);
}
+
/**
* Sets the prndl.
*
@@ -237,10 +265,11 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @deprecated in SmartDeviceLink 7.0.0
*/
@Deprecated
- public UnsubscribeVehicleDataResponse setPrndl( VehicleDataResult prndl) {
+ public UnsubscribeVehicleDataResponse setPrndl(VehicleDataResult prndl) {
setParameters(KEY_PRNDL, prndl);
return this;
}
+
/**
* Gets the prndl.
*
@@ -251,209 +280,260 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getPrndl() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_PRNDL);
}
+
/**
* Sets Tire Pressure
+ *
* @param tirePressure a VehicleDataResult related to tire pressure
*/
- public UnsubscribeVehicleDataResponse setTirePressure( VehicleDataResult tirePressure) {
+ public UnsubscribeVehicleDataResponse setTirePressure(VehicleDataResult tirePressure) {
setParameters(KEY_TIRE_PRESSURE, tirePressure);
return this;
}
+
/**
* Gets Tire Pressure
+ *
* @return a VehicleDataResult related to tire pressure
*/
public VehicleDataResult getTirePressure() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_TIRE_PRESSURE);
}
+
/**
* Sets Odometer
+ *
* @param odometer a VehicleDataResult related to the odometer
*/
- public UnsubscribeVehicleDataResponse setOdometer( VehicleDataResult odometer) {
+ public UnsubscribeVehicleDataResponse setOdometer(VehicleDataResult odometer) {
setParameters(KEY_ODOMETER, odometer);
return this;
}
+
/**
* Gets Odometer
+ *
* @return a VehicleDataResult related to the odometer
*/
public VehicleDataResult getOdometer() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ODOMETER);
}
+
/**
* Sets Belt Status
+ *
* @param beltStatus a VehicleDataResult related to the seat belt status
*/
- public UnsubscribeVehicleDataResponse setBeltStatus( VehicleDataResult beltStatus) {
+ public UnsubscribeVehicleDataResponse setBeltStatus(VehicleDataResult beltStatus) {
setParameters(KEY_BELT_STATUS, beltStatus);
return this;
}
+
/**
* Gets Belt Status
+ *
* @return a VehicleDataResult related to the seat belt status
*/
public VehicleDataResult getBeltStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_BELT_STATUS);
}
+
/**
* Sets Body Information
+ *
* @param bodyInformation a VehicleDataResult related to the body info
*/
- public UnsubscribeVehicleDataResponse setBodyInformation( VehicleDataResult bodyInformation) {
+ public UnsubscribeVehicleDataResponse setBodyInformation(VehicleDataResult bodyInformation) {
setParameters(KEY_BODY_INFORMATION, bodyInformation);
return this;
}
+
/**
* Gets Body Information
+ *
* @return a VehicleDataResult related to the body info
*/
public VehicleDataResult getBodyInformation() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_BODY_INFORMATION);
}
+
/**
* Sets Device Status
+ *
* @param deviceStatus a VehicleDataResult related to the device status of the connected device
*/
- public UnsubscribeVehicleDataResponse setDeviceStatus( VehicleDataResult deviceStatus) {
+ public UnsubscribeVehicleDataResponse setDeviceStatus(VehicleDataResult deviceStatus) {
setParameters(KEY_DEVICE_STATUS, deviceStatus);
return this;
}
+
/**
* Gets Device Status
+ *
* @return a VehicleDataResult related to the device status of the connected device
*/
public VehicleDataResult getDeviceStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_DEVICE_STATUS);
}
+
/**
* Sets Driver Braking
+ *
* @param driverBraking a VehicleDataResult related to the driver breaking status
*/
- public UnsubscribeVehicleDataResponse setDriverBraking( VehicleDataResult driverBraking) {
+ public UnsubscribeVehicleDataResponse setDriverBraking(VehicleDataResult driverBraking) {
setParameters(KEY_DRIVER_BRAKING, driverBraking);
return this;
}
+
/**
* Gets Driver Braking
+ *
* @return a VehicleDataResult related to the driver breaking status
*/
public VehicleDataResult getDriverBraking() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_DRIVER_BRAKING);
}
+
/**
* Sets Wiper Status
+ *
* @param wiperStatus a VehicleDataResult related to the wiper status
*/
- public UnsubscribeVehicleDataResponse setWiperStatus( VehicleDataResult wiperStatus) {
+ public UnsubscribeVehicleDataResponse setWiperStatus(VehicleDataResult wiperStatus) {
setParameters(KEY_WIPER_STATUS, wiperStatus);
return this;
}
+
/**
* Gets Wiper Status
+ *
* @return a VehicleDataResult related to the wiper status
*/
public VehicleDataResult getWiperStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_WIPER_STATUS);
}
+
/**
* Sets Head Lamp Status
+ *
* @param headLampStatus a VehicleDataResult related to the headlamp status
*/
- public UnsubscribeVehicleDataResponse setHeadLampStatus( VehicleDataResult headLampStatus) {
+ public UnsubscribeVehicleDataResponse setHeadLampStatus(VehicleDataResult headLampStatus) {
setParameters(KEY_HEAD_LAMP_STATUS, headLampStatus);
return this;
}
+
/**
* Gets Head Lamp Status
+ *
* @return a VehicleDataResult related to the headlamp status
*/
public VehicleDataResult getHeadLampStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_HEAD_LAMP_STATUS);
}
+
/**
* Sets Engine Torque
+ *
* @param engineTorque a VehicleDataResult related to the engine's torque
*/
- public UnsubscribeVehicleDataResponse setEngineTorque( VehicleDataResult engineTorque) {
+ public UnsubscribeVehicleDataResponse setEngineTorque(VehicleDataResult engineTorque) {
setParameters(KEY_ENGINE_TORQUE, engineTorque);
return this;
}
+
/**
* Gets Engine Torque
+ *
* @return a VehicleDataResult related to the engine's torque
*/
public VehicleDataResult getEngineTorque() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ENGINE_TORQUE);
}
+
/**
* Sets Engine Oil Life
+ *
* @param engineOilLife a VehicleDataResult related to the engine's oil life
*/
- public UnsubscribeVehicleDataResponse setEngineOilLife( VehicleDataResult engineOilLife) {
+ public UnsubscribeVehicleDataResponse setEngineOilLife(VehicleDataResult engineOilLife) {
setParameters(KEY_ENGINE_OIL_LIFE, engineOilLife);
return this;
}
+
/**
* Gets Engine Oil Life
+ *
* @return a VehicleDataResult related to the engine's oil life
*/
public VehicleDataResult getEngineOilLife() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ENGINE_OIL_LIFE);
}
+
/**
* Sets AccPedal Position
+ *
* @param accPedalPosition a VehicleDataResult related to the accelerator pedal's position
*/
- public UnsubscribeVehicleDataResponse setAccPedalPosition( VehicleDataResult accPedalPosition) {
+ public UnsubscribeVehicleDataResponse setAccPedalPosition(VehicleDataResult accPedalPosition) {
setParameters(KEY_ACC_PEDAL_POSITION, accPedalPosition);
return this;
}
+
/**
* Gets AccPedal Position
+ *
* @return a VehicleDataResult related to the accelerator pedal's position
*/
public VehicleDataResult getAccPedalPosition() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ACC_PEDAL_POSITION);
- }
-
- public UnsubscribeVehicleDataResponse setSteeringWheelAngle( VehicleDataResult steeringWheelAngle) {
+ }
+
+ public UnsubscribeVehicleDataResponse setSteeringWheelAngle(VehicleDataResult steeringWheelAngle) {
setParameters(KEY_STEERING_WHEEL_ANGLE, steeringWheelAngle);
return this;
}
public VehicleDataResult getSteeringWheelAngle() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_STEERING_WHEEL_ANGLE);
- }
-
- public UnsubscribeVehicleDataResponse setECallInfo( VehicleDataResult eCallInfo) {
+ }
+
+ public UnsubscribeVehicleDataResponse setECallInfo(VehicleDataResult eCallInfo) {
setParameters(KEY_E_CALL_INFO, eCallInfo);
return this;
}
+
public VehicleDataResult getECallInfo() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_E_CALL_INFO);
}
- public UnsubscribeVehicleDataResponse setAirbagStatus( VehicleDataResult airbagStatus) {
+
+ public UnsubscribeVehicleDataResponse setAirbagStatus(VehicleDataResult airbagStatus) {
setParameters(KEY_AIRBAG_STATUS, airbagStatus);
return this;
}
+
public VehicleDataResult getAirbagStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_AIRBAG_STATUS);
}
- public UnsubscribeVehicleDataResponse setEmergencyEvent( VehicleDataResult emergencyEvent) {
+
+ public UnsubscribeVehicleDataResponse setEmergencyEvent(VehicleDataResult emergencyEvent) {
setParameters(KEY_EMERGENCY_EVENT, emergencyEvent);
return this;
}
+
public VehicleDataResult getEmergencyEvent() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_EMERGENCY_EVENT);
}
+
/**
* @deprecated use {@link #setClusterModes(VehicleDataResult clusterMode)} instead.
*/
@Deprecated
- public UnsubscribeVehicleDataResponse setClusterModeStatus( VehicleDataResult clusterModeStatus) {
+ public UnsubscribeVehicleDataResponse setClusterModeStatus(VehicleDataResult clusterModeStatus) {
return setClusterModes(clusterModeStatus);
}
+
/**
* @deprecated use {@link #getClusterModes()} instead.
*/
@@ -461,25 +541,31 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getClusterModeStatus() {
return getClusterModes();
}
+
/**
* Sets the status modes of the cluster
+ *
* @param clusterMode the status modes of the cluster
*/
public UnsubscribeVehicleDataResponse setClusterModes(VehicleDataResult clusterMode) {
setParameters(KEY_CLUSTER_MODES, clusterMode);
return this;
}
+
/**
* Gets the status modes of the cluster
+ *
* @return The status modes of the cluster
*/
public VehicleDataResult getClusterModes() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLUSTER_MODES);
}
- public UnsubscribeVehicleDataResponse setMyKey( VehicleDataResult myKey) {
+
+ public UnsubscribeVehicleDataResponse setMyKey(VehicleDataResult myKey) {
setParameters(KEY_MY_KEY, myKey);
return this;
}
+
public VehicleDataResult getMyKey() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_MY_KEY);
}
@@ -488,10 +574,10 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* Sets the fuelRange.
*
* @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
- * vehicle. See struct FuelRange for details.
+ * vehicle. See struct FuelRange for details.
* @since SmartDeviceLink 5.0.0
*/
- public UnsubscribeVehicleDataResponse setFuelRange( VehicleDataResult fuelRange) {
+ public UnsubscribeVehicleDataResponse setFuelRange(VehicleDataResult fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
return this;
}
@@ -509,15 +595,17 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
/**
* Sets turnSignal
+ *
* @param turnSignal a VehicleDataResult related to the turn signal status
*/
- public UnsubscribeVehicleDataResponse setTurnSignal( VehicleDataResult turnSignal) {
+ public UnsubscribeVehicleDataResponse setTurnSignal(VehicleDataResult turnSignal) {
setParameters(KEY_TURN_SIGNAL, turnSignal);
return this;
}
/**
* Gets turnSignal
+ *
* @return a VehicleDataResult related to the turn signal status
*/
public VehicleDataResult getTurnSignal() {
@@ -526,53 +614,59 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
/**
* Sets electronicParkBrakeStatus
+ *
* @param electronicParkBrakeStatus a VehicleDataResult related to the electronic park brake status
*/
- public UnsubscribeVehicleDataResponse setElectronicParkBrakeStatus( VehicleDataResult electronicParkBrakeStatus) {
+ public UnsubscribeVehicleDataResponse setElectronicParkBrakeStatus(VehicleDataResult electronicParkBrakeStatus) {
setParameters(KEY_ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
return this;
}
/**
* Gets electronicParkBrakeStatus
+ *
* @return a VehicleDataResult related to the electronic park brake status
*/
- public VehicleDataResult getElectronicParkBrakeStatus(){
+ public VehicleDataResult getElectronicParkBrakeStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
/**
* Sets cloudAppVehicleID
+ *
* @param cloudAppVehicleID a VehicleDataResult related to the cloud app vehicle ID
*/
- public UnsubscribeVehicleDataResponse setCloudAppVehicleID( VehicleDataResult cloudAppVehicleID) {
+ public UnsubscribeVehicleDataResponse setCloudAppVehicleID(VehicleDataResult cloudAppVehicleID) {
setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
return this;
}
/**
* Gets a VehicleDataResult for the unsubscribe response of the CloudAppVehicleID vehicle data item.
+ *
* @return a VehicleDataResult related to the cloud app vehicle ID
*/
- public VehicleDataResult getCloudAppVehicleID(){
+ 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 vehicleDataName a String value
* @param vehicleDataState a VehicleDataResult value
*/
- public UnsubscribeVehicleDataResponse setOEMCustomVehicleData( String vehicleDataName, VehicleDataResult vehicleDataState) {
+ public UnsubscribeVehicleDataResponse setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState) {
setParameters(vehicleDataName, vehicleDataState);
return this;
}
/**
* Gets a VehicleDataResult for the vehicle data item.
+ *
* @return a VehicleDataResult related to the vehicle data
*/
- public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName) {
return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
}
@@ -582,7 +676,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleDataResponse setHandsOffSteering( VehicleDataResult handsOffSteering) {
+ public UnsubscribeVehicleDataResponse setHandsOffSteering(VehicleDataResult handsOffSteering) {
setParameters(KEY_HANDS_OFF_STEERING, handsOffSteering);
return this;
}
@@ -603,7 +697,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @param windowStatus See WindowStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleDataResponse setWindowStatus( VehicleDataResult windowStatus) {
+ public UnsubscribeVehicleDataResponse setWindowStatus(VehicleDataResult windowStatus) {
setParameters(KEY_WINDOW_STATUS, windowStatus);
return this;
}
@@ -624,7 +718,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @param gearStatus See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleDataResponse setGearStatus( VehicleDataResult gearStatus) {
+ public UnsubscribeVehicleDataResponse setGearStatus(VehicleDataResult gearStatus) {
setParameters(KEY_GEAR_STATUS, gearStatus);
return this;
}
@@ -635,7 +729,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @return VehicleDataResult See GearStatus
* @since SmartDeviceLink 7.0.0
*/
- public VehicleDataResult getGearStatus(){
+ public VehicleDataResult getGearStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_GEAR_STATUS);
}
@@ -655,7 +749,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* @param stabilityControlsStatus See StabilityControlsStatus
* @since SmartDeviceLink 7.0.0
*/
- public UnsubscribeVehicleDataResponse setStabilityControlsStatus( VehicleDataResult stabilityControlsStatus) {
+ public UnsubscribeVehicleDataResponse setStabilityControlsStatus(VehicleDataResult stabilityControlsStatus) {
setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPoints.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPoints.java
index a20845c38..43601197f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPoints.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPoints.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,10 +37,11 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
public class UnsubscribeWayPoints extends RPCRequest {
- public UnsubscribeWayPoints() {
+ public UnsubscribeWayPoints() {
super(FunctionID.UNSUBSCRIBE_WAY_POINTS.toString());
}
- public UnsubscribeWayPoints(Hashtable<String, Object> hash) {
+
+ public UnsubscribeWayPoints(Hashtable<String, Object> hash) {
super(hash);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
index 80c668821..25a041951 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,41 +41,45 @@ import java.util.Hashtable;
import java.util.List;
public class UnsubscribeWayPointsResponse extends RPCResponse {
- public static final String KEY_WAY_POINTS = "wayPoints";
+ public static final String KEY_WAY_POINTS = "wayPoints";
- public UnsubscribeWayPointsResponse() {
+ public UnsubscribeWayPointsResponse() {
super(FunctionID.UNSUBSCRIBE_WAY_POINTS.toString());
}
+
public UnsubscribeWayPointsResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new UnsubscribeWayPointsResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UnsubscribeWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new UnsubscribeWayPointsResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnsubscribeWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
- /**
- * Sets the way points location details
- * @param wayPoints the way points location details
- */
- public UnsubscribeWayPointsResponse setWayPoints(List<LocationDetails> wayPoints) {
- setParameters(KEY_WAY_POINTS, wayPoints);
- return this;
- }
+ /**
+ * Sets the way points location details
+ *
+ * @param wayPoints the way points location details
+ */
+ public UnsubscribeWayPointsResponse setWayPoints(List<LocationDetails> wayPoints) {
+ setParameters(KEY_WAY_POINTS, wayPoints);
+ return this;
+ }
- /**
- * Gets the way points location details
- * @return the way points location details
- */
- public List<LocationDetails> getWayPoints() {
- return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
- }
+ /**
+ * Gets the way points location details
+ *
+ * @return the way points location details
+ */
+ public List<LocationDetails> getWayPoints() {
+ return (List<LocationDetails>) getObject(LocationDetails.class, KEY_WAY_POINTS);
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnList.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
index 8782b120c..e8bb17e4d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,16 +40,15 @@ import java.util.List;
/**
* Updates the list of next maneuvers, which can be requested by the user pressing the soft button "Turns" on the
* Navigation base screen. Three soft buttons are predefined by the system: Up, Down, Close
- *
+ *
* <p>Function Group: Navigation</p>
- *
+ *
* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
- *
- *
- * @since SmartDeviceLink 2.0
+ *
* @see ShowConstantTbt
+ * @since SmartDeviceLink 2.0
*/
-public class UpdateTurnList extends RPCRequest{
+public class UpdateTurnList extends RPCRequest {
public static final String KEY_TURN_LIST = "turnList";
public static final String KEY_SOFT_BUTTONS = "softButtons";
@@ -59,70 +58,67 @@ public class UpdateTurnList extends RPCRequest{
public UpdateTurnList() {
super(FunctionID.UPDATE_TURN_LIST.toString());
}
-
+
/**
- * <p>
- * Constructs a new UpdateTurnList object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
- */
+ * <p>
+ * Constructs a new UpdateTurnList object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
public UpdateTurnList(Hashtable<String, Object> hash) {
super(hash);
}
-
+
/**
* Sets a list of turns to be shown to the user
*
- * @param turnList
- * a List<Turn> value representing a list of turns to be shown to the user
- * <p>
- * <b>Notes: </b>Minsize=1; Maxsize=100</p>
+ * @param turnList a List<Turn> value representing a list of turns to be shown to the user
+ * <p>
+ * <b>Notes: </b>Minsize=1; Maxsize=100</p>
*/
- public UpdateTurnList setTurnList( List<Turn> turnList) {
+ public UpdateTurnList setTurnList(List<Turn> turnList) {
setParameters(KEY_TURN_LIST, turnList);
return this;
}
-
+
/**
* Gets a list of turns to be shown to the user
- *
+ *
* @return List<Turn> -a List value representing a list of turns
*/
@SuppressWarnings("unchecked")
- public List<Turn> getTurnList(){
+ public List<Turn> getTurnList() {
return (List<Turn>) getObject(Turn.class, KEY_TURN_LIST);
}
/**
* Gets the SoftButton List object
- *
+ *
* @return List<SoftButton> -a List<SoftButton> representing the List object
* @since SmartDeviceLink 2.0
*/
@SuppressWarnings("unchecked")
- public List<SoftButton> getSoftButtons(){
+ public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
/**
* Sets the SoftButtons
*
- * @param softButtons
- * a List<SoftButton> value
- * <p>
- * <b>Notes: </b></p>
- * <ul>
- * <li>If omitted on supported displays, the alert will not have any SoftButton</li>
- * <li>ArrayMin: 0</li>
- * <li>ArrayMax: 1</li>
- * </ul>
+ * @param softButtons a List<SoftButton> value
+ * <p>
+ * <b>Notes: </b></p>
+ * <ul>
+ * <li>If omitted on supported displays, the alert will not have any SoftButton</li>
+ * <li>ArrayMin: 0</li>
+ * <li>ArrayMax: 1</li>
+ * </ul>
* @since SmartDeviceLink 2.0
*/
- public UpdateTurnList setSoftButtons( List<SoftButton> softButtons) {
+ public UpdateTurnList setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
index a19931d19..579fbc3c3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -41,10 +41,10 @@ import java.util.Hashtable;
/**
* Update Turn List Response is sent, when UpdateTurnList has been called
- *
+ *
* @since SmartDeviceLink 2.0
*/
-public class UpdateTurnListResponse extends RPCResponse{
+public class UpdateTurnListResponse extends RPCResponse {
/**
* Constructs a new UpdateTurnListResponse object
@@ -52,20 +52,21 @@ public class UpdateTurnListResponse extends RPCResponse{
public UpdateTurnListResponse() {
super(FunctionID.UPDATE_TURN_LIST.toString());
}
-
+
public UpdateTurnListResponse(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Constructs a new UpdateTurnListResponse object
- * @param success whether the request is successfully processed
- * @param resultCode whether the request is successfully processed
- */
- public UpdateTurnListResponse(@NonNull Boolean success, @NonNull Result resultCode) {
- this();
- setSuccess(success);
- setResultCode(resultCode);
- }
+ /**
+ * Constructs a new UpdateTurnListResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UpdateTurnListResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
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 cf22bc11c..7ca14a25f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,10 +38,10 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
import java.util.Hashtable;
+
/**
- *
* Individual published data request result.
- *
+ *
* <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
@@ -69,61 +69,63 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- *
*/
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 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() { }
- /**
- * <p>
- * Constructs a new VehicleDataResult object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash the Hashtable to use
- */
- public VehicleDataResult(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public VehicleDataResult() {
+ }
- /**
- * Individual published data request result.
- * @param dataType Defined published data element type.
- * @param resultCode Published data result code.
- */
- public VehicleDataResult(@NonNull VehicleDataType dataType, @NonNull VehicleDataResultCode resultCode){
- this();
- setDataType(dataType);
- setResultCode(resultCode);
- }
-
- public VehicleDataResult setResultCode(@NonNull VehicleDataResultCode resultCode) {
+ /**
+ * <p>
+ * Constructs a new VehicleDataResult object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash the Hashtable to use
+ */
+ public VehicleDataResult(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Individual published data request result.
+ *
+ * @param dataType Defined published data element type.
+ * @param resultCode Published data result code.
+ */
+ public VehicleDataResult(@NonNull VehicleDataType dataType, @NonNull VehicleDataResultCode resultCode) {
+ this();
+ setDataType(dataType);
+ setResultCode(resultCode);
+ }
+
+ public VehicleDataResult setResultCode(@NonNull VehicleDataResultCode resultCode) {
setValue(KEY_RESULT_CODE, resultCode);
return this;
}
-
- public VehicleDataResultCode getResultCode() {
- return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
- }
- public VehicleDataResult setDataType(@NonNull VehicleDataType dataType) {
+ public VehicleDataResultCode getResultCode() {
+ return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
+ }
+
+ public VehicleDataResult setDataType(@NonNull VehicleDataType dataType) {
setValue(KEY_DATA_TYPE, dataType);
return this;
}
- public VehicleDataType getDataType() {
- return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
- }
-
- public VehicleDataResult setOEMCustomVehicleDataType( String oemCustomDataType) {
+ public VehicleDataType getDataType() {
+ return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
+ }
+
+ public VehicleDataResult setOEMCustomVehicleDataType(String oemCustomDataType) {
setValue(KEY_OEM_CUSTOM_DATA_TYPE, oemCustomDataType);
return this;
}
- public String getOEMCustomVehicleDataType() {
- return (String) getObject(String.class, KEY_OEM_CUSTOM_DATA_TYPE);
- }
+ public String getOEMCustomVehicleDataType() {
+ return (String) getObject(String.class, KEY_OEM_CUSTOM_DATA_TYPE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleType.java
index 27b1ff42a..a05216661 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,9 +49,9 @@ import java.util.Hashtable;
* <td>make</td>
* <td>String</td>
* <td>Make of the vehicle
- * <ul>
- * <li>Maxlength = 500</li>
- * </ul>
+ * <ul>
+ * <li>Maxlength = 500</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -59,9 +59,9 @@ import java.util.Hashtable;
* <td>Model</td>
* <td>String</td>
* <td>Model of the vehicle, e.g. Fiesta
- * <ul>
- * <li>Maxlength = 500</li>
- * </ul>
+ * <ul>
+ * <li>Maxlength = 500</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -69,9 +69,9 @@ import java.util.Hashtable;
* <td>modelYear</td>
* <td>String</td>
* <td>Model Year of the vehicle, e.g. 2013
- * <ul>
- * <li>Maxlength = 500</li>
- * </ul>
+ * <ul>
+ * <li>Maxlength = 500</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -79,98 +79,109 @@ import java.util.Hashtable;
* <td>trim</td>
* <td>String</td>
* <td>Trim of the vehicle, e.g. SE
- * <ul>
- * <li>Maxlength = 500</li>
- * </ul>
+ * <ul>
+ * <li>Maxlength = 500</li>
+ * </ul>
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 2.0
*/
public class VehicleType extends RPCStruct {
- public static final String KEY_MAKE = "make";
- public static final String KEY_MODEL = "model";
- public static final String KEY_MODEL_YEAR = "modelYear";
- public static final String KEY_TRIM = "trim";
+ public static final String KEY_MAKE = "make";
+ public static final String KEY_MODEL = "model";
+ public static final String KEY_MODEL_YEAR = "modelYear";
+ public static final String KEY_TRIM = "trim";
+
+ /**
+ * Constructs a newly allocated VehicleType object
+ */
+ public VehicleType() {
+ }
- /**
- * Constructs a newly allocated VehicleType object
- */
- public VehicleType() { }
-
/**
* Constructs a newly allocated VehicleType object indicated by the Hashtable parameter
+ *
* @param hash The Hashtable to use
*/
public VehicleType(Hashtable<String, Object> hash) {
super(hash);
}
-
+
/**
* get the make of the vehicle
+ *
* @return the make of the vehicle
*/
public String getMake() {
return getString(KEY_MAKE);
}
-
+
/**
* set the make of the vehicle
- *@param make the make of the vehicle
+ *
+ * @param make the make of the vehicle
*/
- public VehicleType setMake( String make) {
+ public VehicleType setMake(String make) {
setValue(KEY_MAKE, make);
return this;
}
-
+
/**
* get the model of the vehicle
+ *
* @return the model of the vehicle
*/
public String getModel() {
return getString(KEY_MODEL);
}
-
+
/**
* set the model of the vehicle
+ *
* @param model the model of the vehicle
*/
- public VehicleType setModel( String model) {
+ public VehicleType setModel(String model) {
setValue(KEY_MODEL, model);
return this;
}
-
+
/**
* get the model year of the vehicle
+ *
* @return the model year of the vehicle
*/
public String getModelYear() {
return getString(KEY_MODEL_YEAR);
}
-
+
/**
* set the model year of the vehicle
+ *
* @param modelYear the model year of the vehicle
*/
- public VehicleType setModelYear( String modelYear) {
+ public VehicleType setModelYear(String modelYear) {
setValue(KEY_MODEL_YEAR, modelYear);
return this;
}
-
+
/**
* get the trim of the vehicle
+ *
* @return the trim of the vehicle
*/
public String getTrim() {
return getString(KEY_TRIM);
}
-
+
/**
* set the trim of the vehicle
+ *
* @param trim the trim of the vehicle
*/
- public VehicleType setTrim( String trim) {
+ public VehicleType setTrim(String trim) {
setValue(KEY_TRIM, trim);
return this;
}
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 f6eaa6e5f..88b18b802 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,133 +42,141 @@ import java.util.List;
*/
public class VideoStreamingCapability extends RPCStruct {
- public static final String KEY_PREFERRED_RESOLUTION = "preferredResolution";
- 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);}
-
- public VideoStreamingCapability setPreferredResolution( ImageResolution res) {
+ public static final String KEY_PREFERRED_RESOLUTION = "preferredResolution";
+ 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);
+ }
+
+ public VideoStreamingCapability setPreferredResolution(ImageResolution res) {
setValue(KEY_PREFERRED_RESOLUTION, res);
return this;
}
- public ImageResolution getPreferredResolution(){
- return (ImageResolution) getObject(ImageResolution.class, KEY_PREFERRED_RESOLUTION);
- }
+ public ImageResolution getPreferredResolution() {
+ return (ImageResolution) getObject(ImageResolution.class, KEY_PREFERRED_RESOLUTION);
+ }
- /**
- * Set the max bitrate supported by this module.
- *
- * <b>NOTE: </b> Unit is in kbps.
- * @param maxBitrate in kbps
- */
- public VideoStreamingCapability setMaxBitrate( Integer maxBitrate) {
+ /**
+ * Set the max bitrate supported by this module.
+ *
+ * <b>NOTE: </b> Unit is in kbps.
+ *
+ * @param maxBitrate in kbps
+ */
+ public VideoStreamingCapability setMaxBitrate(Integer maxBitrate) {
setValue(KEY_MAX_BITRATE, maxBitrate);
return this;
}
- /**
- * Retrieves the max bitrate supported by this module.
- *
- * <b>NOTE: </b> Unit is in kbps.
- * @return max bitrate in kbps
- */
- public Integer getMaxBitrate(){
- return getInteger(KEY_MAX_BITRATE);
- }
+ /**
+ * Retrieves the max bitrate supported by this module.
+ *
+ * <b>NOTE: </b> Unit is in kbps.
+ *
+ * @return max bitrate in kbps
+ */
+ public Integer getMaxBitrate() {
+ return getInteger(KEY_MAX_BITRATE);
+ }
- public VideoStreamingCapability setSupportedFormats( List<VideoStreamingFormat> formats) {
+ public VideoStreamingCapability setSupportedFormats(List<VideoStreamingFormat> formats) {
setValue(KEY_SUPPORTED_FORMATS, formats);
return this;
}
- public List<VideoStreamingFormat> getSupportedFormats(){
- return (List<VideoStreamingFormat>) getObject(VideoStreamingFormat.class, KEY_SUPPORTED_FORMATS);
- }
+ public List<VideoStreamingFormat> getSupportedFormats() {
+ return (List<VideoStreamingFormat>) getObject(VideoStreamingFormat.class, KEY_SUPPORTED_FORMATS);
+ }
- /**
- * @deprecated use {@link #isHapticSpatialDataSupported()} instead.
- */
- @Deprecated
- public Boolean getIsHapticSpatialDataSupported() {
- return isHapticSpatialDataSupported();
- }
+ /**
+ * @deprecated use {@link #isHapticSpatialDataSupported()} instead.
+ */
+ @Deprecated
+ public Boolean getIsHapticSpatialDataSupported() {
+ return isHapticSpatialDataSupported();
+ }
- /**
- * @deprecated use {@link #setHapticSpatialDataSupported(Boolean hapticSpatialDataSupported)} instead.
- */
- @Deprecated
- public VideoStreamingCapability setIsHapticSpatialDataSupported( Boolean hapticSpatialDataSupported) {
+ /**
+ * @deprecated use {@link #setHapticSpatialDataSupported(Boolean hapticSpatialDataSupported)} instead.
+ */
+ @Deprecated
+ public VideoStreamingCapability setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
return setHapticSpatialDataSupported(hapticSpatialDataSupported);
}
- /**
- * Gets whether the dead unit supports HapticSpatialData
- * @return True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data.
- */
- public Boolean isHapticSpatialDataSupported() {
- return getBoolean(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED);
- }
-
- /**
- * Sets whether the dead unit supports HapticSpatialData
- * @param hapticSpatialDataSupported True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data.
- */
- public VideoStreamingCapability setHapticSpatialDataSupported( Boolean hapticSpatialDataSupported) {
- setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
- return this;
- }
-
- /**
- * @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 VideoStreamingCapability setDiagonalScreenSize( Double diagonalScreenSize) {
+ /**
+ * Gets whether the dead unit supports HapticSpatialData
+ *
+ * @return True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data.
+ */
+ public Boolean isHapticSpatialDataSupported() {
+ return getBoolean(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED);
+ }
+
+ /**
+ * Sets whether the dead unit supports HapticSpatialData
+ *
+ * @param hapticSpatialDataSupported True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data.
+ */
+ public VideoStreamingCapability setHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
+ setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
+ return this;
+ }
+
+ /**
+ * @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 VideoStreamingCapability setDiagonalScreenSize(Double diagonalScreenSize) {
setValue(KEY_DIAGONAL_SCREEN_SIZE, diagonalScreenSize);
return this;
}
- /**
- * @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);
- }
+ /**
+ * @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 VideoStreamingCapability setPixelPerInch( Double pixelPerInch) {
+ /**
+ * @param pixelPerInch the diagonal resolution in pixels divided by the diagonal screen size in inches.
+ */
+ public VideoStreamingCapability setPixelPerInch(Double pixelPerInch) {
setValue(KEY_PIXEL_PER_INCH, pixelPerInch);
return this;
}
- /**
- * @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);
- }
+ /**
+ * @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 VideoStreamingCapability setScale( Double scale) {
+ /**
+ * @param scale the scaling factor the app should use to change the size of the projecting view.
+ */
+ public VideoStreamingCapability setScale(Double scale) {
setValue(KEY_SCALE, scale);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
index ba3f6a9f9..f74292f76 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -44,53 +44,58 @@ import java.util.Hashtable;
*/
public class VideoStreamingFormat extends RPCStruct {
- public static final String KEY_PROTOCOL = "protocol";
- public static final String KEY_CODEC = "codec";
+ public static final String KEY_PROTOCOL = "protocol";
+ public static final String KEY_CODEC = "codec";
- public VideoStreamingFormat(){}
- public VideoStreamingFormat(Hashtable<String, Object> hash){super(hash);}
+ public VideoStreamingFormat() {
+ }
+
+ public VideoStreamingFormat(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- /**
- * Create the VideoStreamingFormat object
- * @param protocol The protocol used
- * @param codec The codec used
- */
- public VideoStreamingFormat(@NonNull VideoStreamingProtocol protocol, @NonNull VideoStreamingCodec codec){
- this();
- setProtocol(protocol);
- setCodec(codec);
- }
+ /**
+ * Create the VideoStreamingFormat object
+ *
+ * @param protocol The protocol used
+ * @param codec The codec used
+ */
+ public VideoStreamingFormat(@NonNull VideoStreamingProtocol protocol, @NonNull VideoStreamingCodec codec) {
+ this();
+ setProtocol(protocol);
+ setCodec(codec);
+ }
- public VideoStreamingFormat setProtocol(@NonNull VideoStreamingProtocol protocol) {
+ public VideoStreamingFormat setProtocol(@NonNull VideoStreamingProtocol protocol) {
setValue(KEY_PROTOCOL, protocol);
return this;
}
- public VideoStreamingProtocol getProtocol(){
- return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL);
- }
+ public VideoStreamingProtocol getProtocol() {
+ return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL);
+ }
- public VideoStreamingFormat setCodec(@NonNull VideoStreamingCodec codec) {
+ public VideoStreamingFormat setCodec(@NonNull VideoStreamingCodec codec) {
setValue(KEY_CODEC, codec);
return this;
}
- public VideoStreamingCodec getCodec(){
- return (VideoStreamingCodec) getObject(VideoStreamingCodec.class, KEY_CODEC);
- }
+ public VideoStreamingCodec getCodec() {
+ return (VideoStreamingCodec) getObject(VideoStreamingCodec.class, KEY_CODEC);
+ }
- @Override
- public boolean equals(Object obj) {
- if(obj != null && obj instanceof VideoStreamingFormat){
- VideoStreamingFormat compareTo = (VideoStreamingFormat) obj;
- return getCodec() == compareTo.getCodec() && getProtocol() == compareTo.getProtocol();
- }
- return false;
- }
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof VideoStreamingFormat) {
+ VideoStreamingFormat compareTo = (VideoStreamingFormat) obj;
+ return getCodec() == compareTo.getCodec() && getProtocol() == compareTo.getProtocol();
+ }
+ return false;
+ }
- @Override
- public String toString() {
- return "codec=" + getCodec() +
- ", protocol=" + getProtocol();
- }
+ @Override
+ public String toString() {
+ return "codec=" + getCodec() +
+ ", protocol=" + getProtocol();
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
index 7b0c9b7ec..6139f66f7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,8 +36,8 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+
/**
- *
* VR help items i.e. the text strings to be displayed, and when pronounced by the user the recognition of any of which must trigger the corresponding VR command.
*
* <p><b>Parameter List</b></p>
@@ -75,56 +75,63 @@ import java.util.Hashtable;
* <td>SmartDeviceLink 2.3.2</td>
* </tr>
* </table>
- *
*/
public class VrHelpItem extends RPCStruct {
- public static final String KEY_POSITION = "position";
- public static final String KEY_TEXT = "text";
- public static final String KEY_IMAGE = "image";
+ public static final String KEY_POSITION = "position";
+ public static final String KEY_TEXT = "text";
+ public static final String KEY_IMAGE = "image";
- public VrHelpItem() { }
- /**
- * <p>
- * Constructs a new VrHelpItem object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash -The Hashtable to use
- */
+ public VrHelpItem() {
+ }
+
+ /**
+ * <p>
+ * Constructs a new VrHelpItem object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash -The Hashtable to use
+ */
public VrHelpItem(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * VR help items i.e. the text strings to be displayed, and when pronounced
- * by the user the recognition of any of which must trigger the corresponding VR command.
- * @param text Text to display for VR Help item
- * @param position Position to display item in VR Help list
- */
- public VrHelpItem(@NonNull String text, @NonNull Integer position){
- this();
- setText(text);
- setPosition(position);
- }
+ /**
+ * VR help items i.e. the text strings to be displayed, and when pronounced
+ * by the user the recognition of any of which must trigger the corresponding VR command.
+ *
+ * @param text Text to display for VR Help item
+ * @param position Position to display item in VR Help list
+ */
+ public VrHelpItem(@NonNull String text, @NonNull Integer position) {
+ this();
+ setText(text);
+ setPosition(position);
+ }
public VrHelpItem setText(@NonNull String text) {
setValue(KEY_TEXT, text);
return this;
}
+
public String getText() {
return getString(KEY_TEXT);
}
- public VrHelpItem setImage( Image image) {
+
+ public VrHelpItem setImage(Image image) {
setValue(KEY_IMAGE, image);
return this;
}
+
public Image getImage() {
return (Image) getObject(Image.class, KEY_IMAGE);
}
+
public VrHelpItem setPosition(@NonNull Integer position) {
setValue(KEY_POSITION, position);
return this;
}
+
public Integer getPosition() {
return getInteger(KEY_POSITION);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java
index 23f183da5..4156eb421 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherAlert.java
@@ -41,118 +41,120 @@ import java.util.List;
public class WeatherAlert extends RPCStruct {
- public static final String KEY_TITLE = "title";
- public static final String KEY_SUMMARY = "summary";
- public static final String KEY_EXPIRES = "expires";
- public static final String KEY_REGIONS = "regions";
- public static final String KEY_SEVERITY = "severity";
- public static final String KEY_TIME_ISSUED = "timeIssued";
+ public static final String KEY_TITLE = "title";
+ public static final String KEY_SUMMARY = "summary";
+ public static final String KEY_EXPIRES = "expires";
+ public static final String KEY_REGIONS = "regions";
+ public static final String KEY_SEVERITY = "severity";
+ public static final String KEY_TIME_ISSUED = "timeIssued";
- // Constructors
+ // Constructors
- public WeatherAlert() { }
+ public WeatherAlert() {
+ }
- public WeatherAlert(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public WeatherAlert(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public WeatherAlert(@NonNull List<String> regions) {
- this();
- setRegions(regions);
- }
+ public WeatherAlert(@NonNull List<String> regions) {
+ this();
+ setRegions(regions);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param title -
- */
- public WeatherAlert setTitle( String title) {
+ /**
+ * @param title -
+ */
+ public WeatherAlert setTitle(String title) {
setValue(KEY_TITLE, title);
return this;
}
- /**
- * @return title
- */
- public String getTitle() {
- return getString(KEY_TITLE);
- }
-
- /**
- * @param summary -
- */
- public WeatherAlert setSummary( String summary) {
+ /**
+ * @return title
+ */
+ public String getTitle() {
+ return getString(KEY_TITLE);
+ }
+
+ /**
+ * @param summary -
+ */
+ public WeatherAlert setSummary(String summary) {
setValue(KEY_SUMMARY, summary);
return this;
}
- /**
- * @return summary
- */
- public String getSummary() {
- return getString(KEY_SUMMARY);
- }
-
- /**
- * @param severity -
- */
- public WeatherAlert setSeverity( String severity) {
+ /**
+ * @return summary
+ */
+ public String getSummary() {
+ return getString(KEY_SUMMARY);
+ }
+
+ /**
+ * @param severity -
+ */
+ public WeatherAlert setSeverity(String severity) {
setValue(KEY_SEVERITY, severity);
return this;
}
- /**
- * @return severity
- */
- public String getSeverity() {
- return getString(KEY_SEVERITY);
- }
-
- /**
- * Min Size: 1, Max Size: 99
- * @param regions -
- */
- public WeatherAlert setRegions(@NonNull List<String> regions) {
+ /**
+ * @return severity
+ */
+ public String getSeverity() {
+ return getString(KEY_SEVERITY);
+ }
+
+ /**
+ * Min Size: 1, Max Size: 99
+ *
+ * @param regions -
+ */
+ public WeatherAlert setRegions(@NonNull List<String> regions) {
setValue(KEY_REGIONS, regions);
return this;
}
- /**
- * @return regions list
- */
- @SuppressWarnings("unchecked")
- public List<String> getRegions(){
- return (List<String>) getObject(String.class,KEY_REGIONS);
- }
-
- /**
- * @param expires -
- */
- public WeatherAlert setExpires( DateTime expires) {
+ /**
+ * @return regions list
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getRegions() {
+ return (List<String>) getObject(String.class, KEY_REGIONS);
+ }
+
+ /**
+ * @param expires -
+ */
+ public WeatherAlert setExpires(DateTime expires) {
setValue(KEY_EXPIRES, expires);
return this;
}
- /**
- * @return expires
- */
- public DateTime getExpires() {
- return (DateTime) getObject(DateTime.class,KEY_EXPIRES);
- }
-
- /**
- * @param timeIssued -
- */
- public WeatherAlert setTimeIssued( DateTime timeIssued) {
+ /**
+ * @return expires
+ */
+ public DateTime getExpires() {
+ return (DateTime) getObject(DateTime.class, KEY_EXPIRES);
+ }
+
+ /**
+ * @param timeIssued -
+ */
+ public WeatherAlert setTimeIssued(DateTime timeIssued) {
setValue(KEY_TIME_ISSUED, timeIssued);
return this;
}
- /**
- * @return timeIssued
- */
- public DateTime getTimeIssued() {
- return (DateTime) getObject(DateTime.class,KEY_TIME_ISSUED);
- }
+ /**
+ * @return timeIssued
+ */
+ public DateTime getTimeIssued() {
+ return (DateTime) getObject(DateTime.class, KEY_TIME_ISSUED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java
index c9bbf02f4..ae902dac6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherData.java
@@ -37,375 +37,384 @@ import java.util.Hashtable;
public class WeatherData extends RPCStruct {
- public static final String KEY_CURRENT_TEMPERATURE = "currentTemperature";
- public static final String KEY_TEMPERATURE_HIGH = "temperatureHigh";
- public static final String KEY_TEMPERATURE_LOW = "temperatureLow";
- public static final String KEY_APPARENT_TEMPERATURE = "apparentTemperature";
- public static final String KEY_APPARENT_TEMPERATURE_HIGH = "apparentTemperatureHigh";
- public static final String KEY_APPARENT_TEMPERATURE_LOW = "apparentTemperatureLow";
- public static final String KEY_WEATHER_SUMMARY = "weatherSummary";
- public static final String KEY_TIME = "time";
- public static final String KEY_HUMIDITY = "humidity";
- public static final String KEY_CLOUD_COVER = "cloudCover";
- public static final String KEY_MOON_PHASE = "moonPhase";
- public static final String KEY_WIND_BEARING = "windBearing";
- public static final String KEY_WIND_GUST = "windGust";
- public static final String KEY_WIND_SPEED = "windSpeed";
- public static final String KEY_NEAREST_STORM_BEARING = "nearestStormBearing";
- public static final String KEY_NEAREST_STORM_DISTANCE = "nearestStormDistance";
- public static final String KEY_PRECIP_ACCUMULATION = "precipAccumulation";
- public static final String KEY_PRECIP_INTENSITY = "precipIntensity";
- public static final String KEY_PRECIP_PROBABILITY = "precipProbability";
- public static final String KEY_PRECIP_TYPE = "precipType";
- public static final String KEY_VISIBILITY = "visibility";
- public static final String KEY_WEATHER_ICON = "weatherIcon";
-
- // Constructors
-
- public WeatherData() { }
-
- public WeatherData(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- // Setters and Getters
-
- /**
- * @param currentTemperature -
- */
- public WeatherData setCurrentTemperature( Temperature currentTemperature) {
+ public static final String KEY_CURRENT_TEMPERATURE = "currentTemperature";
+ public static final String KEY_TEMPERATURE_HIGH = "temperatureHigh";
+ public static final String KEY_TEMPERATURE_LOW = "temperatureLow";
+ public static final String KEY_APPARENT_TEMPERATURE = "apparentTemperature";
+ public static final String KEY_APPARENT_TEMPERATURE_HIGH = "apparentTemperatureHigh";
+ public static final String KEY_APPARENT_TEMPERATURE_LOW = "apparentTemperatureLow";
+ public static final String KEY_WEATHER_SUMMARY = "weatherSummary";
+ public static final String KEY_TIME = "time";
+ public static final String KEY_HUMIDITY = "humidity";
+ public static final String KEY_CLOUD_COVER = "cloudCover";
+ public static final String KEY_MOON_PHASE = "moonPhase";
+ public static final String KEY_WIND_BEARING = "windBearing";
+ public static final String KEY_WIND_GUST = "windGust";
+ public static final String KEY_WIND_SPEED = "windSpeed";
+ public static final String KEY_NEAREST_STORM_BEARING = "nearestStormBearing";
+ public static final String KEY_NEAREST_STORM_DISTANCE = "nearestStormDistance";
+ public static final String KEY_PRECIP_ACCUMULATION = "precipAccumulation";
+ public static final String KEY_PRECIP_INTENSITY = "precipIntensity";
+ public static final String KEY_PRECIP_PROBABILITY = "precipProbability";
+ public static final String KEY_PRECIP_TYPE = "precipType";
+ public static final String KEY_VISIBILITY = "visibility";
+ public static final String KEY_WEATHER_ICON = "weatherIcon";
+
+ // Constructors
+
+ public WeatherData() {
+ }
+
+ public WeatherData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * @param currentTemperature -
+ */
+ public WeatherData setCurrentTemperature(Temperature currentTemperature) {
setValue(KEY_CURRENT_TEMPERATURE, currentTemperature);
return this;
}
- /**
- * @return currentTemperature
- */
- public Temperature getCurrentTemperature() {
- return (Temperature) getObject(Temperature.class,KEY_CURRENT_TEMPERATURE);
- }
+ /**
+ * @return currentTemperature
+ */
+ public Temperature getCurrentTemperature() {
+ return (Temperature) getObject(Temperature.class, KEY_CURRENT_TEMPERATURE);
+ }
- /**
- * @param temperatureHigh -
- */
- public WeatherData setTemperatureHigh( Temperature temperatureHigh) {
+ /**
+ * @param temperatureHigh -
+ */
+ public WeatherData setTemperatureHigh(Temperature temperatureHigh) {
setValue(KEY_TEMPERATURE_HIGH, temperatureHigh);
return this;
}
- /**
- * @return temperatureHigh
- */
- public Temperature getTemperatureHigh() {
- return (Temperature) getObject(Temperature.class,KEY_TEMPERATURE_HIGH);
- }
+ /**
+ * @return temperatureHigh
+ */
+ public Temperature getTemperatureHigh() {
+ return (Temperature) getObject(Temperature.class, KEY_TEMPERATURE_HIGH);
+ }
- /**
- * @param temperatureLow -
- */
- public WeatherData setTemperatureLow( Temperature temperatureLow) {
+ /**
+ * @param temperatureLow -
+ */
+ public WeatherData setTemperatureLow(Temperature temperatureLow) {
setValue(KEY_TEMPERATURE_LOW, temperatureLow);
return this;
}
- /**
- * @return temperatureLow
- */
- public Temperature getTemperatureLow() {
- return (Temperature) getObject(Temperature.class,KEY_TEMPERATURE_LOW);
- }
+ /**
+ * @return temperatureLow
+ */
+ public Temperature getTemperatureLow() {
+ return (Temperature) getObject(Temperature.class, KEY_TEMPERATURE_LOW);
+ }
- /**
- * @param apparentTemperature -
- */
- public WeatherData setApparentTemperature( Temperature apparentTemperature) {
+ /**
+ * @param apparentTemperature -
+ */
+ public WeatherData setApparentTemperature(Temperature apparentTemperature) {
setValue(KEY_APPARENT_TEMPERATURE, apparentTemperature);
return this;
}
- /**
- * @return apparentTemperature
- */
- public Temperature getApparentTemperature() {
- return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE);
- }
+ /**
+ * @return apparentTemperature
+ */
+ public Temperature getApparentTemperature() {
+ return (Temperature) getObject(Temperature.class, KEY_APPARENT_TEMPERATURE);
+ }
- /**
- * @param apparentTemperatureHigh -
- */
- public WeatherData setApparentTemperatureHigh( Temperature apparentTemperatureHigh) {
+ /**
+ * @param apparentTemperatureHigh -
+ */
+ public WeatherData setApparentTemperatureHigh(Temperature apparentTemperatureHigh) {
setValue(KEY_APPARENT_TEMPERATURE_HIGH, apparentTemperatureHigh);
return this;
}
- /**
- * @return apparentTemperatureHigh
- */
- public Temperature getApparentTemperatureHigh() {
- return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE_HIGH);
- }
+ /**
+ * @return apparentTemperatureHigh
+ */
+ public Temperature getApparentTemperatureHigh() {
+ return (Temperature) getObject(Temperature.class, KEY_APPARENT_TEMPERATURE_HIGH);
+ }
- /**
- * @param apparentTemperatureLow -
- */
- public WeatherData setApparentTemperatureLow( Temperature apparentTemperatureLow) {
+ /**
+ * @param apparentTemperatureLow -
+ */
+ public WeatherData setApparentTemperatureLow(Temperature apparentTemperatureLow) {
setValue(KEY_APPARENT_TEMPERATURE_LOW, apparentTemperatureLow);
return this;
}
- /**
- * @return apparentTemperatureLow
- */
- public Temperature getApparentTemperatureLow() {
- return (Temperature) getObject(Temperature.class,KEY_APPARENT_TEMPERATURE_LOW);
- }
+ /**
+ * @return apparentTemperatureLow
+ */
+ public Temperature getApparentTemperatureLow() {
+ return (Temperature) getObject(Temperature.class, KEY_APPARENT_TEMPERATURE_LOW);
+ }
- /**
- * @param weatherSummary -
- */
- public WeatherData setWeatherSummary( String weatherSummary) {
+ /**
+ * @param weatherSummary -
+ */
+ public WeatherData setWeatherSummary(String weatherSummary) {
setValue(KEY_WEATHER_SUMMARY, weatherSummary);
return this;
}
- /**
- * @return weatherSummary
- */
- public String getWeatherSummary() {
- return getString(KEY_WEATHER_SUMMARY);
- }
+ /**
+ * @return weatherSummary
+ */
+ public String getWeatherSummary() {
+ return getString(KEY_WEATHER_SUMMARY);
+ }
- /**
- * @param time -
- */
- public WeatherData setTime( DateTime time) {
+ /**
+ * @param time -
+ */
+ public WeatherData setTime(DateTime time) {
setValue(KEY_TIME, time);
return this;
}
- /**
- * @return time
- */
- public DateTime getTime() {
- return (DateTime) getObject(DateTime.class,KEY_TIME);
- }
+ /**
+ * @return time
+ */
+ public DateTime getTime() {
+ return (DateTime) getObject(DateTime.class, KEY_TIME);
+ }
- /**
- * minValue: 0, maxValue: 1
- * @param humidity - percentage humidity
- */
- public WeatherData setHumidity( Float humidity) {
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @param humidity - percentage humidity
+ */
+ public WeatherData setHumidity(Float humidity) {
setValue(KEY_HUMIDITY, humidity);
return this;
}
- /**
- * minValue: 0, maxValue: 1
- * @return humidity - percentage humidity
- */
- public Float getHumidity() {
- return getFloat(KEY_HUMIDITY);
- }
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @return humidity - percentage humidity
+ */
+ public Float getHumidity() {
+ return getFloat(KEY_HUMIDITY);
+ }
- /**
- * minValue: 0, maxValue: 1
- * @param cloudCover - cloud cover
- */
- public WeatherData setCloudCover( Float cloudCover) {
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @param cloudCover - cloud cover
+ */
+ public WeatherData setCloudCover(Float cloudCover) {
setValue(KEY_CLOUD_COVER, cloudCover);
return this;
}
- /**
- * minValue: 0, maxValue: 1
- * @return cloudCover - cloud cover
- */
- public Float getCloudCover() {
- return getFloat(KEY_CLOUD_COVER);
- }
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @return cloudCover - cloud cover
+ */
+ public Float getCloudCover() {
+ return getFloat(KEY_CLOUD_COVER);
+ }
- /**
- * minValue: 0, maxValue: 1
- * @param moonPhase - percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
- */
- public WeatherData setMoonPhase( Float moonPhase) {
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @param moonPhase - percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
+ */
+ public WeatherData setMoonPhase(Float moonPhase) {
setValue(KEY_MOON_PHASE, moonPhase);
return this;
}
- /**
- * minValue: 0, maxValue: 1
- * @return moonPhase - percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
- */
- public Float getMoonPhase() {
- return getFloat(KEY_MOON_PHASE);
- }
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @return moonPhase - percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon
+ */
+ public Float getMoonPhase() {
+ return getFloat(KEY_MOON_PHASE);
+ }
- /**
- * @param windBearing - In degrees, true north at 0 degrees
- */
- public WeatherData setWindBearing( Integer windBearing) {
+ /**
+ * @param windBearing - In degrees, true north at 0 degrees
+ */
+ public WeatherData setWindBearing(Integer windBearing) {
setValue(KEY_WIND_BEARING, windBearing);
return this;
}
- /**
- * @return windBearing - In degrees, true north at 0 degrees
- */
- public Integer getWindBearing() {
- return getInteger(KEY_WIND_BEARING);
- }
+ /**
+ * @return windBearing - In degrees, true north at 0 degrees
+ */
+ public Integer getWindBearing() {
+ return getInteger(KEY_WIND_BEARING);
+ }
- /**
- * @param windGust - km/hr
- */
- public WeatherData setWindGust( Float windGust) {
+ /**
+ * @param windGust - km/hr
+ */
+ public WeatherData setWindGust(Float windGust) {
setValue(KEY_WIND_GUST, windGust);
return this;
}
- /**
- * @return windGust - km/hr
- */
- public Float getWindGust() {
- return getFloat(KEY_WIND_GUST);
- }
+ /**
+ * @return windGust - km/hr
+ */
+ public Float getWindGust() {
+ return getFloat(KEY_WIND_GUST);
+ }
- /**
- * @param windSpeed - km/hr
- */
- public WeatherData setWindSpeed( Float windSpeed) {
+ /**
+ * @param windSpeed - km/hr
+ */
+ public WeatherData setWindSpeed(Float windSpeed) {
setValue(KEY_WIND_SPEED, windSpeed);
return this;
}
- /**
- * @return windSpeed - km/hr
- */
- public Float getWindSpeed() {
- return getFloat(KEY_WIND_SPEED);
- }
+ /**
+ * @return windSpeed - km/hr
+ */
+ public Float getWindSpeed() {
+ return getFloat(KEY_WIND_SPEED);
+ }
- /**
- * @param nearestStormBearing - In degrees, true north at 0 degrees
- */
- public WeatherData setNearestStormBearing( Integer nearestStormBearing) {
+ /**
+ * @param nearestStormBearing - In degrees, true north at 0 degrees
+ */
+ public WeatherData setNearestStormBearing(Integer nearestStormBearing) {
setValue(KEY_NEAREST_STORM_BEARING, nearestStormBearing);
return this;
}
- /**
- * @return nearestStormBearing - In degrees, true north at 0 degrees
- */
- public Integer getNearestStormBearing() {
- return getInteger(KEY_NEAREST_STORM_BEARING);
- }
+ /**
+ * @return nearestStormBearing - In degrees, true north at 0 degrees
+ */
+ public Integer getNearestStormBearing() {
+ return getInteger(KEY_NEAREST_STORM_BEARING);
+ }
- /**
- * @param nearestStormDistance - In km
- */
- public WeatherData setNearestStormDistance( Integer nearestStormDistance) {
+ /**
+ * @param nearestStormDistance - In km
+ */
+ public WeatherData setNearestStormDistance(Integer nearestStormDistance) {
setValue(KEY_NEAREST_STORM_DISTANCE, nearestStormDistance);
return this;
}
- /**
- * @return nearestStormDistance - In km
- */
- public Integer getNearestStormDistance() {
- return getInteger(KEY_NEAREST_STORM_DISTANCE);
- }
+ /**
+ * @return nearestStormDistance - In km
+ */
+ public Integer getNearestStormDistance() {
+ return getInteger(KEY_NEAREST_STORM_DISTANCE);
+ }
- /**
- * @param precipAccumulation - cm
- */
- public WeatherData setPrecipAccumulation( Float precipAccumulation) {
+ /**
+ * @param precipAccumulation - cm
+ */
+ public WeatherData setPrecipAccumulation(Float precipAccumulation) {
setValue(KEY_PRECIP_ACCUMULATION, precipAccumulation);
return this;
}
- /**
- * @return precipAccumulation - cm
- */
- public Float getPrecipAccumulation() {
- return getFloat(KEY_PRECIP_ACCUMULATION);
- }
+ /**
+ * @return precipAccumulation - cm
+ */
+ public Float getPrecipAccumulation() {
+ return getFloat(KEY_PRECIP_ACCUMULATION);
+ }
- /**
- * @param precipIntensity - cm of water per hour
- */
- public WeatherData setPrecipIntensity( Float precipIntensity) {
+ /**
+ * @param precipIntensity - cm of water per hour
+ */
+ public WeatherData setPrecipIntensity(Float precipIntensity) {
setValue(KEY_PRECIP_INTENSITY, precipIntensity);
return this;
}
- /**
- * @return precipIntensity - cm of water per hour
- */
- public Float getPrecipIntensity() {
- return getFloat(KEY_PRECIP_INTENSITY);
- }
+ /**
+ * @return precipIntensity - cm of water per hour
+ */
+ public Float getPrecipIntensity() {
+ return getFloat(KEY_PRECIP_INTENSITY);
+ }
- /**
- * minValue: 0, maxValue: 1
- * @param precipProbability - percentage chance
- */
- public WeatherData setPrecipProbability( Float precipProbability) {
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @param precipProbability - percentage chance
+ */
+ public WeatherData setPrecipProbability(Float precipProbability) {
setValue(KEY_PRECIP_PROBABILITY, precipProbability);
return this;
}
- /**
- * minValue: 0, maxValue: 1
- * @return precipProbability - percentage chance
- */
- public Float getPrecipProbability() {
- return getFloat(KEY_PRECIP_PROBABILITY);
- }
+ /**
+ * minValue: 0, maxValue: 1
+ *
+ * @return precipProbability - percentage chance
+ */
+ public Float getPrecipProbability() {
+ return getFloat(KEY_PRECIP_PROBABILITY);
+ }
- /**
- * @param precipType - e.g. "rain", "snow", "sleet", "hail"
- */
- public WeatherData setPrecipType( String precipType) {
+ /**
+ * @param precipType - e.g. "rain", "snow", "sleet", "hail"
+ */
+ public WeatherData setPrecipType(String precipType) {
setValue(KEY_PRECIP_TYPE, precipType);
return this;
}
- /**
- * @return precipType - e.g. "rain", "snow", "sleet", "hail"
- */
- public String getPrecipType() {
- return getString(KEY_PRECIP_TYPE);
- }
+ /**
+ * @return precipType - e.g. "rain", "snow", "sleet", "hail"
+ */
+ public String getPrecipType() {
+ return getString(KEY_PRECIP_TYPE);
+ }
- /**
- * @param weatherIcon -
- */
- public WeatherData setWeatherIcon( Image weatherIcon) {
+ /**
+ * @param weatherIcon -
+ */
+ public WeatherData setWeatherIcon(Image weatherIcon) {
setValue(KEY_WEATHER_ICON, weatherIcon);
return this;
}
- /**
- * @return weatherIcon
- */
- public Image getWeatherIcon() {
- return (Image) getObject(Image.class, KEY_WEATHER_ICON);
- }
+ /**
+ * @return weatherIcon
+ */
+ public Image getWeatherIcon() {
+ return (Image) getObject(Image.class, KEY_WEATHER_ICON);
+ }
- /**
- * @param visibility - In km
- */
- public WeatherData setVisibility( Float visibility) {
+ /**
+ * @param visibility - In km
+ */
+ public WeatherData setVisibility(Float visibility) {
setValue(KEY_VISIBILITY, visibility);
return this;
}
- /**
- * @return visibility - In km
- */
- public Float getVisibility() {
- return getFloat(KEY_VISIBILITY);
- }
+ /**
+ * @return visibility - In km
+ */
+ public Float getVisibility() {
+ return getFloat(KEY_VISIBILITY);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java
index 0d7a26648..d707551a0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceData.java
@@ -43,128 +43,137 @@ import java.util.List;
*/
public class WeatherServiceData extends RPCStruct {
- public static final String KEY_LOCATION = "location";
- public static final String KEY_CURRENT_FORECAST = "currentForecast";
- public static final String KEY_MINUTE_FORECAST = "minuteForecast";
- public static final String KEY_HOURLY_FORECAST = "hourlyForecast";
- public static final String KEY_MULTIDAY_FORECAST = "multidayForecast";
- public static final String KEY_ALERTS = "alerts";
+ public static final String KEY_LOCATION = "location";
+ public static final String KEY_CURRENT_FORECAST = "currentForecast";
+ public static final String KEY_MINUTE_FORECAST = "minuteForecast";
+ public static final String KEY_HOURLY_FORECAST = "hourlyForecast";
+ public static final String KEY_MULTIDAY_FORECAST = "multidayForecast";
+ public static final String KEY_ALERTS = "alerts";
- // Constructors
+ // Constructors
- public WeatherServiceData() { }
+ public WeatherServiceData() {
+ }
- public WeatherServiceData(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public WeatherServiceData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
- public WeatherServiceData(@NonNull LocationDetails location) {
- this();
- setLocation(location);
- }
+ public WeatherServiceData(@NonNull LocationDetails location) {
+ this();
+ setLocation(location);
+ }
- // Setters and Getters
+ // Setters and Getters
- /**
- * @param location -
- */
- public WeatherServiceData setLocation(@NonNull LocationDetails location) {
+ /**
+ * @param location -
+ */
+ public WeatherServiceData setLocation(@NonNull LocationDetails location) {
setValue(KEY_LOCATION, location);
return this;
}
- /**
- * @return location
- */
- public LocationDetails getLocation() {
- return (LocationDetails) getObject(LocationDetails.class,KEY_LOCATION);
- }
-
- /**
- * @param currentForecast -
- */
- public WeatherServiceData setCurrentForecast( WeatherData currentForecast) {
+ /**
+ * @return location
+ */
+ public LocationDetails getLocation() {
+ return (LocationDetails) getObject(LocationDetails.class, KEY_LOCATION);
+ }
+
+ /**
+ * @param currentForecast -
+ */
+ public WeatherServiceData setCurrentForecast(WeatherData currentForecast) {
setValue(KEY_CURRENT_FORECAST, currentForecast);
return this;
}
- /**
- * @return currentForecast
- */
- public WeatherData getCurrentForecast() {
- return (WeatherData) getObject(WeatherData.class,KEY_CURRENT_FORECAST);
- }
-
- /**
- * minsize: 15, maxsize: 60
- * @param minuteForecast -
- */
- public WeatherServiceData setMinuteForecast( List<WeatherData> minuteForecast) {
+ /**
+ * @return currentForecast
+ */
+ public WeatherData getCurrentForecast() {
+ return (WeatherData) getObject(WeatherData.class, KEY_CURRENT_FORECAST);
+ }
+
+ /**
+ * minsize: 15, maxsize: 60
+ *
+ * @param minuteForecast -
+ */
+ public WeatherServiceData setMinuteForecast(List<WeatherData> minuteForecast) {
setValue(KEY_MINUTE_FORECAST, minuteForecast);
return this;
}
- /**
- * minsize: 15, maxsize: 60
- * @return minuteForecast
- */
- @SuppressWarnings("unchecked")
- public List<WeatherData> getMinuteForecast(){
- return (List<WeatherData>) getObject(WeatherData.class,KEY_MINUTE_FORECAST);
- }
-
- /**
- * minsize: 1, maxsize: 96
- * @param hourlyForecast -
- */
- public WeatherServiceData setHourlyForecast( List<WeatherData> hourlyForecast) {
+ /**
+ * minsize: 15, maxsize: 60
+ *
+ * @return minuteForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getMinuteForecast() {
+ return (List<WeatherData>) getObject(WeatherData.class, KEY_MINUTE_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 96
+ *
+ * @param hourlyForecast -
+ */
+ public WeatherServiceData setHourlyForecast(List<WeatherData> hourlyForecast) {
setValue(KEY_HOURLY_FORECAST, hourlyForecast);
return this;
}
- /**
- * minsize: 1, maxsize: 96
- * @return hourlyForecast
- */
- @SuppressWarnings("unchecked")
- public List<WeatherData> getHourlyForecast(){
- return (List<WeatherData>) getObject(WeatherData.class,KEY_HOURLY_FORECAST);
- }
-
- /**
- * minsize: 1, maxsize: 30
- * @param multidayForecast -
- */
- public WeatherServiceData setMultidayForecast( List<WeatherData> multidayForecast) {
+ /**
+ * minsize: 1, maxsize: 96
+ *
+ * @return hourlyForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getHourlyForecast() {
+ return (List<WeatherData>) getObject(WeatherData.class, KEY_HOURLY_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 30
+ *
+ * @param multidayForecast -
+ */
+ public WeatherServiceData setMultidayForecast(List<WeatherData> multidayForecast) {
setValue(KEY_MULTIDAY_FORECAST, multidayForecast);
return this;
}
- /**
- * minsize: 1, maxsize: 30
- * @return multidayForecast
- */
- @SuppressWarnings("unchecked")
- public List<WeatherData> getMultidayForecast(){
- return (List<WeatherData>) getObject(WeatherData.class,KEY_MULTIDAY_FORECAST);
- }
-
- /**
- * minsize: 1, maxsize: 10
- * @param alerts -
- */
- public WeatherServiceData setAlerts( List<WeatherAlert> alerts) {
+ /**
+ * minsize: 1, maxsize: 30
+ *
+ * @return multidayForecast
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherData> getMultidayForecast() {
+ return (List<WeatherData>) getObject(WeatherData.class, KEY_MULTIDAY_FORECAST);
+ }
+
+ /**
+ * minsize: 1, maxsize: 10
+ *
+ * @param alerts -
+ */
+ public WeatherServiceData setAlerts(List<WeatherAlert> alerts) {
setValue(KEY_ALERTS, alerts);
return this;
}
- /**
- * minsize: 1, maxsize: 10
- * @return alerts
- */
- @SuppressWarnings("unchecked")
- public List<WeatherAlert> getAlerts(){
- return (List<WeatherAlert>) getObject(WeatherAlert.class,KEY_ALERTS);
- }
+ /**
+ * minsize: 1, maxsize: 10
+ *
+ * @return alerts
+ */
+ @SuppressWarnings("unchecked")
+ public List<WeatherAlert> getAlerts() {
+ return (List<WeatherAlert>) getObject(WeatherAlert.class, KEY_ALERTS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java
index 79a4e5528..9e6f14cb6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WeatherServiceManifest.java
@@ -37,103 +37,115 @@ import java.util.Hashtable;
public class WeatherServiceManifest extends RPCStruct {
- public static final String KEY_CURRENT_FORECAST_SUPPORTED = "currentForecastSupported";
- public static final String KEY_MAX_MULTIDAY_FORECAST_AMOUNT = "maxMultidayForecastAmount";
- public static final String KEY_MAX_HOURLY_FORECAST_AMOUNT = "maxHourlyForecastAmount";
- public static final String KEY_MAX_MINUTELY_FORECAST_AMOUNT = "maxMinutelyForecastAmount";
- public static final String KEY_WEATHER_FOR_LOCATION_SUPPORTED = "weatherForLocationSupported";
-
- // Constructors
-
- public WeatherServiceManifest() { }
-
- public WeatherServiceManifest(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- // Setters and Getters
- /**
- * Set whether the current forecast is supported
- * @param currentForecastSupported -
- */
- public WeatherServiceManifest setCurrentForecastSupported( Boolean currentForecastSupported) {
+ public static final String KEY_CURRENT_FORECAST_SUPPORTED = "currentForecastSupported";
+ public static final String KEY_MAX_MULTIDAY_FORECAST_AMOUNT = "maxMultidayForecastAmount";
+ public static final String KEY_MAX_HOURLY_FORECAST_AMOUNT = "maxHourlyForecastAmount";
+ public static final String KEY_MAX_MINUTELY_FORECAST_AMOUNT = "maxMinutelyForecastAmount";
+ public static final String KEY_WEATHER_FOR_LOCATION_SUPPORTED = "weatherForLocationSupported";
+
+ // Constructors
+
+ public WeatherServiceManifest() {
+ }
+
+ public WeatherServiceManifest(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // Setters and Getters
+
+ /**
+ * Set whether the current forecast is supported
+ *
+ * @param currentForecastSupported -
+ */
+ public WeatherServiceManifest setCurrentForecastSupported(Boolean currentForecastSupported) {
setValue(KEY_CURRENT_FORECAST_SUPPORTED, currentForecastSupported);
return this;
}
- /**
- * Get whether the current forecast is supported
- * @return currentForecastSupported
- */
- public Boolean getCurrentForecastSupported(){
- return getBoolean(KEY_CURRENT_FORECAST_SUPPORTED);
- }
-
- /**
- * Set the max multi day forecast amount
- * @param maxMultidayForecastAmount -
- */
- public WeatherServiceManifest setMaxMultidayForecastAmount( Integer maxMultidayForecastAmount) {
+ /**
+ * Get whether the current forecast is supported
+ *
+ * @return currentForecastSupported
+ */
+ public Boolean getCurrentForecastSupported() {
+ return getBoolean(KEY_CURRENT_FORECAST_SUPPORTED);
+ }
+
+ /**
+ * Set the max multi day forecast amount
+ *
+ * @param maxMultidayForecastAmount -
+ */
+ public WeatherServiceManifest setMaxMultidayForecastAmount(Integer maxMultidayForecastAmount) {
setValue(KEY_MAX_MULTIDAY_FORECAST_AMOUNT, maxMultidayForecastAmount);
return this;
}
- /**
- * Get the max multi day forecast amount
- * @return maxMultidayForecastAmount
- */
- public Integer getMaxMultidayForecastAmount(){
- return getInteger(KEY_MAX_MULTIDAY_FORECAST_AMOUNT);
- }
-
- /**
- * Set the max hourly forecast amount
- * @param maxHourlyForecastAmount -
- */
- public WeatherServiceManifest setMaxHourlyForecastAmount( Integer maxHourlyForecastAmount) {
+ /**
+ * Get the max multi day forecast amount
+ *
+ * @return maxMultidayForecastAmount
+ */
+ public Integer getMaxMultidayForecastAmount() {
+ return getInteger(KEY_MAX_MULTIDAY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set the max hourly forecast amount
+ *
+ * @param maxHourlyForecastAmount -
+ */
+ public WeatherServiceManifest setMaxHourlyForecastAmount(Integer maxHourlyForecastAmount) {
setValue(KEY_MAX_HOURLY_FORECAST_AMOUNT, maxHourlyForecastAmount);
return this;
}
- /**
- * Get the max hourly forecast amount
- * @return maxHourlyForecastAmount
- */
- public Integer getMaxHourlyForecastAmount(){
- return getInteger(KEY_MAX_HOURLY_FORECAST_AMOUNT);
- }
-
- /**
- * Set the max minutely forecast amount
- * @param maxMinutelyForecastAmount -
- */
- public WeatherServiceManifest setMaxMinutelyForecastAmount( Integer maxMinutelyForecastAmount) {
+ /**
+ * Get the max hourly forecast amount
+ *
+ * @return maxHourlyForecastAmount
+ */
+ public Integer getMaxHourlyForecastAmount() {
+ return getInteger(KEY_MAX_HOURLY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set the max minutely forecast amount
+ *
+ * @param maxMinutelyForecastAmount -
+ */
+ public WeatherServiceManifest setMaxMinutelyForecastAmount(Integer maxMinutelyForecastAmount) {
setValue(KEY_MAX_MINUTELY_FORECAST_AMOUNT, maxMinutelyForecastAmount);
return this;
}
- /**
- * Get the max minutely forecast amount
- * @return maxMinutelyForecastAmount
- */
- public Integer getMaxMinutelyForecastAmount(){
- return getInteger(KEY_MAX_MINUTELY_FORECAST_AMOUNT);
- }
-
- /**
- * Set whether the weather is supported for the current location
- * @param weatherForLocationSupported -
- */
- public WeatherServiceManifest setWeatherForLocationSupported( Boolean weatherForLocationSupported) {
+ /**
+ * Get the max minutely forecast amount
+ *
+ * @return maxMinutelyForecastAmount
+ */
+ public Integer getMaxMinutelyForecastAmount() {
+ return getInteger(KEY_MAX_MINUTELY_FORECAST_AMOUNT);
+ }
+
+ /**
+ * Set whether the weather is supported for the current location
+ *
+ * @param weatherForLocationSupported -
+ */
+ public WeatherServiceManifest setWeatherForLocationSupported(Boolean weatherForLocationSupported) {
setValue(KEY_WEATHER_FOR_LOCATION_SUPPORTED, weatherForLocationSupported);
return this;
}
- /**
- * Get whether the weather is supported for the current location
- * @return weatherForLocationSupported
- */
- public Boolean getWeatherForLocationSupported(){
- return getBoolean(KEY_WEATHER_FOR_LOCATION_SUPPORTED);
- }
+ /**
+ * Get whether the weather is supported for the current location
+ *
+ * @return weatherForLocationSupported
+ */
+ public Boolean getWeatherForLocationSupported() {
+ return getBoolean(KEY_WEATHER_FOR_LOCATION_SUPPORTED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
index dcf05b4c3..28a5b0ccb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
@@ -34,7 +34,7 @@ public class WindowCapability extends RPCStruct {
*
* @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 WindowCapability setWindowID( Integer windowID) {
+ public WindowCapability setWindowID(Integer windowID) {
setValue(KEY_WINDOW_ID, windowID);
return this;
}
@@ -64,7 +64,7 @@ public class WindowCapability extends RPCStruct {
*
* @param textFields the List of textFields
*/
- public WindowCapability setTextFields( List<TextField> textFields) {
+ public WindowCapability setTextFields(List<TextField> textFields) {
setValue(KEY_TEXT_FIELDS, textFields);
return this;
}
@@ -85,7 +85,7 @@ public class WindowCapability extends RPCStruct {
*
* @param imageFields the List of imageFields
*/
- public WindowCapability setImageFields( List<ImageField> imageFields) {
+ public WindowCapability setImageFields(List<ImageField> imageFields) {
setValue(KEY_IMAGE_FIELDS, imageFields);
return this;
}
@@ -106,7 +106,7 @@ public class WindowCapability extends RPCStruct {
*
* @param imageTypeSupported the List of ImageType
*/
- public WindowCapability setImageTypeSupported( List<ImageType> imageTypeSupported) {
+ public WindowCapability setImageTypeSupported(List<ImageType> imageTypeSupported) {
setValue(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported);
return this;
}
@@ -127,7 +127,7 @@ public class WindowCapability extends RPCStruct {
*
* @param templatesAvailable the List of String
*/
- public WindowCapability setTemplatesAvailable( List<String> templatesAvailable) {
+ public WindowCapability setTemplatesAvailable(List<String> templatesAvailable) {
setValue(KEY_TEMPLATES_AVAILABLE, templatesAvailable);
return this;
}
@@ -147,7 +147,7 @@ public class WindowCapability extends RPCStruct {
*
* @param numCustomPresetsAvailable
*/
- public WindowCapability setNumCustomPresetsAvailable( Integer numCustomPresetsAvailable) {
+ public WindowCapability setNumCustomPresetsAvailable(Integer numCustomPresetsAvailable) {
setValue(KEY_NUM_CUSTOM_PRESETS_AVAILABLE, numCustomPresetsAvailable);
return this;
}
@@ -158,7 +158,7 @@ public class WindowCapability extends RPCStruct {
*
* @param buttonCapabilities It refers to number of buttons and the capabilities of each on-window button.
*/
- public WindowCapability setButtonCapabilities( List<ButtonCapabilities> buttonCapabilities) {
+ public WindowCapability setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
return this;
}
@@ -180,7 +180,7 @@ public class WindowCapability extends RPCStruct {
*
* @param softButtonCapabilities It refers to number of soft buttons available on-window and the capabilities for each button.
*/
- public WindowCapability setSoftButtonCapabilities( List<SoftButtonCapabilities> softButtonCapabilities) {
+ public WindowCapability setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
setValue(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
return this;
}
@@ -199,9 +199,10 @@ public class WindowCapability extends RPCStruct {
/**
* An array of available menu layouts. If this parameter is not provided, only the `LIST` layout
* is assumed to be available
+ *
* @param menuLayout - An array of MenuLayouts
*/
- public WindowCapability setMenuLayoutsAvailable( List<MenuLayout> menuLayout) {
+ public WindowCapability setMenuLayoutsAvailable(List<MenuLayout> menuLayout) {
setValue(KEY_MENU_LAYOUTS_AVAILABLE, menuLayout);
return this;
}
@@ -209,6 +210,7 @@ public class WindowCapability extends RPCStruct {
/**
* An array of available menu layouts. If this parameter is not provided, only the `LIST` layout
* is assumed to be available
+ *
* @return MenuLayout[]
*/
@SuppressWarnings("unchecked")
@@ -220,10 +222,10 @@ public class WindowCapability extends RPCStruct {
* Sets the dynamicUpdateCapabilities.
*
* @param dynamicUpdateCapabilities Contains the head unit's capabilities for dynamic updating features declaring if the
- * module will send dynamic update RPCs.
+ * module will send dynamic update RPCs.
* @since SmartDeviceLink 7.0.0
*/
- public WindowCapability setDynamicUpdateCapabilities( DynamicUpdateCapabilities dynamicUpdateCapabilities) {
+ public WindowCapability setDynamicUpdateCapabilities(DynamicUpdateCapabilities dynamicUpdateCapabilities) {
setValue(KEY_DYNAMIC_UPDATE_CAPABILITIES, dynamicUpdateCapabilities);
return this;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowState.java
index 4c61c69a5..d5e4e8d9a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowState.java
@@ -38,7 +38,6 @@ import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
/**
- *
* <p><b>Parameter List</b></p>
*
* <table border="1" rules="all">
@@ -64,6 +63,7 @@ import java.util.Hashtable;
* <td></td>
* </tr>
* </table>
+ *
* @since SmartDeviceLink 7.0.0
*/
public class WindowState extends RPCStruct {
@@ -73,7 +73,8 @@ public class WindowState extends RPCStruct {
/**
* Constructs a new WindowState object
*/
- public WindowState() { }
+ public WindowState() {
+ }
/**
* Constructs a new WindowState object indicated by the Hashtable parameter
@@ -88,9 +89,9 @@ public class WindowState extends RPCStruct {
* Constructs a new WindowState object
*
* @param approximatePosition The approximate percentage that the window is open - 0 being fully closed, 100 being fully
- * open
- * @param deviation The percentage deviation of the approximatePosition. e.g. If the approximatePosition is 50
- * and the deviation is 10, then the window's location is somewhere between 40 and 60.
+ * open
+ * @param deviation The percentage deviation of the approximatePosition. e.g. If the approximatePosition is 50
+ * and the deviation is 10, then the window's location is somewhere between 40 and 60.
*/
public WindowState(@NonNull Integer approximatePosition, @NonNull Integer deviation) {
this();
@@ -102,7 +103,7 @@ public class WindowState extends RPCStruct {
* Sets the approximatePosition.
*
* @param approximatePosition The approximate percentage that the window is open - 0 being fully closed, 100 being fully
- * open
+ * open
*/
public WindowState setApproximatePosition(@NonNull Integer approximatePosition) {
setValue(KEY_APPROXIMATE_POSITION, approximatePosition);
@@ -123,7 +124,7 @@ public class WindowState extends RPCStruct {
* Sets the deviation.
*
* @param deviation The percentage deviation of the approximatePosition. e.g. If the approximatePosition is 50
- * and the deviation is 10, then the window's location is somewhere between 40 and 60.
+ * and the deviation is 10, then the window's location is somewhere between 40 and 60.
*/
public WindowState setDeviation(@NonNull Integer deviation) {
setValue(KEY_DEVIATION, deviation);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowStatus.java
index ebae89ea8..73af10df5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowStatus.java
@@ -75,7 +75,8 @@ public class WindowStatus extends RPCStruct {
/**
* Constructs a new WindowStatus object
*/
- public WindowStatus() { }
+ public WindowStatus() {
+ }
/**
* Constructs a new WindowStatus object indicated by the Hashtable parameter
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
index c145dc455..24382f3ca 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
@@ -9,6 +9,7 @@ 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 {
@@ -33,7 +34,7 @@ public class WindowTypeCapabilities extends RPCStruct {
/**
* Constructs a newly allocated WindowTypeCapabilities object
*
- * @param type Type of windows available, to create.
+ * @param type Type of windows available, to create.
* @param maximumNumberOfWindows Number of windows available, to create.
*/
public WindowTypeCapabilities(@NonNull WindowType type, @NonNull Integer maximumNumberOfWindows) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
index 144da6f5b..5e3f6b185 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
@@ -1,62 +1,64 @@
-/*
- * 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;
-/** Reflects the status of the ambient light sensor.
- *
- * @since SmartDeviceLink 2.3.2
+/**
+ * Reflects the status of the ambient light sensor.
*
+ * @since SmartDeviceLink 2.3.2
*/
public enum AmbientLightStatus {
- NIGHT,
- TWILIGHT_1,
- TWILIGHT_2,
- TWILIGHT_3,
- TWILIGHT_4,
- DAY,
- UNKNOWN,
- INVALID;
- /**
+ NIGHT,
+ TWILIGHT_1,
+ TWILIGHT_2,
+ TWILIGHT_3,
+ TWILIGHT_4,
+ DAY,
+ UNKNOWN,
+ INVALID;
+
+ /**
* Convert String to AmbientLightStatus
+ *
* @param value String
* @return AmbientLightStatus
- */
+ */
public static AmbientLightStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
index e34a8f431..dee86027e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,12 +33,13 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Enumeration listing possible app hmi types.
+ *
* @since SmartDeviceLink 2.0
*/
public enum AppHMIType {
- /**
- * The App will have default rights.
- */
+ /**
+ * The App will have default rights.
+ */
DEFAULT,
/**
* Communication type of App
@@ -86,18 +87,18 @@ public enum AppHMIType {
*
* @since SmartDeviceLink 7.0.0
*/
- WEB_VIEW
- ;
+ WEB_VIEW;
/**
* Convert String to AppHMIType
+ *
* @param value String
* @return AppHMIType
*/
public static AppHMIType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
index 425671b64..fa55e2366 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,111 +34,111 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Indicates reason why app interface was unregistered. The application is being
* disconnected by SDL.
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum AppInterfaceUnregisteredReason {
- USER_EXIT,
- /**
- * Vehicle ignition turned off.
- *
- * @since SmartDeviceLink 1.0
- */
- IGNITION_OFF,
- /**
- * Bluetooth was turned off, causing termination of a necessary Bluetooth
- * connection.
- *
- * @since SmartDeviceLink 1.0
- */
- BLUETOOTH_OFF,
- /**
- * USB was disconnected, causing termination of a necessary iAP connection.
- *
- * @since SmartDeviceLink 1.0
- */
- USB_DISCONNECTED,
- /**
- * Application attempted SmartDeviceLink RPC request while {@linkplain HMILevel}
- * =NONE. App must have HMILevel other than NONE to issue RPC requests or
- * get notifications or RPC responses.
- *
- * @since SmartDeviceLink 1.0
- */
- REQUEST_WHILE_IN_NONE_HMI_LEVEL,
- /**
- * Either too many -- or too many per unit of time -- requests were made by
- * the application.
- *
- * @since SmartDeviceLink 1.0
- */
- TOO_MANY_REQUESTS,
- /**
- * The application has issued requests which cause driver distraction rules
- * to be violated.
- *
- * @since SmartDeviceLink 1.0
- */
- DRIVER_DISTRACTION_VIOLATION,
- /**
- * The user has changed the language in effect on the SDL platform to a
- * language that is incompatible with the language declared by the
- * application in its RegisterAppInterface request.
- *
- * @since SmartDeviceLink 1.0
- */
- LANGUAGE_CHANGE,
- /**
- * The user performed a MASTER RESET on the SDL platform, causing removal
- * of a necessary Bluetooth pairing.
- *
- * @since SmartDeviceLink 1.0
- */
- MASTER_RESET,
- /**
- * The user restored settings to FACTORY DEFAULTS on the SDL platform.
- *
- * @since SmartDeviceLink 1.0
- */
- FACTORY_DEFAULTS,
- /**
- * The app is not being authorized to be connected to SDL.
- *
- * @since SmartDeviceLink 2.0
- */
- APP_UNAUTHORIZED,
- /**
- * The app has committed a protocol violation.
- *
- * @since SmartDeviceLink 4.0
- */
- PROTOCOL_VIOLATION,
- /**
- * The HMI does not support resource.
- *
- * @since SmartDeviceLink 4.1
- */
- UNSUPPORTED_HMI_RESOURCE,
+ USER_EXIT,
+ /**
+ * Vehicle ignition turned off.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ IGNITION_OFF,
+ /**
+ * Bluetooth was turned off, causing termination of a necessary Bluetooth
+ * connection.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ BLUETOOTH_OFF,
+ /**
+ * USB was disconnected, causing termination of a necessary iAP connection.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ USB_DISCONNECTED,
+ /**
+ * Application attempted SmartDeviceLink RPC request while {@linkplain HMILevel}
+ * =NONE. App must have HMILevel other than NONE to issue RPC requests or
+ * get notifications or RPC responses.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ REQUEST_WHILE_IN_NONE_HMI_LEVEL,
+ /**
+ * Either too many -- or too many per unit of time -- requests were made by
+ * the application.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ TOO_MANY_REQUESTS,
+ /**
+ * The application has issued requests which cause driver distraction rules
+ * to be violated.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ DRIVER_DISTRACTION_VIOLATION,
+ /**
+ * The user has changed the language in effect on the SDL platform to a
+ * language that is incompatible with the language declared by the
+ * application in its RegisterAppInterface request.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ LANGUAGE_CHANGE,
+ /**
+ * The user performed a MASTER RESET on the SDL platform, causing removal
+ * of a necessary Bluetooth pairing.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ MASTER_RESET,
+ /**
+ * The user restored settings to FACTORY DEFAULTS on the SDL platform.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ FACTORY_DEFAULTS,
+ /**
+ * The app is not being authorized to be connected to SDL.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ APP_UNAUTHORIZED,
+ /**
+ * The app has committed a protocol violation.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ PROTOCOL_VIOLATION,
+ /**
+ * The HMI does not support resource.
+ *
+ * @since SmartDeviceLink 4.1
+ */
+ UNSUPPORTED_HMI_RESOURCE,
+
+ /**
+ * The application is unregistered due to hardware resource constraints.
+ * The system will shortly close the application to free up hardware resources
+ *
+ * @since SmartDeviceLink 7.0
+ */
+ RESOURCE_CONSTRAINT;
- /**
- * The application is unregistered due to hardware resource constraints.
- * The system will shortly close the application to free up hardware resources
- *
- * @since SmartDeviceLink 7.0
- *
- */
- RESOURCE_CONSTRAINT
- ;
- /**
+ /**
* Convert String to AppInterfaceUnregisteredReason
+ *
* @param value String
* @return AppInterfaceUnregisteredReason
*/
public static AppInterfaceUnregisteredReason valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java
index c52796db5..f4f1e4d34 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppServiceType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,24 +36,25 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum AppServiceType {
- MEDIA,
+ MEDIA,
- WEATHER,
+ WEATHER,
- NAVIGATION,
+ NAVIGATION,
- ;
+ ;
- /**
- * Convert String to AppServiceType
- * @param value String
- * @return AppServiceType
- */
- public static AppServiceType valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ /**
+ * Convert String to AppServiceType
+ *
+ * @param value String
+ * @return AppServiceType
+ */
+ public static AppServiceType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingIndicator.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingIndicator.java
index 78fd11e3b..3fc856598 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingIndicator.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingIndicator.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,43 +37,44 @@ package com.smartdevicelink.proxy.rpc.enums;
* @since SmartDeviceLink 5.0
*/
public enum AudioStreamingIndicator {
- /**
- * Default playback indicator.
- *
- * @since SmartDeviceLink 5.0
- */
- PLAY_PAUSE,
+ /**
+ * Default playback indicator.
+ *
+ * @since SmartDeviceLink 5.0
+ */
+ PLAY_PAUSE,
- /**
- * Indicates that a button press of the Play/Pause button would start the playback.
- *
- * @since SmartDeviceLink 5.0
- */
- PLAY,
- /**
- * Indicates that a button press of the Play/Pause button would pause the current playback.
- *
- * @since SmartDeviceLink 5.0
- */
- PAUSE,
- /**
- * Indicates that a button press of the Play/Pause button would stop the current playback.
- *
- * @since SmartDeviceLink 5.0
- */
- STOP,
- ;
+ /**
+ * Indicates that a button press of the Play/Pause button would start the playback.
+ *
+ * @since SmartDeviceLink 5.0
+ */
+ PLAY,
+ /**
+ * Indicates that a button press of the Play/Pause button would pause the current playback.
+ *
+ * @since SmartDeviceLink 5.0
+ */
+ PAUSE,
+ /**
+ * Indicates that a button press of the Play/Pause button would stop the current playback.
+ *
+ * @since SmartDeviceLink 5.0
+ */
+ STOP,
+ ;
- /**
- * Convert String to AudioStreamingIndicator
- * @param value String
- * @return AudioStreamingIndicator
- */
- public static AudioStreamingIndicator valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ /**
+ * Convert String to AudioStreamingIndicator
+ *
+ * @param value String
+ * @return AudioStreamingIndicator
+ */
+ public static AudioStreamingIndicator valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java
index 3d28272bd..386d18e66 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.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;
/**
@@ -36,41 +36,43 @@ package com.smartdevicelink.proxy.rpc.enums;
* Though provided in every OnHMIStatus notification, this information is only
* relevant for applications that declare themselves as media apps in
* RegisterAppInterface
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum AudioStreamingState {
- /**
- * Currently streaming audio, if any, is audible to user.
- *
- * @since SmartDeviceLink 1.0
- */
- AUDIBLE,
+ /**
+ * Currently streaming audio, if any, is audible to user.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ AUDIBLE,
+
+ /**
+ * Some kind of audio mixing is taking place. Currently streaming audio, if
+ * any, is audible to the user at a lowered volume.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ ATTENUATED,
+ /**
+ * Currently streaming audio, if any, is not audible to user. made via VR
+ * session.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ NOT_AUDIBLE;
- /**
- * Some kind of audio mixing is taking place. Currently streaming audio, if
- * any, is audible to the user at a lowered volume.
- *
- * @since SmartDeviceLink 2.0
- */
- ATTENUATED,
- /**
- * Currently streaming audio, if any, is not audible to user. made via VR
- * session.
- *
- * @since SmartDeviceLink 1.0
- */
- NOT_AUDIBLE;
- /**
+ /**
* Convert String to AudioStreamingState
+ *
* @param value String
* @return AudioStreamingState
- */
+ */
public static AudioStreamingState valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioType.java
index c3892f404..83da424b5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AudioType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,32 +29,33 @@
* 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;
-
-/**
- * Describes different audio type options for PerformAudioPassThru
- *
- * @since SmartDeviceLink 2.0
-
- */
-public enum AudioType {
- /**
- * PCM raw audio
- *
- * @since SmartDeviceLink 2.0
- */
- PCM;
- /**
- * Convert String to AudioType
- * @param value String
- * @return AudioType
- */
-
- public static AudioType valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Describes different audio type options for PerformAudioPassThru
+ *
+ * @since SmartDeviceLink 2.0
+ */
+public enum AudioType {
+ /**
+ * PCM raw audio
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ PCM;
+
+ /**
+ * Convert String to AudioType
+ *
+ * @param value String
+ * @return AudioType
+ */
+
+ public static AudioType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
index a9d530c0b..4d9b04602 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
@@ -1,73 +1,74 @@
-/*
- * 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;
import java.util.EnumSet;
/**
* Describes different bit depth options for PerformAudioPassThru.
- * @see com.smartdevicelink.proxy.rpc.PerformAudioPassThru
- * @since SmartDeviceLink 2.0
+ *
+ * @see com.smartdevicelink.proxy.rpc.PerformAudioPassThru
+ * @since SmartDeviceLink 2.0
*/
public enum BitsPerSample {
- /**
- * 8 bits per sample
- *
- * @since SmartDeviceLink 2.0
- */
- _8_BIT("8_BIT"),
- /**
- * 16 bits per sample
- *
- * @since SmartDeviceLink 2.0
- */
- _16_BIT("16_BIT");
+ /**
+ * 8 bits per sample
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _8_BIT("8_BIT"),
+ /**
+ * 16 bits per sample
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _16_BIT("16_BIT");
private final String VALUE;
-
+
private BitsPerSample(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
public static BitsPerSample valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- for (BitsPerSample anEnum : EnumSet.allOf(BitsPerSample.class)) {
+
+ for (BitsPerSample anEnum : EnumSet.allOf(BitsPerSample.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
index 9188627e7..0c772f14f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
@@ -1,66 +1,65 @@
-/*
- * 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;
/**
* Indicates whether the button was depressed or released. A BUTTONUP event will
* always be preceded by a BUTTONDOWN event
- *
+ *
* @see com.smartdevicelink.proxy.rpc.SoftButtonCapabilities
* @see com.smartdevicelink.proxy.rpc.OnButtonEvent
* @since SmartDeviceLink 1.0
*/
public enum ButtonEventMode {
- /**
- * The button was released
- */
- BUTTONUP,
- /**
- * The button was depressed
- */
- BUTTONDOWN;
+ /**
+ * The button was released
+ */
+ BUTTONUP,
+ /**
+ * The button was depressed
+ */
+ BUTTONDOWN;
- /**
- * Returns a ButtonEventMode (BUTTONUP or BUTTONDOWN)
- *
- * @param value
- * a String
- * @return ButtonEventMode -BUTTONUP or BUTTONDOWN
- */
+ /**
+ * Returns a ButtonEventMode (BUTTONUP or BUTTONDOWN)
+ *
+ * @param value a String
+ * @return ButtonEventMode -BUTTONUP or BUTTONDOWN
+ */
public static ButtonEventMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
index 79b1174dd..6967327dc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -49,304 +49,302 @@ package com.smartdevicelink.proxy.rpc.enums;
* interrogating the ButtonCapabilities parameter of the
* RegisterAppInterface response.
* </p>
- *
+ *
* @since SmartDeviceLink 1.0
*/
-public enum ButtonName{
- /**
- * <br><b>THIS ENUM VALUE WILL CHANGE IN FUNCTIONALITY DURING THE NEXT MAJOR RELEASE!</b>
- * <br><br>
- * This ButtonName value originally was used for both the OK button and PLAY_PAUSE button. As of
- * SmartDeviceLink 5.0.0, the functionality was broken out into the OK and PLAY_PAUSE buttons.
- * <br><br> For this version of the library OK will be received for both OK and PLAY_PAUSE to
- * mitigate a potential break in functionality. If the desire is only for the OK functionality,
- * this button should still be used. If the desired functionality was actually for the play/pause
- * toggle, then the new PLAY_PAUSE should be used.
- * <br><br>
- * Represents the button usually labeled "OK". A typical use of this button
- * is for the user to press it to make a selection (and until a major library version release,
- * play pause toggle).
- *
- * @since SmartDeviceLink 1.0
- * @see #PLAY_PAUSE
- */
- OK,
- /**
- * Represents the seek-left button. A typical use of this button is for the
- * user to scroll to the left through menu choices one menu item per press.
- *
- * @since SmartDeviceLink 1.0
- */
- SEEKLEFT,
- /**
- * Represents the seek-right button. A typical use of this button is for the
- * user to scroll to the right through menu choices one menu item per press.
- *
- * @since SmartDeviceLink 1.0
- */
- SEEKRIGHT,
- /**
- * Represents a turn of the tuner knob in the clockwise direction one tick.
- *
- * @since SmartDeviceLink 1.0
- */
- TUNEUP,
- /**
- * Represents a turn of the tuner knob in the counter-clockwise direction
- * one tick.
- *
- * @since SmartDeviceLink 1.0
- */
- TUNEDOWN,
- /**
- * Represents the preset 0 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_0,
- /**
- * Represents the preset 1 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_1,
- /**
- * Represents the preset 2 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_2,
- /**
- * Represents the preset 3 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_3,
- /**
- * Represents the preset 4 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_4,
- /**
- * Represents the preset 5 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_5,
- /**
- * Represents the preset 6 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_6,
- /**
- * Represents the preset 7 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_7,
- /**
- * Represents the preset 8 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_8,
- /**
- * Represents the preset 9 button.
- *
- * @since SmartDeviceLink 1.0
- */
- PRESET_9,
- CUSTOM_BUTTON,
- SEARCH,
- AC_MAX,
- AC,
- RECIRCULATE,
- FAN_UP,
- FAN_DOWN,
- TEMP_UP,
- TEMP_DOWN,
- DEFROST_MAX,
- DEFROST,
- DEFROST_REAR,
- UPPER_VENT,
- LOWER_VENT,
- VOLUME_UP,
- VOLUME_DOWN,
- EJECT,
- SOURCE,
- SHUFFLE,
- REPEAT,
- /**
- * Represents the play/pause button. A typical use of this button
- * is for the user to press it to toggle between media playing and pausing.
- *
- * <br><br><b>NOTE:</b> This functionality used to be represented by the OK button.
- *
- * @since SmartDeviceLink 5.0
- * @see #OK
- */
- PLAY_PAUSE,
- /**
- * Represents the center location button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_CENTER_LOCATION,
- /**
- * Represents the the zoom in button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_ZOOM_IN,
- /**
- * Represents the zoom out button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_ZOOM_OUT,
- /**
- * Represents the pan up button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_UP,
- /**
- * Represents the pan up-right button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_UP_RIGHT,
- /**
- * Represents the pan right button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_RIGHT,
- /**
- * Represents the pan down-right button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_DOWN_RIGHT,
- /**
- * Represents the pan down button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_DOWN,
- /**
- * Represents the pan down-left button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_DOWN_LEFT,
- /**
- * Represents the pan left button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_LEFT,
- /**
- * Represents the pan up-left button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_PAN_UP_LEFT,
- /**
- * Represents the title toggle button
- * If supported, this toggles between a top-down view and an angled/3D view.
- * If your app supports different, but substantially similar options, then you may implement those.
- * If you don't implement these or similar options, do not subscribe to this button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_TILT_TOGGLE,
- /**
- * Represents the rotate clockwise button
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_ROTATE_CLOCKWISE,
- /**
- * Represents the rotate counterclockwise button
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_ROTATE_COUNTERCLOCKWISE,
- /**
- * Represents the heading toggle button
- * If supported, this toggles between locking the orientation to north or to the vehicle's heading.
- * If your app supports different, but substantially similar options, then you may implement those.
- * If you don't implement these or similar options, do not subscribe to this button.
- *
- * @since SmartDeviceLink 6.0
- */
- NAV_HEADING_TOGGLE
-
- ;
+public enum ButtonName {
+ /**
+ * <br><b>THIS ENUM VALUE WILL CHANGE IN FUNCTIONALITY DURING THE NEXT MAJOR RELEASE!</b>
+ * <br><br>
+ * This ButtonName value originally was used for both the OK button and PLAY_PAUSE button. As of
+ * SmartDeviceLink 5.0.0, the functionality was broken out into the OK and PLAY_PAUSE buttons.
+ * <br><br> For this version of the library OK will be received for both OK and PLAY_PAUSE to
+ * mitigate a potential break in functionality. If the desire is only for the OK functionality,
+ * this button should still be used. If the desired functionality was actually for the play/pause
+ * toggle, then the new PLAY_PAUSE should be used.
+ * <br><br>
+ * Represents the button usually labeled "OK". A typical use of this button
+ * is for the user to press it to make a selection (and until a major library version release,
+ * play pause toggle).
+ *
+ * @see #PLAY_PAUSE
+ * @since SmartDeviceLink 1.0
+ */
+ OK,
+ /**
+ * Represents the seek-left button. A typical use of this button is for the
+ * user to scroll to the left through menu choices one menu item per press.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ SEEKLEFT,
+ /**
+ * Represents the seek-right button. A typical use of this button is for the
+ * user to scroll to the right through menu choices one menu item per press.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ SEEKRIGHT,
+ /**
+ * Represents a turn of the tuner knob in the clockwise direction one tick.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ TUNEUP,
+ /**
+ * Represents a turn of the tuner knob in the counter-clockwise direction
+ * one tick.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ TUNEDOWN,
+ /**
+ * Represents the preset 0 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_0,
+ /**
+ * Represents the preset 1 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_1,
+ /**
+ * Represents the preset 2 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_2,
+ /**
+ * Represents the preset 3 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_3,
+ /**
+ * Represents the preset 4 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_4,
+ /**
+ * Represents the preset 5 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_5,
+ /**
+ * Represents the preset 6 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_6,
+ /**
+ * Represents the preset 7 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_7,
+ /**
+ * Represents the preset 8 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_8,
+ /**
+ * Represents the preset 9 button.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ PRESET_9,
+ CUSTOM_BUTTON,
+ SEARCH,
+ AC_MAX,
+ AC,
+ RECIRCULATE,
+ FAN_UP,
+ FAN_DOWN,
+ TEMP_UP,
+ TEMP_DOWN,
+ DEFROST_MAX,
+ DEFROST,
+ DEFROST_REAR,
+ UPPER_VENT,
+ LOWER_VENT,
+ VOLUME_UP,
+ VOLUME_DOWN,
+ EJECT,
+ SOURCE,
+ SHUFFLE,
+ REPEAT,
+ /**
+ * Represents the play/pause button. A typical use of this button
+ * is for the user to press it to toggle between media playing and pausing.
+ *
+ * <br><br><b>NOTE:</b> This functionality used to be represented by the OK button.
+ *
+ * @see #OK
+ * @since SmartDeviceLink 5.0
+ */
+ PLAY_PAUSE,
+ /**
+ * Represents the center location button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_CENTER_LOCATION,
+ /**
+ * Represents the the zoom in button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ZOOM_IN,
+ /**
+ * Represents the zoom out button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ZOOM_OUT,
+ /**
+ * Represents the pan up button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP,
+ /**
+ * Represents the pan up-right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP_RIGHT,
+ /**
+ * Represents the pan right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_RIGHT,
+ /**
+ * Represents the pan down-right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN_RIGHT,
+ /**
+ * Represents the pan down button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN,
+ /**
+ * Represents the pan down-left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN_LEFT,
+ /**
+ * Represents the pan left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_LEFT,
+ /**
+ * Represents the pan up-left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP_LEFT,
+ /**
+ * Represents the title toggle button
+ * If supported, this toggles between a top-down view and an angled/3D view.
+ * If your app supports different, but substantially similar options, then you may implement those.
+ * If you don't implement these or similar options, do not subscribe to this button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_TILT_TOGGLE,
+ /**
+ * Represents the rotate clockwise button
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ROTATE_CLOCKWISE,
+ /**
+ * Represents the rotate counterclockwise button
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ROTATE_COUNTERCLOCKWISE,
+ /**
+ * Represents the heading toggle button
+ * If supported, this toggles between locking the orientation to north or to the vehicle's heading.
+ * If your app supports different, but substantially similar options, then you may implement those.
+ * If you don't implement these or similar options, do not subscribe to this button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_HEADING_TOGGLE;
public static ButtonName valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
-
+
/**
* indexForPresetButton returns the integer index for preset buttons
* which match the preset order. E.G.: indexForPresetButton(PRESET_1)
* returns the value 1. If the buttonName given is not a preset button,
* the method will return null.
- *
+ *
* @param buttonName the buttonName of PRESET_0 through PRESET_9 to
* @return Integer that represents which preset the supplied button name represents. It will return null if the
- * ButtonName is not one of the PRESET_# names.
+ * ButtonName is not one of the PRESET_# names.
*/
public static Integer indexForPresetButton(ButtonName buttonName) {
- if(buttonName == null){
+ if (buttonName == null) {
return null;
}
-
- Integer returnIndex = null;
-
- switch(buttonName) {
- case PRESET_0:
- returnIndex = 0;
- break;
- case PRESET_1:
- returnIndex = 1;
- break;
- case PRESET_2:
- returnIndex = 2;
- break;
- case PRESET_3:
- returnIndex = 3;
- break;
- case PRESET_4:
- returnIndex = 4;
- break;
- case PRESET_5:
- returnIndex = 5;
- break;
- case PRESET_6:
- returnIndex = 6;
- break;
- case PRESET_7:
- returnIndex = 7;
- break;
- case PRESET_8:
- returnIndex = 8;
- break;
- case PRESET_9:
- returnIndex = 9;
- break;
+
+ Integer returnIndex = null;
+
+ switch (buttonName) {
+ case PRESET_0:
+ returnIndex = 0;
+ break;
+ case PRESET_1:
+ returnIndex = 1;
+ break;
+ case PRESET_2:
+ returnIndex = 2;
+ break;
+ case PRESET_3:
+ returnIndex = 3;
+ break;
+ case PRESET_4:
+ returnIndex = 4;
+ break;
+ case PRESET_5:
+ returnIndex = 5;
+ break;
+ case PRESET_6:
+ returnIndex = 6;
+ break;
+ case PRESET_7:
+ returnIndex = 7;
+ break;
+ case PRESET_8:
+ returnIndex = 8;
+ break;
+ case PRESET_9:
+ returnIndex = 9;
+ break;
default:
break;
- }
-
- return returnIndex;
+ }
+
+ return returnIndex;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
index 1236084f2..ecc7febee 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
@@ -1,65 +1,66 @@
-/*
- * 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;
/**
* Indicates whether this is a LONG or SHORT button press.
* <p></p>
- *@see ButtonEventMode
- *@since SmartDeviceLink 1.0
+ *
+ * @see ButtonEventMode
+ * @since SmartDeviceLink 1.0
*/
public enum ButtonPressMode {
- /**
- * The button has been depressed for 2 seconds. The button may remain
- * depressed after receiving this event
- */
- LONG,
- /**
- * The button was released before the 2-second long-press interval had
- * elapsed
- */
- SHORT;
- /**
- * Returns a ButtonPressMode (LONG or SHORT)
- *
- * @param value
- * a String
- * @return ButtonPressMode -LONG or SHORT
- */
+ /**
+ * The button has been depressed for 2 seconds. The button may remain
+ * depressed after receiving this event
+ */
+ LONG,
+ /**
+ * The button was released before the 2-second long-press interval had
+ * elapsed
+ */
+ SHORT;
+
+ /**
+ * Returns a ButtonPressMode (LONG or SHORT)
+ *
+ * @param value a String
+ * @return ButtonPressMode -LONG or SHORT
+ */
public static ButtonPressMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java
index a8b3c4817..64e6b8b0e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java
@@ -48,9 +48,9 @@ public enum CapacityUnit {
* @return CapacityUnit
*/
public static CapacityUnit valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
index e4a5cdff1..ab492f064 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -31,36 +31,45 @@
*/
package com.smartdevicelink.proxy.rpc.enums;
-/** Describes the carmode the vehicle is in.
+/**
+ * Describes the carmode the vehicle is in.
+ *
* @since SmartDeviceLink 2.0
*/
public enum CarModeStatus {
- /** Provides car mode NORMAL to each module.
- */
+ /**
+ * Provides car mode NORMAL to each module.
+ */
+
+ NORMAL,
+ /**
+ * Provides car mode FACTORY to each module.
+ */
- NORMAL,
- /** Provides car mode FACTORY to each module.
- */
+ FACTORY,
+ /**
+ * Provides car mode TRANSPORT to each module.
+ */
- FACTORY,
- /** Provides car mode TRANSPORT to each module.
- */
+ TRANSPORT,
+ /**
+ * Provides car mode CRASH to each module.
+ */
- TRANSPORT,
- /** Provides car mode CRASH to each module.
- */
+ CRASH;
- CRASH;
- /** Convert String to CarModeStatus
- * @param value String
- * @return CarModeStatus
- */
+ /**
+ * Convert String to CarModeStatus
+ *
+ * @param value String
+ * @return CarModeStatus
+ */
public static CarModeStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
index a2170c70a..9f5f6d608 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CharacterSet.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,8 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
+
/**
* Character sets supported by SDL.
+ *
* @since SmartDeviceLink 1.0
*/
public enum CharacterSet {
@@ -79,13 +81,14 @@ public enum CharacterSet {
/**
* Convert String to CharacterSet
+ *
* @param value String
* @return CharacterSet
*/
public static CharacterSet valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CompassDirection.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CompassDirection.java
index dd4493747..b888d0dcc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CompassDirection.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CompassDirection.java
@@ -1,83 +1,85 @@
-/*
- * 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;
/**
* The list of potential compass directions
- * @since SmartDeviceLink 2.0
+ *
+ * @since SmartDeviceLink 2.0
*/
public enum CompassDirection {
- /**
- * Direction North
- */
- NORTH,
- /**
- * Direction Northwest
- */
- NORTHWEST,
- /**
- * Direction West
- */
- WEST,
- /**
- * Direction Southwest
- */
- SOUTHWEST,
- /**
- * Direction South
- */
- SOUTH,
- /**
- * Direction Southeast
- */
- SOUTHEAST,
- /**
- * Direction East
- */
- EAST,
- /**
- * Direction Northeast
- */
- NORTHEAST;
+ /**
+ * Direction North
+ */
+ NORTH,
+ /**
+ * Direction Northwest
+ */
+ NORTHWEST,
+ /**
+ * Direction West
+ */
+ WEST,
+ /**
+ * Direction Southwest
+ */
+ SOUTHWEST,
+ /**
+ * Direction South
+ */
+ SOUTH,
+ /**
+ * Direction Southeast
+ */
+ SOUTHEAST,
+ /**
+ * Direction East
+ */
+ EAST,
+ /**
+ * Direction Northeast
+ */
+ NORTHEAST;
/**
* Convert String to CompassDirection
+ *
* @param value String
* @return CompassDirection
*/
public static CompassDirection valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ComponentVolumeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ComponentVolumeStatus.java
index c2ef627f9..fec50ce0e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ComponentVolumeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ComponentVolumeStatus.java
@@ -1,75 +1,77 @@
-/*
- * 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;
/**
* The volume status of a vehicle component
+ *
* @since SmartDeviceLink 2.0
*/
public enum ComponentVolumeStatus {
- /**
- * Unknown
- */
- UNKNOWN,
- /**
- * Normal
- */
- NORMAL,
- /**
- * Low
- */
- LOW,
- /**
- * Fault
- */
- FAULT,
- /**
- * Alert
- */
- ALERT,
- /**
- * Not supported
- */
- NOT_SUPPORTED;
+ /**
+ * Unknown
+ */
+ UNKNOWN,
+ /**
+ * Normal
+ */
+ NORMAL,
+ /**
+ * Low
+ */
+ LOW,
+ /**
+ * Fault
+ */
+ FAULT,
+ /**
+ * Alert
+ */
+ ALERT,
+ /**
+ * Not supported
+ */
+ NOT_SUPPORTED;
/**
* Convert String to ComponentVolumeStatus
+ *
* @param value String
* @return ComponentVolumeStatus
- */
+ */
public static ComponentVolumeStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java
index fb6c8b9b0..8c31ae988 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,9 +39,9 @@ public enum DefrostZone {
;
public static DefrostZone valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java
index bc83a4927..ba7e8827d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,15 +32,15 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum DeliveryMode {
- PROMPT,
+ PROMPT,
DESTINATION,
QUEUE,
;
public static DeliveryMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeviceLevelStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeviceLevelStatus.java
index 89bd99219..492e11099 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeviceLevelStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DeviceLevelStatus.java
@@ -1,75 +1,77 @@
-/*
- * 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;
/**
* Reflects the reported battery status of the connected device, if reported.
+ *
* @since SmartDeviceLink 2.0
*/
public enum DeviceLevelStatus {
- /**
- * Zero level bars
- */
- ZERO_LEVEL_BARS,
- /**
- * One level bars
- */
- ONE_LEVEL_BARS,
- /**
- * Two level bars
- */
- TWO_LEVEL_BARS,
- /**
- * Three level bars
- */
- THREE_LEVEL_BARS,
- /**
- * Four level bars
- */
- FOUR_LEVEL_BARS,
- /**
- * Not provided
- */
- NOT_PROVIDED;
+ /**
+ * Zero level bars
+ */
+ ZERO_LEVEL_BARS,
+ /**
+ * One level bars
+ */
+ ONE_LEVEL_BARS,
+ /**
+ * Two level bars
+ */
+ TWO_LEVEL_BARS,
+ /**
+ * Three level bars
+ */
+ THREE_LEVEL_BARS,
+ /**
+ * Four level bars
+ */
+ FOUR_LEVEL_BARS,
+ /**
+ * Not provided
+ */
+ NOT_PROVIDED;
/**
* Convert String to DeviceLevelStatus
+ *
* @param value String
* @return DeviceLevelStatus
- */
+ */
public static DeviceLevelStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
index 00f912478..7da5aec2c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
@@ -1,46 +1,47 @@
-/*
- * 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;
import java.util.EnumSet;
/**
* The supported dimensions of the GPS.
+ *
* @since SmartDeviceLink 2.0
*/
public enum Dimension {
- /**
- * No GPS at all
- */
+ /**
+ * No GPS at all
+ */
NO_FIX("NO_FIX"),
/**
* Longitude and latitude
@@ -50,28 +51,29 @@ public enum Dimension {
* Longitude and latitude and altitude
*/
_3D("3D");
-
+
private final String VALUE;
private Dimension(String value) {
- this.VALUE = value;
+ this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
/**
* Convert String to Dimension
+ *
* @param value String
* @return Dimension
- */
+ */
public static Dimension valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- for (Dimension anEnum : EnumSet.allOf(Dimension.class)) {
+
+ for (Dimension anEnum : EnumSet.allOf(Dimension.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java
index 2b63424b8..40bab0019 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Direction.java
@@ -33,17 +33,17 @@ package com.smartdevicelink.proxy.rpc.enums;
public enum Direction {
- LEFT,
+ LEFT,
- RIGHT,
+ RIGHT,
- ;
+ ;
- public static Direction valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static Direction valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayMode.java
index 0573208ef..7eee6f685 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayMode.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,16 +32,16 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum DisplayMode {
- DAY,
- NIGHT,
- AUTO,
- ;
+ DAY,
+ NIGHT,
+ AUTO,
+ ;
- public static DisplayMode valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static DisplayMode valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
index 44b654a78..314f70ce8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,34 +30,34 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
-/** The type of the display.
- *
- *
- * @since SmartDeviceLink 1.0
+
+/**
+ * The type of the display.
*
+ * @since SmartDeviceLink 1.0
*/
public enum DisplayType {
- /**
- * Center Information Display.
- *This display type provides a 2-line x 20 character "dot matrix" display.
- *
- */
+ /**
+ * Center Information Display.
+ * This display type provides a 2-line x 20 character "dot matrix" display.
+ */
CID("CID"),
- /** TYPE II display.
- 1 line older radio head unit. */
+ /**
+ * TYPE II display.
+ * 1 line older radio head unit.
+ */
TYPE2("TYPE2"),
/**
- * TYPE V display
- Old radio head unit.
-
- */
+ * TYPE V display
+ * Old radio head unit.
+ */
TYPE5("TYPE5"),
/**
- * Next Generation Navigation display.
+ * Next Generation Navigation display.
*/
NGN("NGN"),
@@ -72,31 +72,31 @@ public enum DisplayType {
GEN2_6_DMA("GEN2_6_DMA"),
/**
- * 3 inch GEN1.1 display.
+ * 3 inch GEN1.1 display.
*/
MFD3("MFD3"),
/**
- * 4 inch GEN1.1 display
+ * 4 inch GEN1.1 display
*/
MFD4("MFD4"),
/**
- * 5 inch GEN1.1 display.
+ * 5 inch GEN1.1 display.
*/
MFD5("MFD5"),
/**
- * GEN-3, 8 inch display.
+ * GEN-3, 8 inch display.
*/
GEN3_8_INCH("GEN3_8-INCH"),
-
+
/**
* SDL_GENERIC display type. Used for most SDL integrations.
*/
SDL_GENERIC("SDL_GENERIC"),
-
+
;
private final String VALUE;
@@ -106,10 +106,10 @@ public enum DisplayType {
}
public static DisplayType valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
+
for (DisplayType type : DisplayType.values()) {
if (type.toString().equals(value)) {
return type;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DistanceUnit.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DistanceUnit.java
index 8d79cd4ed..c3f2ec1ab 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DistanceUnit.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DistanceUnit.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,15 +32,15 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum DistanceUnit {
- MILES,
- KILOMETERS,
- ;
+ MILES,
+ KILOMETERS,
+ ;
- public static DistanceUnit valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static DistanceUnit valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DriverDistractionState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DriverDistractionState.java
index 4ff83592e..c91bc8893 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DriverDistractionState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DriverDistractionState.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,32 +29,34 @@
* 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;
-
-/**
- * Enumeration that describes possible states of driver distraction.
- * @since SmartDeviceLink 1.0
- */
-public enum DriverDistractionState {
- /**
- * Driver distraction rules are in effect.
- */
- DD_ON,
- /**
- * Driver distraction rules are NOT in effect.
- */
- DD_OFF;
-
- /**
- * Convert String to DriverDistractionState
- * @param value String
- * @return DriverDistractionState
- */
- public static DriverDistractionState valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enumeration that describes possible states of driver distraction.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+public enum DriverDistractionState {
+ /**
+ * Driver distraction rules are in effect.
+ */
+ DD_ON,
+ /**
+ * Driver distraction rules are NOT in effect.
+ */
+ DD_OFF;
+
+ /**
+ * Convert String to DriverDistractionState
+ *
+ * @param value String
+ * @return DriverDistractionState
+ */
+ public static DriverDistractionState valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
index 698c2af8a..924aeb9bf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
@@ -1,46 +1,47 @@
-/*
- * 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;
-/** Reflects the status of the eCall Notification.
+
+/**
+ * Reflects the status of the eCall Notification.
* <p>
- *
- * @since SmartDeviceLink 2.0
*
+ * @since SmartDeviceLink 2.0
*/
public enum ECallConfirmationStatus {
- /**
- * No E-Call signal triggered.
- */
+ /**
+ * No E-Call signal triggered.
+ */
NORMAL,
/**
* An E-Call is being in progress.
@@ -68,9 +69,9 @@ public enum ECallConfirmationStatus {
CALL_COMPLETE_DTMF_TIMEOUT;
public static ECallConfirmationStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ElectronicParkBrakeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ElectronicParkBrakeStatus.java
index d3c9a9908..822b91bb5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ElectronicParkBrakeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ElectronicParkBrakeStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,38 +32,39 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum ElectronicParkBrakeStatus {
- /**
- * Park brake actuators have been fully applied.
- */
- CLOSED,
- /**
- * Park brake actuators are transitioning to either Apply/Closed or Release/Open state.
- */
- TRANSITION,
- /**
- * Park brake actuators are released.
- */
- OPEN,
- /**
- * When driver pulls the Electronic Park Brake switch while driving "at speed".
- */
- DRIVE_ACTIVE,
- /**
- * When system has a fault or is under maintenance.
- */
- FAULT,
- ;
+ /**
+ * Park brake actuators have been fully applied.
+ */
+ CLOSED,
+ /**
+ * Park brake actuators are transitioning to either Apply/Closed or Release/Open state.
+ */
+ TRANSITION,
+ /**
+ * Park brake actuators are released.
+ */
+ OPEN,
+ /**
+ * When driver pulls the Electronic Park Brake switch while driving "at speed".
+ */
+ DRIVE_ACTIVE,
+ /**
+ * When system has a fault or is under maintenance.
+ */
+ FAULT,
+ ;
- /**
- * Convert String to ElectronicParkBrakeStatus
- * @param value String
- * @return ElectronicParkBrakeStatus
- */
- public static ElectronicParkBrakeStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ /**
+ * Convert String to ElectronicParkBrakeStatus
+ *
+ * @param value String
+ * @return ElectronicParkBrakeStatus
+ */
+ public static ElectronicParkBrakeStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
index 9811d494b..e555364e7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
@@ -1,71 +1,79 @@
-/*
- * 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;
+
/**
- *
* Reflects the emergency event status of the vehicle.
- *
*/
public enum EmergencyEventType {
- /** No emergency event has happened.
- */
+ /**
+ * No emergency event has happened.
+ */
NO_EVENT,
- /** Frontal collision has happened.
+ /**
+ * Frontal collision has happened.
*/
FRONTAL,
- /** Side collision has happened.
+ /**
+ * Side collision has happened.
*/
SIDE,
- /**Rear collision has happened.
+ /**
+ * Rear collision has happened.
*/
REAR,
- /** A rollover event has happened.
+ /**
+ * A rollover event has happened.
*/
ROLLOVER,
- /** The signal is not supported
+ /**
+ * The signal is not supported
*/
NOT_SUPPORTED,
- /** Emergency status cannot be determined
+ /**
+ * Emergency status cannot be determined
*/
FAULT;
+
/**
* Convert String to EmergencyEventType
+ *
* @param value String
* @return EmergencyEventTpe
*/
public static EmergencyEventType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FileType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FileType.java
index 112d3d259..8b10ff1e9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FileType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FileType.java
@@ -1,44 +1,45 @@
-/*
- * 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;
/**
* Enumeration listing possible file types.
+ *
* @since SmartDeviceLink 2.0
*/
public enum FileType {
- /**
- * BMP
- */
+ /**
+ * BMP
+ */
GRAPHIC_BMP,
/**
* JPEG
@@ -62,13 +63,14 @@ public enum FileType {
/**
* Convert String to FileType
+ *
* @param value String
* @return FileType
- */
+ */
public static FileType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
index 2098de77f..fb9fec975 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
@@ -1,62 +1,66 @@
-/*
- * 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;
-/** Reflects the status of the Restraints Control Module fuel pump cutoff.<br> The fuel pump is cut off typically after the vehicle has had a collision.
+
+/**
+ * Reflects the status of the Restraints Control Module fuel pump cutoff.<br> The fuel pump is cut off typically after the vehicle has had a collision.
* <p>
- *
- * @since SmartDeviceLink 2.0
*
+ * @since SmartDeviceLink 2.0
*/
public enum FuelCutoffStatus {
- /** Fuel is cut off
- */
- TERMINATE_FUEL,
- /** Fuel is not cut off
- *
- */
- NORMAL_OPERATION,
- /** Status of the fuel pump cannot be determined
- *
- */
+ /**
+ * Fuel is cut off
+ */
+ TERMINATE_FUEL,
+ /**
+ * Fuel is not cut off
+ */
+ NORMAL_OPERATION,
+ /**
+ * Status of the fuel pump cannot be determined
+ */
FAULT;
- /**
+
+ /**
* Convert String to FuelCutoffStatus
+ *
* @param value String
* @return FuelCuttoffStatus
*/
public static FuelCutoffStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelType.java
index 7ddc3cc9d..8c5b339c0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/FuelType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -53,9 +53,9 @@ public enum FuelType {
;
public static FuelType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
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 0990ef5ad..af90a02ce 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
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,18 +33,19 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Properties of a user-initiated VR interaction (i.e. interactions started by the user pressing the PTT button).
+ *
* @since SmartDeviceLink 1.0
*/
-public enum GlobalProperty{
- /**
- * The help prompt to be spoken if the user needs assistance during a user-initiated interaction.
- */
+public enum GlobalProperty {
+ /**
+ * The help prompt to be spoken if the user needs assistance during a user-initiated interaction.
+ */
HELPPROMPT,
/**
* The prompt to be spoken if the user-initiated interaction times out waiting for the user's verbal input.
*/
TIMEOUTPROMPT,
- /**
+ /**
* The property vrHelpTitle of setGlobalProperties
*/
@@ -77,13 +78,14 @@ public enum GlobalProperty{
/**
* Convert String to GlobalProperty
+ *
* @param value String
* @return GlobalProperty
*/
public static GlobalProperty valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
index 5f5eca430..4eeb2f6a2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,13 +35,13 @@ import java.util.EnumSet;
/**
* Specifies current level of the HMI. An HMI level indicates the degree of user interaction possible through the HMI (e.g. TTS only, display only, VR, etc.). The HMI level varies for an application based on the type of display (i.e. Nav or non-Nav) and the user directing "focus" to other applications (e.g. phone, other mobile applications, etc.)
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum HMILevel {
- /**
- * The application has full use of the SDL HMI. The app may output via TTS, display, or streaming audio and may gather input via VR, Menu, and button presses
- */
+ /**
+ * The application has full use of the SDL HMI. The app may output via TTS, display, or streaming audio and may gather input via VR, Menu, and button presses
+ */
HMI_FULL("FULL"),
/**
* This HMI Level is only defined for a media application using an HMI with an 8 inch touchscreen (Nav) system. The application's {@linkplain com.smartdevicelink.proxy.rpc.Show} text is displayed and it receives button presses from media-oriented buttons (SEEKRIGHT, SEEKLEFT, TUNEUP, TUNEDOWN, PRESET_0-9)
@@ -72,25 +72,26 @@ public enum HMILevel {
HMI_NONE("NONE");
private final String VALUE;
-
+
private HMILevel(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
/**
* Returns a HMILevel Status (FULL, LIMITED, BACKGROUND or NONE)
+ *
* @param value a String
* @return HMILevel -a String value (FULL, LIMITED, BACKGROUND or NONE)
*/
public static HMILevel valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
+
for (HMILevel anEnum : EnumSet.allOf(HMILevel.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
index 0a0a654b1..e3722cbad 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
@@ -1,64 +1,66 @@
-/*
- * 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;
/**
* Specifies HMI Zones in the vehicle.
- *
- * @since SmartDeviceLink 1.0
+ *
+ * @since SmartDeviceLink 1.0
*/
public enum HmiZoneCapabilities {
- /**
- * Indicates HMI available for front seat passengers.
- *
- * @since SmartDeviceLink 1.0
- */
- FRONT,
- /**
- * Indicates HMI available for rear seat passengers.
- *
- * @since SmartDeviceLink 1.0
- */
- BACK;
- /**
+ /**
+ * Indicates HMI available for front seat passengers.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ FRONT,
+ /**
+ * Indicates HMI available for rear seat passengers.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ BACK;
+
+ /**
* Convert String to HMIZoneCapabilities
+ *
* @param value String
* @return HMIZoneCapabilities
*/
public static HmiZoneCapabilities valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java
index 4c8a9205b..fa6fecd8e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,10 +37,10 @@ public enum HybridAppPreference {
CLOUD,
BOTH;
- public static HybridAppPreference valueForString(String value){
- try{
+ public static HybridAppPreference valueForString(String value) {
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStableStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStableStatus.java
index 6404ef0bc..2d4e9bd9c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStableStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStableStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,33 +29,35 @@
* 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;
-
-/**
- * Reflects the ignition switch stability.
- * @since SmartDeviceLink 2.0
- */
-public enum IgnitionStableStatus {
- /**
- * The current ignition switch status is considered not to be stable.
- */
- IGNITION_SWITCH_NOT_STABLE,
- /**
- * The current ignition switch status is considered to be stable.
- */
- IGNITION_SWITCH_STABLE,
- MISSING_FROM_TRANSMITTER;
-
- /**
- * Convert String to IgnitionStableStatus
- * @param value String
- * @return IgnitionStableStatus
- */
- public static IgnitionStableStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Reflects the ignition switch stability.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+public enum IgnitionStableStatus {
+ /**
+ * The current ignition switch status is considered not to be stable.
+ */
+ IGNITION_SWITCH_NOT_STABLE,
+ /**
+ * The current ignition switch status is considered to be stable.
+ */
+ IGNITION_SWITCH_STABLE,
+ MISSING_FROM_TRANSMITTER;
+
+ /**
+ * Convert String to IgnitionStableStatus
+ *
+ * @param value String
+ * @return IgnitionStableStatus
+ */
+ public static IgnitionStableStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
index f917d7221..42ef24dbe 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
@@ -1,75 +1,77 @@
-/*
- * 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;
/**
* Reflects the status of ignition.
+ *
* @since SmartDeviceLink 2.0
*/
public enum IgnitionStatus {
- /**
- * Ignition status currently unknown
- */
- UNKNOWN,
- /**
- * Ignition is off
- */
- OFF,
- /**
- * Ignition is in mode accessory
- */
- ACCESSORY,
- /**
- * Ignition is in mode run
- */
- RUN,
- /**
- * Ignition is in mode run
- */
- START,
- /**
- * Signal is invalid
- */
- INVALID;
+ /**
+ * Ignition status currently unknown
+ */
+ UNKNOWN,
+ /**
+ * Ignition is off
+ */
+ OFF,
+ /**
+ * Ignition is in mode accessory
+ */
+ ACCESSORY,
+ /**
+ * Ignition is in mode run
+ */
+ RUN,
+ /**
+ * Ignition is in mode run
+ */
+ START,
+ /**
+ * Signal is invalid
+ */
+ INVALID;
/**
* Convert String to IgnitionStatus
+ *
* @param value String
* @return IgnitionStatus
- */
+ */
public static IgnitionStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
index cb595fc9d..d6a0d7fa3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,108 +30,109 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
+
/**
* The name that identifies the field.
- *
+ *
* @since SmartDeviceLink 2.3.2
*/
public enum ImageFieldName {
- /** The image field for SoftButton
- *
- */
+ /**
+ * The image field for SoftButton
+ */
- softButtonImage,
- /** The first image field for Choice.
- *
- */
+ softButtonImage,
+ /**
+ * The first image field for Choice.
+ */
- choiceImage,
- /** The secondary image field for Choice.
- *
- */
+ choiceImage,
+ /**
+ * The secondary image field for Choice.
+ */
- choiceSecondaryImage,
- /** The image field for vrHelpItem.
- *
- */
+ choiceSecondaryImage,
+ /**
+ * The image field for vrHelpItem.
+ */
- vrHelpItem,
- /** The image field for Turn.
- *
- */
+ vrHelpItem,
+ /**
+ * The image field for Turn.
+ */
- turnIcon,
- /** The image field for the menu icon in SetGlobalProperties.
- *
- */
+ turnIcon,
+ /**
+ * The image field for the menu icon in SetGlobalProperties.
+ */
- menuIcon,
- /** The image filed for AddCommand.
- *
- */
+ menuIcon,
+ /**
+ * The image filed for AddCommand.
+ */
- cmdIcon,
- /** The image field for the app icon ( set by setAppIcon).
- *
- */
+ cmdIcon,
+ /**
+ * The image field for the app icon ( set by setAppIcon).
+ */
- appIcon,
- /** The image filed for Show.
- *
- */
+ appIcon,
+ /**
+ * The image filed for Show.
+ */
- graphic,
- /** The primary image field for ShowConstant TBT.
- *
- */
+ graphic,
+ /**
+ * The primary image field for ShowConstant TBT.
+ */
- showConstantTBTIcon,
+ showConstantTBTIcon,
- /** The secondary image field for ShowConstant TBT.
- *
- */
- showConstantTBTNextTurnIcon,
- /**
+ /**
+ * The secondary image field for ShowConstant TBT.
+ */
+ showConstantTBTNextTurnIcon,
+ /**
* The optional image of a destination / location
- *
+ *
* @since SmartDeviceLink 4.0
*/
- locationImage,
- /**
- * The secondary graphic image field
- *
- * @since SmartDeviceLink 5.0
- */
- secondaryGraphic,
- /**
- * The image field for Alert
- *
- * @since SmartDeviceLink 6.0.0
- */
- alertIcon,
- /**
- * The image of the subtle alert; applies to `SubtleAlert` `alertIcon`
- *
- * @since SmartDeviceLink 7.0.0
- */
- subtleAlertIcon,
- /**
- * The image field for AddSubMenu.menuIcon
- *
- * @since SmartDeviceLink 7.0.0
- */
- subMenuIcon
- ;
-
- /**
+ locationImage,
+ /**
+ * The secondary graphic image field
+ *
+ * @since SmartDeviceLink 5.0
+ */
+ secondaryGraphic,
+ /**
+ * The image field for Alert
+ *
+ * @since SmartDeviceLink 6.0.0
+ */
+ alertIcon,
+ /**
+ * The image of the subtle alert; applies to `SubtleAlert` `alertIcon`
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subtleAlertIcon,
+ /**
+ * The image field for AddSubMenu.menuIcon
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ subMenuIcon;
+
+ /**
* Convert String to ImageFieldName
+ *
* @param value String
* @return ImageFieldName
- */
- public static ImageFieldName valueForString(String value) {
- try{
+ */
+ public static ImageFieldName valueForString(String value) {
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageType.java
index 9eb89a794..6b3c29ab1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,32 +29,34 @@
* 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;
-
-/**
- * Contains information about the type of image.
- * @since SmartDeviceLink 2.0
- */
-public enum ImageType {
- /**
- * Just the static hex icon value to be used
- */
- STATIC,
- /**
- * Binary image file to be used (identifier to be sent by PutFile)
- */
- DYNAMIC;
-
- /**
- * Convert String to ImageType
- * @param value String
- * @return ImageType
- */
- public static ImageType valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Contains information about the type of image.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+public enum ImageType {
+ /**
+ * Just the static hex icon value to be used
+ */
+ STATIC,
+ /**
+ * Binary image file to be used (identifier to be sent by PutFile)
+ */
+ DYNAMIC;
+
+ /**
+ * Convert String to ImageType
+ *
+ * @param value String
+ * @return ImageType
+ */
+ public static ImageType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
index a6a8c1e07..4a28de8eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
@@ -1,88 +1,89 @@
-/*
- * 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;
/**
* For application-initiated interactions (<i>{@linkplain com.smartdevicelink.proxy.rpc.PerformInteraction}</i>), this specifies
* the mode by which the user is prompted and by which the user's selection is
* indicated
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum InteractionMode {
- /**
- * This mode causes the interaction to occur only on the display, meaning
- * the choices are presented and selected only via the display. Selections
- * are viewed with the SEEKRIGHT, SEEKLEFT, TUNEUP, TUNEDOWN buttons. User's
- * selection is indicated with the OK button
- */
- MANUAL_ONLY,
- /**
- * This mode causes the interaction to occur only through TTS and VR. The
- * user is prompted via TTS to select a choice by saying one of the choice's
- * synonyms
- */
- VR_ONLY,
- /**
- * This mode is a combination of MANUAL_ONLY and VR_ONLY, meaning the user
- * is prompted both visually and audibly. The user can make a selection
- * either using the mode described in MANUAL_ONLY or using the mode
- * described in VR_ONLY. If the user views selections as described in
- * MANUAL_ONLY mode, the interaction becomes strictly, and irreversibly, a
- * MANUAL_ONLY interaction (i.e. the VR session is cancelled, although the
- * interaction itself is still in progress). If the user interacts with the
- * VR session in any way (e.g. speaks a phrase, even if it is not a
- * recognized choice), the interaction becomes strictly, and irreversibly, a
- * VR_ONLY interaction (i.e. the MANUAL_ONLY mode forms of interaction will
- * no longer be honored)
- *
- * <p>The TriggerSource parameter of the
- * {@linkplain com.smartdevicelink.proxy.rpc.PerformInteraction} response will
- * indicate which interaction mode the user finally chose to attempt the
- * selection (even if the interaction did not end with a selection being
- * made)</P>
- */
- BOTH;
+ /**
+ * This mode causes the interaction to occur only on the display, meaning
+ * the choices are presented and selected only via the display. Selections
+ * are viewed with the SEEKRIGHT, SEEKLEFT, TUNEUP, TUNEDOWN buttons. User's
+ * selection is indicated with the OK button
+ */
+ MANUAL_ONLY,
+ /**
+ * This mode causes the interaction to occur only through TTS and VR. The
+ * user is prompted via TTS to select a choice by saying one of the choice's
+ * synonyms
+ */
+ VR_ONLY,
+ /**
+ * This mode is a combination of MANUAL_ONLY and VR_ONLY, meaning the user
+ * is prompted both visually and audibly. The user can make a selection
+ * either using the mode described in MANUAL_ONLY or using the mode
+ * described in VR_ONLY. If the user views selections as described in
+ * MANUAL_ONLY mode, the interaction becomes strictly, and irreversibly, a
+ * MANUAL_ONLY interaction (i.e. the VR session is cancelled, although the
+ * interaction itself is still in progress). If the user interacts with the
+ * VR session in any way (e.g. speaks a phrase, even if it is not a
+ * recognized choice), the interaction becomes strictly, and irreversibly, a
+ * VR_ONLY interaction (i.e. the MANUAL_ONLY mode forms of interaction will
+ * no longer be honored)
+ *
+ * <p>The TriggerSource parameter of the
+ * {@linkplain com.smartdevicelink.proxy.rpc.PerformInteraction} response will
+ * indicate which interaction mode the user finally chose to attempt the
+ * selection (even if the interaction did not end with a selection being
+ * made)</P>
+ */
+ BOTH;
- /**
- * Returns InteractionMode (MANUAL_ONLY, VR_ONLY or BOTH)
- * @param value a String
- * @return InteractionMode -MANUAL_ONLY, VR_ONLY or BOTH
- */
+ /**
+ * Returns InteractionMode (MANUAL_ONLY, VR_ONLY or BOTH)
+ *
+ * @param value a String
+ * @return InteractionMode -MANUAL_ONLY, VR_ONLY or BOTH
+ */
public static InteractionMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
index 032a53bbe..fcc3230f2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,24 +34,24 @@ package com.smartdevicelink.proxy.rpc.enums;
import java.util.EnumSet;
-public enum Jingle{
+public enum Jingle {
POSITIVE("POSITIVE_JINGLE"),
NEGATIVE("NEGATIVE_JINGLE"),
INITIAL("INITIAL_JINGLE"),
LISTEN("LISTEN_JINGLE"),
HELP("HELP_JINGLE");
-
+
private final String VALUE;
-
- private Jingle(String value){
+
+ private Jingle(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
- public static Jingle valueForString(String value) {
+
+ public static Jingle valueForString(String value) {
for (Jingle anEnum : EnumSet.allOf(Jingle.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
index 94eb79f79..2e3b45c1b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
@@ -1,75 +1,76 @@
-/*
- * 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;
+
/**
* Enumeration listing possible keyboard events.
- *
- *
*/
public enum KeyboardEvent {
- /** The use has pressed the keyboard key (applies to both SINGLE_KEYPRESS and RESEND_CURRENT_ENTRY modes).
- *
- */
+ /**
+ * The use has pressed the keyboard key (applies to both SINGLE_KEYPRESS and RESEND_CURRENT_ENTRY modes).
+ */
KEYPRESS,
- /** The User has finished entering text from the keyboard and submitted the entry.
- *
+ /**
+ * The User has finished entering text from the keyboard and submitted the entry.
*/
ENTRY_SUBMITTED,
- /** The User has pressed the HMI-defined "Cancel" button.
- *
+ /**
+ * The User has pressed the HMI-defined "Cancel" button.
*/
ENTRY_CANCELLED,
- /** The User has not finished entering text and the keyboard is aborted with the event of higher priority.
- *
- */
+ /**
+ * The User has not finished entering text and the keyboard is aborted with the event of higher priority.
+ */
ENTRY_ABORTED,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
ENTRY_VOICE,
;
+
/**
* Convert String to KeyboardEvent
+ *
* @param value String
* @return KeyboardEvent
- */
+ */
public static KeyboardEvent valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
index f2b3fadd5..fac69ac4d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,22 +29,23 @@
* 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;
-/**
- * Enumeration listing possible keyboard layouts.
- *
- * @since SmartDeviceLink 2.3.2
- */
-public enum KeyboardLayout {
- QWERTY,
- QWERTZ,
- AZERTY;
-
- public static KeyboardLayout valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enumeration listing possible keyboard layouts.
+ *
+ * @since SmartDeviceLink 2.3.2
+ */
+public enum KeyboardLayout {
+ QWERTY,
+ QWERTZ,
+ AZERTY;
+
+ public static KeyboardLayout valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
index 1b40ca8e5..a64362a0e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,15 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
+
/**
* Enumeration listing possible keyboard events.
- *
- *
*/
public enum KeypressMode {
- /**
- * Each keypress is individually sent as the user presses the keyboard keys.
- */
+ /**
+ * Each keypress is individually sent as the user presses the keyboard keys.
+ */
SINGLE_KEYPRESS,
/**
* The key presses are queued and a string is eventually sent once the user chooses to submit their entry.
@@ -50,9 +49,9 @@ public enum KeypressMode {
RESEND_CURRENT_ENTRY;
public static KeypressMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
index dab768296..bd4a6084c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.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;
import java.util.EnumSet;
@@ -36,91 +36,89 @@ import java.util.EnumSet;
/**
* Specifies the language to be used for TTS, VR, displayed messages/menus
*
- *
* @since SmartDeviceLink 1.0
- *
*/
public enum Language {
- /**
- * English - SA
- */
+ /**
+ * English - SA
+ */
- EN_SA("EN-SA"),
+ EN_SA("EN-SA"),
- /**
- * Hebrew - IL
- */
+ /**
+ * Hebrew - IL
+ */
- HE_IL("HE-IL"),
+ HE_IL("HE-IL"),
- /**
- * Romanian - RO
- */
+ /**
+ * Romanian - RO
+ */
- RO_RO("RO-RO"),
+ RO_RO("RO-RO"),
- /**
- * Ukrainian - UA
- */
+ /**
+ * Ukrainian - UA
+ */
- UK_UA("UK-UA"),
+ UK_UA("UK-UA"),
- /**
- * Indonesian - ID
- */
+ /**
+ * Indonesian - ID
+ */
- ID_ID("ID-ID"),
+ ID_ID("ID-ID"),
- /**
- * Vietnamese - VN
- */
+ /**
+ * Vietnamese - VN
+ */
- VI_VN("VI-VN"),
+ VI_VN("VI-VN"),
- /**
- * Malay - MY
- */
+ /**
+ * Malay - MY
+ */
- MS_MY("MS-MY"),
+ MS_MY("MS-MY"),
- /**
- * Hindi - IN
- */
+ /**
+ * Hindi - IN
+ */
- HI_IN("HI-IN"),
+ HI_IN("HI-IN"),
- /**
- * Dutch - BE
- */
+ /**
+ * Dutch - BE
+ */
- NL_BE("NL-BE"),
+ NL_BE("NL-BE"),
- /**
- * Greek - GR
- */
+ /**
+ * Greek - GR
+ */
- EL_GR("EL-GR"),
+ EL_GR("EL-GR"),
- /**
- * Hungarian - HU
- */
+ /**
+ * Hungarian - HU
+ */
- HU_HU("HU-HU"),
+ HU_HU("HU-HU"),
- /**
- * Finnish - FI
- */
+ /**
+ * Finnish - FI
+ */
- FI_FI("FI-FI"),
+ FI_FI("FI-FI"),
- /**
- * Slovak - SK
- */
+ /**
+ * Slovak - SK
+ */
- SK_SK("SK-SK"),
- /**
- * English - US
- */
+ SK_SK("SK-SK"),
+ /**
+ * English - US
+ */
EN_US("EN-US"),
/**
@@ -250,28 +248,30 @@ public enum Language {
TH_TH("TH-TH");
private final String VALUE;
-
+
private Language(String value) {
this.VALUE = value;
}
+
/**
* Returns a String representing a kind of Language
*/
public String toString() {
return this.VALUE;
}
-
+
/**
* Returns a Language's name
+ *
* @param value a String
* @return Language -EN-US, ES-MX or FR-CA
*/
public static Language valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- for (Language anEnum : EnumSet.allOf(Language.class)) {
+
+ for (Language anEnum : EnumSet.allOf(Language.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
index 2d2d3685d..7071615f8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
@@ -1,44 +1,43 @@
-/*
- * 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;
+
/**
* For touchscreen interactions, the mode of how the choices are presented.
- *
- *
*/
public enum LayoutMode {
- /**
- * This mode causes the interaction to display the previous set of choices as icons.
- */
+ /**
+ * This mode causes the interaction to display the previous set of choices as icons.
+ */
ICON_ONLY,
/**
* This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.
@@ -53,14 +52,14 @@ public enum LayoutMode {
*/
LIST_WITH_SEARCH,
/**
- * This mode causes the interaction to immediately display a keyboard entry through the HMI.
+ * This mode causes the interaction to immediately display a keyboard entry through the HMI.
*/
KEYBOARD;
public static LayoutMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightName.java
index b44431a23..7f33bb9f6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightName.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,134 +32,134 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum LightName {
- /*Common Single Light*/
- FRONT_LEFT_HIGH_BEAM,
- FRONT_RIGHT_HIGH_BEAM,
- FRONT_LEFT_LOW_BEAM,
- FRONT_RIGHT_LOW_BEAM,
- FRONT_LEFT_PARKING_LIGHT,
- FRONT_RIGHT_PARKING_LIGHT,
- FRONT_LEFT_FOG_LIGHT,
- FRONT_RIGHT_FOG_LIGHT,
- FRONT_LEFT_DAYTIME_RUNNING_LIGHT,
- FRONT_RIGHT_DAYTIME_RUNNING_LIGHT,
- FRONT_LEFT_TURN_LIGHT,
- FRONT_RIGHT_TURN_LIGHT,
- REAR_LEFT_FOG_LIGHT,
- REAR_RIGHT_FOG_LIGHT,
- REAR_LEFT_TAIL_LIGHT,
- REAR_RIGHT_TAIL_LIGHT,
- REAR_LEFT_BRAKE_LIGHT,
- REAR_RIGHT_BRAKE_LIGHT,
- REAR_LEFT_TURN_LIGHT,
- REAR_RIGHT_TURN_LIGHT,
- REAR_REGISTRATION_PLATE_LIGHT,
+ /*Common Single Light*/
+ FRONT_LEFT_HIGH_BEAM,
+ FRONT_RIGHT_HIGH_BEAM,
+ FRONT_LEFT_LOW_BEAM,
+ FRONT_RIGHT_LOW_BEAM,
+ FRONT_LEFT_PARKING_LIGHT,
+ FRONT_RIGHT_PARKING_LIGHT,
+ FRONT_LEFT_FOG_LIGHT,
+ FRONT_RIGHT_FOG_LIGHT,
+ FRONT_LEFT_DAYTIME_RUNNING_LIGHT,
+ FRONT_RIGHT_DAYTIME_RUNNING_LIGHT,
+ FRONT_LEFT_TURN_LIGHT,
+ FRONT_RIGHT_TURN_LIGHT,
+ REAR_LEFT_FOG_LIGHT,
+ REAR_RIGHT_FOG_LIGHT,
+ REAR_LEFT_TAIL_LIGHT,
+ REAR_RIGHT_TAIL_LIGHT,
+ REAR_LEFT_BRAKE_LIGHT,
+ REAR_RIGHT_BRAKE_LIGHT,
+ REAR_LEFT_TURN_LIGHT,
+ REAR_RIGHT_TURN_LIGHT,
+ REAR_REGISTRATION_PLATE_LIGHT,
- /**
- * Include all high beam lights: front_left and front_right.
- */
- HIGH_BEAMS,
- /**
- * Include all low beam lights: front_left and front_right.
- */
- LOW_BEAMS,
- /**
- * Include all fog lights: front_left, front_right, rear_left and rear_right.
- */
- FOG_LIGHTS,
- /**
- * Include all daytime running lights: front_left and front_right.
- */
- RUNNING_LIGHTS,
- /**
- * Include all parking lights: front_left and front_right.
- */
- PARKING_LIGHTS,
- /**
- * Include all brake lights: rear_left and rear_right.
- */
- BRAKE_LIGHTS,
- REAR_REVERSING_LIGHTS,
- SIDE_MARKER_LIGHTS,
+ /**
+ * Include all high beam lights: front_left and front_right.
+ */
+ HIGH_BEAMS,
+ /**
+ * Include all low beam lights: front_left and front_right.
+ */
+ LOW_BEAMS,
+ /**
+ * Include all fog lights: front_left, front_right, rear_left and rear_right.
+ */
+ FOG_LIGHTS,
+ /**
+ * Include all daytime running lights: front_left and front_right.
+ */
+ RUNNING_LIGHTS,
+ /**
+ * Include all parking lights: front_left and front_right.
+ */
+ PARKING_LIGHTS,
+ /**
+ * Include all brake lights: rear_left and rear_right.
+ */
+ BRAKE_LIGHTS,
+ REAR_REVERSING_LIGHTS,
+ SIDE_MARKER_LIGHTS,
- /**
- * Include all left turn signal lights: front_left, rear_left, left_side and mirror_mounted.
- */
- LEFT_TURN_LIGHTS,
- /**
- * Include all right turn signal lights: front_right, rear_right, right_side and mirror_mounted.
- */
- RIGHT_TURN_LIGHTS,
- /**
- * Include all hazard lights: front_left, front_right, rear_left and rear_right.
- */
- HAZARD_LIGHTS,
- /**
- * Cargo lamps illuminate the cargo area.
- */
- REAR_CARGO_LIGHTS,
- /**
- * Truck bed lamps light up the bed of the truck.
- */
- REAR_TRUCK_BED_LIGHTS,
- /**
- * Trailer lights are lamps mounted on a trailer hitch.
- */
- REAR_TRAILER_LIGHTS,
- /**
- * It is the spotlights mounted on the left side of a vehicle.
- */
- LEFT_SPOT_LIGHTS,
- /**
- * It is the spotlights mounted on the right side of a vehicle.
- */
- RIGHT_SPOT_LIGHTS,
- /**
- * Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.
- */
- LEFT_PUDDLE_LIGHTS,
- /**
- * Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.
- */
- RIGHT_PUDDLE_LIGHTS,
+ /**
+ * Include all left turn signal lights: front_left, rear_left, left_side and mirror_mounted.
+ */
+ LEFT_TURN_LIGHTS,
+ /**
+ * Include all right turn signal lights: front_right, rear_right, right_side and mirror_mounted.
+ */
+ RIGHT_TURN_LIGHTS,
+ /**
+ * Include all hazard lights: front_left, front_right, rear_left and rear_right.
+ */
+ HAZARD_LIGHTS,
+ /**
+ * Cargo lamps illuminate the cargo area.
+ */
+ REAR_CARGO_LIGHTS,
+ /**
+ * Truck bed lamps light up the bed of the truck.
+ */
+ REAR_TRUCK_BED_LIGHTS,
+ /**
+ * Trailer lights are lamps mounted on a trailer hitch.
+ */
+ REAR_TRAILER_LIGHTS,
+ /**
+ * It is the spotlights mounted on the left side of a vehicle.
+ */
+ LEFT_SPOT_LIGHTS,
+ /**
+ * It is the spotlights mounted on the right side of a vehicle.
+ */
+ RIGHT_SPOT_LIGHTS,
+ /**
+ * Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.
+ */
+ LEFT_PUDDLE_LIGHTS,
+ /**
+ * Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.
+ */
+ RIGHT_PUDDLE_LIGHTS,
- /*Interior Lights by common function groups*/
+ /*Interior Lights by common function groups*/
- AMBIENT_LIGHTS,
- OVERHEAD_LIGHTS,
- READING_LIGHTS,
- TRUNK_LIGHTS,
+ AMBIENT_LIGHTS,
+ OVERHEAD_LIGHTS,
+ READING_LIGHTS,
+ TRUNK_LIGHTS,
- /*Lights by location*/
+ /*Lights by location*/
- /**
- * Include exterior lights located in front of the vehicle. For example, fog lights and low beams.
- */
- EXTERIOR_FRONT_LIGHTS,
- /**
- * Include exterior lights located at the back of the vehicle. For example, license plate lights, reverse lights, cargo lights, bed lights an trailer assist lights.
- */
- EXTERIOR_REAR_LIGHTS,
- /**
- * Include exterior lights located at the left side of the vehicle. For example, left puddle lights and spot lights.
- */
- EXTERIOR_LEFT_LIGHTS,
- /**
- * Include exterior lights located at the right side of the vehicle. For example, right puddle lights and spot lights.
- */
- EXTERIOR_RIGHT_LIGHTS,
- /**
- * Include all exterior lights around the vehicle.
- */
- EXTERIOR_ALL_LIGHTS,
- ;
+ /**
+ * Include exterior lights located in front of the vehicle. For example, fog lights and low beams.
+ */
+ EXTERIOR_FRONT_LIGHTS,
+ /**
+ * Include exterior lights located at the back of the vehicle. For example, license plate lights, reverse lights, cargo lights, bed lights an trailer assist lights.
+ */
+ EXTERIOR_REAR_LIGHTS,
+ /**
+ * Include exterior lights located at the left side of the vehicle. For example, left puddle lights and spot lights.
+ */
+ EXTERIOR_LEFT_LIGHTS,
+ /**
+ * Include exterior lights located at the right side of the vehicle. For example, right puddle lights and spot lights.
+ */
+ EXTERIOR_RIGHT_LIGHTS,
+ /**
+ * Include all exterior lights around the vehicle.
+ */
+ EXTERIOR_ALL_LIGHTS,
+ ;
- public static LightName valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static LightName valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightStatus.java
index cd21978c9..771142259 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LightStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,19 +32,19 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum LightStatus {
- ON,
- OFF,
- RAMP_UP,
- RAMP_DOWN,
- UNKNOWN,
- INVALID,
- ;
+ ON,
+ OFF,
+ RAMP_UP,
+ RAMP_DOWN,
+ UNKNOWN,
+ INVALID,
+ ;
- public static LightStatus valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static LightStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
index 9895c679f..b7f60f4ec 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,34 +29,33 @@
* 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;
-/**
- *
- * Status of the Lock Screen.
- *
- */
-public enum LockScreenStatus {
- /**
- * LockScreen is Required
- */
-
- REQUIRED,
- /**
- * LockScreen is Optional
- */
-
- OPTIONAL,
- /**
- * LockScreen is Not Required
- */
-
- OFF;
-
- public static LockScreenStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Status of the Lock Screen.
+ */
+public enum LockScreenStatus {
+ /**
+ * LockScreen is Required
+ */
+
+ REQUIRED,
+ /**
+ * LockScreen is Optional
+ */
+
+ OPTIONAL,
+ /**
+ * LockScreen is Not Required
+ */
+
+ OFF;
+
+ public static LockScreenStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
index ebc4ed366..abe06e97c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
@@ -44,6 +44,7 @@ public enum MaintenanceModeStatus {
/**
* Convert String to MaintenanceModeStatus
+ *
* @param value String
* @return MaintenanceModeStatus
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageCushion.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageCushion.java
index 618c166a5..4e4028abe 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageCushion.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageCushion.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,18 +35,18 @@ package com.smartdevicelink.proxy.rpc.enums;
* List possible cushions of a multi-contour massage seat.
*/
public enum MassageCushion {
- TOP_LUMBAR,
- MIDDLE_LUMBAR,
- BOTTOM_LUMBAR,
- BACK_BOLSTERS,
- SEAT_BOLSTERS,
- ;
+ TOP_LUMBAR,
+ MIDDLE_LUMBAR,
+ BOTTOM_LUMBAR,
+ BACK_BOLSTERS,
+ SEAT_BOLSTERS,
+ ;
- public static MassageCushion valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static MassageCushion valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageMode.java
index e1faa2ace..774146b5d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageMode.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,16 +35,16 @@ package com.smartdevicelink.proxy.rpc.enums;
* List possible modes of a massage zone.
*/
public enum MassageMode {
- OFF,
- LOW,
- HIGH,
- ;
+ OFF,
+ LOW,
+ HIGH,
+ ;
- public static MassageMode valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static MassageMode valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageZone.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageZone.java
index 8c7b62f6b..c7f31303f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageZone.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MassageZone.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,21 +35,21 @@ package com.smartdevicelink.proxy.rpc.enums;
* List possible zones of a multi-contour massage seat.
*/
public enum MassageZone {
- /**
- * The back of a multi-contour massage seat. or SEAT_BACK
- */
- LUMBAR,
- /**
- * The bottom a multi-contour massage seat. or SEAT_BOTTOM
- */
- SEAT_CUSHION,
- ;
+ /**
+ * The back of a multi-contour massage seat. or SEAT_BACK
+ */
+ LUMBAR,
+ /**
+ * The bottom a multi-contour massage seat. or SEAT_BOTTOM
+ */
+ SEAT_CUSHION,
+ ;
- public static MassageZone valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static MassageZone valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
index 55d9c6791..1e29d7d5b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,122 +35,117 @@ package com.smartdevicelink.proxy.rpc.enums;
* Indicates the format of the time displayed on the connected SDL unit.Format
* description follows the following nomenclature:<p> Sp = Space</p> <p>| = or </p><p>c =
* character</p>
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum MediaClockFormat {
- /**
- * <p>
- * </p>
- * <ul>
- * <li>maxHours = 19</li>
- * <li>maxMinutes = 59</li>
- * <li>maxSeconds = 59</li>
- * </ul>
- *
- * @since SmartDeviceLink 1.0
- *
- */
- CLOCK1,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>maxHours = 59</li>
- * <li>maxMinutes = 59</li>
- * <li>maxSeconds = 59</li>
- * </ul>
- *
- * @since SmartDeviceLink 1.0
- *
- */
- CLOCK2,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>maxHours = 9</li>
- * <li>maxMinutes = 59</li>
- * <li>maxSeconds = 59</li>
- * </ul>
- *
- * @since SmartDeviceLink 2.0
- *
- */
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>maxHours = 19</li>
+ * <li>maxMinutes = 59</li>
+ * <li>maxSeconds = 59</li>
+ * </ul>
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ CLOCK1,
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>maxHours = 59</li>
+ * <li>maxMinutes = 59</li>
+ * <li>maxSeconds = 59</li>
+ * </ul>
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ CLOCK2,
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>maxHours = 9</li>
+ * <li>maxMinutes = 59</li>
+ * <li>maxSeconds = 59</li>
+ * </ul>
+ *
+ * @since SmartDeviceLink 2.0
+ */
CLOCK3,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>5 characters possible</li>
- * <li>Format: 1|sp c :|sp c c</li>
- * <li>1|sp : digit "1" or space</li>
- * <li>c : character out of following character set: sp|0-9|[letters, see
- * TypeII column in XLS.</li>
- * <li>:|sp : colon or space</li>
- * <li>used for Type II head unit</li>
- * </ul>
- *
- * @since SmartDeviceLink 1.0
- */
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>5 characters possible</li>
+ * <li>Format: 1|sp c :|sp c c</li>
+ * <li>1|sp : digit "1" or space</li>
+ * <li>c : character out of following character set: sp|0-9|[letters, see
+ * TypeII column in XLS.</li>
+ * <li>:|sp : colon or space</li>
+ * <li>used for Type II head unit</li>
+ * </ul>
+ *
+ * @since SmartDeviceLink 1.0
+ */
CLOCKTEXT1,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>5 characters possible</li>
- * <li>Format: 1|sp c :|sp c c</li>
- * <li>1|sp : digit "1" or space</li>
- * <li>c : character out of following character set: sp|0-9|[letters, see
- * CID column in XLS.</li>
- * <li>:|sp : colon or space</li>
- * <li>used for CID head unit</li>
- * </ul>
- * difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character
- * set
- *
- * @since SmartDeviceLink 1.0
- */
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>5 characters possible</li>
+ * <li>Format: 1|sp c :|sp c c</li>
+ * <li>1|sp : digit "1" or space</li>
+ * <li>c : character out of following character set: sp|0-9|[letters, see
+ * CID column in XLS.</li>
+ * <li>:|sp : colon or space</li>
+ * <li>used for CID head unit</li>
+ * </ul>
+ * difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character
+ * set
+ *
+ * @since SmartDeviceLink 1.0
+ */
CLOCKTEXT2,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>6 chars possible</li>
- * <li>Format: 1|sp c c :|sp c c</li>
- * <li>1|sp : digit "1" or space</li>
- * <li>c : character out of following character set: sp|0-9|[letters, see
- * Type 5 column in XLS].</li>
- * <li>:|sp : colon or space</li>
- * <li>used for Type V head unit</li>
- * </ul>
- * difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character
- * set
- *
- *
- * @since SmartDeviceLink 1.0
- */
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>6 chars possible</li>
+ * <li>Format: 1|sp c c :|sp c c</li>
+ * <li>1|sp : digit "1" or space</li>
+ * <li>c : character out of following character set: sp|0-9|[letters, see
+ * Type 5 column in XLS].</li>
+ * <li>:|sp : colon or space</li>
+ * <li>used for Type V head unit</li>
+ * </ul>
+ * difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character
+ * set
+ *
+ * @since SmartDeviceLink 1.0
+ */
CLOCKTEXT3,
- /**
- * <p>
- * </p>
- * <ul>
- * <li>6 chars possible</li>
- * <li>Format: c :|sp c c : c c</li>
- * <li>:|sp : colon or space</li>
- * <li>c : character out of following character set: sp|0-9|[letters]</li>
- * <li>used for MFD3/4/5 head units</li>
- * </ul>
- *
- *
- * @since SmartDeviceLink 2.0
- */
+ /**
+ * <p>
+ * </p>
+ * <ul>
+ * <li>6 chars possible</li>
+ * <li>Format: c :|sp c c : c c</li>
+ * <li>:|sp : colon or space</li>
+ * <li>c : character out of following character set: sp|0-9|[letters]</li>
+ * <li>used for MFD3/4/5 head units</li>
+ * </ul>
+ *
+ * @since SmartDeviceLink 2.0
+ */
CLOCKTEXT4;
public static MediaClockFormat valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java
index a2b2e2e6a..8205df5cf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MediaType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,21 +34,21 @@ package com.smartdevicelink.proxy.rpc.enums;
public enum MediaType {
- MUSIC,
+ MUSIC,
- PODCAST,
+ PODCAST,
- AUDIOBOOK,
+ AUDIOBOOK,
- OTHER,
+ OTHER,
- ;
+ ;
- public static MediaType valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static MediaType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java
index fcda7b498..64a4cc994 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java
@@ -40,18 +40,18 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum MenuLayout {
- LIST,
+ LIST,
- TILES,
+ TILES,
- ;
+ ;
- public static MenuLayout valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static MenuLayout valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java
index fe6152ee3..a62400780 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java
@@ -49,12 +49,13 @@ public enum MessageType {
/**
* Private constructor
*/
- private MessageType (int value) {
+ private MessageType(int value) {
this.VALUE = value;
}
/**
* Convert value to MessageType
+ *
* @param value int
* @return MessageType
*/
@@ -69,9 +70,10 @@ public enum MessageType {
/**
* Gets the value for the MessageType
+ *
* @return value for the MessageType
*/
- public int getValue(){
+ public int getValue() {
return VALUE;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
index 23623fd8c..d99333e6d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,93 +35,92 @@ import java.util.EnumSet;
/**
* Defines the metadata types that can be applied to text fields
- *
*/
public enum MetadataType {
- /**
- * The data in this field contains the title of the currently playing audio track.
- */
- MEDIA_TITLE("mediaTitle"),
-
- /**
- * The data in this field contains the artist or creator of the currently playing audio track.
- */
- MEDIA_ARTIST("mediaArtist"),
-
- /**
- * The data in this field contains the album title of the currently playing audio track.
- */
- MEDIA_ALBUM("mediaAlbum"),
-
- /**
- * The data in this field contains the creation year of the currently playing audio track.
- */
- MEDIA_YEAR("mediaYear"),
-
- /**
- * The data in this field contains the genre of the currently playing audio track.
- */
- MEDIA_GENRE("mediaGenre"),
-
- /**
- * The data in this field contains the name of the current source for the media.
- */
- MEDIA_STATION("mediaStation"),
-
- /**
- * The data in this field is a rating.
- */
- RATING("rating"),
-
- /**
- * The data in this field is the current temperature.
- */
- CURRENT_TEMPERATURE("currentTemperature"),
-
- /**
- * The data in this field is the maximum temperature for the day.
- */
- MAXIMUM_TEMPERATURE("maximumTemperature"),
-
- /**
- * The data in this field is the minimum temperature for the day.
- */
- MINIMUM_TEMPERATURE("minimumTemperature"),
-
- /**
- * The data in this field describes the current weather (ex. cloudy, clear, etc.).
- */
- WEATHER_TERM("weatherTerm"),
-
- /**
- * The data in this field describes the current humidity value.
- */
- HUMIDITY("humidity"),
-
-
- ;
-
- private final String VALUE;
-
- private MetadataType(String value) {
- this.VALUE = value;
- }
-
- public String toString() {
- return this.VALUE;
- }
-
- public static MetadataType valueForString(String value) {
- if(value == null){
- return null;
- }
-
- for (MetadataType anEnum : EnumSet.allOf(MetadataType.class)) {
- if (anEnum.toString().equals(value)) {
- return anEnum;
- }
- }
- return null;
- }
+ /**
+ * The data in this field contains the title of the currently playing audio track.
+ */
+ MEDIA_TITLE("mediaTitle"),
+
+ /**
+ * The data in this field contains the artist or creator of the currently playing audio track.
+ */
+ MEDIA_ARTIST("mediaArtist"),
+
+ /**
+ * The data in this field contains the album title of the currently playing audio track.
+ */
+ MEDIA_ALBUM("mediaAlbum"),
+
+ /**
+ * The data in this field contains the creation year of the currently playing audio track.
+ */
+ MEDIA_YEAR("mediaYear"),
+
+ /**
+ * The data in this field contains the genre of the currently playing audio track.
+ */
+ MEDIA_GENRE("mediaGenre"),
+
+ /**
+ * The data in this field contains the name of the current source for the media.
+ */
+ MEDIA_STATION("mediaStation"),
+
+ /**
+ * The data in this field is a rating.
+ */
+ RATING("rating"),
+
+ /**
+ * The data in this field is the current temperature.
+ */
+ CURRENT_TEMPERATURE("currentTemperature"),
+
+ /**
+ * The data in this field is the maximum temperature for the day.
+ */
+ MAXIMUM_TEMPERATURE("maximumTemperature"),
+
+ /**
+ * The data in this field is the minimum temperature for the day.
+ */
+ MINIMUM_TEMPERATURE("minimumTemperature"),
+
+ /**
+ * The data in this field describes the current weather (ex. cloudy, clear, etc.).
+ */
+ WEATHER_TERM("weatherTerm"),
+
+ /**
+ * The data in this field describes the current humidity value.
+ */
+ HUMIDITY("humidity"),
+
+
+ ;
+
+ private final String VALUE;
+
+ private MetadataType(String value) {
+ this.VALUE = value;
+ }
+
+ public String toString() {
+ return this.VALUE;
+ }
+
+ public static MetadataType valueForString(String value) {
+ if (value == null) {
+ return null;
+ }
+
+ for (MetadataType anEnum : EnumSet.allOf(MetadataType.class)) {
+ if (anEnum.toString().equals(value)) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java
index 22b9be8a6..8876b1155 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,19 +32,19 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum ModuleType {
- CLIMATE,
- RADIO,
- SEAT,
- AUDIO,
- LIGHT,
- HMI_SETTINGS,
- ;
+ CLIMATE,
+ RADIO,
+ SEAT,
+ AUDIO,
+ LIGHT,
+ HMI_SETTINGS,
+ ;
- public static ModuleType valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static ModuleType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java
index a576d69bf..b1f3d9d62 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationAction.java
@@ -33,30 +33,30 @@ package com.smartdevicelink.proxy.rpc.enums;
public enum NavigationAction {
- /**
- * Using this action plus a supplied direction can give the type of turn.
- */
- TURN,
+ /**
+ * Using this action plus a supplied direction can give the type of turn.
+ */
+ TURN,
- EXIT,
+ EXIT,
- STAY,
+ STAY,
- MERGE,
+ MERGE,
- FERRY,
+ FERRY,
- CAR_SHUTTLE_TRAIN,
+ CAR_SHUTTLE_TRAIN,
- WAYPOINT,
+ WAYPOINT,
- ;
+ ;
- public static NavigationAction valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static NavigationAction valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java
index f7c535657..57d41458a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/NavigationJunction.java
@@ -33,57 +33,57 @@ package com.smartdevicelink.proxy.rpc.enums;
public enum NavigationJunction {
- /**
- * A junction that represents a standard intersection with a single road crossing another.
- */
- REGULAR,
+ /**
+ * A junction that represents a standard intersection with a single road crossing another.
+ */
+ REGULAR,
- /**
- * A junction where the road splits off into two paths; a fork in the road.
- */
- BIFURCATION,
+ /**
+ * A junction where the road splits off into two paths; a fork in the road.
+ */
+ BIFURCATION,
- /**
- * A junction that has multiple intersections and paths.
- */
- MULTI_CARRIAGEWAY,
+ /**
+ * A junction that has multiple intersections and paths.
+ */
+ MULTI_CARRIAGEWAY,
- /**
- * A junction where traffic moves in a single direction around a central, non-traversable point
- * to reach one of the connecting roads.
- */
- ROUNDABOUT,
+ /**
+ * A junction where traffic moves in a single direction around a central, non-traversable point
+ * to reach one of the connecting roads.
+ */
+ ROUNDABOUT,
- /**
- * Similar to a roundabout, however the center of the roundabout is fully traversable. Also
- * known as a mini-roundabout.
- */
- TRAVERSABLE_ROUNDABOUT,
+ /**
+ * Similar to a roundabout, however the center of the roundabout is fully traversable. Also
+ * known as a mini-roundabout.
+ */
+ TRAVERSABLE_ROUNDABOUT,
- /**
- * A junction where lefts diverge to the right, then curve to the left, converting a left turn
- * to a crossing maneuver.
- */
- JUGHANDLE,
+ /**
+ * A junction where lefts diverge to the right, then curve to the left, converting a left turn
+ * to a crossing maneuver.
+ */
+ JUGHANDLE,
- /**
- * Multiple way intersection that allows traffic to flow based on priority; most commonly right
- * of way and first in, first out.
- */
- ALL_WAY_YIELD,
+ /**
+ * Multiple way intersection that allows traffic to flow based on priority; most commonly right
+ * of way and first in, first out.
+ */
+ ALL_WAY_YIELD,
- /**
- * A junction designated for traffic turn arounds.
- */
- TURN_AROUND,
+ /**
+ * A junction designated for traffic turn arounds.
+ */
+ TURN_AROUND,
- ;
+ ;
- public static NavigationJunction valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static NavigationJunction valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PRNDL.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PRNDL.java
index d21c7b62c..b3c5f86cf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PRNDL.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PRNDL.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,12 +33,13 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* The selected gear.
+ *
* @since SmartDeviceLink 2.0
*/
public enum PRNDL {
- /**
- * Parking
- */
+ /**
+ * Parking
+ */
PARK,
/**
* Reverse gear
@@ -99,13 +100,14 @@ public enum PRNDL {
/**
* Convert String to PRNDL
+ *
* @param value String
* @return PRNDL
- */
+ */
public static PRNDL valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
index 17b53d7a2..aa2746f05 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
@@ -44,6 +44,7 @@ public enum PermissionStatus {
/**
* Convert String to PermissionStatus
+ *
* @param value String
* @return PermissionStatus
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
index 1a98b73ba..c56ee9d51 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
@@ -1,72 +1,75 @@
-/*
- * 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;
-/** Reflects the status of the current power mode qualification.
- *
- * @since SmartDeviceLink 2.0
+
+/**
+ * Reflects the status of the current power mode qualification.
*
+ * @since SmartDeviceLink 2.0
*/
public enum PowerModeQualificationStatus {
- /** The power mode of the vehicle is currently considered undefined
- *
- */
+ /**
+ * The power mode of the vehicle is currently considered undefined
+ */
+
+ POWER_MODE_UNDEFINED,
+ /**
+ * The evaluation of the power mode is in progress
+ */
- POWER_MODE_UNDEFINED,
- /** The evaluation of the power mode is in progress
- *
- */
+ POWER_MODE_EVALUATION_IN_PROGRESS,
+ /**
+ * Currently undefined
+ */
- POWER_MODE_EVALUATION_IN_PROGRESS,
- /** Currently undefined
- *
- */
+ NOT_DEFINED,
+ /**
+ * The power mode of the vehicle
+ */
- NOT_DEFINED,
- /** The power mode of the vehicle
- *
- */
+ POWER_MODE_OK;
- POWER_MODE_OK;
- /**
+ /**
* Convert String to PowerModeQualificationStatus
+ *
* @param value String
* @return PowerModeQualificationStatus
- */
+ */
public static PowerModeQualificationStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
index 2f708b63f..ab6a6b022 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,49 +30,50 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
-/** Reflects the status of the current power mode.
- *
- * @since SmartDeviceLink 2.0
+
+/**
+ * Reflects the status of the current power mode.
*
+ * @since SmartDeviceLink 2.0
*/
public enum PowerModeStatus {
- /** Key not inserted
- *
- */
+ /**
+ * Key not inserted
+ */
KEY_OUT,
- /** Key is currently out
- *
+ /**
+ * Key is currently out
*/
KEY_RECENTLY_OUT,
-
+
KEY_APPROVED_0,
POST_ACCESORY_0,
- /** Key is in accessory position
- *
+ /**
+ * Key is in accessory position
*/
ACCESORY_1,
POST_IGNITION_1,
-
- /** Key is in position ignition on
- *
+
+ /**
+ * Key is in position ignition on
*/
IGNITION_ON_2,
- /** Key is in position running
- *
+ /**
+ * Key is in position running
*/
RUNNING_2,
- /** Key is in crank position
- *
+ /**
+ * Key is in crank position
*/
CRANK_3;
public static PowerModeStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
index dcec89019..d57a22dd1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,144 +34,145 @@ package com.smartdevicelink.proxy.rpc.enums;
import java.util.EnumSet;
/**
- A template layout an app uses to display information. The broad details of the layout are defined, but the details depend on the IVI system. Used in SetDisplayLayout.
+ * A template layout an app uses to display information. The broad details of the layout are defined, but the details depend on the IVI system. Used in SetDisplayLayout.
*/
public enum PredefinedLayout {
- /**
- A default layout
- */
- DEFAULT("DEFAULT"),
-
- /**
- The default media layout
- */
- MEDIA("MEDIA"),
-
- /**
- The default non-media layout
- */
- NON_MEDIA("NON-MEDIA"),
-
- /**
- A media layout containing preset buttons
- */
- ONSCREEN_PRESETS("ONSCREEN_PRESETS"),
-
- /**
- The default navigation layout with a fullscreen map
- */
- NAV_FULLSCREEN_MAP("NAV_FULLSCREEN_MAP"),
-
- /**
- A list layout used for navigation apps
- */
- NAV_LIST("NAV_LIST"),
-
- /**
- A keyboard layout used for navigation apps
- */
- NAV_KEYBOARD("NAV_KEYBOARD"),
-
- /**
- A layout with a single graphic on the left and text on the right
- */
- GRAPHIC_WITH_TEXT("GRAPHIC_WITH_TEXT"),
-
- /**
- A layout with text on the left and a single graphic on the right
- */
- TEXT_WITH_GRAPHIC("TEXT_WITH_GRAPHIC"),
-
- /**
- A layout with only soft buttons placed in a tile layout
- */
- TILES_ONLY("TILES_ONLY"),
-
- /**
- A layout with only soft buttons that only accept text
- */
- TEXTBUTTONS_ONLY("TEXTBUTTONS_ONLY"),
-
- /**
- A layout with a single graphic on the left and soft buttons in a tile layout on the right
- */
- GRAPHIC_WITH_TILES("GRAPHIC_WITH_TILES"),
-
- /**
- A layout with soft buttons in a tile layout on the left and a single graphic on the right
- */
- TILES_WITH_GRAPHIC("TILES_WITH_GRAPHIC"),
-
- /**
- A layout with a single graphic on the left and both text and soft buttons on the right
- */
- GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS("GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS"),
-
- /**
- A layout with both text and soft buttons on the left and a single graphic on the right
- */
- TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC("TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC"),
-
- /**
- A layout with a single graphic on the left and text-only soft buttons on the right
- */
- GRAPHIC_WITH_TEXTBUTTONS("GRAPHIC_WITH_TEXTBUTTONS"),
-
- /**
- A layout with text-only soft buttons on the left and a single graphic on the right
- */
- TEXTBUTTONS_WITH_GRAPHIC("TEXTBUTTONS_WITH_GRAPHIC"),
-
- /**
- A layout with a single large graphic and soft buttons
- */
- LARGE_GRAPHIC_WITH_SOFTBUTTONS("LARGE_GRAPHIC_WITH_SOFTBUTTONS"),
-
- /**
- A layout with two graphics and soft buttons
- */
- DOUBLE_GRAPHIC_WITH_SOFTBUTTONS("DOUBLE_GRAPHIC_WITH_SOFTBUTTONS"),
-
- /**
- A layout with only a single large graphic
- */
- LARGE_GRAPHIC_ONLY("LARGE_GRAPHIC_ONLY"),
-
- /**
- * Custom root template allowing in-vehicle WebEngine applications with
- * appropriate permissions to show the application's own web view.
- */
- WEB_VIEW("WEB_VIEW")
- ;
-
- private final String VALUE;
-
- private PredefinedLayout(String value) {
- this.VALUE = value;
- }
- /**
- * Returns a String representing a PredefinedLayout
- */
- public String toString() {
- return this.VALUE;
- }
-
- /**
- * Returns a PredefinedLayout
- * @param value a String
- * @return PredefinedLayout
- */
- public static PredefinedLayout valueForString(String value) {
- if(value == null){
- return null;
- }
-
- for (PredefinedLayout anEnum : EnumSet.allOf(PredefinedLayout.class)) {
- if (anEnum.toString().equals(value)) {
- return anEnum;
- }
- }
- return null;
- }
+ /**
+ * A default layout
+ */
+ DEFAULT("DEFAULT"),
+
+ /**
+ * The default media layout
+ */
+ MEDIA("MEDIA"),
+
+ /**
+ * The default non-media layout
+ */
+ NON_MEDIA("NON-MEDIA"),
+
+ /**
+ * A media layout containing preset buttons
+ */
+ ONSCREEN_PRESETS("ONSCREEN_PRESETS"),
+
+ /**
+ * The default navigation layout with a fullscreen map
+ */
+ NAV_FULLSCREEN_MAP("NAV_FULLSCREEN_MAP"),
+
+ /**
+ * A list layout used for navigation apps
+ */
+ NAV_LIST("NAV_LIST"),
+
+ /**
+ * A keyboard layout used for navigation apps
+ */
+ NAV_KEYBOARD("NAV_KEYBOARD"),
+
+ /**
+ * A layout with a single graphic on the left and text on the right
+ */
+ GRAPHIC_WITH_TEXT("GRAPHIC_WITH_TEXT"),
+
+ /**
+ * A layout with text on the left and a single graphic on the right
+ */
+ TEXT_WITH_GRAPHIC("TEXT_WITH_GRAPHIC"),
+
+ /**
+ * A layout with only soft buttons placed in a tile layout
+ */
+ TILES_ONLY("TILES_ONLY"),
+
+ /**
+ * A layout with only soft buttons that only accept text
+ */
+ TEXTBUTTONS_ONLY("TEXTBUTTONS_ONLY"),
+
+ /**
+ * A layout with a single graphic on the left and soft buttons in a tile layout on the right
+ */
+ GRAPHIC_WITH_TILES("GRAPHIC_WITH_TILES"),
+
+ /**
+ * A layout with soft buttons in a tile layout on the left and a single graphic on the right
+ */
+ TILES_WITH_GRAPHIC("TILES_WITH_GRAPHIC"),
+
+ /**
+ * A layout with a single graphic on the left and both text and soft buttons on the right
+ */
+ GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS("GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS"),
+
+ /**
+ * A layout with both text and soft buttons on the left and a single graphic on the right
+ */
+ TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC("TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC"),
+
+ /**
+ * A layout with a single graphic on the left and text-only soft buttons on the right
+ */
+ GRAPHIC_WITH_TEXTBUTTONS("GRAPHIC_WITH_TEXTBUTTONS"),
+
+ /**
+ * A layout with text-only soft buttons on the left and a single graphic on the right
+ */
+ TEXTBUTTONS_WITH_GRAPHIC("TEXTBUTTONS_WITH_GRAPHIC"),
+
+ /**
+ * A layout with a single large graphic and soft buttons
+ */
+ LARGE_GRAPHIC_WITH_SOFTBUTTONS("LARGE_GRAPHIC_WITH_SOFTBUTTONS"),
+
+ /**
+ * A layout with two graphics and soft buttons
+ */
+ DOUBLE_GRAPHIC_WITH_SOFTBUTTONS("DOUBLE_GRAPHIC_WITH_SOFTBUTTONS"),
+
+ /**
+ * A layout with only a single large graphic
+ */
+ LARGE_GRAPHIC_ONLY("LARGE_GRAPHIC_ONLY"),
+
+ /**
+ * Custom root template allowing in-vehicle WebEngine applications with
+ * appropriate permissions to show the application's own web view.
+ */
+ WEB_VIEW("WEB_VIEW");
+
+ private final String VALUE;
+
+ private PredefinedLayout(String value) {
+ this.VALUE = value;
+ }
+
+ /**
+ * Returns a String representing a PredefinedLayout
+ */
+ public String toString() {
+ return this.VALUE;
+ }
+
+ /**
+ * Returns a PredefinedLayout
+ *
+ * @param value a String
+ * @return PredefinedLayout
+ */
+ public static PredefinedLayout valueForString(String value) {
+ if (value == null) {
+ return null;
+ }
+
+ for (PredefinedLayout anEnum : EnumSet.allOf(PredefinedLayout.class)) {
+ if (anEnum.toString().equals(value)) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
}
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
index 35b8833c0..5ca108171 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
@@ -4,35 +4,37 @@ import java.util.EnumSet;
/**
* specifies what windows and IDs are predefined and pre-created on behalf of the app.
- *
+ * <p>
* 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.
- *
+ * <p>
* 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),
+ DEFAULT_WINDOW(0),
/**
* The primary widget of the app.
*/
- PRIMARY_WIDGET (1),
+ PRIMARY_WIDGET(1),
;
final int VALUE;
+
/**
* Private constructor
*/
- PredefinedWindows (int value) {
+ PredefinedWindows(int value) {
this.VALUE = value;
}
@@ -46,7 +48,7 @@ public enum PredefinedWindows {
return null;
}
- public int getValue(){
+ public int getValue() {
return VALUE;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
index 6b06b9b97..0b0c6790e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,29 +29,30 @@
* 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;
-/**
- * Contains a list of Pre-recorded speech items present on the platform.
- *
- *
- */
-public enum PrerecordedSpeech {
- HELP_JINGLE,
- INITIAL_JINGLE,
- LISTEN_JINGLE,
- POSITIVE_JINGLE,
- NEGATIVE_JINGLE;
- /**
- * Convert String to PrerecordedSpeech
- * @param value String
- * @return PrerecordedSpeech
- */
-
- public static PrerecordedSpeech valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Contains a list of Pre-recorded speech items present on the platform.
+ */
+public enum PrerecordedSpeech {
+ HELP_JINGLE,
+ INITIAL_JINGLE,
+ LISTEN_JINGLE,
+ POSITIVE_JINGLE,
+ NEGATIVE_JINGLE;
+
+ /**
+ * Convert String to PrerecordedSpeech
+ *
+ * @param value String
+ * @return PrerecordedSpeech
+ */
+
+ public static PrerecordedSpeech valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrimaryAudioSource.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrimaryAudioSource.java
index 36d3d4c9a..509a0a65c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrimaryAudioSource.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PrimaryAudioSource.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.rpc.enums;
/**
* Reflects the current primary audio source of SDL (if selected).
+ *
* @since SmartDeviceLink 2.0
*/
public enum PrimaryAudioSource {
@@ -76,14 +77,15 @@ public enum PrimaryAudioSource {
/**
* Convert String to PrimaryAudioSource
+ *
* @param value String
* @return PrimaryAudioSource
*/
public static PrimaryAudioSource valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java
index e7724e8ce..e9d641db1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,9 +38,9 @@ public enum RadioBand {
;
public static RadioBand valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java
index 0408f6061..159abceec 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,7 +32,7 @@
package com.smartdevicelink.proxy.rpc.enums;
/**
- * List possible states of a remote control radio module.
+ * List possible states of a remote control radio module.
*/
public enum RadioState {
ACQUIRING,
@@ -42,9 +42,9 @@ public enum RadioState {
;
public static RadioState valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
index 4ad9438e9..88a50d776 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
@@ -1,101 +1,100 @@
-/*
- * 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;
+
/**
* Enumeration listing possible asynchronous requests.
- *
- *
*/
public enum RequestType {
- HTTP,
- FILE_RESUME,
- AUTH_REQUEST,
- AUTH_CHALLENGE,
- AUTH_ACK,
- PROPRIETARY,
- /**
+ HTTP,
+ FILE_RESUME,
+ AUTH_REQUEST,
+ AUTH_CHALLENGE,
+ AUTH_ACK,
+ PROPRIETARY,
+ /**
* @since SmartDeviceLink 4.0
*/
- QUERY_APPS,
- /**
+ QUERY_APPS,
+ /**
* @since SmartDeviceLink 4.0
*/
LAUNCH_APP,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
LOCK_SCREEN_ICON_URL,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
TRAFFIC_MESSAGE_CHANNEL,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
DRIVER_PROFILE,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
- VOICE_SEARCH,
- /**
+ VOICE_SEARCH,
+ /**
* @since SmartDeviceLink 4.0
*/
NAVIGATION,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
PHONE,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
CLIMATE,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
SETTINGS,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
VEHICLE_DIAGNOSTICS,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
EMERGENCY,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
MEDIA,
- /**
+ /**
* @since SmartDeviceLink 4.0
*/
FOTA,
@@ -107,16 +106,18 @@ public enum RequestType {
* @since SmartDeviceLink 5.1
*/
ICON_URL,
- ;
- /**
+ ;
+
+ /**
* Convert String to RequestType
+ *
* @param value String
* @return RequestType
- */
+ */
public static RequestType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
index 512cee9d2..fb255b996 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -34,120 +34,119 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Defines the possible result codes returned by SDL to the application in a
* Response to a requested operation
- *
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum Result {
- /**
- * The request succeeded
- */
- SUCCESS,
- /**
- * <p>The data sent is invalid. For example:</p>
- * <ul>
- * <li>Invalid Json syntax</li>
- * <li>Parameters out of bounds (number or enum range)</li>
- * <li>Mandatory parameters not provided</li>
- * <li>Parameter provided with wrong type</li>
- * <li>Invalid characters</li>
- * <li>Empty string</li>
- * </ul>
- */
- INVALID_DATA,
- /**
- * The request is not supported by SDL
- */
- UNSUPPORTED_REQUEST,
- /**
- * The system could not process the request because the necessary memory
- * couldn't be allocated
- */
- OUT_OF_MEMORY,
- /**
- * There are too many requests pending (means that the response has not been
- * delivered yet). There is a limit of 1000 pending requests at a time
- */
- TOO_MANY_PENDING_REQUESTS,
- CHAR_LIMIT_EXCEEDED,
- /**
- * <p>One of the provided IDs is not valid. For example:</p>
- * <ul>
- * <li>CorrelationID</li>
- * <li>CommandID</li>
- * <li>MenuID</li>
- * </ul>
- */
- INVALID_ID,
- /**
- * The provided name or synonym is a duplicate of some already-defined name
- * or synonym
- */
+ /**
+ * The request succeeded
+ */
+ SUCCESS,
+ /**
+ * <p>The data sent is invalid. For example:</p>
+ * <ul>
+ * <li>Invalid Json syntax</li>
+ * <li>Parameters out of bounds (number or enum range)</li>
+ * <li>Mandatory parameters not provided</li>
+ * <li>Parameter provided with wrong type</li>
+ * <li>Invalid characters</li>
+ * <li>Empty string</li>
+ * </ul>
+ */
+ INVALID_DATA,
+ /**
+ * The request is not supported by SDL
+ */
+ UNSUPPORTED_REQUEST,
+ /**
+ * The system could not process the request because the necessary memory
+ * couldn't be allocated
+ */
+ OUT_OF_MEMORY,
+ /**
+ * There are too many requests pending (means that the response has not been
+ * delivered yet). There is a limit of 1000 pending requests at a time
+ */
+ TOO_MANY_PENDING_REQUESTS,
+ CHAR_LIMIT_EXCEEDED,
+ /**
+ * <p>One of the provided IDs is not valid. For example:</p>
+ * <ul>
+ * <li>CorrelationID</li>
+ * <li>CommandID</li>
+ * <li>MenuID</li>
+ * </ul>
+ */
+ INVALID_ID,
+ /**
+ * The provided name or synonym is a duplicate of some already-defined name
+ * or synonym
+ */
DUPLICATE_NAME,
- /**
- * Specified application name is already associated with an active interface
- * registration. Attempts at doing a second <i>
- * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i> on a
- * given protocol session will also cause this
- */
+ /**
+ * Specified application name is already associated with an active interface
+ * registration. Attempts at doing a second <i>
+ * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i> on a
+ * given protocol session will also cause this
+ */
TOO_MANY_APPLICATIONS,
- /**
- * SDL does not support the interface version requested by the mobile
- * application
- */
+ /**
+ * SDL does not support the interface version requested by the mobile
+ * application
+ */
APPLICATION_REGISTERED_ALREADY,
- /**
- * The requested language is currently not supported. Might be because of a
- * mismatch of the currently active language
- */
+ /**
+ * The requested language is currently not supported. Might be because of a
+ * mismatch of the currently active language
+ */
UNSUPPORTED_VERSION,
- /**
- * The request cannot be executed because no application interface has been
- * registered via <i>
- * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i>
- */
- WRONG_LANGUAGE,
- /**
- * The request cannot be executed because no application interface has been
- * registered via <i>
- * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i>
- */
- APPLICATION_NOT_REGISTERED,
- /**
- * The data may not be changed, because it is currently in use. For example,
- * when trying to delete a Choice Set that is currently involved in an
- * interaction
- */
- IN_USE,
- /**
- *The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.
- */
+ /**
+ * The request cannot be executed because no application interface has been
+ * registered via <i>
+ * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i>
+ */
+ WRONG_LANGUAGE,
+ /**
+ * The request cannot be executed because no application interface has been
+ * registered via <i>
+ * {@linkplain com.smartdevicelink.proxy.rpc.RegisterAppInterface}</i>
+ */
+ APPLICATION_NOT_REGISTERED,
+ /**
+ * The data may not be changed, because it is currently in use. For example,
+ * when trying to delete a Choice Set that is currently involved in an
+ * interaction
+ */
+ IN_USE,
+ /**
+ * The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.
+ */
VEHICLE_DATA_NOT_ALLOWED,
/**
* The requested vehicle data is not available on this vehicle or is not published.
*/
- VEHICLE_DATA_NOT_AVAILABLE,
- /**
- * The requested operation was rejected. No attempt was made to perform the
- * operation
- */
- REJECTED,
- /**
- * The requested operation was aborted due to some pre-empting event (e.g.
- * button push, <i>{@linkplain com.smartdevicelink.proxy.rpc.Alert}</i>
- * pre-empts <i>{@linkplain com.smartdevicelink.proxy.rpc.Speak}</i>, etc.)
- */
- ABORTED,
- /**
- * The requested operation was ignored because it was determined to be
- * redundant (e.g. pause media clock when already paused)
- */
- IGNORED,
- /**
- * A button that was requested for subscription is not supported on the
- * currently connected SDL platform. See DisplayCapabilities for further
- * information on supported buttons on the currently connected SDL platform
- */
+ VEHICLE_DATA_NOT_AVAILABLE,
+ /**
+ * The requested operation was rejected. No attempt was made to perform the
+ * operation
+ */
+ REJECTED,
+ /**
+ * The requested operation was aborted due to some pre-empting event (e.g.
+ * button push, <i>{@linkplain com.smartdevicelink.proxy.rpc.Alert}</i>
+ * pre-empts <i>{@linkplain com.smartdevicelink.proxy.rpc.Speak}</i>, etc.)
+ */
+ ABORTED,
+ /**
+ * The requested operation was ignored because it was determined to be
+ * redundant (e.g. pause media clock when already paused)
+ */
+ IGNORED,
+ /**
+ * A button that was requested for subscription is not supported on the
+ * currently connected SDL platform. See DisplayCapabilities for further
+ * information on supported buttons on the currently connected SDL platform
+ */
UNSUPPORTED_RESOURCE,
/**
* A specified file could not be found on Sync.
@@ -201,34 +200,36 @@ public enum Result {
* The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.
*/
RESUME_FAILED,
- /**
- * The requested data is not available on this vehicle or is not published for the connected app.
- */
- DATA_NOT_AVAILABLE,
- /**
- * The requested data is read only thus cannot be change via remote control
- */
- READ_ONLY,
- /**
- * The data sent failed to pass CRC check in receiver end
- */
- CORRUPTED_DATA,
- /**
- * The data sent needs to be encrypted
- */
- ENCRYPTION_NEEDED,
+ /**
+ * The requested data is not available on this vehicle or is not published for the connected app.
+ */
+ DATA_NOT_AVAILABLE,
+ /**
+ * The requested data is read only thus cannot be change via remote control
+ */
+ READ_ONLY,
+ /**
+ * The data sent failed to pass CRC check in receiver end
+ */
+ CORRUPTED_DATA,
+ /**
+ * The data sent needs to be encrypted
+ */
+ ENCRYPTION_NEEDED,
- ;
- /**
+ ;
+
+ /**
* Convert String to Result
+ *
* @param value String
* @return Result
*/
public static Result valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
index 10ab40020..82886751d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
@@ -1,85 +1,86 @@
-/*
- * 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;
import java.util.EnumSet;
/**
* Describes different sampling rates for PerformAudioPassThru
+ *
* @since SmartDeviceLink 2.0
*/
public enum SamplingRate {
- /**
- * Sampling rate of 8 kHz
- *
- * @since SmartDeviceLink 2.0
- */
- _8KHZ("8KHZ"),
- /**
- * Sampling rate of 16 kHz
- *
- * @since SmartDeviceLink 2.0
- */
- _16KHZ("16KHZ"),
- /**
- * Sampling rate of 22 kHz
- *
- * @since SmartDeviceLink 2.0
- */
- _22KHZ("22KHZ"),
- /**
- * Sampling rate of 44 kHz
- *
- * @since SmartDeviceLink 2.0
- */
- _44KHZ("44KHZ");
+ /**
+ * Sampling rate of 8 kHz
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _8KHZ("8KHZ"),
+ /**
+ * Sampling rate of 16 kHz
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _16KHZ("16KHZ"),
+ /**
+ * Sampling rate of 22 kHz
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _22KHZ("22KHZ"),
+ /**
+ * Sampling rate of 44 kHz
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ _44KHZ("44KHZ");
+
+ private final String VALUE;
- private final String VALUE;
-
private SamplingRate(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
public static SamplingRate valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- for (SamplingRate anEnum : EnumSet.allOf(SamplingRate.class)) {
+
+ for (SamplingRate anEnum : EnumSet.allOf(SamplingRate.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
index 7513d56af..f910e1db0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,7 +32,7 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum SdlDisconnectedReason {
- USER_EXIT,
+ USER_EXIT,
IGNITION_OFF,
BLUETOOTH_OFF,
USB_DISCONNECTED,
@@ -43,7 +43,7 @@ public enum SdlDisconnectedReason {
MASTER_RESET,
FACTORY_DEFAULTS,
TRANSPORT_ERROR,
- RESOURCE_CONSTRAINT,
+ RESOURCE_CONSTRAINT,
APPLICATION_REQUESTED_DISCONNECT,
DEFAULT,
TRANSPORT_DISCONNECT,
@@ -58,65 +58,65 @@ public enum SdlDisconnectedReason {
*/
LEGACY_BLUETOOTH_MODE_ENABLED,
RPC_SESSION_ENDED,
- PRIMARY_TRANSPORT_CYCLE_REQUEST,
- MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED,
- MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED,
+ PRIMARY_TRANSPORT_CYCLE_REQUEST,
+ MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED,
+ MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED,
;
-
- public static SdlDisconnectedReason valueForString(String value) {
- try{
+
+ public static SdlDisconnectedReason valueForString(String value) {
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
-
- public static SdlDisconnectedReason convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason reason) {
- if(reason == null){
- return null;
- }
-
- SdlDisconnectedReason returnReason = SdlDisconnectedReason.DEFAULT;
-
- switch(reason) {
- case USER_EXIT:
- returnReason = SdlDisconnectedReason.USER_EXIT;
- break;
- case IGNITION_OFF:
- returnReason = SdlDisconnectedReason.IGNITION_OFF;
- break;
- case BLUETOOTH_OFF:
- returnReason = SdlDisconnectedReason.BLUETOOTH_OFF;
- break;
- case USB_DISCONNECTED:
- returnReason = SdlDisconnectedReason.USB_DISCONNECTED;
- break;
- case REQUEST_WHILE_IN_NONE_HMI_LEVEL:
- returnReason = SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL;
- break;
- case TOO_MANY_REQUESTS:
- returnReason = SdlDisconnectedReason.TOO_MANY_REQUESTS;
- break;
- case DRIVER_DISTRACTION_VIOLATION:
- returnReason = SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION;
- break;
- case LANGUAGE_CHANGE:
- returnReason = SdlDisconnectedReason.LANGUAGE_CHANGE;
- break;
- case MASTER_RESET:
- returnReason = SdlDisconnectedReason.MASTER_RESET;
- break;
- case FACTORY_DEFAULTS:
- returnReason = SdlDisconnectedReason.FACTORY_DEFAULTS;
- break;
- case RESOURCE_CONSTRAINT:
- returnReason = SdlDisconnectedReason.RESOURCE_CONSTRAINT;
- break;
+
+ public static SdlDisconnectedReason convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason reason) {
+ if (reason == null) {
+ return null;
+ }
+
+ SdlDisconnectedReason returnReason = SdlDisconnectedReason.DEFAULT;
+
+ switch (reason) {
+ case USER_EXIT:
+ returnReason = SdlDisconnectedReason.USER_EXIT;
+ break;
+ case IGNITION_OFF:
+ returnReason = SdlDisconnectedReason.IGNITION_OFF;
+ break;
+ case BLUETOOTH_OFF:
+ returnReason = SdlDisconnectedReason.BLUETOOTH_OFF;
+ break;
+ case USB_DISCONNECTED:
+ returnReason = SdlDisconnectedReason.USB_DISCONNECTED;
+ break;
+ case REQUEST_WHILE_IN_NONE_HMI_LEVEL:
+ returnReason = SdlDisconnectedReason.REQUEST_WHILE_IN_NONE_HMI_LEVEL;
+ break;
+ case TOO_MANY_REQUESTS:
+ returnReason = SdlDisconnectedReason.TOO_MANY_REQUESTS;
+ break;
+ case DRIVER_DISTRACTION_VIOLATION:
+ returnReason = SdlDisconnectedReason.DRIVER_DISTRACTION_VIOLATION;
+ break;
+ case LANGUAGE_CHANGE:
+ returnReason = SdlDisconnectedReason.LANGUAGE_CHANGE;
+ break;
+ case MASTER_RESET:
+ returnReason = SdlDisconnectedReason.MASTER_RESET;
+ break;
+ case FACTORY_DEFAULTS:
+ returnReason = SdlDisconnectedReason.FACTORY_DEFAULTS;
+ break;
+ case RESOURCE_CONSTRAINT:
+ returnReason = SdlDisconnectedReason.RESOURCE_CONSTRAINT;
+ break;
default:
break;
- }
-
- return returnReason;
- }
+ }
+
+ return returnReason;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlInterfaceAvailability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlInterfaceAvailability.java
index 18c342f64..3cbfe6905 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlInterfaceAvailability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlInterfaceAvailability.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,6 +32,6 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum SdlInterfaceAvailability {
- SDL_INTERFACE_AVAILABLE,
- SDL_INTERFACE_UNAVAILABLE
+ SDL_INTERFACE_AVAILABLE,
+ SDL_INTERFACE_UNAVAILABLE
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SeatMemoryActionType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SeatMemoryActionType.java
index ef368743d..d0e43a5f8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SeatMemoryActionType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SeatMemoryActionType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,25 +32,25 @@
package com.smartdevicelink.proxy.rpc.enums;
public enum SeatMemoryActionType {
- /**
- * Save current seat positions and settings to seat memory.
- */
- SAVE,
- /**
- * Restore / apply the seat memory settings to the current seat.
- */
- RESTORE,
- /**
- * No action to be performed.
- */
- NONE,
- ;
+ /**
+ * Save current seat positions and settings to seat memory.
+ */
+ SAVE,
+ /**
+ * Restore / apply the seat memory settings to the current seat.
+ */
+ RESTORE,
+ /**
+ * No action to be performed.
+ */
+ NONE,
+ ;
- public static SeatMemoryActionType valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static SeatMemoryActionType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java
index bb003284b..996ef4de7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ServiceUpdateReason.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,45 +36,46 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum ServiceUpdateReason {
- /**
- * The service has just been published with the module and once
- * activated to the primary service of its type, it will be ready for possible consumption.
- */
- PUBLISHED,
+ /**
+ * The service has just been published with the module and once
+ * activated to the primary service of its type, it will be ready for possible consumption.
+ */
+ PUBLISHED,
- /**
- * The service has just been unpublished with the module and is no longer accessible
- */
- REMOVED,
+ /**
+ * The service has just been unpublished with the module and is no longer accessible
+ */
+ REMOVED,
- /**
- * The service is activated as the primary service of this type. All requests dealing with
- * this service type will be handled by this service.
- */
- ACTIVATED,
+ /**
+ * The service is activated as the primary service of this type. All requests dealing with
+ * this service type will be handled by this service.
+ */
+ ACTIVATED,
- /**
- * The service has been deactivated as the primary service of its type
- */
- DEACTIVATED,
+ /**
+ * The service has been deactivated as the primary service of its type
+ */
+ DEACTIVATED,
- /**
- * The service has updated its manifest. This could imply updated capabilities
- */
- MANIFEST_UPDATE,
+ /**
+ * The service has updated its manifest. This could imply updated capabilities
+ */
+ MANIFEST_UPDATE,
- ;
+ ;
- /**
- * Convert String to ServiceUpdateReason
- * @param value String
- * @return ServiceUpdateReason
- */
- public static ServiceUpdateReason valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ /**
+ * Convert String to ServiceUpdateReason
+ *
+ * @param value String
+ * @return ServiceUpdateReason
+ */
+ public static ServiceUpdateReason valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
index f11025445..eafceb56e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
@@ -1,73 +1,75 @@
-/*
- * 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;
import java.util.EnumSet;
-/** The enumeration defines the types of the soft buttons to be displayed on UI component:<p>The text is displayed on the soft button</p>
- *<p>The image is displayed on the soft button</p>
- *<p>Both image and text are displayed on the soft button.</p>
- *
+
+/**
+ * The enumeration defines the types of the soft buttons to be displayed on UI component:<p>The text is displayed on the soft button</p>
+ * <p>The image is displayed on the soft button</p>
+ * <p>Both image and text are displayed on the soft button.</p>
+ *
* @since SmartDeviceLink 2.0
*/
public enum SoftButtonType {
- /** Text displayed
- *
- */
- SBT_TEXT("TEXT"),
- /** Image displayed
- *
- */
- SBT_IMAGE("IMAGE"),
- /** Image displayed
- *
- */
- SBT_BOTH("BOTH");
+ /**
+ * Text displayed
+ */
+ SBT_TEXT("TEXT"),
+ /**
+ * Image displayed
+ */
+ SBT_IMAGE("IMAGE"),
+ /**
+ * Image displayed
+ */
+ SBT_BOTH("BOTH");
+
+ private final String VALUE;
- private final String VALUE;
-
private SoftButtonType(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
public static SoftButtonType valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- for (SoftButtonType anEnum : EnumSet.allOf(SoftButtonType.class)) {
+
+ for (SoftButtonType anEnum : EnumSet.allOf(SoftButtonType.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
index 83dbbec8f..e91333a6e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
@@ -1,60 +1,61 @@
-/*
- * 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;
+
/**
* Contains information about TTS capabilities on the SDL platform.
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum SpeechCapabilities {
- /**
- * The SDL platform can speak text phrases.
- *
- * @since SmartDeviceLink 1.0
- */
+ /**
+ * The SDL platform can speak text phrases.
+ *
+ * @since SmartDeviceLink 1.0
+ */
TEXT,
/**
* The SDL platform can interpret and speak LHPLUS phonemes
*/
SAPI_PHONEMES,
-
+
/**
* The SDL platform can interpret and speak LHPLUS phonemes
*/
LHPLUS_PHONEMES,
/**
- * The SDL platform can play pre-recorded sounds as part of a TTS operation.<p>(e.g. Speak, Alert, PerformInteraction, etc.).</p>
+ * The SDL platform can play pre-recorded sounds as part of a TTS operation.<p>(e.g. Speak, Alert, PerformInteraction, etc.).</p>
*/
PRE_RECORDED,
/**
@@ -67,16 +68,18 @@ public enum SpeechCapabilities {
* The SDL platform can play audio files in conjunction with/without TTS text.
*/
FILE;
+
/**
* Convert String to SpeechCapabilities
- * @param value String
- * @return SpeechCapabilities
- */
+ *
+ * @param value String
+ * @return SpeechCapabilities
+ */
public static SpeechCapabilities valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
index e3cbc7226..7b136c11f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,910 +36,911 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum StaticIconName {
- /**
- * Icon Name accept call / active phone call in progress / initiate a phone call
- */
- ACCEPT_CALL("0x29"),
-
- /**
- * Icon Name add waypoint
- */
- ADD_WAYPOINT("0x1B"),
-
- /**
- * Icon Name album
- */
- ALBUM("0x21"),
-
- /**
- * Icon Name ambient lighting
- */
- AMBIENT_LIGHTING("0x3d"),
-
- /**
- * Icon Name arrow - north
- */
- ARROW_NORTH("0x40"),
-
- /**
- * Icon Name audio mute
- */
- AUDIO_MUTE("0x12"),
-
- /**
- * Icon Name audiobook episode
- */
- AUDIOBOOK_EPISODE("0x83"),
-
- /**
- * Icon Name audiobook narrator
- */
- AUDIOBOOK_NARRATOR("0x82"),
-
- /**
- * Icon Name auxillary audio
- */
- AUXILLARY_AUDIO("0x45"),
-
- /**
- * Icon Name back / return
- */
- BACK("0x86"),
-
- /**
- * Icon Name battery capacity 0 of 5
- */
- BATTERY_CAPACITY_0_OF_5("0xF7"),
-
- /**
- * Icon Name battery capacity 1 of 5
- */
- BATTERY_CAPACITY_1_OF_5("0xF8"),
-
- /**
- * Icon Name battery capacity 2 of 5
- */
- BATTERY_CAPACITY_2_OF_5("0xF9"),
-
- /**
- * Icon Name battery capacity 3 of 5
- */
- BATTERY_CAPACITY_3_OF_5("0xFA"),
-
- /**
- * Icon Name battery capacity 4 of 5
- */
- BATTERY_CAPACITY_4_OF_5("0xf6"),
-
- /**
- * Icon Name battery capacity 5 of 5
- */
- BATTERY_CAPACITY_5_OF_5("0xFB"),
-
- /**
- * Icon Name bluetooth audio source
- */
- BLUETOOTH_AUDIO_SOURCE("0x09"),
-
- /**
- * Icon Name bluetooth1
- */
- BLUETOOTH1("0xcc"),
-
- /**
- * Icon Name bluetooth2
- */
- BLUETOOTH2("0xCD"),
-
- /**
- * Icon Name browse
- */
- BROWSE("0x77"),
-
- /**
- * Icon Name cell phone in roaming mode
- */
- CELL_PHONE_IN_ROAMING_MODE("0x66"),
-
- /**
- * Icon Name cell service signal strength 0 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS("0x67"),
-
- /**
- * Icon Name cell service signal strength 1 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS("0x68"),
-
- /**
- * Icon Name cell service signal strength 2 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS("0x69"),
-
- /**
- * Icon Name cell service signal strength 3 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS("0x6A"),
-
- /**
- * Icon Name cell service signal strength 4 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS("0x6B"),
-
- /**
- * Icon Name cell service signal strength 5 of 5 bars
- */
- CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS("0xd3"),
-
- /**
- * Icon Name change lane left
- */
- CHANGE_LANE_LEFT("0xc3"),
-
- /**
- * Icon Name change lane right
- */
- CHANGE_LANE_RIGHT("0xc1"),
-
- /**
- * Icon Name check box checked
- */
- CHECK_BOX_CHECKED("0x27"),
-
- /**
- * Icon Name check box unchecked
- */
- CHECK_BOX_UNCHECKED("0x28"),
-
- /**
- * Icon Name climate
- */
- CLIMATE("0xd1"),
-
- /**
- * Icon Name clock
- */
- CLOCK("0xfc"),
-
- /**
- * Icon Name compose (e.g. message)
- */
- COMPOSE("0x1A"),
-
- /**
- * Icon Name contact / person
- */
- CONTACT("0x5C"),
-
- /**
- * Icon Name continue
- */
- CONTINUE("0x42"),
-
- /**
- * Icon Name dash / bullet point
- */
- DASH("0x7F"),
-
- /**
- * Icon Name date / calendar
- */
- DATE("0x87"),
-
- /**
- * Icon Name delete/remove - trash
- */
- DELETE("0x0F"),
-
- /**
- * Icon Name destination
- */
- DESTINATION("0x94"),
-
- /**
- * Icon Name destination ferry ahead
- */
- DESTINATION_FERRY_AHEAD("0x4D"),
-
- /**
- * Icon Name ebookmark (e.g. message, feed)
- */
- EBOOKMARK("0x2B"),
-
- /**
- * Icon Name end call / reject call
- */
- END_CALL("0x2C"),
-
- /**
- * Icon Name fail / X
- */
- FAIL("0xD6"),
-
- /**
- * Icon Name fast forward 30 secs
- */
- FAST_FORWARD_30_SECS("0x08"),
-
- /**
- * Icon Name favorite / heart
- */
- FAVORITE_HEART("0x0E"),
-
- /**
- * Icon Name favorite / star
- */
- FAVORITE_STAR("0x95"),
-
- /**
- * Icon Name fax number
- */
- FAX_NUMBER("0x80"),
-
- /**
- * Icon Name filename
- */
- FILENAME("0x50"),
-
- /**
- * Icon Name filter / search
- */
- FILTER("0x79"),
-
- /**
- * Icon Name folder
- */
- FOLDER("0x1C"),
-
- /**
- * Icon Name fuel prices
- */
- FUEL_PRICES("0xe9"),
-
- /**
- * Icon Name full map
- */
- FULL_MAP("0x0c"),
-
- /**
- * Icon Name generic phone number
- */
- GENERIC_PHONE_NUMBER("0x53"),
-
- /**
- * Icon Name genre
- */
- GENRE("0x4E"),
-
- /**
- * Icon Name global keyboard
- */
- GLOBAL_KEYBOARD("0xea"),
-
- /**
- * Icon Name highway exit information
- */
- HIGHWAY_EXIT_INFORMATION("0xf4"),
-
- /**
- * Icon Name home phone number
- */
- HOME_PHONE_NUMBER("0x55"),
-
- /**
- * Icon Name hyperlink
- */
- HYPERLINK("0x78"),
-
- /**
- * Icon Name ID3 tag unknown
- */
- ID3_TAG_UNKNOWN("0x51"),
-
- /**
- * Icon Name incoming calls (in list of phone calls)
- */
- INCOMING_CALLS("0x57"),
-
- /**
- * Icon Name information
- */
- INFORMATION("0x5d"),
-
- /**
- * Icon Name IPOD media source
- */
- IPOD_MEDIA_SOURCE("0x0D"),
-
- /**
- * Icon Name join calls
- */
- JOIN_CALLS("0x02"),
-
- /**
- * Icon Name keep left
- */
- KEEP_LEFT("0x46"),
-
- /**
- * Icon Name keep right
- */
- KEEP_RIGHT("0x48"),
-
- /**
- * Icon Name key / keycode
- */
- KEY("0x7D"),
-
- /**
- * Icon Name left
- */
- LEFT("0x9f"),
-
- /**
- * Icon Name left arrow / back
- */
- LEFT_ARROW("0x4B"),
-
- /**
- * Icon Name left exit
- */
- LEFT_EXIT("0xaf"),
-
- /**
- * Icon Name LINE IN audio source
- */
- LINE_IN_AUDIO_SOURCE("0x06"),
-
- /**
- * Icon Name locked
- */
- LOCKED("0x22"),
-
- /**
- * Icon Name media control - left arrow
- */
- MEDIA_CONTROL_LEFT_ARROW("0x17"),
-
- /**
- * Icon Name media control - recording
- */
- MEDIA_CONTROL_RECORDING("0x20"),
-
- /**
- * Icon Name media control - right arrow
- */
- MEDIA_CONTROL_RIGHT_ARROW("0x15"),
-
- /**
- * Icon Name media control - stop (e.g. streaming)
- */
- MEDIA_CONTROL_STOP("0x16"),
-
- /**
- * Icon Name microphone
- */
- MICROPHONE("0xe8"),
-
- /**
- * Icon Name missed calls (in list of phone calls)
- */
- MISSED_CALLS("0x58"),
-
- /**
- * Icon Name mobile phone number
- */
- MOBILE_PHONE_NUMBER("0x54"),
-
- /**
- * Icon Name move down / download
- */
- MOVE_DOWN("0xE5"),
-
- /**
- * Icon Name move up
- */
- MOVE_UP("0xe4"),
-
- /**
- * Icon Name MP3 tag artist
- */
- MP3_TAG_ARTIST("0x24"),
-
- /**
- * Icon Name navigation / navigation settings
- */
- NAVIGATION("0x8e"),
-
- /**
- * Icon Name navigation current direction
- */
- NAVIGATION_CURRENT_DIRECTION("0x0a"),
-
- /**
- * Icon Name negative rating - thumbs down
- */
- NEGATIVE_RATING_THUMBS_DOWN("0x14"),
-
- /**
- * Icon Name new/unread text message/email
- */
- NEW("0x5E"),
-
- /**
- * Icon Name office phone number / work phone number
- */
- OFFICE_PHONE_NUMBER("0x56"),
-
- /**
- * Icon Name opened/read text message/email
- */
- OPENED("0x5F"),
-
- /**
- * Icon Name origin / nearby locale / current position
- */
- ORIGIN("0x96"),
-
- /**
- * Icon Name outgoing calls (in list of phone calls)
- */
- OUTGOING_CALLS("0x59"),
-
- /**
- * Icon Name phone call 1
- */
- PHONE_CALL_1("0x1D"),
-
- /**
- * Icon Name phone call 2
- */
- PHONE_CALL_2("0x1E"),
-
- /**
- * Icon Name phone device
- */
- PHONE_DEVICE("0x03"),
-
- /**
- * Icon Name phonebook
- */
- PHONEBOOK("0x81"),
-
- /**
- * Icon Name photo / picture
- */
- PHOTO("0x88"),
-
- /**
- * Icon Name play / pause - pause active
- */
- PLAY("0xD0"),
-
- /**
- * Icon Name playlist
- */
- PLAYLIST("0x4F"),
-
- /**
- * Icon Name pop-up
- */
- POPUP("0x76"),
-
- /**
- * Icon Name positive rating - thumbs up
- */
- POSITIVE_RATING_THUMBS_UP("0x13"),
-
- /**
- * Icon Name power
- */
- POWER("0x5b"),
-
- /**
- * Icon Name primary phone (favorite)
- */
- PRIMARY_PHONE("0x1F"),
-
- /**
- * Icon Name radio button checked
- */
- RADIO_BUTTON_CHECKED("0x25"),
-
- /**
- * Icon Name radio button unchecked
- */
- RADIO_BUTTON_UNCHECKED("0x26"),
-
- /**
- * Icon Name recent calls / history
- */
- RECENT_CALLS("0xe7"),
-
- /**
- * Icon Name recent destinations
- */
- RECENT_DESTINATIONS("0xf2"),
-
- /**
- * Icon Name redo
- */
- REDO("0x19"),
-
- /**
- * Icon Name refresh
- */
- REFRESH("0x97"),
-
- /**
- * Icon Name remote diagnostics - check engine
- */
- REMOTE_DIAGNOSTICS_CHECK_ENGINE("0x7E"),
-
- /**
- * Icon Name rendered 911 assist / emergency assistance
- */
- RENDERED_911_ASSIST("0xac"),
-
- /**
- * Icon Name repeat
- */
- REPEAT("0xe6"),
-
- /**
- * Icon Name repeat play
- */
- REPEAT_PLAY("0x73"),
-
- /**
- * Icon Name reply
- */
- REPLY("0x04"),
-
- /**
- * Icon Name rewind 30 secs
- */
- REWIND_30_SECS("0x07"),
-
- /**
- * Icon Name right
- */
- RIGHT("0xa3"),
-
- /**
- * Icon Name right exit
- */
- RIGHT_EXIT("0xb1"),
-
- /**
- * Icon Name ringtones
- */
- RINGTONES("0x5A"),
-
- /**
- * Icon Name roundabout left hand 1
- */
- ROUNDABOUT_LEFT_HAND_1("0xee"),
-
- /**
- * Icon Name roundabout left hand 2
- */
- ROUNDABOUT_LEFT_HAND_2("0x8c"),
-
- /**
- * Icon Name roundabout left hand 3
- */
- ROUNDABOUT_LEFT_HAND_3("0x84"),
-
- /**
- * Icon Name roundabout left hand 4
- */
- ROUNDABOUT_LEFT_HAND_4("0x72"),
-
- /**
- * Icon Name roundabout left hand 5
- */
- ROUNDABOUT_LEFT_HAND_5("0x6e"),
-
- /**
- * Icon Name roundabout left hand 6
- */
- ROUNDABOUT_LEFT_HAND_6("0x64"),
-
- /**
- * Icon Name roundabout left hand 7
- */
- ROUNDABOUT_LEFT_HAND_7("0x60"),
-
- /**
- * Icon Name roundabout right hand 1
- */
- ROUNDABOUT_RIGHT_HAND_1("0x62"),
-
- /**
- * Icon Name roundabout right hand 2
- */
- ROUNDABOUT_RIGHT_HAND_2("0x6c"),
-
- /**
- * Icon Name roundabout right hand 3
- */
- ROUNDABOUT_RIGHT_HAND_3("0x70"),
-
- /**
- * Icon Name roundabout right hand 4
- */
- ROUNDABOUT_RIGHT_HAND_4("0x7a"),
-
- /**
- * Icon Name roundabout right hand 5
- */
- ROUNDABOUT_RIGHT_HAND_5("0x8a"),
-
- /**
- * Icon Name roundabout right hand 6
- */
- ROUNDABOUT_RIGHT_HAND_6("0xec"),
-
- /**
- * Icon Name roundabout right hand 7
- */
- ROUNDABOUT_RIGHT_HAND_7("0xf0"),
-
- /**
- * Icon Name RSS
- */
- RSS("0x89"),
-
- /**
- * Icon Name settings / menu
- */
- SETTINGS("0x49"),
-
- /**
- * Icon Name sharp left
- */
- SHARP_LEFT("0xa5"),
-
- /**
- * Icon Name sharp right
- */
- SHARP_RIGHT("0xa7"),
-
- /**
- * Icon Name show
- */
- SHOW("0xe1"),
-
- /**
- * Icon Name shuffle play
- */
- SHUFFLE_PLAY("0x74"),
-
- /**
- * Icon Name ski places / elevation / altitude
- */
- SKI_PLACES("0xab"),
-
- /**
- * Icon Name slight left
- */
- SLIGHT_LEFT("0x9d"),
-
- /**
- * Icon Name slight right
- */
- SLIGHT_RIGHT("0xa1"),
-
- /**
- * Icon Name smartphone
- */
- SMARTPHONE("0x05"),
-
- /**
- * Icon Name sort list
- */
- SORT_LIST("0x7B"),
-
- /**
- * Icon Name speed dial numbers - number 0
- */
- SPEED_DIAL_NUMBERS_NUMBER_0("0xE0"),
-
- /**
- * Icon Name speed dial numbers - number 1
- */
- SPEED_DIAL_NUMBERS_NUMBER_1("0xD7"),
-
- /**
- * Icon Name speed dial numbers - number 2
- */
- SPEED_DIAL_NUMBERS_NUMBER_2("0xD8"),
-
- /**
- * Icon Name speed dial numbers - number 3
- */
- SPEED_DIAL_NUMBERS_NUMBER_3("0xD9"),
-
- /**
- * Icon Name speed dial numbers - number 4
- */
- SPEED_DIAL_NUMBERS_NUMBER_4("0xDA"),
-
- /**
- * Icon Name speed dial numbers - number 5
- */
- SPEED_DIAL_NUMBERS_NUMBER_5("0xDB"),
-
- /**
- * Icon Name speed dial numbers - number 6
- */
- SPEED_DIAL_NUMBERS_NUMBER_6("0xDC"),
-
- /**
- * Icon Name speed dial numbers - number 7
- */
- SPEED_DIAL_NUMBERS_NUMBER_7("0xDD"),
-
- /**
- * Icon Name speed dial numbers - number 8
- */
- SPEED_DIAL_NUMBERS_NUMBER_8("0xDE"),
-
- /**
- * Icon Name speed dial numbers - number 9
- */
- SPEED_DIAL_NUMBERS_NUMBER_9("0xDF"),
-
- /**
- * Icon Name success / check
- */
- SUCCESS("0xD5"),
-
- /**
- * Icon Name track title / song title
- */
- TRACK_TITLE("0x4C"),
-
- /**
- * Icon Name traffic report
- */
- TRAFFIC_REPORT("0x2A"),
-
- /**
- * Icon Name turn list
- */
- TURN_LIST("0x10"),
-
- /**
- * Icon Name u-turn left traffic
- */
- UTURN_LEFT_TRAFFIC("0xad"),
-
- /**
- * Icon Name u-turn right traffic
- */
- UTURN_RIGHT_TRAFFIC("0xa9"),
-
- /**
- * Icon Name undo
- */
- UNDO("0x18"),
-
- /**
- * Icon Name unlocked
- */
- UNLOCKED("0x23"),
-
- /**
- * Icon Name USB media audio source
- */
- USB_MEDIA_AUDIO_SOURCE("0x0B"),
-
- /**
- * Icon Name voice control scrollbar - list item no. 1
- */
- VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1("0xC7"),
-
- /**
- * Icon Name voice control scrollbar - list item no. 2
- */
- VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2("0xC8"),
-
- /**
- * Icon Name voice control scrollbar - list item no. 3
- */
- VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3("0xC9"),
-
- /**
- * Icon Name voice control scrollbar - list item no. 4
- */
- VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4("0xCA"),
-
- /**
- * Icon Name voice recognition - failed
- */
- VOICE_RECOGNITION_FAILED("0x90"),
-
- /**
- * Icon Name voice recognition - pause
- */
- VOICE_RECOGNITION_PAUSE("0x92"),
-
- /**
- * Icon Name voice recognition - successful
- */
- VOICE_RECOGNITION_SUCCESSFUL("0x8F"),
-
- /**
- * Icon Name voice recognition - system active
- */
- VOICE_RECOGNITION_SYSTEM_ACTIVE("0x11"),
-
- /**
- * Icon Name voice recognition - system listening
- */
- VOICE_RECOGNITION_SYSTEM_LISTENING("0x91"),
-
- /**
- * Icon Name voice recognition - try again
- */
- VOICE_RECOGNITION_TRY_AGAIN("0x93"),
-
- /**
- * Icon Name warning / safety alert
- */
- WARNING("0xfe"),
-
- /**
- * Icon Name weather
- */
- WEATHER("0xeb"),
-
- /**
- * Icon Name wifi full
- */
- WIFI_FULL("0x43"),
-
- /**
- * Icon Name zoom in
- */
- ZOOM_IN("0x98"),
-
- /**
- * Icon Name zoom out
- */
- ZOOM_OUT("0x9a"),
-
- ;
-
- private final String VALUE;
-
- private StaticIconName(String value) {
- this.VALUE = value;
- }
-
- public static StaticIconName valueForString(String value) {
- if(value == null){
- return null;
- }
-
- for (StaticIconName type : StaticIconName.values()) {
- if (type.toString().equals(value)) {
- return type;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the string representation of the hex value associated with this static icon
- * @return string of the hex value representation of this static icon
- */
- @Override
- public String toString() {
- return VALUE;
- }
+ /**
+ * Icon Name accept call / active phone call in progress / initiate a phone call
+ */
+ ACCEPT_CALL("0x29"),
+
+ /**
+ * Icon Name add waypoint
+ */
+ ADD_WAYPOINT("0x1B"),
+
+ /**
+ * Icon Name album
+ */
+ ALBUM("0x21"),
+
+ /**
+ * Icon Name ambient lighting
+ */
+ AMBIENT_LIGHTING("0x3d"),
+
+ /**
+ * Icon Name arrow - north
+ */
+ ARROW_NORTH("0x40"),
+
+ /**
+ * Icon Name audio mute
+ */
+ AUDIO_MUTE("0x12"),
+
+ /**
+ * Icon Name audiobook episode
+ */
+ AUDIOBOOK_EPISODE("0x83"),
+
+ /**
+ * Icon Name audiobook narrator
+ */
+ AUDIOBOOK_NARRATOR("0x82"),
+
+ /**
+ * Icon Name auxillary audio
+ */
+ AUXILLARY_AUDIO("0x45"),
+
+ /**
+ * Icon Name back / return
+ */
+ BACK("0x86"),
+
+ /**
+ * Icon Name battery capacity 0 of 5
+ */
+ BATTERY_CAPACITY_0_OF_5("0xF7"),
+
+ /**
+ * Icon Name battery capacity 1 of 5
+ */
+ BATTERY_CAPACITY_1_OF_5("0xF8"),
+
+ /**
+ * Icon Name battery capacity 2 of 5
+ */
+ BATTERY_CAPACITY_2_OF_5("0xF9"),
+
+ /**
+ * Icon Name battery capacity 3 of 5
+ */
+ BATTERY_CAPACITY_3_OF_5("0xFA"),
+
+ /**
+ * Icon Name battery capacity 4 of 5
+ */
+ BATTERY_CAPACITY_4_OF_5("0xf6"),
+
+ /**
+ * Icon Name battery capacity 5 of 5
+ */
+ BATTERY_CAPACITY_5_OF_5("0xFB"),
+
+ /**
+ * Icon Name bluetooth audio source
+ */
+ BLUETOOTH_AUDIO_SOURCE("0x09"),
+
+ /**
+ * Icon Name bluetooth1
+ */
+ BLUETOOTH1("0xcc"),
+
+ /**
+ * Icon Name bluetooth2
+ */
+ BLUETOOTH2("0xCD"),
+
+ /**
+ * Icon Name browse
+ */
+ BROWSE("0x77"),
+
+ /**
+ * Icon Name cell phone in roaming mode
+ */
+ CELL_PHONE_IN_ROAMING_MODE("0x66"),
+
+ /**
+ * Icon Name cell service signal strength 0 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_0_OF_5_BARS("0x67"),
+
+ /**
+ * Icon Name cell service signal strength 1 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_1_OF_5_BARS("0x68"),
+
+ /**
+ * Icon Name cell service signal strength 2 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_2_OF_5_BARS("0x69"),
+
+ /**
+ * Icon Name cell service signal strength 3 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_3_OF_5_BARS("0x6A"),
+
+ /**
+ * Icon Name cell service signal strength 4 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_4_OF_5_BARS("0x6B"),
+
+ /**
+ * Icon Name cell service signal strength 5 of 5 bars
+ */
+ CELL_SERVICE_SIGNAL_STRENGTH_5_OF_5_BARS("0xd3"),
+
+ /**
+ * Icon Name change lane left
+ */
+ CHANGE_LANE_LEFT("0xc3"),
+
+ /**
+ * Icon Name change lane right
+ */
+ CHANGE_LANE_RIGHT("0xc1"),
+
+ /**
+ * Icon Name check box checked
+ */
+ CHECK_BOX_CHECKED("0x27"),
+
+ /**
+ * Icon Name check box unchecked
+ */
+ CHECK_BOX_UNCHECKED("0x28"),
+
+ /**
+ * Icon Name climate
+ */
+ CLIMATE("0xd1"),
+
+ /**
+ * Icon Name clock
+ */
+ CLOCK("0xfc"),
+
+ /**
+ * Icon Name compose (e.g. message)
+ */
+ COMPOSE("0x1A"),
+
+ /**
+ * Icon Name contact / person
+ */
+ CONTACT("0x5C"),
+
+ /**
+ * Icon Name continue
+ */
+ CONTINUE("0x42"),
+
+ /**
+ * Icon Name dash / bullet point
+ */
+ DASH("0x7F"),
+
+ /**
+ * Icon Name date / calendar
+ */
+ DATE("0x87"),
+
+ /**
+ * Icon Name delete/remove - trash
+ */
+ DELETE("0x0F"),
+
+ /**
+ * Icon Name destination
+ */
+ DESTINATION("0x94"),
+
+ /**
+ * Icon Name destination ferry ahead
+ */
+ DESTINATION_FERRY_AHEAD("0x4D"),
+
+ /**
+ * Icon Name ebookmark (e.g. message, feed)
+ */
+ EBOOKMARK("0x2B"),
+
+ /**
+ * Icon Name end call / reject call
+ */
+ END_CALL("0x2C"),
+
+ /**
+ * Icon Name fail / X
+ */
+ FAIL("0xD6"),
+
+ /**
+ * Icon Name fast forward 30 secs
+ */
+ FAST_FORWARD_30_SECS("0x08"),
+
+ /**
+ * Icon Name favorite / heart
+ */
+ FAVORITE_HEART("0x0E"),
+
+ /**
+ * Icon Name favorite / star
+ */
+ FAVORITE_STAR("0x95"),
+
+ /**
+ * Icon Name fax number
+ */
+ FAX_NUMBER("0x80"),
+
+ /**
+ * Icon Name filename
+ */
+ FILENAME("0x50"),
+
+ /**
+ * Icon Name filter / search
+ */
+ FILTER("0x79"),
+
+ /**
+ * Icon Name folder
+ */
+ FOLDER("0x1C"),
+
+ /**
+ * Icon Name fuel prices
+ */
+ FUEL_PRICES("0xe9"),
+
+ /**
+ * Icon Name full map
+ */
+ FULL_MAP("0x0c"),
+
+ /**
+ * Icon Name generic phone number
+ */
+ GENERIC_PHONE_NUMBER("0x53"),
+
+ /**
+ * Icon Name genre
+ */
+ GENRE("0x4E"),
+
+ /**
+ * Icon Name global keyboard
+ */
+ GLOBAL_KEYBOARD("0xea"),
+
+ /**
+ * Icon Name highway exit information
+ */
+ HIGHWAY_EXIT_INFORMATION("0xf4"),
+
+ /**
+ * Icon Name home phone number
+ */
+ HOME_PHONE_NUMBER("0x55"),
+
+ /**
+ * Icon Name hyperlink
+ */
+ HYPERLINK("0x78"),
+
+ /**
+ * Icon Name ID3 tag unknown
+ */
+ ID3_TAG_UNKNOWN("0x51"),
+
+ /**
+ * Icon Name incoming calls (in list of phone calls)
+ */
+ INCOMING_CALLS("0x57"),
+
+ /**
+ * Icon Name information
+ */
+ INFORMATION("0x5d"),
+
+ /**
+ * Icon Name IPOD media source
+ */
+ IPOD_MEDIA_SOURCE("0x0D"),
+
+ /**
+ * Icon Name join calls
+ */
+ JOIN_CALLS("0x02"),
+
+ /**
+ * Icon Name keep left
+ */
+ KEEP_LEFT("0x46"),
+
+ /**
+ * Icon Name keep right
+ */
+ KEEP_RIGHT("0x48"),
+
+ /**
+ * Icon Name key / keycode
+ */
+ KEY("0x7D"),
+
+ /**
+ * Icon Name left
+ */
+ LEFT("0x9f"),
+
+ /**
+ * Icon Name left arrow / back
+ */
+ LEFT_ARROW("0x4B"),
+
+ /**
+ * Icon Name left exit
+ */
+ LEFT_EXIT("0xaf"),
+
+ /**
+ * Icon Name LINE IN audio source
+ */
+ LINE_IN_AUDIO_SOURCE("0x06"),
+
+ /**
+ * Icon Name locked
+ */
+ LOCKED("0x22"),
+
+ /**
+ * Icon Name media control - left arrow
+ */
+ MEDIA_CONTROL_LEFT_ARROW("0x17"),
+
+ /**
+ * Icon Name media control - recording
+ */
+ MEDIA_CONTROL_RECORDING("0x20"),
+
+ /**
+ * Icon Name media control - right arrow
+ */
+ MEDIA_CONTROL_RIGHT_ARROW("0x15"),
+
+ /**
+ * Icon Name media control - stop (e.g. streaming)
+ */
+ MEDIA_CONTROL_STOP("0x16"),
+
+ /**
+ * Icon Name microphone
+ */
+ MICROPHONE("0xe8"),
+
+ /**
+ * Icon Name missed calls (in list of phone calls)
+ */
+ MISSED_CALLS("0x58"),
+
+ /**
+ * Icon Name mobile phone number
+ */
+ MOBILE_PHONE_NUMBER("0x54"),
+
+ /**
+ * Icon Name move down / download
+ */
+ MOVE_DOWN("0xE5"),
+
+ /**
+ * Icon Name move up
+ */
+ MOVE_UP("0xe4"),
+
+ /**
+ * Icon Name MP3 tag artist
+ */
+ MP3_TAG_ARTIST("0x24"),
+
+ /**
+ * Icon Name navigation / navigation settings
+ */
+ NAVIGATION("0x8e"),
+
+ /**
+ * Icon Name navigation current direction
+ */
+ NAVIGATION_CURRENT_DIRECTION("0x0a"),
+
+ /**
+ * Icon Name negative rating - thumbs down
+ */
+ NEGATIVE_RATING_THUMBS_DOWN("0x14"),
+
+ /**
+ * Icon Name new/unread text message/email
+ */
+ NEW("0x5E"),
+
+ /**
+ * Icon Name office phone number / work phone number
+ */
+ OFFICE_PHONE_NUMBER("0x56"),
+
+ /**
+ * Icon Name opened/read text message/email
+ */
+ OPENED("0x5F"),
+
+ /**
+ * Icon Name origin / nearby locale / current position
+ */
+ ORIGIN("0x96"),
+
+ /**
+ * Icon Name outgoing calls (in list of phone calls)
+ */
+ OUTGOING_CALLS("0x59"),
+
+ /**
+ * Icon Name phone call 1
+ */
+ PHONE_CALL_1("0x1D"),
+
+ /**
+ * Icon Name phone call 2
+ */
+ PHONE_CALL_2("0x1E"),
+
+ /**
+ * Icon Name phone device
+ */
+ PHONE_DEVICE("0x03"),
+
+ /**
+ * Icon Name phonebook
+ */
+ PHONEBOOK("0x81"),
+
+ /**
+ * Icon Name photo / picture
+ */
+ PHOTO("0x88"),
+
+ /**
+ * Icon Name play / pause - pause active
+ */
+ PLAY("0xD0"),
+
+ /**
+ * Icon Name playlist
+ */
+ PLAYLIST("0x4F"),
+
+ /**
+ * Icon Name pop-up
+ */
+ POPUP("0x76"),
+
+ /**
+ * Icon Name positive rating - thumbs up
+ */
+ POSITIVE_RATING_THUMBS_UP("0x13"),
+
+ /**
+ * Icon Name power
+ */
+ POWER("0x5b"),
+
+ /**
+ * Icon Name primary phone (favorite)
+ */
+ PRIMARY_PHONE("0x1F"),
+
+ /**
+ * Icon Name radio button checked
+ */
+ RADIO_BUTTON_CHECKED("0x25"),
+
+ /**
+ * Icon Name radio button unchecked
+ */
+ RADIO_BUTTON_UNCHECKED("0x26"),
+
+ /**
+ * Icon Name recent calls / history
+ */
+ RECENT_CALLS("0xe7"),
+
+ /**
+ * Icon Name recent destinations
+ */
+ RECENT_DESTINATIONS("0xf2"),
+
+ /**
+ * Icon Name redo
+ */
+ REDO("0x19"),
+
+ /**
+ * Icon Name refresh
+ */
+ REFRESH("0x97"),
+
+ /**
+ * Icon Name remote diagnostics - check engine
+ */
+ REMOTE_DIAGNOSTICS_CHECK_ENGINE("0x7E"),
+
+ /**
+ * Icon Name rendered 911 assist / emergency assistance
+ */
+ RENDERED_911_ASSIST("0xac"),
+
+ /**
+ * Icon Name repeat
+ */
+ REPEAT("0xe6"),
+
+ /**
+ * Icon Name repeat play
+ */
+ REPEAT_PLAY("0x73"),
+
+ /**
+ * Icon Name reply
+ */
+ REPLY("0x04"),
+
+ /**
+ * Icon Name rewind 30 secs
+ */
+ REWIND_30_SECS("0x07"),
+
+ /**
+ * Icon Name right
+ */
+ RIGHT("0xa3"),
+
+ /**
+ * Icon Name right exit
+ */
+ RIGHT_EXIT("0xb1"),
+
+ /**
+ * Icon Name ringtones
+ */
+ RINGTONES("0x5A"),
+
+ /**
+ * Icon Name roundabout left hand 1
+ */
+ ROUNDABOUT_LEFT_HAND_1("0xee"),
+
+ /**
+ * Icon Name roundabout left hand 2
+ */
+ ROUNDABOUT_LEFT_HAND_2("0x8c"),
+
+ /**
+ * Icon Name roundabout left hand 3
+ */
+ ROUNDABOUT_LEFT_HAND_3("0x84"),
+
+ /**
+ * Icon Name roundabout left hand 4
+ */
+ ROUNDABOUT_LEFT_HAND_4("0x72"),
+
+ /**
+ * Icon Name roundabout left hand 5
+ */
+ ROUNDABOUT_LEFT_HAND_5("0x6e"),
+
+ /**
+ * Icon Name roundabout left hand 6
+ */
+ ROUNDABOUT_LEFT_HAND_6("0x64"),
+
+ /**
+ * Icon Name roundabout left hand 7
+ */
+ ROUNDABOUT_LEFT_HAND_7("0x60"),
+
+ /**
+ * Icon Name roundabout right hand 1
+ */
+ ROUNDABOUT_RIGHT_HAND_1("0x62"),
+
+ /**
+ * Icon Name roundabout right hand 2
+ */
+ ROUNDABOUT_RIGHT_HAND_2("0x6c"),
+
+ /**
+ * Icon Name roundabout right hand 3
+ */
+ ROUNDABOUT_RIGHT_HAND_3("0x70"),
+
+ /**
+ * Icon Name roundabout right hand 4
+ */
+ ROUNDABOUT_RIGHT_HAND_4("0x7a"),
+
+ /**
+ * Icon Name roundabout right hand 5
+ */
+ ROUNDABOUT_RIGHT_HAND_5("0x8a"),
+
+ /**
+ * Icon Name roundabout right hand 6
+ */
+ ROUNDABOUT_RIGHT_HAND_6("0xec"),
+
+ /**
+ * Icon Name roundabout right hand 7
+ */
+ ROUNDABOUT_RIGHT_HAND_7("0xf0"),
+
+ /**
+ * Icon Name RSS
+ */
+ RSS("0x89"),
+
+ /**
+ * Icon Name settings / menu
+ */
+ SETTINGS("0x49"),
+
+ /**
+ * Icon Name sharp left
+ */
+ SHARP_LEFT("0xa5"),
+
+ /**
+ * Icon Name sharp right
+ */
+ SHARP_RIGHT("0xa7"),
+
+ /**
+ * Icon Name show
+ */
+ SHOW("0xe1"),
+
+ /**
+ * Icon Name shuffle play
+ */
+ SHUFFLE_PLAY("0x74"),
+
+ /**
+ * Icon Name ski places / elevation / altitude
+ */
+ SKI_PLACES("0xab"),
+
+ /**
+ * Icon Name slight left
+ */
+ SLIGHT_LEFT("0x9d"),
+
+ /**
+ * Icon Name slight right
+ */
+ SLIGHT_RIGHT("0xa1"),
+
+ /**
+ * Icon Name smartphone
+ */
+ SMARTPHONE("0x05"),
+
+ /**
+ * Icon Name sort list
+ */
+ SORT_LIST("0x7B"),
+
+ /**
+ * Icon Name speed dial numbers - number 0
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_0("0xE0"),
+
+ /**
+ * Icon Name speed dial numbers - number 1
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_1("0xD7"),
+
+ /**
+ * Icon Name speed dial numbers - number 2
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_2("0xD8"),
+
+ /**
+ * Icon Name speed dial numbers - number 3
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_3("0xD9"),
+
+ /**
+ * Icon Name speed dial numbers - number 4
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_4("0xDA"),
+
+ /**
+ * Icon Name speed dial numbers - number 5
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_5("0xDB"),
+
+ /**
+ * Icon Name speed dial numbers - number 6
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_6("0xDC"),
+
+ /**
+ * Icon Name speed dial numbers - number 7
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_7("0xDD"),
+
+ /**
+ * Icon Name speed dial numbers - number 8
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_8("0xDE"),
+
+ /**
+ * Icon Name speed dial numbers - number 9
+ */
+ SPEED_DIAL_NUMBERS_NUMBER_9("0xDF"),
+
+ /**
+ * Icon Name success / check
+ */
+ SUCCESS("0xD5"),
+
+ /**
+ * Icon Name track title / song title
+ */
+ TRACK_TITLE("0x4C"),
+
+ /**
+ * Icon Name traffic report
+ */
+ TRAFFIC_REPORT("0x2A"),
+
+ /**
+ * Icon Name turn list
+ */
+ TURN_LIST("0x10"),
+
+ /**
+ * Icon Name u-turn left traffic
+ */
+ UTURN_LEFT_TRAFFIC("0xad"),
+
+ /**
+ * Icon Name u-turn right traffic
+ */
+ UTURN_RIGHT_TRAFFIC("0xa9"),
+
+ /**
+ * Icon Name undo
+ */
+ UNDO("0x18"),
+
+ /**
+ * Icon Name unlocked
+ */
+ UNLOCKED("0x23"),
+
+ /**
+ * Icon Name USB media audio source
+ */
+ USB_MEDIA_AUDIO_SOURCE("0x0B"),
+
+ /**
+ * Icon Name voice control scrollbar - list item no. 1
+ */
+ VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_1("0xC7"),
+
+ /**
+ * Icon Name voice control scrollbar - list item no. 2
+ */
+ VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_2("0xC8"),
+
+ /**
+ * Icon Name voice control scrollbar - list item no. 3
+ */
+ VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_3("0xC9"),
+
+ /**
+ * Icon Name voice control scrollbar - list item no. 4
+ */
+ VOICE_CONTROL_SCROLLBAR_LIST_ITEM_NO_4("0xCA"),
+
+ /**
+ * Icon Name voice recognition - failed
+ */
+ VOICE_RECOGNITION_FAILED("0x90"),
+
+ /**
+ * Icon Name voice recognition - pause
+ */
+ VOICE_RECOGNITION_PAUSE("0x92"),
+
+ /**
+ * Icon Name voice recognition - successful
+ */
+ VOICE_RECOGNITION_SUCCESSFUL("0x8F"),
+
+ /**
+ * Icon Name voice recognition - system active
+ */
+ VOICE_RECOGNITION_SYSTEM_ACTIVE("0x11"),
+
+ /**
+ * Icon Name voice recognition - system listening
+ */
+ VOICE_RECOGNITION_SYSTEM_LISTENING("0x91"),
+
+ /**
+ * Icon Name voice recognition - try again
+ */
+ VOICE_RECOGNITION_TRY_AGAIN("0x93"),
+
+ /**
+ * Icon Name warning / safety alert
+ */
+ WARNING("0xfe"),
+
+ /**
+ * Icon Name weather
+ */
+ WEATHER("0xeb"),
+
+ /**
+ * Icon Name wifi full
+ */
+ WIFI_FULL("0x43"),
+
+ /**
+ * Icon Name zoom in
+ */
+ ZOOM_IN("0x98"),
+
+ /**
+ * Icon Name zoom out
+ */
+ ZOOM_OUT("0x9a"),
+
+ ;
+
+ private final String VALUE;
+
+ private StaticIconName(String value) {
+ this.VALUE = value;
+ }
+
+ public static StaticIconName valueForString(String value) {
+ if (value == null) {
+ return null;
+ }
+
+ for (StaticIconName type : StaticIconName.values()) {
+ if (type.toString().equals(value)) {
+ return type;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the string representation of the hex value associated with this static icon
+ *
+ * @return string of the hex value representation of this static icon
+ */
+ @Override
+ public String toString() {
+ return VALUE;
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SupportedSeat.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SupportedSeat.java
index d89420304..ef3358b68 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SupportedSeat.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SupportedSeat.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,15 +36,15 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
@Deprecated
public enum SupportedSeat {
- DRIVER,
- FRONT_PASSENGER,
- ;
+ DRIVER,
+ FRONT_PASSENGER,
+ ;
- public static SupportedSeat valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static SupportedSeat valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemAction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
index 70697e5f6..71f42a705 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
@@ -1,67 +1,70 @@
-/*
- * 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;
-/** Enumeration that describes system actions that can be triggered.
- *
- * @since SmartDeviceLink 2.0
+
+/**
+ * Enumeration that describes system actions that can be triggered.
*
+ * @since SmartDeviceLink 2.0
*/
public enum SystemAction {
- /** Default action occurs. Standard behavior (e.g. SoftButton clears overlay).
- *
- */
+ /**
+ * Default action occurs. Standard behavior (e.g. SoftButton clears overlay).
+ */
+
+ DEFAULT_ACTION,
+ /**
+ * App is brought into HMI_FULL.
+ */
- DEFAULT_ACTION,
- /** App is brought into HMI_FULL.
- *
- */
+ STEAL_FOCUS,
+ /**
+ * Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.
+ */
- STEAL_FOCUS,
- /** Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.
- *
- */
+ KEEP_CONTEXT;
- KEEP_CONTEXT;
- /**
+ /**
* Convert String to SystemAction
+ *
* @param value String
* @return SystemAction
- */
+ */
public static SystemAction valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
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 8b6c9a591..e0ff50265 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
@@ -163,422 +163,419 @@ package com.smartdevicelink.proxy.rpc.enums;
* <td><strong>Since 7.0</strong> Describes capabilities when the driver is distracted</td>
* </tr>
* </table>
- *
*/
public enum SystemCapabilityType {
- /**
- * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>NAVIGATION</td>
- * <td>NavigationCapability</td>
- * <td>Returns Navigation Capabilities</td>
- * <td align=center>Y</td>
- * <td>Call is synchronous <strong>after</strong> initial call</td>
- * </tr>
- * </table>
- */
- NAVIGATION (true),
+ /**
+ * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>NAVIGATION</td>
+ * <td>NavigationCapability</td>
+ * <td>Returns Navigation Capabilities</td>
+ * <td align=center>Y</td>
+ * <td>Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ NAVIGATION(true),
- /**
- * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>PHONE_CALL</td>
- * <td>PhoneCapability</td>
- * <td>Returns Phone Capabilities</td>
- * <td align=center>Y</td>
- * <td>Call is synchronous <strong>after</strong> initial call</td>
- * </tr>
- * </table>
- */
- PHONE_CALL (true),
+ /**
+ * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>PHONE_CALL</td>
+ * <td>PhoneCapability</td>
+ * <td>Returns Phone Capabilities</td>
+ * <td align=center>Y</td>
+ * <td>Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ PHONE_CALL(true),
- /**
- * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>VIDEO_STREAMING</td>
- * <td>VideoStreamingCapability</td>
- * <td>Returns Video Streaming Capabilities</td>
- * <td align=center>Y</td>
- * <td>Call is synchronous <strong>after</strong> initial call</td>
- * </tr>
- * </table>
- */
- VIDEO_STREAMING (true),
+ /**
+ * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>VIDEO_STREAMING</td>
+ * <td>VideoStreamingCapability</td>
+ * <td>Returns Video Streaming Capabilities</td>
+ * <td align=center>Y</td>
+ * <td>Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ VIDEO_STREAMING(true),
- /**
- * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>
- * <td>REMOTE_CONTROL</td>
- * <td>RemoteControlCapabilities</td>
- * <td>Returns Remote Control Capabilities</td>
- * <td align=center>Y</td>
- * <td>Call is synchronous <strong>after</strong> initial call</td>
- * </tr>
- * </table>
- *
- */
- REMOTE_CONTROL (true),
+ /**
+ * <strong>Requires</strong> initial asynchronous call, then available synchronously after successful call. <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>
+ * <td>REMOTE_CONTROL</td>
+ * <td>RemoteControlCapabilities</td>
+ * <td>Returns Remote Control Capabilities</td>
+ * <td align=center>Y</td>
+ * <td>Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ REMOTE_CONTROL(true),
/* These below are not part of the RPC spec. Only for Internal Proxy use */
- /**
- * 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>HMI</td>
- * <td>HMICapabilities</td>
- * <td>Returns HMI Capabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
- * </tr>
- * </table>
- */
- HMI (false),
-
- /**
- * Available Synchronously after Register App Interface response <br>
- * Returns: DisplayCapabilities
- * <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>DISPLAY</td>
- * <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>
- * </tr>
- * </table>
- */
- @Deprecated
- DISPLAY (false),
+ /**
+ * 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>HMI</td>
+ * <td>HMICapabilities</td>
+ * <td>Returns HMI Capabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
+ * </tr>
+ * </table>
+ */
+ HMI(false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * Returns: DisplayCapabilities
+ * <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>DISPLAY</td>
+ * <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>
+ * </tr>
+ * </table>
+ */
+ @Deprecated
+ 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>
- * <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>PRERECORDED_SPEECH</td>
- * <td>prerecordedSpeechCapabilities</td>
- * <td>Returns List<PrerecordedSpeech></td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response received</td>
- * </tr>
- * </table>
- */
- PRERECORDED_SPEECH (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>
- * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
- * <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>AUDIO_PASSTHROUGH</td>
- * <td>List<AudioPassThruCapabilities></td>
- * <td>Returns a List of AudioPassThruCapabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
- * </tr>
- * </table>
- */
- AUDIO_PASSTHROUGH (false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * Returns: List<PrerecordedSpeech>
+ * <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>PRERECORDED_SPEECH</td>
+ * <td>prerecordedSpeechCapabilities</td>
+ * <td>Returns List<PrerecordedSpeech></td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response received</td>
+ * </tr>
+ * </table>
+ */
+ PRERECORDED_SPEECH(false),
- /**
- * Available Synchronously after Register App Interface response <br>
- * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
- * <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>PCM_STREAMING</td>
- * <td>AudioPassThruCapabilities</td>
- * <td>Returns a AudioPassThruCapabilities Object</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
- * </tr>
- * </table>
- */
- PCM_STREAMING (false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
+ * <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>AUDIO_PASSTHROUGH</td>
+ * <td>List<AudioPassThruCapabilities></td>
+ * <td>Returns a List of AudioPassThruCapabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
+ * </tr>
+ * </table>
+ */
+ AUDIO_PASSTHROUGH(false),
- /**
- * Available Synchronously after Register App Interface response <br>
- * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
- * <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>BUTTON</td>
- * <td>List<ButtonCapabilities></td>
- * <td>Returns a List of ButtonCapabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
- * </tr>
- * </table>
- */
- @Deprecated
- BUTTON (false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
+ * <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>PCM_STREAMING</td>
+ * <td>AudioPassThruCapabilities</td>
+ * <td>Returns a AudioPassThruCapabilities Object</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
+ * </tr>
+ * </table>
+ */
+ PCM_STREAMING(false),
- /**
- * 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>HMI_ZONE</td>
- * <td>HmiZoneCapabilities</td>
- * <td>Returns HmiZone Capabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
- * </tr>
- * </table>
- */
- HMI_ZONE (false),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <b>Note:</b> @SuppressWarnings("unchecked") may be needed when casting depending on implementation
+ * <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>BUTTON</td>
+ * <td>List<ButtonCapabilities></td>
+ * <td>Returns a List of ButtonCapabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
+ * </tr>
+ * </table>
+ */
+ @Deprecated
+ BUTTON(false),
- /**
- * 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>PRESET_BANK</td>
- * <td>PresetBankCapabilities</td>
- * <td>Returns PresetBank Capabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
- * </tr>
- * </table>
- */
- @Deprecated
- PRESET_BANK (false),
+ /**
+ * 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>HMI_ZONE</td>
+ * <td>HmiZoneCapabilities</td>
+ * <td>Returns HmiZone Capabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
+ * </tr>
+ * </table>
+ */
+ HMI_ZONE(false),
- /**
- * Available Synchronously after Register App Interface response <br>
- * Returns: List<SoftButtonCapabilities> <br>
- * Note: @SuppressWarnings("unchecked") may be needed when casting depending on implementation
- * <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>SOFTBUTTON</td>
- * <td>List<SoftButtonCapabilities></td>
- * <td>Returns a List of SoftButtonCapabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
- * </tr>
- * </table>
- */
- @Deprecated
- SOFTBUTTON (false),
+ /**
+ * 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>PRESET_BANK</td>
+ * <td>PresetBankCapabilities</td>
+ * <td>Returns PresetBank Capabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
+ * </tr>
+ * </table>
+ */
+ @Deprecated
+ PRESET_BANK(false),
- /**
- * 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>SPEECH</td>
- * <td>SpeechCapabilities</td>
- * <td>Returns Speech Capabilities</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
- * </tr>
- * </table>
- */
- SPEECH (false),
- /**
- * 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>VOICE_RECOGNITION</td>
- * <td>VrCapabilities</td>
- * <td>Returns VOICE_RECOGNITION</td>
- * <td align=center>N</td>
- * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
- * </tr>
- * </table>
- */
- VOICE_RECOGNITION (false),
- /**
- * 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>APP_SERVICES</td>
- * <td>AppServicesCapabilities</td>
- * <td>Returns APP_SERVICES</td>
- * <td align=center>N</td>
- * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
- * </tr>
- * </table>
- */
- APP_SERVICES (true),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * Returns: List<SoftButtonCapabilities> <br>
+ * Note: @SuppressWarnings("unchecked") may be needed when casting depending on implementation
+ * <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>SOFTBUTTON</td>
+ * <td>List<SoftButtonCapabilities></td>
+ * <td>Returns a List of SoftButtonCapabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response. @SuppressWarnings("unchecked") may be needed when casting depending on implementation</td>
+ * </tr>
+ * </table>
+ */
+ @Deprecated
+ SOFTBUTTON(false),
- /**
- * 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),
+ /**
+ * 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>SPEECH</td>
+ * <td>SpeechCapabilities</td>
+ * <td>Returns Speech Capabilities</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
+ * </tr>
+ * </table>
+ */
+ SPEECH(false),
+ /**
+ * 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>VOICE_RECOGNITION</td>
+ * <td>VrCapabilities</td>
+ * <td>Returns VOICE_RECOGNITION</td>
+ * <td align=center>N</td>
+ * <td>Available Synchronously <strong>after</strong> Register App Interface response</td>
+ * </tr>
+ * </table>
+ */
+ VOICE_RECOGNITION(false),
+ /**
+ * 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>APP_SERVICES</td>
+ * <td>AppServicesCapabilities</td>
+ * <td>Returns APP_SERVICES</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ APP_SERVICES(true),
- /**
- * <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>DRIVER_DISTRACTION</td>
- * <td>DriverDistractionCapability</td>
- * <td>Returns DRIVER_DISTRACTION</td>
- * <td align=center>N</td>
- * <td><strong>Since 7.0</strong> Describes capabilities when the driver is distracted</td>
- * </tr>
- * </table>
- */
- DRIVER_DISTRACTION(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),
+ /**
+ * <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>DRIVER_DISTRACTION</td>
+ * <td>DriverDistractionCapability</td>
+ * <td>Returns DRIVER_DISTRACTION</td>
+ * <td align=center>N</td>
+ * <td><strong>Since 7.0</strong> Describes capabilities when the driver is distracted</td>
+ * </tr>
+ * </table>
+ */
+ DRIVER_DISTRACTION(true);
final boolean IS_QUERYABLE;
@@ -592,9 +589,9 @@ public enum SystemCapabilityType {
}
public static SystemCapabilityType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java
index 18a3ad949..e9adacc80 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.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;
import java.util.EnumSet;
@@ -36,58 +36,58 @@ import java.util.EnumSet;
/**
* Indicates whether or not a user-initiated interaction is in progress, and if
* so, in what mode (i.e. MENU or VR).
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum SystemContext {
- /**
- * No user interaction (user-initiated or app-initiated) is in progress.
- *
- * @since SmartDeviceLink 1.0
- */
- SYSCTXT_MAIN("MAIN"),
- /**
- * VR-oriented, user-initiated or app-initiated interaction is in-progress.
- *
- * @since SmartDeviceLink 1.0
- */
- SYSCTXT_VRSESSION("VRSESSION"),
- /**
- * Menu-oriented, user-initiated or app-initiated interaction is
- * in-progress.
- *
- * @since SmartDeviceLink 1.0
- */
- SYSCTXT_MENU("MENU"),
- /**
- * The app's display HMI is currently being obscured by either a system or
- * other app's overlay.
- *
- * @since SmartDeviceLink 2.0
- */
- SYSCTXT_HMI_OBSCURED("HMI_OBSCURED"),
- /**
- * Broadcast only to whichever app has an alert currently being displayed.
- *
- * @since SmartDeviceLink 2.0
- */
- SYSCTXT_ALERT("ALERT");
+ /**
+ * No user interaction (user-initiated or app-initiated) is in progress.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ SYSCTXT_MAIN("MAIN"),
+ /**
+ * VR-oriented, user-initiated or app-initiated interaction is in-progress.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ SYSCTXT_VRSESSION("VRSESSION"),
+ /**
+ * Menu-oriented, user-initiated or app-initiated interaction is
+ * in-progress.
+ *
+ * @since SmartDeviceLink 1.0
+ */
+ SYSCTXT_MENU("MENU"),
+ /**
+ * The app's display HMI is currently being obscured by either a system or
+ * other app's overlay.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ SYSCTXT_HMI_OBSCURED("HMI_OBSCURED"),
+ /**
+ * Broadcast only to whichever app has an alert currently being displayed.
+ *
+ * @since SmartDeviceLink 2.0
+ */
+ SYSCTXT_ALERT("ALERT");
+
+ private final String VALUE;
- private final String VALUE;
-
private SystemContext(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
public static SystemContext valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
+
for (SystemContext anEnum : EnumSet.allOf(SystemContext.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TBTState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TBTState.java
index 80e113190..f06ef80d1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TBTState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TBTState.java
@@ -1,48 +1,49 @@
-/*
- * 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;
/**
* Describes possible states of turn-by-turn module.
- * @since SmartDeviceLink 1.0
+ *
+ * @since SmartDeviceLink 1.0
*/
public enum TBTState {
- /**
- * Indicates that driver requested a route update.
- */
- ROUTE_UPDATE_REQUEST,
- /**
- * Confirmation from HMI about accepting the route.
- */
+ /**
+ * Indicates that driver requested a route update.
+ */
+ ROUTE_UPDATE_REQUEST,
+ /**
+ * Confirmation from HMI about accepting the route.
+ */
ROUTE_ACCEPTED,
/**
@@ -88,13 +89,14 @@ public enum TBTState {
/**
* Convert String to TBTState
+ *
* @param value String
* @return TBTState
*/
public static TBTState valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TPMS.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TPMS.java
index a1c0fe30b..61f0dc34f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TPMS.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TPMS.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,45 +38,45 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum TPMS {
- /**
- * If set the status of the tire is not known.
- */
- UNKNOWN,
- /**
- * TPMS does not function.
- */
- SYSTEM_FAULT,
- /**
- * The sensor of the tire does not function.
- */
- SENSOR_FAULT,
- /**
- * TPMS is reporting a low tire pressure for the tire.
- */
- LOW,
- /**
- * TPMS is active and the tire pressure is monitored.
- */
- SYSTEM_ACTIVE,
- /**
- * TPMS is reporting that the tire must be trained.
- */
- TRAIN,
- /**
- * TPMS reports the training for the tire is completed.
- */
- TRAINING_COMPLETE,
- /**
- * TPMS reports the tire is not trained.
- */
- NOT_TRAINED,
- ;
+ /**
+ * If set the status of the tire is not known.
+ */
+ UNKNOWN,
+ /**
+ * TPMS does not function.
+ */
+ SYSTEM_FAULT,
+ /**
+ * The sensor of the tire does not function.
+ */
+ SENSOR_FAULT,
+ /**
+ * TPMS is reporting a low tire pressure for the tire.
+ */
+ LOW,
+ /**
+ * TPMS is active and the tire pressure is monitored.
+ */
+ SYSTEM_ACTIVE,
+ /**
+ * TPMS is reporting that the tire must be trained.
+ */
+ TRAIN,
+ /**
+ * TPMS reports the training for the tire is completed.
+ */
+ TRAINING_COMPLETE,
+ /**
+ * TPMS reports the tire is not trained.
+ */
+ NOT_TRAINED,
+ ;
- public static TPMS valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static TPMS valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java
index 5c732c957..794688571 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,9 +36,9 @@ public enum TemperatureUnit {
FAHRENHEIT;
public static TemperatureUnit valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextAlignment.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextAlignment.java
index 366082c99..9e9093ecd 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextAlignment.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextAlignment.java
@@ -1,44 +1,45 @@
-/*
- * 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;
/**
* The list of possible alignments of text in a field.
+ *
* @since SmartDeviceLink 1.0
*/
public enum TextAlignment {
- /**
- * Text aligned left.
- */
+ /**
+ * Text aligned left.
+ */
LEFT_ALIGNED,
/**
* Text aligned right.
@@ -51,13 +52,14 @@ public enum TextAlignment {
/**
* Convert String to TextAlignment
+ *
* @param value String
* @return TextAlignment
*/
public static TextAlignment valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
index 22e367871..53f77428d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -30,153 +30,154 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.smartdevicelink.proxy.rpc.enums;
-/** Names of the text fields that can appear on the display.
- *
- * @since SmartDeviceLink 1.0
+
+/**
+ * Names of the text fields that can appear on the display.
*
+ * @since SmartDeviceLink 1.0
*/
public enum TextFieldName {
- /** The first line of first set of main fields of the persistent display; applies to "Show"
- *
- */
+ /**
+ * The first line of first set of main fields of the persistent display; applies to "Show"
+ */
mainField1,
- /** The second line of first set of main fields of the persistent display; applies to "Show"
- *
+ /**
+ * The second line of first set of main fields of the persistent display; applies to "Show"
*/
mainField2,
- /** The first line of second set of main fields of persistent display; applies to "Show"
- *
+ /**
+ * The first line of second set of main fields of persistent display; applies to "Show"
*/
mainField3,
- /** The second line of second set of main fields of the persistent display; applies to "Show"
- *
+ /**
+ * The second line of second set of main fields of the persistent display; applies to "Show"
*/
mainField4,
- /** The status bar on NGN; applies to "Show"
- *
+ /**
+ * The status bar on NGN; applies to "Show"
*/
statusBar,
- /** Text value for MediaClock field; applies to "Show"
- *
+ /**
+ * Text value for MediaClock field; applies to "Show"
*/
mediaClock,
- /** The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"
- *
+ /**
+ * The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"
*/
mediaTrack,
- /** The first line of the alert text field; applies to "Alert"
- *
+ /**
+ * The first line of the alert text field; applies to "Alert"
*/
alertText1,
- /** The second line of the alert text field; applies to "Alert"
- *
+ /**
+ * The second line of the alert text field; applies to "Alert"
*/
alertText2,
- /** The third line of the alert text field; applies to "Alert"
- *
+ /**
+ * The third line of the alert text field; applies to "Alert"
*/
alertText3,
- /** Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"
- *
+ /**
+ * Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"
*/
scrollableMessageBody,
- /** First line suggestion for a user response (in the case of VR enabled interaction)
- *
+ /**
+ * First line suggestion for a user response (in the case of VR enabled interaction)
*/
initialInteractionText,
- /** First line of navigation text
- *
+ /**
+ * First line of navigation text
*/
navigationText1,
- /** Second line of navigation text
- *
+ /**
+ * Second line of navigation text
*/
navigationText2,
- /** Estimated Time of Arrival time for navigation
- *
+ /**
+ * Estimated Time of Arrival time for navigation
*/
ETA,
- /** Total distance to destination for navigation
- *
+ /**
+ * Total distance to destination for navigation
*/
totalDistance,
- /** First line of text for audio pass thru
- *
+ /**
+ * First line of text for audio pass thru
*/
audioPassThruDisplayText1,
- /** Second line of text for audio pass thru
- *
+ /**
+ * Second line of text for audio pass thru
*/
audioPassThruDisplayText2,
- /** Header text for slider
- *
+ /**
+ * Header text for slider
*/
sliderHeader,
- /** Footer text for slider
- *
+ /**
+ * Footer text for slider
*/
sliderFooter,
- /** Primary text for Choice
- *
+ /**
+ * Primary text for Choice
*/
menuName,
- /** Secondary text for Choice
- *
+ /**
+ * Secondary text for Choice
*/
secondaryText,
- /** Tertiary text for Choice
- *
+ /**
+ * Tertiary text for Choice
*/
tertiaryText,
- /** Optional text to label an app menu button (for certain touchscreen platforms).
- *
- */
+ /**
+ * Optional text to label an app menu button (for certain touchscreen platforms).
+ */
menuTitle,
/**
* Optional name / title of intended location for SendLocation.
- *
+ *
* @since SmartDeviceLink 4.0
*/
locationName,
/**
* Optional description of intended location / establishment (if applicable) for SendLocation
- *
+ *
* @since SmartDeviceLink 4.0
*/
locationDescription,
/**
* Optional location address (if applicable) for SendLocation.
- *
+ *
* @since SmartDeviceLink 4.0
*/
addressLines,
/**
* Optional phone number of intended location / establishment (if applicable) for SendLocation.
- *
+ *
* @since SmartDeviceLink 4.0
*/
phoneNumber,
@@ -205,16 +206,17 @@ public enum TextFieldName {
*/
subtleAlertSoftButtonText;
- /**
- * Convert String to TextFieldName
- * @param value String
- * @return TextFieldName
- */
+ /**
+ * Convert String to TextFieldName
+ *
+ * @param value String
+ * @return TextFieldName
+ */
public static TextFieldName valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
index f12c2965c..568ff2d20 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
@@ -1,71 +1,74 @@
-/*
- * 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;
-/** The type of touch event.
- *
- * @since SmartDeviceLink 2.3.2
+
+/**
+ * The type of touch event.
*
+ * @since SmartDeviceLink 2.3.2
*/
public enum TouchType {
- /** The user has touched the screen.
- *
- */
+ /**
+ * The user has touched the screen.
+ */
BEGIN,
- /** The User has moved his finger over the screen.
- *
+ /**
+ * The User has moved his finger over the screen.
*/
MOVE,
- /** The User has removed his finger from the screen.
- *
+ /**
+ * The User has removed his finger from the screen.
*/
END,
- /** The user has made a cancellation gesture.
- *
+ /**
+ * The user has made a cancellation gesture.
*/
CANCEL;
- /**
- * Convert String to TouchType
- * @param value String
- * @return TouchType
- */
+
+ /**
+ * Convert String to TouchType
+ *
+ * @param value String
+ * @return TouchType
+ */
public static TouchType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TransmissionType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TransmissionType.java
index d7a2ff6fd..cda5d588d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TransmissionType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TransmissionType.java
@@ -72,6 +72,7 @@ public enum TransmissionType {
/**
* Convert String to TransmissionType
+ *
* @param value String
* @return TransmissionType
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java
index 165fc21c9..e0f4b7aea 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.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;
import java.util.EnumSet;
@@ -36,38 +36,37 @@ import java.util.EnumSet;
/**
* Indicates whether choice/command was selected via VR or via a menu selection
* (using SEEKRIGHT/SEEKLEFT, TUNEUP, TUNEDOWN and OK buttons)
- *
+ *
* @since SmartDeviceLink 1.0
- *
*/
public enum TriggerSource {
- /**
- * Selection made via menu (i.e. using SEEKRIGHT/SEEKLEFT, TUNEUP, TUNEDOWN
- * and OK buttons)
- */
- TS_MENU("MENU"),
- /**
- * Selection made via VR session
- */
- TS_VR("VR"),
-
- TS_KEYBOARD("KEYBOARD");
+ /**
+ * Selection made via menu (i.e. using SEEKRIGHT/SEEKLEFT, TUNEUP, TUNEDOWN
+ * and OK buttons)
+ */
+ TS_MENU("MENU"),
+ /**
+ * Selection made via VR session
+ */
+ TS_VR("VR"),
+
+ TS_KEYBOARD("KEYBOARD");
+
+ private final String VALUE;
- private final String VALUE;
-
private TriggerSource(String value) {
this.VALUE = value;
}
-
+
public String toString() {
return this.VALUE;
}
-
+
public static TriggerSource valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
+
for (TriggerSource anEnum : EnumSet.allOf(TriggerSource.class)) {
if (anEnum.toString().equals(value)) {
return anEnum;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TurnSignal.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TurnSignal.java
index fb490f7f0..591725694 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TurnSignal.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TurnSignal.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,29 +38,29 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum TurnSignal {
- /**
- * Turn signal is OFF
- */
- OFF,
- /**
- * Left turn signal is on
- */
- LEFT,
- /**
- * Right turn signal is on
- */
- RIGHT,
- /**
- * Both signals (left and right) are on.
- */
- BOTH,
- ;
+ /**
+ * Turn signal is OFF
+ */
+ OFF,
+ /**
+ * Left turn signal is on
+ */
+ LEFT,
+ /**
+ * Right turn signal is on
+ */
+ RIGHT,
+ /**
+ * Both signals (left and right) are on.
+ */
+ BOTH,
+ ;
- public static TurnSignal valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static TurnSignal valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
index d43940153..602ce406f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
@@ -1,72 +1,72 @@
-/*
- * 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;
/**
* Specifies what function should be performed on the media clock/counter
- *
- *
+ *
* @since SmartDeviceLink 1.0
*/
public enum UpdateMode {
- /**
- * Starts the media clock timer counting upward, in increments of 1 second
- */
- COUNTUP,
- /**
- * Starts the media clock timer counting downward, in increments of 1 second
- */
- COUNTDOWN,
- /**
- * Pauses the media clock timer
- */
- PAUSE,
- /**
- * Resumes the media clock timer. The timer resumes counting in whatever
- * mode was in effect before pausing (i.e. COUNTUP or COUNTDOWN)
- */
- RESUME,
+ /**
+ * Starts the media clock timer counting upward, in increments of 1 second
+ */
+ COUNTUP,
+ /**
+ * Starts the media clock timer counting downward, in increments of 1 second
+ */
+ COUNTDOWN,
+ /**
+ * Pauses the media clock timer
+ */
+ PAUSE,
+ /**
+ * Resumes the media clock timer. The timer resumes counting in whatever
+ * mode was in effect before pausing (i.e. COUNTUP or COUNTDOWN)
+ */
+ RESUME,
CLEAR;
-
- /**
- * Returns an UpdateMode value (COUNTUP, COUNTDOWN, PAUSE or RESUME)
- * @param value a String
- * @return UpdateMode -COUNTUP, COUNTDOWN, PAUSE or RESUME
- */
+
+ /**
+ * Returns an UpdateMode value (COUNTUP, COUNTDOWN, PAUSE or RESUME)
+ *
+ * @param value a String
+ * @return UpdateMode -COUNTUP, COUNTDOWN, PAUSE or RESUME
+ */
public static UpdateMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
index 0afd389ee..4a4e3c88d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
@@ -45,6 +45,7 @@ public enum VehicleDataActiveStatus {
/**
* Convert String to VehicleDataActiveStatus
+ *
* @param value String
* @return VehicleDataActiveStatus
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataEventStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataEventStatus.java
index 529c79431..00051b8be 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataEventStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataEventStatus.java
@@ -1,62 +1,64 @@
-/*
- * 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;
/**
* Reflects the status of a vehicle data event; e.g. a seat belt event status.
+ *
* @since SmartDeviceLink 2.0
*/
public enum VehicleDataEventStatus {
- /**
- * No event available
- */
- NO_EVENT,
- NO,
- YES,
- /**
- * Vehicle data event is not support
- */
- NOT_SUPPORTED,
- FAULT;
+ /**
+ * No event available
+ */
+ NO_EVENT,
+ NO,
+ YES,
+ /**
+ * Vehicle data event is not support
+ */
+ NOT_SUPPORTED,
+ FAULT;
/**
* Convert String to VehicleDataEventStatus
+ *
* @param value String
* @return VehicleDataEventStatus
- */
+ */
public static VehicleDataEventStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
index ec0aa048a..4725e96bb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
@@ -1,68 +1,69 @@
-/*
- * 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;
/**
* Reflects the status of a vehicle data notification.
- * @since SmartDeviceLink 2.0
*
+ * @since SmartDeviceLink 2.0
*/
public enum VehicleDataNotificationStatus {
- /**
- * VehicleDataNotificationStatus is not supported.
- */
- NOT_SUPPORTED,
- /**
- * VehicleDataNotificationStatus is normal.
- */
- NORMAL,
- /**
- * VehicleDataNotificationStatus is active.
- */
- ACTIVE,
- /**
- * VehicleDataNotificationStatus is not in use.
- */
- NOT_USED;
+ /**
+ * VehicleDataNotificationStatus is not supported.
+ */
+ NOT_SUPPORTED,
+ /**
+ * VehicleDataNotificationStatus is normal.
+ */
+ NORMAL,
+ /**
+ * VehicleDataNotificationStatus is active.
+ */
+ ACTIVE,
+ /**
+ * VehicleDataNotificationStatus is not in use.
+ */
+ NOT_USED;
/**
* Convert String to VehicleDataNotificationStatus
+ *
* @param value String
* @return VehicleDataNotificationStatus
- */
+ */
public static VehicleDataNotificationStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
index 7f12b8623..579607ebf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
@@ -1,95 +1,97 @@
-/*
- * 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;
-/** Enumeration that describes possible result codes of a vehicle data entry request.
- *
- * @since SmartDeviceLink 2.0
+
+/**
+ * Enumeration that describes possible result codes of a vehicle data entry request.
*
- *@see com.smartdevicelink.proxy.rpc.DIDResult
- *@see com.smartdevicelink.proxy.rpc.ReadDID
+ * @see com.smartdevicelink.proxy.rpc.DIDResult
+ * @see com.smartdevicelink.proxy.rpc.ReadDID
+ * @since SmartDeviceLink 2.0
*/
public enum VehicleDataResultCode {
- /**Individual vehicle data item / DTC / DID request or subscription successful
- *
- */
+ /**
+ * Individual vehicle data item / DTC / DID request or subscription successful
+ */
- SUCCESS,
- /**
- *DTC / DID request successful, however, not all active DTCs or full contents of DID location available
- *
+ SUCCESS,
+ /**
+ * DTC / DID request successful, however, not all active DTCs or full contents of DID location available
+ *
* @since SmartDeviceLink 4.0
*/
-
- TRUNCATED_DATA,
- /** This vehicle data item is not allowed for this app .The request is not authorized in local policies.
- *
- */
- DISALLOWED,
- /** The user has not granted access to this type of vehicle data item at this time.
- *
- */
+ TRUNCATED_DATA,
+ /**
+ * This vehicle data item is not allowed for this app .The request is not authorized in local policies.
+ */
+
+ DISALLOWED,
+ /**
+ * The user has not granted access to this type of vehicle data item at this time.
+ */
- USER_DISALLOWED,
- /** The ECU ID referenced is not a valid ID on the bus / system.
- *
- */
+ USER_DISALLOWED,
+ /**
+ * The ECU ID referenced is not a valid ID on the bus / system.
+ */
- INVALID_ID,
- /** The requested vehicle data item / DTC / DID is not currently available or responding on the bus / system.
- *
- */
+ INVALID_ID,
+ /**
+ * The requested vehicle data item / DTC / DID is not currently available or responding on the bus / system.
+ */
- VEHICLE_DATA_NOT_AVAILABLE,
- /** The vehicle data item is already subscribed.
- *
- */
+ VEHICLE_DATA_NOT_AVAILABLE,
+ /**
+ * The vehicle data item is already subscribed.
+ */
- DATA_ALREADY_SUBSCRIBED,
- /** The vehicle data item cannot be unsubscribed because it is not currently subscribed.
- *
- */
+ DATA_ALREADY_SUBSCRIBED,
+ /**
+ * The vehicle data item cannot be unsubscribed because it is not currently subscribed.
+ */
- DATA_NOT_SUBSCRIBED,
- /** The request for this item is ignored because it is already in progress
- */
+ DATA_NOT_SUBSCRIBED,
+ /**
+ * The request for this item is ignored because it is already in progress
+ */
- IGNORED;
+ IGNORED;
public static VehicleDataResultCode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
index 1319791b2..a573131c1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
@@ -1,49 +1,49 @@
-/*
- * 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;
/**
* Reflects the status of a binary vehicle data item.
- * @since SmartDeviceLink 2.0
*
+ * @since SmartDeviceLink 2.0
*/
public enum VehicleDataStatus {
- /**
- * No data available
- */
- NO_DATA_EXISTS,
- /**
- * The vehicle item is in Off state
- */
+ /**
+ * No data available
+ */
+ NO_DATA_EXISTS,
+ /**
+ * The vehicle item is in Off state
+ */
OFF,
/**
@@ -54,13 +54,14 @@ public enum VehicleDataStatus {
/**
* Convert String to VehicleDataStatus
+ *
* @param value String
* @return VehicleDataStatus
- */
+ */
public static VehicleDataStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
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 294d50f1e..7d7219453 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
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,16 +33,15 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Defines the vehicle data types that can be published and subscribed to.
- *
*/
public enum VehicleDataType {
- /**
- * Notifies GPSData may be subscribed
- */
- VEHICLEDATA_GPS,
- /**
- * Notifies SPEED Data may be subscribed
- */
+ /**
+ * Notifies GPSData may be subscribed
+ */
+ VEHICLEDATA_GPS,
+ /**
+ * Notifies SPEED Data may be subscribed
+ */
VEHICLEDATA_SPEED,
/**
* Notifies RPMData may be subscribed
@@ -58,9 +57,9 @@ public enum VehicleDataType {
* until Smart Device Link 7.0
*/
VEHICLEDATA_FUELLEVEL_STATE,
-/**
- * Notifies FUELCONSUMPTIONData may be subscribed
- */
+ /**
+ * Notifies FUELCONSUMPTIONData may be subscribed
+ */
VEHICLEDATA_FUELCONSUMPTION,
/**
* Notifies EXTERNTEMPData may be subscribed
@@ -81,7 +80,7 @@ public enum VehicleDataType {
/**
* Notifies ODOMETERData may be subscribed
*/
- VEHICLEDATA_ODOMETER,
+ VEHICLEDATA_ODOMETER,
/**
* Notifies BELTSTATUSData may be subscribed
*/
@@ -188,16 +187,17 @@ public enum VehicleDataType {
*/
VEHICLEDATA_GEARSTATUS;
- /**
+ /**
* Convert String to VehicleDataType
+ *
* @param value String
* @return VehicleDataType
*/
public static VehicleDataType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java
index a66c6d34e..3e7c9486d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,9 +39,9 @@ public enum VentilationMode {
;
public static VentilationMode valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java
index f390df075..3a9cb5efd 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,46 +36,46 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum VideoStreamingCodec {
- /**
- * A block-oriented motion-compensation-based video compression standard. As of 2014 it is one
- * of the most commonly used formats for the recording, compression, and distribution of video
- * content.
- */
- H264,
- /**
- * High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video
- * compression standard, one of several potential successors to the widely used AVC
- * (H.264 or MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data
- * compression ratio at the same level of video quality, or substantially improved video quality
- * at the same bit rate. It supports resolutions up to 8192x4320, including 8K UHD.
- */
- H265,
- /**
- * Theora is derived from the formerly proprietary VP3 codec, released into the public domain by
- * On2 Technologies. It is broadly comparable in design and bitrate efficiency to MPEG-4 Part 2,
- * early versions of Windows Media Video, and RealVideo while lacking some of the features
- * present in some of these other codecs. It is comparable in open standards philosophy to the
- * BBC's Dirac codec.
- */
- Theora,
- /**
- * VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and
- * Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct
- * successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance
- * for Open Media (AOMedia) are based on VP8.
- */
- VP8,
- /**
- * Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video
- * (UHD) and also enables lossless compression.
- */
- VP9;
+ /**
+ * A block-oriented motion-compensation-based video compression standard. As of 2014 it is one
+ * of the most commonly used formats for the recording, compression, and distribution of video
+ * content.
+ */
+ H264,
+ /**
+ * High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video
+ * compression standard, one of several potential successors to the widely used AVC
+ * (H.264 or MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data
+ * compression ratio at the same level of video quality, or substantially improved video quality
+ * at the same bit rate. It supports resolutions up to 8192x4320, including 8K UHD.
+ */
+ H265,
+ /**
+ * Theora is derived from the formerly proprietary VP3 codec, released into the public domain by
+ * On2 Technologies. It is broadly comparable in design and bitrate efficiency to MPEG-4 Part 2,
+ * early versions of Windows Media Video, and RealVideo while lacking some of the features
+ * present in some of these other codecs. It is comparable in open standards philosophy to the
+ * BBC's Dirac codec.
+ */
+ Theora,
+ /**
+ * VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and
+ * Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct
+ * successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance
+ * for Open Media (AOMedia) are based on VP8.
+ */
+ VP8,
+ /**
+ * Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video
+ * (UHD) and also enables lossless compression.
+ */
+ VP9;
- public static VideoStreamingCodec valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static VideoStreamingCodec valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java
index bd7e426c5..1ca46ab50 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -36,40 +36,40 @@ package com.smartdevicelink.proxy.rpc.enums;
*/
public enum VideoStreamingProtocol {
- /**
- * Raw stream bytes that contains no timestamp data and is the lowest supported video streaming
- */
- RAW,
- /**
- * RTP facilitates the transfer of real-time data. Information provided by this protocol include
- * timestamps (for synchronization), sequence numbers (for packet loss and reordering detection)
- * and the payload format which indicates the encoded format of the data.
- */
- RTP,
- /**
- * The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the
- * Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) for
- * media stream delivery. However, some vendors implement proprietary transport protocols.
- */
- RTSP,
- /**
- * Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by
- * Macromedia for streaming audio, video and data over the Internet, between a Flash player and
- * a server. Macromedia is now owned by Adobe, which has released an incomplete version of the
- * specification of the protocol for public use.
- */
- RTMP,
- /**
- * The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and
- * Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio.
- */
- WEBM;
+ /**
+ * Raw stream bytes that contains no timestamp data and is the lowest supported video streaming
+ */
+ RAW,
+ /**
+ * RTP facilitates the transfer of real-time data. Information provided by this protocol include
+ * timestamps (for synchronization), sequence numbers (for packet loss and reordering detection)
+ * and the payload format which indicates the encoded format of the data.
+ */
+ RTP,
+ /**
+ * The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the
+ * Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) for
+ * media stream delivery. However, some vendors implement proprietary transport protocols.
+ */
+ RTSP,
+ /**
+ * Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by
+ * Macromedia for streaming audio, video and data over the Internet, between a Flash player and
+ * a server. Macromedia is now owned by Adobe, which has released an incomplete version of the
+ * specification of the protocol for public use.
+ */
+ RTMP,
+ /**
+ * The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and
+ * Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio.
+ */
+ WEBM;
- public static VideoStreamingProtocol valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+ public static VideoStreamingProtocol valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingState.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingState.java
index 6952919c8..8c1e7e2eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingState.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingState.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,26 +29,28 @@
* 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;
-
-/**
- * Enumeration that describes possible states of video streaming.
- * @since SmartDeviceLink 5.0
- */
-public enum VideoStreamingState {
- /**
- * @since SmartDeviceLink 5.0
- */
- STREAMABLE,
- /**
- * @since SmartDeviceLink 5.0
- */
- NOT_STREAMABLE;
- public static VideoStreamingState valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enumeration that describes possible states of video streaming.
+ *
+ * @since SmartDeviceLink 5.0
+ */
+public enum VideoStreamingState {
+ /**
+ * @since SmartDeviceLink 5.0
+ */
+ STREAMABLE,
+ /**
+ * @since SmartDeviceLink 5.0
+ */
+ NOT_STREAMABLE;
+
+ public static VideoStreamingState valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VrCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VrCapabilities.java
index 13d4add28..ade0dec27 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VrCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VrCapabilities.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,31 +33,29 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* The VR capabilities of the connected SDL platform.
- *
*/
public enum VrCapabilities {
/**
* The SDL platform is capable of recognizing spoken text in the current
* language.
- *
+ *
* @since SmartDeviceLink 3.0
*/
- TEXT,
- ;
+ TEXT,
+ ;
public static VrCapabilities valueForString(String value) {
- if(value == null){
+ if (value == null) {
return null;
}
-
- if (value.equalsIgnoreCase(TEXT.toString()))
- {
- return TEXT;
+
+ if (value.equalsIgnoreCase(TEXT.toString())) {
+ return TEXT;
}
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WarningLightStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WarningLightStatus.java
index 2139c74bd..42f2f4382 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WarningLightStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WarningLightStatus.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -33,32 +33,34 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Reflects the status of a cluster instrument warning light.
+ *
* @since SmartDeviceLink 2.0
*/
public enum WarningLightStatus {
- /**
- * Warning light Off
- */
- OFF,
- /**
- * Warning light On
- */
- ON,
- /**
- * Warning light is flashing
- */
- FLASH,
- NOT_USED;
+ /**
+ * Warning light Off
+ */
+ OFF,
+ /**
+ * Warning light On
+ */
+ ON,
+ /**
+ * Warning light is flashing
+ */
+ FLASH,
+ NOT_USED;
/**
* Convert String to WarningLightStatus
+ *
* @param value String
* @return WarningLightStatus
- */
+ */
public static WarningLightStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WayPointType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WayPointType.java
index 03f8e06f2..49da14500 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WayPointType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WayPointType.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,9 +37,9 @@ public enum WayPointType {
;
public static WayPointType valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
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
index 754b0433c..8ae47b54e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
@@ -2,6 +2,7 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* The type of the window to be created. Main window or widget.
+ *
* @since 6.0
*/
public enum WindowType {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
index b03ceeae2..b6557ce7a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
@@ -1,128 +1,132 @@
-/*
- * 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;
-/** This enumeration reflects the status of the wipers.
- *
- * @since SmartDeviceLink 2.0
- *
+
+/**
+ * This enumeration reflects the status of the wipers.
+ *
* @see com.smartdevicelink.proxy.rpc.GetVehicleData
* @see com.smartdevicelink.proxy.rpc.OnVehicleData
+ * @since SmartDeviceLink 2.0
*/
public enum WiperStatus {
- /** The wipers are off.
- *
- */
-
- OFF,
- /** The wipers are automatically off after detecting the wipers do not need to be engaged (rain stopped, etc.).
- *
- */
-
- AUTO_OFF,
- /** Means that though set to off, somehow the wipers have been engaged (physically moved enough to engage a wiping motion).
- *
- */
-
- OFF_MOVING,
- /** The wipers are manually off after having been working.
- *
- */
-
- MAN_INT_OFF,
- /** The wipers are manually on.
- *
- */
-
- MAN_INT_ON,
- /** The wipers are manually set to low speed.
- *
- */
-
- MAN_LOW,
- /** The wipers are manually set to high speed.
- *
- */
-
- MAN_HIGH,
- /** The wipers are manually set for doing a flick.
- *
- */
-
- MAN_FLICK,
- /** The wipers are set to use the water from vehicle washer bottle for cleaning the windscreen.
- *
- */
-
- WASH,
- /** The wipers are automatically set to low speed.
- *
- */
-
- AUTO_LOW,
- /** The wipers are automatically set to high speed.
- *
- */
-
- AUTO_HIGH,
- /** This is for when a user has just initiated a WASH and several seconds later a secondary wipe is automatically initiated to clear remaining fluid
- */
-
- COURTESYWIPE,
- /** This is set as the user moves between possible automatic wiper speeds.
- *
- */
-
- AUTO_ADJUST,
- /** The wiper is stalled to its place. There may be an obstruction.
- *
- */
-
- STALLED,
- /** The sensor / module cannot provide any information for wiper.
- *
- */
-
- NO_DATA_EXISTS;
- /**
- * Convert String to WiperStatus
- * @param value String
- * @return WiperStatus
- */
+ /**
+ * The wipers are off.
+ */
+
+ OFF,
+ /**
+ * The wipers are automatically off after detecting the wipers do not need to be engaged (rain stopped, etc.).
+ */
+
+ AUTO_OFF,
+ /**
+ * Means that though set to off, somehow the wipers have been engaged (physically moved enough to engage a wiping motion).
+ */
+
+ OFF_MOVING,
+ /**
+ * The wipers are manually off after having been working.
+ */
+
+ MAN_INT_OFF,
+ /**
+ * The wipers are manually on.
+ */
+
+ MAN_INT_ON,
+ /**
+ * The wipers are manually set to low speed.
+ */
+
+ MAN_LOW,
+ /**
+ * The wipers are manually set to high speed.
+ */
+
+ MAN_HIGH,
+ /**
+ * The wipers are manually set for doing a flick.
+ */
+
+ MAN_FLICK,
+ /**
+ * The wipers are set to use the water from vehicle washer bottle for cleaning the windscreen.
+ */
+
+ WASH,
+ /**
+ * The wipers are automatically set to low speed.
+ */
+
+ AUTO_LOW,
+ /**
+ * The wipers are automatically set to high speed.
+ */
+
+ AUTO_HIGH,
+ /**
+ * This is for when a user has just initiated a WASH and several seconds later a secondary wipe is automatically initiated to clear remaining fluid
+ */
+
+ COURTESYWIPE,
+ /**
+ * This is set as the user moves between possible automatic wiper speeds.
+ */
+
+ AUTO_ADJUST,
+ /**
+ * The wiper is stalled to its place. There may be an obstruction.
+ */
+
+ STALLED,
+ /**
+ * The sensor / module cannot provide any information for wiper.
+ */
+
+ NO_DATA_EXISTS;
+
+ /**
+ * Convert String to WiperStatus
+ *
+ * @param value String
+ * @return WiperStatus
+ */
public static WiperStatus valueForString(String value) {
- try{
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
index 8f07d4320..6a40f09d2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
@@ -40,37 +40,40 @@ import java.util.Vector;
*/
public abstract class OnMultipleRequestListener extends OnRPCResponseListener {
- final Vector<Integer> correlationIds;
- final OnRPCResponseListener rpcResponseListener;
+ final Vector<Integer> correlationIds;
+ final OnRPCResponseListener rpcResponseListener;
- public OnMultipleRequestListener(){
- setListenerType(UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS);
- correlationIds = new Vector<>();
+ public OnMultipleRequestListener() {
+ setListenerType(UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS);
+ correlationIds = new Vector<>();
- rpcResponseListener = new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- OnMultipleRequestListener.this.onResponse(correlationId, response);
- correlationIds.remove(Integer.valueOf(correlationId));
- onUpdate(correlationIds.size());
- if(correlationIds.size() == 0){
- onFinished();
- }
- }
- };
- }
+ rpcResponseListener = new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ OnMultipleRequestListener.this.onResponse(correlationId, response);
+ correlationIds.remove(Integer.valueOf(correlationId));
+ onUpdate(correlationIds.size());
+ if (correlationIds.size() == 0) {
+ onFinished();
+ }
+ }
+ };
+ }
- public void addCorrelationId(int correlationId){
- correlationIds.add(correlationId);
- }
- /**
- * onUpdate is called during multiple stream request
- * @param remainingRequests of the original request
- */
- public abstract void onUpdate(int remainingRequests);
- public abstract void onFinished();
+ public void addCorrelationId(int correlationId) {
+ correlationIds.add(correlationId);
+ }
- public OnRPCResponseListener getSingleRpcResponseListener(){
- return rpcResponseListener;
- }
+ /**
+ * onUpdate is called during multiple stream request
+ *
+ * @param remainingRequests of the original request
+ */
+ public abstract void onUpdate(int remainingRequests);
+
+ public abstract void onFinished();
+
+ public OnRPCResponseListener getSingleRpcResponseListener() {
+ return rpcResponseListener;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
index 237c5efe6..daa80b073 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
@@ -38,17 +38,17 @@ public abstract class OnRPCListener {
/**
* Generic listener for all RPCs including Requests, response, and notification
*/
- public final static int UPDATE_LISTENER_TYPE_ALL_RPCS = -1;
+ public final static int UPDATE_LISTENER_TYPE_ALL_RPCS = -1;
/**
* Generic listener type that will work for most RPCs
*/
- public final static int UPDATE_LISTENER_TYPE_BASE_RPC = 0;
+ public final static int UPDATE_LISTENER_TYPE_BASE_RPC = 0;
/**
* Listener type specific to sendRequests and sendSequentialRequests
*/
- public final static int UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS = 2;
+ public final static int UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS = 2;
/**
* Stores what type of listener this instance is. This prevents of from having to use reflection
@@ -58,26 +58,29 @@ public abstract class OnRPCListener {
/**
* This is the base listener for all RPCs.
*/
- public OnRPCListener(){
+ public OnRPCListener() {
setListenerType(UPDATE_LISTENER_TYPE_ALL_RPCS);
}
- protected final void setListenerType(int type){
+ protected final void setListenerType(int type) {
this.listenerType = type;
}
+
/**
* This is used to see what type of listener this instance is. It is needed
* because some RPCs require additional callbacks. Types are constants located in this class
+ *
* @return the type of listener this is
*/
- public int getListenerType(){
+ public int getListenerType() {
return this.listenerType;
}
/**
* This is the only method that must be extended.
+ *
* @param message This will be the response message received from the core side. It should be cast into a corresponding RPC Response type. ie, if setting this
- * for a PutFile request, the message parameter should be cast to a PutFileResponse class.
+ * for a PutFile request, the message parameter should be cast to a PutFileResponse class.
*/
public abstract void onReceived(final RPCMessage message);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java
index 33ddf9b83..4f0398acb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCNotificationListener.java
@@ -34,6 +34,6 @@ package com.smartdevicelink.proxy.rpc.listeners;
import com.smartdevicelink.proxy.RPCNotification;
public abstract class OnRPCNotificationListener {
-
- public abstract void onNotified(RPCNotification notification);
+
+ public abstract void onNotified(RPCNotification notification);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java
index c4df348d9..9945fee09 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCRequestListener.java
@@ -36,15 +36,15 @@ import com.smartdevicelink.proxy.RPCRequest;
public abstract class OnRPCRequestListener extends OnRPCListener {
- public final void onReceived(final RPCMessage message){
- if (message instanceof RPCRequest){
- onRequest((RPCRequest)message);
- }
- }
+ public final void onReceived(final RPCMessage message) {
+ if (message instanceof RPCRequest) {
+ onRequest((RPCRequest) message);
+ }
+ }
- /**
- * @param request - The incoming RPC Request
- */
- public abstract void onRequest(final RPCRequest request);
+ /**
+ * @param request - The incoming RPC Request
+ */
+ public abstract void onRequest(final RPCRequest request);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
index d32a70f7e..b0bb22f83 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
@@ -37,34 +37,36 @@ import com.smartdevicelink.proxy.RPCResponse;
public abstract class OnRPCResponseListener extends OnRPCListener {
- public OnRPCResponseListener(){
- setListenerType(OnRPCListener.UPDATE_LISTENER_TYPE_BASE_RPC);
- }
+ public OnRPCResponseListener() {
+ setListenerType(OnRPCListener.UPDATE_LISTENER_TYPE_BASE_RPC);
+ }
- public final void onReceived(final RPCMessage message){
- if (message != null && message instanceof RPCResponse){
- onResponse(((RPCResponse) message).getCorrelationID(), (RPCResponse)message);
- }
- }
+ public final void onReceived(final RPCMessage message) {
+ if (message != null && message instanceof RPCResponse) {
+ onResponse(((RPCResponse) message).getCorrelationID(), (RPCResponse) message);
+ }
+ }
- /* *****************************************************************
- ************************* Event Callbacks *************************
- *******************************************************************/
-
- /**
- * This method will be called once the packet has been entered into the queue of messages to send
- * @param correlationId
- */
- public void onStart(int correlationId){
-
- }
+ /* *****************************************************************
+ ************************* Event Callbacks *************************
+ *******************************************************************/
- /**
- * This is the only method that must be extended. Other methods that are able to be extended are
- * onStart and onError.
- * @param correlationId
- * @param response This will be the response message received from the core side. It should be cast into a corresponding RPC Response type. ie, if setting this
- * for a PutFile request, the message parameter should be cast to a PutFileResponse class.
- */
- public abstract void onResponse(int correlationId, final RPCResponse response);
+ /**
+ * This method will be called once the packet has been entered into the queue of messages to send
+ *
+ * @param correlationId
+ */
+ public void onStart(int correlationId) {
+
+ }
+
+ /**
+ * This is the only method that must be extended. Other methods that are able to be extended are
+ * onStart and onError.
+ *
+ * @param correlationId
+ * @param response This will be the response message received from the core side. It should be cast into a corresponding RPC Response type. ie, if setting this
+ * for a PutFile request, the message parameter should be cast to a PutFileResponse class.
+ */
+ public abstract void onResponse(int correlationId, final RPCResponse response);
}
diff --git a/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java b/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
index 03f720096..e8e31ba9b 100644
--- a/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
+++ b/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -31,92 +31,92 @@
*/
package com.smartdevicelink.security;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
import java.util.ArrayList;
import java.util.List;
abstract class AbstractSdlSecurityBase {
-
- protected SdlSession session = null;
- protected String appId = null;
- protected List<String> makeList = null;
- protected boolean isInitSuccess = false;
- protected byte sessionId = 0;
- protected List<SessionType> startServiceList = new ArrayList<>();
-
+
+ protected SdlSession session = null;
+ protected String appId = null;
+ protected List<String> makeList = null;
+ protected boolean isInitSuccess = false;
+ protected byte sessionId = 0;
+ protected List<SessionType> startServiceList = new ArrayList<>();
+
public AbstractSdlSecurityBase() {
- }
-
- public abstract void initialize();
-
- public abstract Integer runHandshake(byte[] inputData,byte[] outputData);
-
- public abstract Integer encryptData(byte[] inputData,byte[] outputData);
-
- public abstract Integer decryptData(byte[] inputData,byte[] outputData);
-
+ }
+
+ public abstract void initialize();
+
+ public abstract Integer runHandshake(byte[] inputData, byte[] outputData);
+
+ public abstract Integer encryptData(byte[] inputData, byte[] outputData);
+
+ public abstract Integer decryptData(byte[] inputData, byte[] outputData);
+
public abstract void shutDown();
-
+
public void resetParams() {
- session = null;
- appId = null;
- isInitSuccess = false;
- startServiceList.clear();
+ session = null;
+ appId = null;
+ isInitSuccess = false;
+ startServiceList.clear();
}
-
+
public List<SessionType> getServiceList() {
- return startServiceList;
+ return startServiceList;
}
-
+
public void handleInitResult(boolean val) {
if (session == null) return;
setInitSuccess(val);
session.onSecurityInitialized();
}
-
+
public void handleSdlSession(SdlSession sdlSession) {
- if (sdlSession == null) return;
-
- setSessionId((byte)sdlSession.getSessionId());
- setSdlSession(sdlSession);
+ if (sdlSession == null) return;
+
+ setSessionId((byte) sdlSession.getSessionId());
+ setSdlSession(sdlSession);
}
-
+
private void setInitSuccess(boolean val) {
- isInitSuccess = val;
+ isInitSuccess = val;
}
-
+
public boolean getInitSuccess() {
- return isInitSuccess;
+ return isInitSuccess;
}
-
+
private void setSessionId(byte val) {
- sessionId = val;
+ sessionId = val;
}
-
+
public byte getSessionId() {
- return sessionId;
+ return sessionId;
}
private void setSdlSession(SdlSession val) {
- session = val;
+ session = val;
}
-
+
public String getAppId() {
- return appId;
+ return appId;
}
-
+
public void setAppId(String val) {
- appId = val;
+ appId = val;
}
public List<String> getMakeList() {
- return makeList;
+ return makeList;
}
-
+
public void setMakeList(List<String> val) {
- makeList = val;
+ makeList = val;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/security/ISecurityInitializedListener.java b/base/src/main/java/com/smartdevicelink/security/ISecurityInitializedListener.java
index 8969be76a..b801f9a65 100644
--- a/base/src/main/java/com/smartdevicelink/security/ISecurityInitializedListener.java
+++ b/base/src/main/java/com/smartdevicelink/security/ISecurityInitializedListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,5 +32,5 @@
package com.smartdevicelink.security;
public interface ISecurityInitializedListener {
- void onSecurityInitialized();
+ void onSecurityInitialized();
}
diff --git a/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java b/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
index f2d50b040..ed4957b78 100644
--- a/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
+++ b/base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java
@@ -77,7 +77,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
boolean sdlSecurityInitializing = false;
- public BaseSdlSession(ISdlSessionListener listener, BaseTransportConfig config){
+ public BaseSdlSession(ISdlSessionListener listener, BaseTransportConfig config) {
this.transportConfig = config;
this.sessionListener = listener;
this.sdlProtocol = getSdlProtocolImplementation();
@@ -86,10 +86,10 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
protected abstract SdlProtocolBase getSdlProtocolImplementation();
- public int getMtu(){
- if(this.sdlProtocol!=null){
+ public int getMtu() {
+ if (this.sdlProtocol != null) {
return this.sdlProtocol.getMtu();
- }else{
+ } else {
return 0;
}
}
@@ -103,20 +103,19 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
}
public void close() {
- if (sdlSecurity != null)
- {
+ if (sdlSecurity != null) {
sdlSecurity.resetParams();
sdlSecurity.shutDown();
}
- if(sdlProtocol != null){
- sdlProtocol.endSession((byte)sessionId);
+ if (sdlProtocol != null) {
+ sdlProtocol.endSession((byte) sessionId);
}
}
- public void startService (SessionType serviceType, boolean isEncrypted) {
- if (isEncrypted){
- if (sdlSecurity != null){
+ public void startService(SessionType serviceType, boolean isEncrypted) {
+ if (isEncrypted) {
+ if (sdlSecurity != null) {
List<SessionType> serviceList = sdlSecurity.getServiceList();
if (!serviceList.contains(serviceType)) {
serviceList.add(serviceType);
@@ -129,14 +128,14 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
}
}
}
- sdlProtocol.startService(serviceType, (byte)this.sessionId, isEncrypted);
+ sdlProtocol.startService(serviceType, (byte) this.sessionId, isEncrypted);
}
- public void endService (SessionType serviceType) {
+ public void endService(SessionType serviceType) {
if (sdlProtocol == null) {
return;
}
- sdlProtocol.endService(serviceType, (byte)this.sessionId);
+ sdlProtocol.endService(serviceType, (byte) this.sessionId);
}
@@ -146,7 +145,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
public void sendMessage(ProtocolMessage msg) {
- if (sdlProtocol == null){
+ if (sdlProtocol == null) {
return;
}
sdlProtocol.sendMessage(msg);
@@ -162,13 +161,14 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
/**
* Get the current protocol version used by this session
+ *
* @return Version that represents the Protocol version being used
*/
- public Version getProtocolVersion(){
- if(sdlProtocol!=null){
+ public Version getProtocolVersion() {
+ if (sdlProtocol != null) {
return sdlProtocol.getProtocolVersion();
}
- return new Version(1,0,0);
+ return new Version(1, 0, 0);
}
@@ -201,8 +201,8 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
protocolMessage.setSessionType(SessionType.CONTROL);
protocolMessage.setData(returnBytes);
protocolMessage.setFunctionID(0x01);
- protocolMessage.setVersion((byte)sdlProtocol.getProtocolVersion().getMajor());
- protocolMessage.setSessionID((byte)this.sessionId);
+ protocolMessage.setVersion((byte) sdlProtocol.getProtocolVersion().getMajor());
+ protocolMessage.setSessionID((byte) this.sessionId);
//sdlSecurity.hs();
@@ -214,35 +214,35 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
return encryptedServices.contains(sType);
}
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
- if(serviceListeners == null){
+ public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ if (serviceListeners == null) {
serviceListeners = new HashMap<>();
}
- if(serviceType != null && sdlServiceListener != null){
- if(!serviceListeners.containsKey(serviceType)){
- serviceListeners.put(serviceType,new CopyOnWriteArrayList<ISdlServiceListener>());
+ if (serviceType != null && sdlServiceListener != null) {
+ if (!serviceListeners.containsKey(serviceType)) {
+ serviceListeners.put(serviceType, new CopyOnWriteArrayList<ISdlServiceListener>());
}
serviceListeners.get(serviceType).add(sdlServiceListener);
}
}
- public boolean removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
- if(serviceListeners!= null && serviceType != null && sdlServiceListener != null && serviceListeners.containsKey(serviceType)){
+ public boolean removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ if (serviceListeners != null && serviceType != null && sdlServiceListener != null && serviceListeners.containsKey(serviceType)) {
return serviceListeners.get(serviceType).remove(sdlServiceListener);
}
return false;
}
- public HashMap<SessionType, CopyOnWriteArrayList<ISdlServiceListener>> getServiceListeners(){
+ public HashMap<SessionType, CopyOnWriteArrayList<ISdlServiceListener>> getServiceListeners() {
return serviceListeners;
}
- public void setDesiredVideoParams(VideoStreamingParameters params){
+ public void setDesiredVideoParams(VideoStreamingParameters params) {
this.desiredVideoParams = params;
}
- public VideoStreamingParameters getAcceptedVideoParams(){
+ public VideoStreamingParameters getAcceptedVideoParams() {
return acceptedVideoParams;
}
@@ -278,18 +278,21 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
}
}
+
//To be implemented by child class
@Override
public abstract void onServiceStarted(SdlPacket packet, SessionType sessionType, int sessionID, Version version, boolean isEncrypted);
+
@Override
public abstract void onServiceEnded(SdlPacket packet, SessionType sessionType, int sessionID);
+
@Override
public abstract void onServiceError(SdlPacket packet, SessionType sessionType, int sessionID, String error);
@Override
public void onProtocolError(String info, Exception e) {
- DebugTool.logError(TAG,"on protocol error", e);
+ DebugTool.logError(TAG, "on protocol error", e);
}
@Override
@@ -316,6 +319,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
/**
* Returns the currently set desired video streaming parameters. If there haven't been any set,
* the default options will be returned and set for this instance.
+ *
* @return the desired video streaming parameters
*/
@Override
@@ -344,8 +348,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
@Override
public void onSecurityInitialized() {
- if (sdlProtocol != null && sdlSecurity != null)
- {
+ if (sdlProtocol != null && sdlSecurity != null) {
List<SessionType> list = sdlSecurity.getServiceList();
SessionType service;
@@ -355,7 +358,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
service = iter.next();
if (service != null)
- sdlProtocol.startService(service, (byte)this.sessionId, true);
+ sdlProtocol.startService(service, (byte) this.sessionId, true);
iter.remove();
}
@@ -363,18 +366,18 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializ
}
-
/**
* Check to see if a transport is available to start/use the supplied service.
+ *
* @param sessionType the session that should be checked for transport availability
* @return true if there is either a supported
- * transport currently connected or a transport is
- * available to connect with for the supplied service type.
- * <br>false if there is no
- * transport connected to support the service type in question and
- * no possibility in the foreseeable future.
+ * transport currently connected or a transport is
+ * available to connect with for the supplied service type.
+ * <br>false if there is no
+ * transport connected to support the service type in question and
+ * no possibility in the foreseeable future.
*/
- public boolean isTransportForServiceAvailable(SessionType sessionType){
- return sdlProtocol!=null && sdlProtocol.isTransportForServiceAvailable(sessionType);
+ public boolean isTransportForServiceAvailable(SessionType sessionType) {
+ return sdlProtocol != null && sdlProtocol.isTransportForServiceAvailable(sessionType);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/session/ISdlSessionListener.java b/base/src/main/java/com/smartdevicelink/session/ISdlSessionListener.java
index e43d08f10..180452997 100644
--- a/base/src/main/java/com/smartdevicelink/session/ISdlSessionListener.java
+++ b/base/src/main/java/com/smartdevicelink/session/ISdlSessionListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,41 +40,46 @@ import com.smartdevicelink.util.Version;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public interface ISdlSessionListener {
- /**
- * Called when a transport disconnects
- * @param info a human readable string including information on the disconnected transport
- * @param availablePrimary a boolean flag indicating if there is another transport that can
- * be used to connect with the SDL enabled device.
- * @param transportConfig the previously supplied transport config
- */
- void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig);
+ /**
+ * Called when a transport disconnects
+ *
+ * @param info a human readable string including information on the disconnected transport
+ * @param availablePrimary a boolean flag indicating if there is another transport that can
+ * be used to connect with the SDL enabled device.
+ * @param transportConfig the previously supplied transport config
+ */
+ void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig);
- /**
- * Called when an RPC message has been received from the connected SDL device
- * @param rpcMessage the RPC message that was received
- */
- void onRPCMessageReceived(RPCMessage rpcMessage);
+ /**
+ * Called when an RPC message has been received from the connected SDL device
+ *
+ * @param rpcMessage the RPC message that was received
+ */
+ void onRPCMessageReceived(RPCMessage rpcMessage);
- /**
- * Called to indicate that a session has started with the connected SDL device. This means the
- * RPC and Bulk service types have also been started.
- * @param sessionID session ID associated with the session that was established
- * @param version the protocol version that has been negotiated for this session
- */
- void onSessionStarted(int sessionID, Version version);
+ /**
+ * Called to indicate that a session has started with the connected SDL device. This means the
+ * RPC and Bulk service types have also been started.
+ *
+ * @param sessionID session ID associated with the session that was established
+ * @param version the protocol version that has been negotiated for this session
+ */
+ void onSessionStarted(int sessionID, Version version);
- /**
- * Called to indicate that the session that was previously established has now ended. This means
- * that all services previously started on this session are also closed.
- * @param sessionID the session ID that was assigned to this now closed session
- */
- void onSessionEnded( int sessionID);
+ /**
+ * Called to indicate that the session that was previously established has now ended. This means
+ * that all services previously started on this session are also closed.
+ *
+ * @param sessionID the session ID that was assigned to this now closed session
+ */
+ void onSessionEnded(int sessionID);
- /**
- * Called when an auth token has been received. This should always happen after the session
- * has been created.
- * @param authToken the actual auth token that has been stringified
- * @param sessionID the session ID that this auth token is associated with
- */
- void onAuthTokenReceived(String authToken, int sessionID);
+ /**
+ * Called when an auth token has been received. This should always happen after the session
+ * has been created.
+ *
+ * @param authToken the actual auth token that has been stringified
+ * @param sessionID the session ID that this auth token is associated with
+ */
+ void onAuthTokenReceived(String authToken, int sessionID);
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java b/base/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
index d7047ee76..b19a6cc0b 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -31,9 +31,9 @@
*/
package com.smartdevicelink.streaming;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.util.Version;
import java.io.IOException;
@@ -41,52 +41,52 @@ import java.io.InputStream;
abstract public class AbstractPacketizer {
- protected IStreamListener _streamListener;
- protected byte _rpcSessionID = 0;
+ protected IStreamListener _streamListener;
+ protected byte _rpcSessionID = 0;
- protected SessionType _serviceType;
- protected SdlSession _session;
- protected InputStream is;
- protected int bufferSize;
- protected byte[] buffer;
- protected RPCRequest _request = null;
- protected Version _wiproVersion = new Version("1.0.0");
+ protected SessionType _serviceType;
+ protected SdlSession _session;
+ protected InputStream is;
+ protected int bufferSize;
+ protected byte[] buffer;
+ protected RPCRequest _request = null;
+ protected Version _wiproVersion = new Version("1.0.0");
- public AbstractPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID, SdlSession session) throws IOException, IllegalArgumentException {
- this._streamListener = streamListener;
- this.is = is;
- _rpcSessionID = rpcSessionID;
- _serviceType = sType;
- this._session = session;
- if (this._session != null) {
- bufferSize = this._session.getMtu();
- buffer = new byte[bufferSize];
- }else{
- throw new IllegalArgumentException("Session variable is null");
- }
- }
+ public AbstractPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID, SdlSession session) throws IOException, IllegalArgumentException {
+ this._streamListener = streamListener;
+ this.is = is;
+ _rpcSessionID = rpcSessionID;
+ _serviceType = sType;
+ this._session = session;
+ if (this._session != null) {
+ bufferSize = this._session.getMtu();
+ buffer = new byte[bufferSize];
+ } else {
+ throw new IllegalArgumentException("Session variable is null");
+ }
+ }
- public AbstractPacketizer(IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version protocolVersion, SdlSession session) throws IOException, IllegalArgumentException {
- this._streamListener = streamListener;
- this.is = is;
- _rpcSessionID = rpcSessionID;
- _serviceType = sType;
- _request = request;
- _wiproVersion = protocolVersion;
- this._session = session;
- if (this._session != null) {
- bufferSize = this._session.getMtu();
- buffer = new byte[bufferSize];
- }else{
- throw new IllegalArgumentException("Session variable is null");
- }
- }
+ public AbstractPacketizer(IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version protocolVersion, SdlSession session) throws IOException, IllegalArgumentException {
+ this._streamListener = streamListener;
+ this.is = is;
+ _rpcSessionID = rpcSessionID;
+ _serviceType = sType;
+ _request = request;
+ _wiproVersion = protocolVersion;
+ this._session = session;
+ if (this._session != null) {
+ bufferSize = this._session.getMtu();
+ buffer = new byte[bufferSize];
+ } else {
+ throw new IllegalArgumentException("Session variable is null");
+ }
+ }
- public abstract void start() throws IOException;
+ public abstract void start() throws IOException;
- public abstract void stop();
+ public abstract void stop();
- public abstract void pause();
+ public abstract void pause();
- public abstract void resume();
+ public abstract void resume();
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/streaming/IStreamListener.java b/base/src/main/java/com/smartdevicelink/streaming/IStreamListener.java
index 998888bc5..61aa8f5fc 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/IStreamListener.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/IStreamListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,5 +37,5 @@ import com.smartdevicelink.protocol.ProtocolMessage;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public interface IStreamListener {
- void sendStreamPacket(ProtocolMessage pm);
+ void sendStreamPacket(ProtocolMessage pm);
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java
index bf69a792b..7be3cc038 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java
@@ -34,16 +34,16 @@ package com.smartdevicelink.streaming.audio;
* Enum for each type of audio streaming codec.
*/
public enum AudioStreamingCodec {
- /**
- * Linear-PCM without any compression.
- */
- LPCM;
+ /**
+ * Linear-PCM without any compression.
+ */
+ LPCM;
- public static AudioStreamingCodec valueForString(String value) {
- try {
- return valueOf(value);
- } catch (Exception e) {
- return null;
- }
- }
+ public static AudioStreamingCodec valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java
index 9845301a3..522a5eeb4 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java
@@ -35,31 +35,31 @@ package com.smartdevicelink.streaming.audio;
*/
@Deprecated
public class AudioStreamingLPCMParams extends AudioStreamingParams {
- /**
- * Sample format of linear PCM data.
- */
- public enum SampleFormat {
- /**
- * LPCM data is represented by 8-bit unsigned integers. Center point is 128.
- */
- LPCM_8BIT_UNSIGNED,
+ /**
+ * Sample format of linear PCM data.
+ */
+ public enum SampleFormat {
+ /**
+ * LPCM data is represented by 8-bit unsigned integers. Center point is 128.
+ */
+ LPCM_8BIT_UNSIGNED,
- /**
- * LPCM data is represented by 16-bit signed integers, in little endian.
- */
- LPCM_16BIT_SIGNED_LITTLE_ENDIAN,
- }
+ /**
+ * LPCM data is represented by 16-bit signed integers, in little endian.
+ */
+ LPCM_16BIT_SIGNED_LITTLE_ENDIAN,
+ }
- /**
- * Sample format in which app will provide LPCM data to
- * IAudioStreamListener.sendAudio()
- * <p>
- * This is reserved for future and not used right now.
- */
- public final SampleFormat sampleFormat;
+ /**
+ * Sample format in which app will provide LPCM data to
+ * IAudioStreamListener.sendAudio()
+ * <p>
+ * This is reserved for future and not used right now.
+ */
+ public final SampleFormat sampleFormat;
- public AudioStreamingLPCMParams(SampleFormat sampleFormat, int samplingRate, int channels) {
- super(samplingRate, channels);
- this.sampleFormat = sampleFormat;
- }
+ public AudioStreamingLPCMParams(SampleFormat sampleFormat, int samplingRate, int channels) {
+ super(samplingRate, channels);
+ this.sampleFormat = sampleFormat;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java
index f9181e7fe..2be71d4f8 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java
@@ -38,22 +38,22 @@ import androidx.annotation.RestrictTo;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class AudioStreamingParams {
- /**
- * Sampling rate in Hz, e.g. 44100
- * <p>
- * This is reserved for future and not used right now.
- */
- public final int samplingRate;
+ /**
+ * Sampling rate in Hz, e.g. 44100
+ * <p>
+ * This is reserved for future and not used right now.
+ */
+ public final int samplingRate;
- /**
- * Number of channels in the audio stream
- * <p>
- * This is reserved for future and not used right now.
- */
- public final int channels;
+ /**
+ * Number of channels in the audio stream
+ * <p>
+ * This is reserved for future and not used right now.
+ */
+ public final int channels;
- public AudioStreamingParams(int samplingRate, int channels) {
- this.samplingRate = samplingRate;
- this.channels = channels;
- }
+ public AudioStreamingParams(int samplingRate, int channels) {
+ this.samplingRate = samplingRate;
+ this.channels = channels;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/audio/IAudioStreamListener.java b/base/src/main/java/com/smartdevicelink/streaming/audio/IAudioStreamListener.java
index 20f758969..cc3e3bda4 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/audio/IAudioStreamListener.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/audio/IAudioStreamListener.java
@@ -38,37 +38,37 @@ import java.nio.ByteBuffer;
* A listener that receives audio streaming data from app.
*/
public interface IAudioStreamListener {
- /**
- * Sends a chunk of audio data to SDL Core.
- * <p>
- * Note: this method must not be called after SdlProxyBase.endAudioStream() is called.
- *
- * @param data Byte array containing audio data
- * @param offset Starting offset in 'data'
- * @param length Length of the data
- * @param presentationTimeUs (Reserved for future use) Presentation timestamp (PTS) of the
- * last audio sample data included in this chunk, in microseconds.
- * It must be greater than the previous timestamp.
- * Specify -1 if unknown.
- * @throws ArrayIndexOutOfBoundsException When offset does not satisfy
- * {@code 0 <= offset && offset <= data.length}
- * or length does not satisfy
- * {@code 0 < length && offset + length <= data.length}
- */
- void sendAudio(byte[] data, int offset, int length, long presentationTimeUs)
- throws ArrayIndexOutOfBoundsException;
+ /**
+ * Sends a chunk of audio data to SDL Core.
+ * <p>
+ * Note: this method must not be called after SdlProxyBase.endAudioStream() is called.
+ *
+ * @param data Byte array containing audio data
+ * @param offset Starting offset in 'data'
+ * @param length Length of the data
+ * @param presentationTimeUs (Reserved for future use) Presentation timestamp (PTS) of the
+ * last audio sample data included in this chunk, in microseconds.
+ * It must be greater than the previous timestamp.
+ * Specify -1 if unknown.
+ * @throws ArrayIndexOutOfBoundsException When offset does not satisfy
+ * {@code 0 <= offset && offset <= data.length}
+ * or length does not satisfy
+ * {@code 0 < length && offset + length <= data.length}
+ */
+ void sendAudio(byte[] data, int offset, int length, long presentationTimeUs)
+ throws ArrayIndexOutOfBoundsException;
- /**
- * Sends a chunk of audio data to SDL Core.
- * <p>
- * Note: this method must not be called after SdlProxyBase.endAudioStream() is called.
- *
- * @param data Data chunk to send. Its position will be updated upon return.
- * @param presentationTimeUs (Reserved for future use) Presentation timestamp (PTS) of the
- * last audio sample data included in this chunk, in microseconds.
- * It must be greater than the previous timestamp.
- * Specify -1 if unknown.
- * @param completionListener A completion listener that informs when the audio file is played
- */
- void sendAudio(ByteBuffer data, long presentationTimeUs, CompletionListener completionListener);
+ /**
+ * Sends a chunk of audio data to SDL Core.
+ * <p>
+ * Note: this method must not be called after SdlProxyBase.endAudioStream() is called.
+ *
+ * @param data Data chunk to send. Its position will be updated upon return.
+ * @param presentationTimeUs (Reserved for future use) Presentation timestamp (PTS) of the
+ * last audio sample data included in this chunk, in microseconds.
+ * It must be greater than the previous timestamp.
+ * Specify -1 if unknown.
+ * @param completionListener A completion listener that informs when the audio file is played
+ */
+ void sendAudio(ByteBuffer data, long presentationTimeUs, CompletionListener completionListener);
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/IVideoStreamListener.java b/base/src/main/java/com/smartdevicelink/streaming/video/IVideoStreamListener.java
index 755ad7948..b24fb97b2 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/IVideoStreamListener.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/IVideoStreamListener.java
@@ -37,54 +37,54 @@ import java.nio.ByteBuffer;
*/
public interface IVideoStreamListener {
- /**
- * Sends a chunk of data which represents a frame to SDL Core.
- * <p>
- * The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it
- * should contain a single video frame, and it should start and end on frame boundaries.
- * Please refer to https://developer.android.com/reference/android/media/MediaCodec.html
- * Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B
- * format). This isn't explained in the document above, but MediaCodec does output in this
- * format.
- * <p>
- * In short, you can just provide MediaCodec's data outputs to this method without tweaking
- * any data.
- * <p>
- * Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
- *
- * @param data Byte array containing a video frame
- * @param offset Starting offset in 'data'
- * @param length Length of the data
- * @param presentationTimeUs Presentation timestamp (PTS) of this frame, in microseconds.
- * It must be greater than the previous timestamp.
- * Specify -1 if unknown.
- * @throws ArrayIndexOutOfBoundsException When offset does not satisfy
- * {@code 0 <= offset && offset <= data.length}
- * or length does not satisfy
- * {@code 0 < length && offset + length <= data.length}
- */
- void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
- throws ArrayIndexOutOfBoundsException;
+ /**
+ * Sends a chunk of data which represents a frame to SDL Core.
+ * <p>
+ * The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it
+ * should contain a single video frame, and it should start and end on frame boundaries.
+ * Please refer to https://developer.android.com/reference/android/media/MediaCodec.html
+ * Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B
+ * format). This isn't explained in the document above, but MediaCodec does output in this
+ * format.
+ * <p>
+ * In short, you can just provide MediaCodec's data outputs to this method without tweaking
+ * any data.
+ * <p>
+ * Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
+ *
+ * @param data Byte array containing a video frame
+ * @param offset Starting offset in 'data'
+ * @param length Length of the data
+ * @param presentationTimeUs Presentation timestamp (PTS) of this frame, in microseconds.
+ * It must be greater than the previous timestamp.
+ * Specify -1 if unknown.
+ * @throws ArrayIndexOutOfBoundsException When offset does not satisfy
+ * {@code 0 <= offset && offset <= data.length}
+ * or length does not satisfy
+ * {@code 0 < length && offset + length <= data.length}
+ */
+ void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
+ throws ArrayIndexOutOfBoundsException;
- /**
- * Sends chunks of data which represent a frame to SDL Core.
- * <p>
- * The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it
- * should contain a single video frame, and it should start and end on frame boundaries.
- * Please refer to https://developer.android.com/reference/android/media/MediaCodec.html
- * Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B
- * format). This isn't explained in the document above, but MediaCodec does output in this
- * format.
- * <p>
- * In short, you can just provide MediaCodec's data outputs to this method without tweaking
- * any data.
- * <p>
- * Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
- *
- * @param data Data chunk to send. Its position will be updated upon return.
- * @param presentationTimeUs Presentation timestamp (PTS) of this frame, in microseconds.
- * It must be greater than the previous timestamp.
- * Specify -1 if unknown.
- */
- void sendFrame(ByteBuffer data, long presentationTimeUs);
+ /**
+ * Sends chunks of data which represent a frame to SDL Core.
+ * <p>
+ * The format of the chunk should align with MediaCodec's "Compressed Buffer" format, i.e. it
+ * should contain a single video frame, and it should start and end on frame boundaries.
+ * Please refer to https://developer.android.com/reference/android/media/MediaCodec.html
+ * Also, for H.264 codec case the stream must be in byte-stream format (also known as Annex-B
+ * format). This isn't explained in the document above, but MediaCodec does output in this
+ * format.
+ * <p>
+ * In short, you can just provide MediaCodec's data outputs to this method without tweaking
+ * any data.
+ * <p>
+ * Note: this method must not be called after SdlProxyBase.endVideoStream() is called.
+ *
+ * @param data Data chunk to send. Its position will be updated upon return.
+ * @param presentationTimeUs Presentation timestamp (PTS) of this frame, in microseconds.
+ * It must be greater than the previous timestamp.
+ * Specify -1 if unknown.
+ */
+ void sendFrame(ByteBuffer data, long presentationTimeUs);
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java b/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
index 6a98c879e..83c43d817 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
@@ -32,9 +32,9 @@ package com.smartdevicelink.streaming.video;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
@@ -64,442 +64,443 @@ import java.util.concurrent.LinkedBlockingQueue;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class RTPH264Packetizer extends AbstractPacketizer implements IVideoStreamListener, Runnable {
- // Approximate size of data that mOutputQueue can hold in bytes.
- // By adding a buffer, we accept underlying transport being stuck for a short time. By setting
- // a limit of the buffer size, we avoid buffer overflows when underlying transport is too slow.
- private static final int MAX_QUEUE_SIZE = 256 * 1024;
-
- private static final int FRAME_LENGTH_LEN = 2;
- private static final int MAX_RTP_PACKET_SIZE = 65535; // because length field is two bytes (RFC 4571)
- private static final int RTP_HEADER_LEN = 12;
- private static final byte DEFAULT_RTP_PAYLOAD_TYPE = 96;
- private static final int FU_INDICATOR_LEN = 1;
- private static final int FU_HEADER_LEN = 1;
- private static final byte TYPE_FU_A = 28;
-
- // To align with StreamPacketizer class
- private final static int TLS_MAX_RECORD_SIZE = 16384;
- private final static int TLS_RECORD_HEADER_SIZE = 5;
- private final static int TLS_RECORD_MES_AUTH_CDE_SIZE = 32;
- private final static int TLS_MAX_RECORD_PADDING_SIZE = 256;
-
- private final static int MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE =
- TLS_MAX_RECORD_SIZE - TLS_RECORD_HEADER_SIZE - TLS_RECORD_MES_AUTH_CDE_SIZE- TLS_MAX_RECORD_PADDING_SIZE;
-
- private boolean mServiceProtected;
- private Thread mThread;
- private BlockingQueue<ByteBuffer> mOutputQueue;
- private volatile boolean mPaused;
- private boolean mWaitForIDR;
- private NALUnitReader mNALUnitReader;
- private byte mPayloadType = 0;
- private int mSSRC = 0;
- private char mSequenceNum = 0;
- private int mInitialPTS = 0;
-
- /**
- * Constructor
- *
- * @param streamListener The listener which this packetizer outputs SDL frames to
- * @param serviceType The value of "Service Type" field in SDL frames
- * @param sessionID The value of "Session ID" field in SDL frames
- * @param session The SdlSession instance that this packetizer belongs to
- */
- public RTPH264Packetizer(IStreamListener streamListener,
- SessionType serviceType, byte sessionID, SdlSession session) throws IOException {
-
- super(streamListener, null, serviceType, sessionID, session);
-
- mServiceProtected = session.isServiceProtected(_serviceType);
-
- bufferSize = (int)this._session.getMtu(SessionType.NAV);
- if (bufferSize == 0) {
- // fail safe
- bufferSize = MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE;
- }
- if (mServiceProtected && bufferSize > MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE) {
- bufferSize = MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE;
- }
-
- mOutputQueue = new LinkedBlockingQueue<>(MAX_QUEUE_SIZE / bufferSize);
- mNALUnitReader = new NALUnitReader();
- mPayloadType = DEFAULT_RTP_PAYLOAD_TYPE;
-
- Random r = new Random();
- mSSRC = r.nextInt();
-
- // initial value of the sequence number and timestamp should be random ([5.1] in RFC3550)
- mSequenceNum = (char)r.nextInt(65536);
- mInitialPTS = r.nextInt();
- }
-
- /**
- * Sets the Payload Type (PT) of RTP header field.
- *
- * Use this method if PT needs to be specified. The value should be between 0 and 127.
- * Otherwise, a default value (96) is used.
- *
- * @param type A value indicating the Payload Type
- */
- public void setPayloadType(byte type) {
- if (type >= 0 && type <= 127) {
- mPayloadType = type;
- } else {
- mPayloadType = DEFAULT_RTP_PAYLOAD_TYPE;
- }
- }
-
- /**
- * Sets the SSRC of RTP header field.
- *
- * Use this method if SSRC needs to be specified. Otherwise, a random value is generated and
- * used.
- *
- * @param ssrc An integer value representing SSRC
- */
- public void setSSRC(int ssrc) {
- mSSRC = ssrc;
- }
-
- /**
- * Starts this packetizer.
- *
- * It is recommended that the video encoder is started after the packetizer is started.
- */
- @Override
- public void start() throws IOException {
- if (mThread != null) {
- return;
- }
-
- mThread = new Thread(this);
- mThread.start();
- }
-
- /**
- * Stops this packetizer.
- *
- * It is recommended that the video encoder is stopped prior to the packetizer.
- */
- @Override
- public void stop() {
- if (mThread == null) {
- return;
- }
-
- mThread.interrupt();
- mThread = null;
-
- mPaused = false;
- mWaitForIDR = false;
- mOutputQueue.clear();
- }
-
- /**
- * Pauses this packetizer.
- *
- * This pauses the packetizer but does not pause the video encoder.
- */
- @Override
- public void pause() {
- mPaused = true;
- }
-
- /**
- * Resumes this packetizer.
- */
- @Override
- public void resume() {
- mWaitForIDR = true;
- mPaused = false;
- }
-
- /**
- * The thread routine.
- */
- public void run() {
-
- while (mThread != null && !mThread.isInterrupted()) {
- ByteBuffer frame;
- try {
- frame = mOutputQueue.take();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- break;
- }
-
- while (frame.hasRemaining()) {
- int len = Math.min(frame.remaining(), bufferSize);
-
- ProtocolMessage pm = new ProtocolMessage();
- pm.setSessionID(_rpcSessionID);
- pm.setSessionType(_serviceType);
- pm.setFunctionID(0);
- pm.setCorrID(0);
- pm.setData(frame.array(), frame.arrayOffset() + frame.position(), len);
- pm.setPayloadProtected(mServiceProtected);
-
- _streamListener.sendStreamPacket(pm);
-
- frame.position(frame.position() + len);
- }
- }
-
- // XXX: This is added to sync with StreamPacketizer. Actually it shouldn't be here since
- // it's confusing that a packetizer takes care of End Service request.
- if (_session != null) {
- _session.endService(_serviceType);
- }
- }
-
- /**
- * Called by the app and encoder.
- *
- * @see IVideoStreamListener#sendFrame(byte[], int, int, long)
- */
- @Override
- public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
- throws ArrayIndexOutOfBoundsException {
- mNALUnitReader.init(data, offset, length);
- onEncoderOutput(mNALUnitReader, presentationTimeUs);
- }
-
- /**
- * Called by the app and encoder.
- *
- * @see IVideoStreamListener#sendFrame(ByteBuffer, long)
- */
- @Override
- public void sendFrame(ByteBuffer data, long presentationTimeUs) {
- mNALUnitReader.init(data);
- onEncoderOutput(mNALUnitReader, presentationTimeUs);
- }
-
- private void onEncoderOutput(NALUnitReader nalUnitReader, long ptsInUs) {
- if (mPaused) {
- return;
- }
-
- ByteBuffer nalUnit;
-
- while ((nalUnit = nalUnitReader.getNalUnit()) != null) {
- if (mWaitForIDR) {
- if (isIDR(nalUnit)) {
- mWaitForIDR = false;
- } else {
- continue;
- }
- }
- outputRTPFrames(nalUnit, ptsInUs, nalUnitReader.hasConsumedAll());
- }
- }
-
- private boolean outputRTPFrames(ByteBuffer nalUnit, long ptsInUs, boolean isLast) {
- if (RTP_HEADER_LEN + nalUnit.remaining() > MAX_RTP_PACKET_SIZE) {
- // Split into multiple Fragmentation Units ([5.8] in RFC 6184)
- byte firstByte = nalUnit.get();
- boolean firstFragment = true;
- boolean lastFragment = false;
-
- while (nalUnit.remaining() > 0) {
- int payloadLength = MAX_RTP_PACKET_SIZE - (RTP_HEADER_LEN + FU_INDICATOR_LEN + FU_HEADER_LEN);
- if (nalUnit.remaining() <= payloadLength) {
- payloadLength = nalUnit.remaining();
- lastFragment = true;
- }
-
- ByteBuffer frame = allocateRTPFrame(FU_INDICATOR_LEN + FU_HEADER_LEN + payloadLength,
- false, isLast, ptsInUs);
- // FU indicator
- frame.put((byte)((firstByte & 0xE0) | TYPE_FU_A));
- // FU header
- frame.put((byte)((firstFragment ? 0x80 : lastFragment ? 0x40 : 0) | (firstByte & 0x1F)));
- // FU payload
- frame.put(nalUnit.array(), nalUnit.position(), payloadLength);
- nalUnit.position(nalUnit.position() + payloadLength);
- frame.flip();
-
- try {
- mOutputQueue.put(frame);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return false;
- }
-
- firstFragment = false;
- }
- } else {
- // Use Single NAL Unit Packet ([5.6] in RFC 6184)
- ByteBuffer frame = allocateRTPFrame(nalUnit.remaining(), false, isLast, ptsInUs);
- frame.put(nalUnit);
- frame.flip();
-
- try {
- mOutputQueue.put(frame);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return false;
- }
- }
-
- return true;
- }
-
- private ByteBuffer allocateRTPFrame(int rtpPayloadLen,
- boolean hasPadding, boolean isLast, long ptsInUs) {
- if (rtpPayloadLen <= 0) {
- throw new IllegalArgumentException("Invalid rtpPayloadLen value: " + rtpPayloadLen);
- }
- if (ptsInUs < 0) {
- throw new IllegalArgumentException("Invalid ptsInUs value: " + ptsInUs);
- }
-
- int packetLength = RTP_HEADER_LEN + rtpPayloadLen;
- if (packetLength > MAX_RTP_PACKET_SIZE) {
- throw new IllegalArgumentException("Invalid rtpPayloadLen value: " + rtpPayloadLen);
- }
- int ptsIn90kHz = (int)(ptsInUs * 9 / 100) + mInitialPTS;
-
- ByteBuffer frame = ByteBuffer.allocate(FRAME_LENGTH_LEN + packetLength);
- frame.order(ByteOrder.BIG_ENDIAN);
- frame.putShort((short)packetLength);
-
- // Version = 2, Padding = hasPadding, Extension = 0, CSRC count = 0
- frame.put((byte)(0x80 | (hasPadding ? 0x20 : 0)))
- // Marker = isLast, Payload type = mPayloadType
- .put((byte)((isLast ? 0x80 : 0) | (mPayloadType & 0x7F)))
- .putChar(mSequenceNum)
- .putInt(ptsIn90kHz)
- .putInt(mSSRC);
-
- if (frame.position() != FRAME_LENGTH_LEN + RTP_HEADER_LEN) {
- throw new RuntimeException("Data size in ByteBuffer mismatch");
- }
-
- mSequenceNum++;
- return frame;
- }
-
- private static boolean isIDR(ByteBuffer nalUnit) {
- if (nalUnit == null || !nalUnit.hasRemaining()) {
- throw new IllegalArgumentException("Invalid nalUnit arg");
- }
-
- byte nalUnitType = (byte)(nalUnit.get(nalUnit.position()) & 0x1F);
- return nalUnitType == 5;
- }
-
-
- private static int[] SKIP_TABLE = new int[256];
- static {
- // Sunday's quick search algorithm is used to find the start code.
- // Prepare the table (SKIP_TABLE[0] = 2, SKIP_TABLE[1] = 1 and other elements will be 4).
- byte[] NAL_UNIT_START_CODE = {0, 0, 1};
- int searchStringLen = NAL_UNIT_START_CODE.length;
- for (int i = 0; i < SKIP_TABLE.length; i++) {
- SKIP_TABLE[i] = searchStringLen + 1;
- }
- for (int i = 0; i < searchStringLen; i++) {
- SKIP_TABLE[NAL_UNIT_START_CODE[i] & 0xFF] = searchStringLen - i;
- }
- }
-
- private class NALUnitReader {
- private byte[] mData;
- private int mOffset;
- private int mLimit;
-
- NALUnitReader() {
- }
-
- void init(byte[] data) {
- mData = data;
- mOffset = 0;
- mLimit = data.length;
- }
-
- void init(byte[] data, int offset, int length) throws ArrayIndexOutOfBoundsException {
- if (offset < 0 || offset > data.length || length <= 0 || offset + length > data.length) {
- throw new ArrayIndexOutOfBoundsException();
- }
- mData = data;
- mOffset = offset;
- mLimit = offset + length;
- }
-
- void init(ByteBuffer data) {
- if (data == null || data.remaining() == 0) {
- mData = null;
- mOffset = 0;
- mLimit = 0;
- return;
- }
-
- if (data.hasArray()) {
- mData = data.array();
- mOffset = data.position() + data.arrayOffset();
- mLimit = mOffset + data.remaining();
-
- // mark the buffer as consumed
- data.position(data.position() + data.remaining());
- } else {
- byte[] buffer = new byte[data.remaining()];
- data.get(buffer);
-
- mData = buffer;
- mOffset = 0;
- mLimit = buffer.length;
- }
- }
-
- ByteBuffer getNalUnit() {
- if (hasConsumedAll()) {
- return null;
- }
-
- int pos = mOffset;
- int start = -1;
-
- while (mLimit - pos >= 3) {
- if (mData[pos] == 0 && mData[pos+1] == 0 && mData[pos+2] == 1) {
- if (start != -1) {
- // We've found a start code, a NAL unit and then another start code.
- mOffset = pos;
- // remove 0x00s in front of the start code
- while (pos > start && mData[pos-1] == 0) {
- pos--;
- }
- if (pos > start) {
- return ByteBuffer.wrap(mData, start, pos - start);
- } else {
- // No NAL unit between two start codes?! Forget it and search for
- // another start code.
- pos = mOffset;
- }
- }
- // This is the first start code.
- pos += 3;
- start = pos;
- } else {
- try {
- pos += SKIP_TABLE[mData[pos+3] & 0xFF];
- } catch (ArrayIndexOutOfBoundsException e) {
- break;
- }
- }
- }
-
- mOffset = mLimit;
- if (start != -1 && mLimit > start) {
- // We've found a start code and then reached to the end of array.
- return ByteBuffer.wrap(mData, start, mLimit - start);
- }
- // A start code was not found
- return null;
- }
-
- boolean hasConsumedAll() {
- return (mData == null) || (mLimit - mOffset < 4);
- }
- }
+ // Approximate size of data that mOutputQueue can hold in bytes.
+ // By adding a buffer, we accept underlying transport being stuck for a short time. By setting
+ // a limit of the buffer size, we avoid buffer overflows when underlying transport is too slow.
+ private static final int MAX_QUEUE_SIZE = 256 * 1024;
+
+ private static final int FRAME_LENGTH_LEN = 2;
+ private static final int MAX_RTP_PACKET_SIZE = 65535; // because length field is two bytes (RFC 4571)
+ private static final int RTP_HEADER_LEN = 12;
+ private static final byte DEFAULT_RTP_PAYLOAD_TYPE = 96;
+ private static final int FU_INDICATOR_LEN = 1;
+ private static final int FU_HEADER_LEN = 1;
+ private static final byte TYPE_FU_A = 28;
+
+ // To align with StreamPacketizer class
+ private final static int TLS_MAX_RECORD_SIZE = 16384;
+ private final static int TLS_RECORD_HEADER_SIZE = 5;
+ private final static int TLS_RECORD_MES_AUTH_CDE_SIZE = 32;
+ private final static int TLS_MAX_RECORD_PADDING_SIZE = 256;
+
+ private final static int MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE =
+ TLS_MAX_RECORD_SIZE - TLS_RECORD_HEADER_SIZE - TLS_RECORD_MES_AUTH_CDE_SIZE - TLS_MAX_RECORD_PADDING_SIZE;
+
+ private boolean mServiceProtected;
+ private Thread mThread;
+ private BlockingQueue<ByteBuffer> mOutputQueue;
+ private volatile boolean mPaused;
+ private boolean mWaitForIDR;
+ private NALUnitReader mNALUnitReader;
+ private byte mPayloadType = 0;
+ private int mSSRC = 0;
+ private char mSequenceNum = 0;
+ private int mInitialPTS = 0;
+
+ /**
+ * Constructor
+ *
+ * @param streamListener The listener which this packetizer outputs SDL frames to
+ * @param serviceType The value of "Service Type" field in SDL frames
+ * @param sessionID The value of "Session ID" field in SDL frames
+ * @param session The SdlSession instance that this packetizer belongs to
+ */
+ public RTPH264Packetizer(IStreamListener streamListener,
+ SessionType serviceType, byte sessionID, SdlSession session) throws IOException {
+
+ super(streamListener, null, serviceType, sessionID, session);
+
+ mServiceProtected = session.isServiceProtected(_serviceType);
+
+ bufferSize = (int) this._session.getMtu(SessionType.NAV);
+ if (bufferSize == 0) {
+ // fail safe
+ bufferSize = MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE;
+ }
+ if (mServiceProtected && bufferSize > MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE) {
+ bufferSize = MAX_DATA_SIZE_FOR_ENCRYPTED_SERVICE;
+ }
+
+ mOutputQueue = new LinkedBlockingQueue<>(MAX_QUEUE_SIZE / bufferSize);
+ mNALUnitReader = new NALUnitReader();
+ mPayloadType = DEFAULT_RTP_PAYLOAD_TYPE;
+
+ Random r = new Random();
+ mSSRC = r.nextInt();
+
+ // initial value of the sequence number and timestamp should be random ([5.1] in RFC3550)
+ mSequenceNum = (char) r.nextInt(65536);
+ mInitialPTS = r.nextInt();
+ }
+
+ /**
+ * Sets the Payload Type (PT) of RTP header field.
+ * <p>
+ * Use this method if PT needs to be specified. The value should be between 0 and 127.
+ * Otherwise, a default value (96) is used.
+ *
+ * @param type A value indicating the Payload Type
+ */
+ public void setPayloadType(byte type) {
+ if (type >= 0 && type <= 127) {
+ mPayloadType = type;
+ } else {
+ mPayloadType = DEFAULT_RTP_PAYLOAD_TYPE;
+ }
+ }
+
+ /**
+ * Sets the SSRC of RTP header field.
+ * <p>
+ * Use this method if SSRC needs to be specified. Otherwise, a random value is generated and
+ * used.
+ *
+ * @param ssrc An integer value representing SSRC
+ */
+ public void setSSRC(int ssrc) {
+ mSSRC = ssrc;
+ }
+
+ /**
+ * Starts this packetizer.
+ * <p>
+ * It is recommended that the video encoder is started after the packetizer is started.
+ */
+ @Override
+ public void start() throws IOException {
+ if (mThread != null) {
+ return;
+ }
+
+ mThread = new Thread(this);
+ mThread.start();
+ }
+
+ /**
+ * Stops this packetizer.
+ * <p>
+ * It is recommended that the video encoder is stopped prior to the packetizer.
+ */
+ @Override
+ public void stop() {
+ if (mThread == null) {
+ return;
+ }
+
+ mThread.interrupt();
+ mThread = null;
+
+ mPaused = false;
+ mWaitForIDR = false;
+ mOutputQueue.clear();
+ }
+
+ /**
+ * Pauses this packetizer.
+ * <p>
+ * This pauses the packetizer but does not pause the video encoder.
+ */
+ @Override
+ public void pause() {
+ mPaused = true;
+ }
+
+ /**
+ * Resumes this packetizer.
+ */
+ @Override
+ public void resume() {
+ mWaitForIDR = true;
+ mPaused = false;
+ }
+
+ /**
+ * The thread routine.
+ */
+ public void run() {
+
+ while (mThread != null && !mThread.isInterrupted()) {
+ ByteBuffer frame;
+ try {
+ frame = mOutputQueue.take();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+
+ while (frame.hasRemaining()) {
+ int len = Math.min(frame.remaining(), bufferSize);
+
+ ProtocolMessage pm = new ProtocolMessage();
+ pm.setSessionID(_rpcSessionID);
+ pm.setSessionType(_serviceType);
+ pm.setFunctionID(0);
+ pm.setCorrID(0);
+ pm.setData(frame.array(), frame.arrayOffset() + frame.position(), len);
+ pm.setPayloadProtected(mServiceProtected);
+
+ _streamListener.sendStreamPacket(pm);
+
+ frame.position(frame.position() + len);
+ }
+ }
+
+ // XXX: This is added to sync with StreamPacketizer. Actually it shouldn't be here since
+ // it's confusing that a packetizer takes care of End Service request.
+ if (_session != null) {
+ _session.endService(_serviceType);
+ }
+ }
+
+ /**
+ * Called by the app and encoder.
+ *
+ * @see IVideoStreamListener#sendFrame(byte[], int, int, long)
+ */
+ @Override
+ public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs)
+ throws ArrayIndexOutOfBoundsException {
+ mNALUnitReader.init(data, offset, length);
+ onEncoderOutput(mNALUnitReader, presentationTimeUs);
+ }
+
+ /**
+ * Called by the app and encoder.
+ *
+ * @see IVideoStreamListener#sendFrame(ByteBuffer, long)
+ */
+ @Override
+ public void sendFrame(ByteBuffer data, long presentationTimeUs) {
+ mNALUnitReader.init(data);
+ onEncoderOutput(mNALUnitReader, presentationTimeUs);
+ }
+
+ private void onEncoderOutput(NALUnitReader nalUnitReader, long ptsInUs) {
+ if (mPaused) {
+ return;
+ }
+
+ ByteBuffer nalUnit;
+
+ while ((nalUnit = nalUnitReader.getNalUnit()) != null) {
+ if (mWaitForIDR) {
+ if (isIDR(nalUnit)) {
+ mWaitForIDR = false;
+ } else {
+ continue;
+ }
+ }
+ outputRTPFrames(nalUnit, ptsInUs, nalUnitReader.hasConsumedAll());
+ }
+ }
+
+ private boolean outputRTPFrames(ByteBuffer nalUnit, long ptsInUs, boolean isLast) {
+ if (RTP_HEADER_LEN + nalUnit.remaining() > MAX_RTP_PACKET_SIZE) {
+ // Split into multiple Fragmentation Units ([5.8] in RFC 6184)
+ byte firstByte = nalUnit.get();
+ boolean firstFragment = true;
+ boolean lastFragment = false;
+
+ while (nalUnit.remaining() > 0) {
+ int payloadLength = MAX_RTP_PACKET_SIZE - (RTP_HEADER_LEN + FU_INDICATOR_LEN + FU_HEADER_LEN);
+ if (nalUnit.remaining() <= payloadLength) {
+ payloadLength = nalUnit.remaining();
+ lastFragment = true;
+ }
+
+ ByteBuffer frame = allocateRTPFrame(FU_INDICATOR_LEN + FU_HEADER_LEN + payloadLength,
+ false, isLast, ptsInUs);
+ // FU indicator
+ frame.put((byte) ((firstByte & 0xE0) | TYPE_FU_A));
+ // FU header
+ frame.put((byte) ((firstFragment ? 0x80 : lastFragment ? 0x40 : 0) | (firstByte & 0x1F)));
+ // FU payload
+ frame.put(nalUnit.array(), nalUnit.position(), payloadLength);
+ nalUnit.position(nalUnit.position() + payloadLength);
+ frame.flip();
+
+ try {
+ mOutputQueue.put(frame);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return false;
+ }
+
+ firstFragment = false;
+ }
+ } else {
+ // Use Single NAL Unit Packet ([5.6] in RFC 6184)
+ ByteBuffer frame = allocateRTPFrame(nalUnit.remaining(), false, isLast, ptsInUs);
+ frame.put(nalUnit);
+ frame.flip();
+
+ try {
+ mOutputQueue.put(frame);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private ByteBuffer allocateRTPFrame(int rtpPayloadLen,
+ boolean hasPadding, boolean isLast, long ptsInUs) {
+ if (rtpPayloadLen <= 0) {
+ throw new IllegalArgumentException("Invalid rtpPayloadLen value: " + rtpPayloadLen);
+ }
+ if (ptsInUs < 0) {
+ throw new IllegalArgumentException("Invalid ptsInUs value: " + ptsInUs);
+ }
+
+ int packetLength = RTP_HEADER_LEN + rtpPayloadLen;
+ if (packetLength > MAX_RTP_PACKET_SIZE) {
+ throw new IllegalArgumentException("Invalid rtpPayloadLen value: " + rtpPayloadLen);
+ }
+ int ptsIn90kHz = (int) (ptsInUs * 9 / 100) + mInitialPTS;
+
+ ByteBuffer frame = ByteBuffer.allocate(FRAME_LENGTH_LEN + packetLength);
+ frame.order(ByteOrder.BIG_ENDIAN);
+ frame.putShort((short) packetLength);
+
+ // Version = 2, Padding = hasPadding, Extension = 0, CSRC count = 0
+ frame.put((byte) (0x80 | (hasPadding ? 0x20 : 0)))
+ // Marker = isLast, Payload type = mPayloadType
+ .put((byte) ((isLast ? 0x80 : 0) | (mPayloadType & 0x7F)))
+ .putChar(mSequenceNum)
+ .putInt(ptsIn90kHz)
+ .putInt(mSSRC);
+
+ if (frame.position() != FRAME_LENGTH_LEN + RTP_HEADER_LEN) {
+ throw new RuntimeException("Data size in ByteBuffer mismatch");
+ }
+
+ mSequenceNum++;
+ return frame;
+ }
+
+ private static boolean isIDR(ByteBuffer nalUnit) {
+ if (nalUnit == null || !nalUnit.hasRemaining()) {
+ throw new IllegalArgumentException("Invalid nalUnit arg");
+ }
+
+ byte nalUnitType = (byte) (nalUnit.get(nalUnit.position()) & 0x1F);
+ return nalUnitType == 5;
+ }
+
+
+ private static int[] SKIP_TABLE = new int[256];
+
+ static {
+ // Sunday's quick search algorithm is used to find the start code.
+ // Prepare the table (SKIP_TABLE[0] = 2, SKIP_TABLE[1] = 1 and other elements will be 4).
+ byte[] NAL_UNIT_START_CODE = {0, 0, 1};
+ int searchStringLen = NAL_UNIT_START_CODE.length;
+ for (int i = 0; i < SKIP_TABLE.length; i++) {
+ SKIP_TABLE[i] = searchStringLen + 1;
+ }
+ for (int i = 0; i < searchStringLen; i++) {
+ SKIP_TABLE[NAL_UNIT_START_CODE[i] & 0xFF] = searchStringLen - i;
+ }
+ }
+
+ private class NALUnitReader {
+ private byte[] mData;
+ private int mOffset;
+ private int mLimit;
+
+ NALUnitReader() {
+ }
+
+ void init(byte[] data) {
+ mData = data;
+ mOffset = 0;
+ mLimit = data.length;
+ }
+
+ void init(byte[] data, int offset, int length) throws ArrayIndexOutOfBoundsException {
+ if (offset < 0 || offset > data.length || length <= 0 || offset + length > data.length) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ mData = data;
+ mOffset = offset;
+ mLimit = offset + length;
+ }
+
+ void init(ByteBuffer data) {
+ if (data == null || data.remaining() == 0) {
+ mData = null;
+ mOffset = 0;
+ mLimit = 0;
+ return;
+ }
+
+ if (data.hasArray()) {
+ mData = data.array();
+ mOffset = data.position() + data.arrayOffset();
+ mLimit = mOffset + data.remaining();
+
+ // mark the buffer as consumed
+ data.position(data.position() + data.remaining());
+ } else {
+ byte[] buffer = new byte[data.remaining()];
+ data.get(buffer);
+
+ mData = buffer;
+ mOffset = 0;
+ mLimit = buffer.length;
+ }
+ }
+
+ ByteBuffer getNalUnit() {
+ if (hasConsumedAll()) {
+ return null;
+ }
+
+ int pos = mOffset;
+ int start = -1;
+
+ while (mLimit - pos >= 3) {
+ if (mData[pos] == 0 && mData[pos + 1] == 0 && mData[pos + 2] == 1) {
+ if (start != -1) {
+ // We've found a start code, a NAL unit and then another start code.
+ mOffset = pos;
+ // remove 0x00s in front of the start code
+ while (pos > start && mData[pos - 1] == 0) {
+ pos--;
+ }
+ if (pos > start) {
+ return ByteBuffer.wrap(mData, start, pos - start);
+ } else {
+ // No NAL unit between two start codes?! Forget it and search for
+ // another start code.
+ pos = mOffset;
+ }
+ }
+ // This is the first start code.
+ pos += 3;
+ start = pos;
+ } else {
+ try {
+ pos += SKIP_TABLE[mData[pos + 3] & 0xFF];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ break;
+ }
+ }
+ }
+
+ mOffset = mLimit;
+ if (start != -1 && mLimit > start) {
+ // We've found a start code and then reached to the end of array.
+ return ByteBuffer.wrap(mData, start, mLimit - start);
+ }
+ // A start code was not found
+ return null;
+ }
+
+ boolean hasConsumedAll() {
+ return (mData == null) || (mLimit - mOffset < 4);
+ }
+ }
}
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 0bc5a5f8a..51c635154 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -47,63 +47,65 @@ import java.util.List;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class VideoStreamingParameters {
private static final String TAG = "VideoStreamingParameters";
- private final VideoStreamingProtocol DEFAULT_PROTOCOL = VideoStreamingProtocol.RAW;
- private final VideoStreamingCodec DEFAULT_CODEC = VideoStreamingCodec.H264;
- private final VideoStreamingFormat[] currentlySupportedFormats = { new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H264),
- new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.H264) };
- private final int DEFAULT_WIDTH = 1024;
- private final int DEFAULT_HEIGHT = 576;
- private final int DEFAULT_DENSITY = 240;
- 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;
- private int frameRate;
- private int bitrate;
- private int interval;
- private ImageResolution resolution;
- private VideoStreamingFormat format;
-
- public VideoStreamingParameters(){
- displayDensity = DEFAULT_DENSITY;
- frameRate = DEFAULT_FRAMERATE;
- bitrate = DEFAULT_BITRATE;
- interval = DEFAULT_INTERVAL;
- resolution = new ImageResolution();
- resolution.setResolutionWidth(DEFAULT_WIDTH);
- resolution.setResolutionHeight(DEFAULT_HEIGHT);
- format = new VideoStreamingFormat();
- format.setProtocol(DEFAULT_PROTOCOL);
- format.setCodec(DEFAULT_CODEC);
+ private final VideoStreamingProtocol DEFAULT_PROTOCOL = VideoStreamingProtocol.RAW;
+ private final VideoStreamingCodec DEFAULT_CODEC = VideoStreamingCodec.H264;
+ private final VideoStreamingFormat[] currentlySupportedFormats = {new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H264),
+ new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.H264)};
+ private final int DEFAULT_WIDTH = 1024;
+ private final int DEFAULT_HEIGHT = 576;
+ private final int DEFAULT_DENSITY = 240;
+ 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;
+ private int frameRate;
+ private int bitrate;
+ private int interval;
+ private ImageResolution resolution;
+ private VideoStreamingFormat format;
+
+ public VideoStreamingParameters() {
+ displayDensity = DEFAULT_DENSITY;
+ frameRate = DEFAULT_FRAMERATE;
+ bitrate = DEFAULT_BITRATE;
+ interval = DEFAULT_INTERVAL;
+ resolution = new ImageResolution();
+ resolution.setResolutionWidth(DEFAULT_WIDTH);
+ resolution.setResolutionHeight(DEFAULT_HEIGHT);
+ format = new VideoStreamingFormat();
+ format.setProtocol(DEFAULT_PROTOCOL);
+ format.setCodec(DEFAULT_CODEC);
}
public VideoStreamingParameters(int displayDensity, int frameRate, int bitrate, int interval,
- ImageResolution resolution, VideoStreamingFormat format){
- this.displayDensity = displayDensity;
- this.frameRate = frameRate;
- this.bitrate = bitrate;
- this.interval = interval;
- this.resolution = resolution;
- this.format = format;
+ ImageResolution resolution, VideoStreamingFormat format) {
+ this.displayDensity = displayDensity;
+ this.frameRate = frameRate;
+ this.bitrate = bitrate;
+ this.interval = interval;
+ this.resolution = resolution;
+ this.format = format;
}
/**
* Will only copy values that are not null or are greater than 0
+ *
* @param params VideoStreamingParameters that should be copied into this new instants
*/
- public VideoStreamingParameters(VideoStreamingParameters params){
+ public VideoStreamingParameters(VideoStreamingParameters params) {
update(params);
}
/**
* Will only copy values that are not null or are greater than 0
+ *
* @param params VideoStreamingParameters that should be copied into this new instants
*/
- public void update(VideoStreamingParameters params){
- if(params!=null) {
+ public void update(VideoStreamingParameters params) {
+ if (params != null) {
if (params.displayDensity > 0) {
this.displayDensity = params.displayDensity;
}
@@ -133,17 +135,22 @@ public class VideoStreamingParameters {
/**
* Update the values contained in the capability that should have been returned through the SystemCapabilityManager.
* This update will use the most preferred streaming format from the module.
- * @param capability the video streaming capability returned from the SystemCapabilityManager
+ *
+ * @param capability the video streaming capability returned from the SystemCapabilityManager
* @param vehicleMake the vehicle make from the RegisterAppInterfaceResponse
* @see com.smartdevicelink.managers.lifecycle.SystemCapabilityManager
* @see VideoStreamingCapability
*/
- public void update(VideoStreamingCapability capability, String vehicleMake){
- if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
+ public void update(VideoStreamingCapability capability, String vehicleMake) {
+ 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(); }
+ if (capability.getScale() != null) {
+ scale = capability.getScale();
+ }
ImageResolution resolution = capability.getPreferredResolution();
- if(resolution!=null){
+ if (resolution != null) {
if (vehicleMake != null) {
if ((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight() != null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() != null && resolution.getResolutionWidth() > 800))) {
@@ -151,14 +158,18 @@ public class VideoStreamingParameters {
}
}
- 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)); }
+ 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));
+ }
}
// This should be the last call as it will return out once a suitable format is found
final List<VideoStreamingFormat> formats = capability.getSupportedFormats();
- if(formats != null && formats.size()>0){
- for(VideoStreamingFormat format : formats){
+ if (formats != null && formats.size() > 0) {
+ for (VideoStreamingFormat format : formats) {
for (VideoStreamingFormat currentlySupportedFormat : currentlySupportedFormats) {
if (currentlySupportedFormat.equals(format)) {
this.format = format;
@@ -206,21 +217,21 @@ public class VideoStreamingParameters {
return interval;
}
- public void setFormat(VideoStreamingFormat format){
- this.format = format;
+ public void setFormat(VideoStreamingFormat format) {
+ this.format = format;
}
- public VideoStreamingFormat getFormat(){
- return format;
+ public VideoStreamingFormat getFormat() {
+ return format;
}
- public void setResolution(ImageResolution resolution){
- this.resolution = resolution;
+ public void setResolution(ImageResolution resolution) {
+ this.resolution = resolution;
}
- public ImageResolution getResolution() {
- return resolution;
- }
+ public ImageResolution getResolution() {
+ return resolution;
+ }
@Override
public String toString() {
diff --git a/base/src/main/java/com/smartdevicelink/trace/DiagLevel.java b/base/src/main/java/com/smartdevicelink/trace/DiagLevel.java
index 6c9e60738..fb52b2066 100644
--- a/base/src/main/java/com/smartdevicelink/trace/DiagLevel.java
+++ b/base/src/main/java/com/smartdevicelink/trace/DiagLevel.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,56 +37,56 @@ import com.smartdevicelink.trace.enums.Mod;
public class DiagLevel {
- static private final DetailLevel[] levels;
-
- static { // this is a static c-tor!!
- levels = new DetailLevel[Mod.values().length];
- setAllLevels(DetailLevel.OFF);
- }
-
- public static void setAllLevels(DetailLevel thisDetail) {
- if (thisDetail != null) {
- for (int i = 0; i < levels.length; i++) {
- levels[i] = thisDetail; //
- }
- }
- }
-
+ static private final DetailLevel[] levels;
+
+ static { // this is a static c-tor!!
+ levels = new DetailLevel[Mod.values().length];
+ setAllLevels(DetailLevel.OFF);
+ }
+
+ public static void setAllLevels(DetailLevel thisDetail) {
+ if (thisDetail != null) {
+ for (int i = 0; i < levels.length; i++) {
+ levels[i] = thisDetail; //
+ }
+ }
+ }
+
public static void setLevel(Mod thisMod, DetailLevel thisDetail) {
- if (thisMod != null && thisDetail != null) {
- levels[thisMod.ordinal()] = thisDetail;
- }
+ if (thisMod != null && thisDetail != null) {
+ levels[thisMod.ordinal()] = thisDetail;
+ }
}
-
- public static DetailLevel getLevel(Mod thisMod) {
- if (thisMod != null) {
- return levels[thisMod.ordinal()];
- }
- return null;
- }
- public static boolean isValidDetailLevel(String dtString) {
- // Assume false
- Boolean isValid = false;
+ public static DetailLevel getLevel(Mod thisMod) {
+ if (thisMod != null) {
+ return levels[thisMod.ordinal()];
+ }
+ return null;
+ }
- if (dtString != null) {
- if (dtString.equalsIgnoreCase("verbose"))
- isValid = true;
- else if (dtString.equalsIgnoreCase("terse"))
- isValid = true;
- else if (dtString.equalsIgnoreCase("off"))
- isValid = true;
- }
-
- return isValid;
- }
-
- public static DetailLevel toDetailLevel(String dtString) {
- DetailLevel dt = DetailLevel.OFF;
- if (dtString.equalsIgnoreCase("verbose"))
- dt = DetailLevel.VERBOSE;
- else if (dtString.equalsIgnoreCase("terse"))
- dt = DetailLevel.TERSE;
- return dt;
- }
+ public static boolean isValidDetailLevel(String dtString) {
+ // Assume false
+ Boolean isValid = false;
+
+ if (dtString != null) {
+ if (dtString.equalsIgnoreCase("verbose"))
+ isValid = true;
+ else if (dtString.equalsIgnoreCase("terse"))
+ isValid = true;
+ else if (dtString.equalsIgnoreCase("off"))
+ isValid = true;
+ }
+
+ return isValid;
+ }
+
+ public static DetailLevel toDetailLevel(String dtString) {
+ DetailLevel dt = DetailLevel.OFF;
+ if (dtString.equalsIgnoreCase("verbose"))
+ dt = DetailLevel.VERBOSE;
+ else if (dtString.equalsIgnoreCase("terse"))
+ dt = DetailLevel.TERSE;
+ return dt;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/trace/ISTListener.java b/base/src/main/java/com/smartdevicelink/trace/ISTListener.java
index 7b5296d12..77c9b8091 100644
--- a/base/src/main/java/com/smartdevicelink/trace/ISTListener.java
+++ b/base/src/main/java/com/smartdevicelink/trace/ISTListener.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,8 +29,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.trace;
-
-public interface ISTListener {
- void logXmlMsg(String msg, String token);
+package com.smartdevicelink.trace;
+
+public interface ISTListener {
+ void logXmlMsg(String msg, String token);
} // end-interface \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/trace/Mime.java b/base/src/main/java/com/smartdevicelink/trace/Mime.java
index 54c99e582..d17e2dfbe 100644
--- a/base/src/main/java/com/smartdevicelink/trace/Mime.java
+++ b/base/src/main/java/com/smartdevicelink/trace/Mime.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,97 +37,97 @@ import java.nio.charset.StandardCharsets;
public class Mime {
- private static final String BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ private static final String BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- /**
- * @param str A String to encode into base64 String.
- * @return Base64 encoded String or a null String if input is null.
- */
- public static String base64Encode(String str) {
- if(str == null){
- return null;
- }
+ /**
+ * @param str A String to encode into base64 String.
+ * @return Base64 encoded String or a null String if input is null.
+ */
+ public static String base64Encode(String str) {
+ if (str == null) {
+ return null;
+ }
- String b64String = "";
- try {
- byte[] strBytes = str.getBytes(StandardCharsets.US_ASCII);
- b64String = base64Encode(strBytes);
- } catch (Exception ex) {
- // Don't care?
- }
- return b64String;
- }
+ String b64String = "";
+ try {
+ byte[] strBytes = str.getBytes(StandardCharsets.US_ASCII);
+ b64String = base64Encode(strBytes);
+ } catch (Exception ex) {
+ // Don't care?
+ }
+ return b64String;
+ }
- /**
- * @param bytesToEncode A byte array to encode into base64 String.
- * @return Base64 encoded String or a null String if input array is null.
- */
- public static String base64Encode(byte[] bytesToEncode) {
- if(bytesToEncode != null){
- return base64Encode(bytesToEncode, 0, bytesToEncode.length);
- }
- return null;
- }
+ /**
+ * @param bytesToEncode A byte array to encode into base64 String.
+ * @return Base64 encoded String or a null String if input array is null.
+ */
+ public static String base64Encode(byte[] bytesToEncode) {
+ if (bytesToEncode != null) {
+ return base64Encode(bytesToEncode, 0, bytesToEncode.length);
+ }
+ return null;
+ }
- /**
- * @param bytesToEncode A byte array to encode into base64 String.
- * @param offset Offset to begin at
- * @param length Length to read
- * @return Base64 encoded String or a null String if input array is null or the input range is out of bounds.
- */
- public static String base64Encode(byte[] bytesToEncode, int offset, int length) {
- if (bytesToEncode == null || bytesToEncode.length < length || bytesToEncode.length < offset + length) {
- return null;
- }
+ /**
+ * @param bytesToEncode A byte array to encode into base64 String.
+ * @param offset Offset to begin at
+ * @param length Length to read
+ * @return Base64 encoded String or a null String if input array is null or the input range is out of bounds.
+ */
+ public static String base64Encode(byte[] bytesToEncode, int offset, int length) {
+ if (bytesToEncode == null || bytesToEncode.length < length || bytesToEncode.length < offset + length) {
+ return null;
+ }
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
- int idxin = 0;
- int b64idx = 0;
+ int idxin = 0;
+ int b64idx = 0;
- for (idxin = offset; idxin < offset + length; idxin++) {
- switch ((idxin - offset) % 3) {
- case 0:
- b64idx = (bytesToEncode[idxin] >> 2) & 0x3f;
- break;
- case 1:
- b64idx = (bytesToEncode[idxin] >> 4) & 0x0f;
- b64idx |= ((bytesToEncode[idxin - 1] << 4) & 0x30);
- break;
- case 2:
- b64idx = (bytesToEncode[idxin] >> 6) & 0x03;
- b64idx |= ((bytesToEncode[idxin - 1] << 2) & 0x3c);
- sb.append(getBase64Char(b64idx));
- b64idx = bytesToEncode[idxin] & 0x3f;
- break;
- }
- sb.append(getBase64Char(b64idx));
- }
+ for (idxin = offset; idxin < offset + length; idxin++) {
+ switch ((idxin - offset) % 3) {
+ case 0:
+ b64idx = (bytesToEncode[idxin] >> 2) & 0x3f;
+ break;
+ case 1:
+ b64idx = (bytesToEncode[idxin] >> 4) & 0x0f;
+ b64idx |= ((bytesToEncode[idxin - 1] << 4) & 0x30);
+ break;
+ case 2:
+ b64idx = (bytesToEncode[idxin] >> 6) & 0x03;
+ b64idx |= ((bytesToEncode[idxin - 1] << 2) & 0x3c);
+ sb.append(getBase64Char(b64idx));
+ b64idx = bytesToEncode[idxin] & 0x3f;
+ break;
+ }
+ sb.append(getBase64Char(b64idx));
+ }
- switch ((idxin - offset) % 3) {
- case 0:
- break;
- case 1:
- b64idx = (bytesToEncode[idxin - 1] << 4) & 0x30;
- sb.append(getBase64Char(b64idx));
- sb.append("==");
- break;
- case 2:
- b64idx = ((bytesToEncode[idxin - 1] << 2) & 0x3c);
- sb.append(getBase64Char(b64idx));
- sb.append('=');
- break;
- }
+ switch ((idxin - offset) % 3) {
+ case 0:
+ break;
+ case 1:
+ b64idx = (bytesToEncode[idxin - 1] << 4) & 0x30;
+ sb.append(getBase64Char(b64idx));
+ sb.append("==");
+ break;
+ case 2:
+ b64idx = ((bytesToEncode[idxin - 1] << 2) & 0x3c);
+ sb.append(getBase64Char(b64idx));
+ sb.append('=');
+ break;
+ }
- return sb.toString();
+ return sb.toString();
- }
+ }
- private static char getBase64Char(int b64idx){
- if(b64idx >= 0 && b64idx < BASE_64_CHARS.length()) {
- return BASE_64_CHARS.charAt(b64idx);
- }else{
- return 0x20;
- }
- }
+ private static char getBase64Char(int b64idx) {
+ if (b64idx >= 0 && b64idx < BASE_64_CHARS.length()) {
+ return BASE_64_CHARS.charAt(b64idx);
+ } else {
+ return 0x20;
+ }
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java b/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
index b521d76ca..3822a8d41 100644
--- a/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
+++ b/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -39,78 +39,81 @@ import java.util.Iterator;
import java.util.List;
class OpenRPCMessage extends RPCMessage {
- private OpenRPCMessage() {super("");}
- public OpenRPCMessage(RPCMessage rpcm) {
- super(rpcm);
- } // end-method
-
- public OpenRPCMessage(RPCStruct rpcs) {
- super(rpcs);
- } // end-method
-
- public String msgDump() {
- StringBuilder pd = new StringBuilder();
-
- pd.append(this.getFunctionName()).append(" ").append(this.getMessageType());
-
- msgDump(pd);
-
- return pd.toString();
- } // end-method
-
- public void msgDump(StringBuilder pd) {
- pd.append("[");
-
- dumpParams(parameters, pd);
-
- pd.append("]");
-
- } // end-method
-
- private void dumpParams(Hashtable<String, Object> ht, StringBuilder pd) {
- Iterator<String> keySet = ht.keySet().iterator();
- Object obj;
- String key = "";
- boolean isFirstParam = true;
-
- while (keySet.hasNext()) {
- key = (String)keySet.next();
- obj = ht.get(key);
- if (isFirstParam) {
- isFirstParam = false;
- } else {
- pd.append(", ");
- } // end-if
-
- dumpParamNode(key, obj, pd);
-
- } // end-while
- } // end-method
-
- @SuppressWarnings("unchecked")
+ private OpenRPCMessage() {
+ super("");
+ }
+
+ public OpenRPCMessage(RPCMessage rpcm) {
+ super(rpcm);
+ } // end-method
+
+ public OpenRPCMessage(RPCStruct rpcs) {
+ super(rpcs);
+ } // end-method
+
+ public String msgDump() {
+ StringBuilder pd = new StringBuilder();
+
+ pd.append(this.getFunctionName()).append(" ").append(this.getMessageType());
+
+ msgDump(pd);
+
+ return pd.toString();
+ } // end-method
+
+ public void msgDump(StringBuilder pd) {
+ pd.append("[");
+
+ dumpParams(parameters, pd);
+
+ pd.append("]");
+
+ } // end-method
+
+ private void dumpParams(Hashtable<String, Object> ht, StringBuilder pd) {
+ Iterator<String> keySet = ht.keySet().iterator();
+ Object obj;
+ String key = "";
+ boolean isFirstParam = true;
+
+ while (keySet.hasNext()) {
+ key = (String) keySet.next();
+ obj = ht.get(key);
+ if (isFirstParam) {
+ isFirstParam = false;
+ } else {
+ pd.append(", ");
+ } // end-if
+
+ dumpParamNode(key, obj, pd);
+
+ } // end-while
+ } // end-method
+
+ @SuppressWarnings("unchecked")
private void dumpParamNode(String key, Object obj, StringBuilder pd) {
- if (obj instanceof Hashtable) {
- pd.append("[");
- dumpParams((Hashtable<String, Object>)obj, pd);
- pd.append("]");
- } else if (obj instanceof RPCStruct) {
- pd.append("[");
- OpenRPCMessage orpcm = new OpenRPCMessage((RPCStruct)obj);
- orpcm.msgDump(pd);
- pd.append("]");
- } else if (obj instanceof List) {
- pd.append("[");
- List<?> list = (List<?>)obj;
- for (int idx=0;idx < list.size();idx++) {
- if (idx > 0) {
- pd.append(", ");
- }
- dumpParamNode(key, list.get(idx), pd);
- } // end-for
- pd.append("]");
- } else {
- pd.append("\"" + key + "\" = \"" + obj.toString() + "\"");
- }
- } // end-method
+ if (obj instanceof Hashtable) {
+ pd.append("[");
+ dumpParams((Hashtable<String, Object>) obj, pd);
+ pd.append("]");
+ } else if (obj instanceof RPCStruct) {
+ pd.append("[");
+ OpenRPCMessage orpcm = new OpenRPCMessage((RPCStruct) obj);
+ orpcm.msgDump(pd);
+ pd.append("]");
+ } else if (obj instanceof List) {
+ pd.append("[");
+ List<?> list = (List<?>) obj;
+ for (int idx = 0; idx < list.size(); idx++) {
+ if (idx > 0) {
+ pd.append(", ");
+ }
+ dumpParamNode(key, list.get(idx), pd);
+ } // end-for
+ pd.append("]");
+ } else {
+ pd.append("\"" + key + "\" = \"" + obj.toString() + "\"");
+ }
+ } // end-method
} // end-class OpenRPCMessage
diff --git a/base/src/main/java/com/smartdevicelink/trace/SdlTraceBase.java b/base/src/main/java/com/smartdevicelink/trace/SdlTraceBase.java
index d271bf895..6c6f92bdf 100644
--- a/base/src/main/java/com/smartdevicelink/trace/SdlTraceBase.java
+++ b/base/src/main/java/com/smartdevicelink/trace/SdlTraceBase.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -55,390 +55,390 @@ import com.smartdevicelink.util.NativeLogTool;
*/
class SdlTraceBase {
- private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
-
- public static final String SYSTEM_LOG_TAG = "SdlTrace";
-
- private static final long baseTics = java.lang.System.currentTimeMillis();
- private static boolean acceptAPITraceAdjustments = true;
-
- protected static ISTListener m_appTraceListener = null;
-
- ///
- /// The PUBLIC interface to SdlTrace starts here
- ///
-
- public static void setAcceptAPITraceAdjustments(Boolean APITraceAdjustmentsAccepted) {
- if (APITraceAdjustmentsAccepted != null) {
- acceptAPITraceAdjustments = APITraceAdjustmentsAccepted;
- }
- }
-
- public static boolean getAcceptAPITraceAdjustments() {
- return acceptAPITraceAdjustments;
- }
-
- public static void setAppTraceListener(ISTListener listener) {
- m_appTraceListener = listener;
- } // end-method
-
- public static void setAppTraceLevel(DetailLevel dt) {
- if ( dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.app, dt);
- } // end-method
-
- public static void setProxyTraceLevel(DetailLevel dt) {
- if (dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.proxy, dt);
- } // end-method
-
- public static void setRpcTraceLevel(DetailLevel dt) {
- if (dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.rpc, dt);
- } // end-method
-
- public static void setMarshallingTraceLevel(DetailLevel dt) {
- if (dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.mar, dt);
- } // end-method
-
- public static void setProtocolTraceLevel(DetailLevel dt) {
- if (dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.proto, dt);
- } // end-method
-
- public static void setTransportTraceLevel(DetailLevel dt) {
- if (dt != null && acceptAPITraceAdjustments)
- DiagLevel.setLevel(Mod.tran, dt);
- } // end-method
-
- private static String getPid() {
- return "UNKNOWN";
- }
-
- private static String encodeTraceMessage(long timestamp, Mod module, InterfaceActivityDirection msgDirection, String msgBodyXml) {
- StringBuilder sb = new StringBuilder("<msg><dms>");
- sb.append(timestamp);
- sb.append("</dms><pid>");
- sb.append(getPid());
- sb.append("</pid><tid>");
- sb.append(Thread.currentThread().getId());
- sb.append("</tid><mod>");
- sb.append(module.toString());
- sb.append("</mod>");
- if (msgDirection != InterfaceActivityDirection.None) {
- sb.append("<dir>");
- sb.append(interfaceActivityDirectionToString(msgDirection));
- sb.append("</dir>");
- } // end-if
- sb.append(msgBodyXml);
- sb.append("</msg>");
-
- return sb.toString();
- } // end-method
-
- private static String interfaceActivityDirectionToString(InterfaceActivityDirection iaDirection) {
- String str = "";
- switch (iaDirection) {
- case Receive:
- str = "rx";
- break;
- case Transmit:
- str = "tx";
- break;
- default:
- break;
- } // end-switch
- return str;
- } // end-method
-
- static String B64EncodeForXML(String data) {
- return Mime.base64Encode(data);
- // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: return Base64.encodeToString(data.getBytes(), Base64.DEFAULT);
- } // end-method
-
- public static boolean logProxyEvent(String eventText, String token) {
- if (DiagLevel.getLevel(Mod.proxy) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
- return false;
- }
-
- String msg = SdlTrace.B64EncodeForXML(eventText);
- String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proxy, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
- return writeXmlTraceMessage(xml);
- }
-
- public static boolean logAppEvent(String eventText) {
- if (DiagLevel.getLevel(Mod.app) == DetailLevel.OFF) {
- return false;
- }
-
- long timestamp = SdlTrace.getBaseTicsDelta();
- String msg = SdlTrace.B64EncodeForXML(eventText);
- String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.app, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
- return writeXmlTraceMessage(xml);
- }
-
- public static boolean logRPCEvent(InterfaceActivityDirection msgDirection, RPCMessage rpcMsg, String token) {
- DetailLevel dl = DiagLevel.getLevel(Mod.rpc);
- if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
- return false;
- }
-
- long timestamp = SdlTrace.getBaseTicsDelta();
- String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.rpc, msgDirection, rpc2Xml(dl, rpcMsg));
- return writeXmlTraceMessage(xml);
- }
-
- private static String rpc2Xml(DetailLevel dl, RPCMessage rpcMsg) {
- StringBuilder rpcAsXml = new StringBuilder();
- rpcAsXml.append("<op>");
- rpcAsXml.append(rpcMsg.getFunctionName());
- rpcAsXml.append("</op>");
- boolean hasCorrelationID = false;
- Integer correlationID = -1;
- if (rpcMsg instanceof RPCRequest) {
- hasCorrelationID = true;
- correlationID = ((RPCRequest)rpcMsg).getCorrelationID();
- } else if (rpcMsg instanceof RPCResponse) {
- hasCorrelationID = true;
- correlationID = ((RPCResponse)rpcMsg).getCorrelationID();
- } // end-if
- if (hasCorrelationID) {
- rpcAsXml.append("<cid>");
- rpcAsXml.append(correlationID);
- rpcAsXml.append("</cid>");
- } // end-if
- rpcAsXml.append("<type>");
- rpcAsXml.append(rpcMsg.getMessageType());
- rpcAsXml.append("</type>");
- //rpcAsXml.append(newline);
-
- if (dl == DetailLevel.VERBOSE) {
- OpenRPCMessage openRPCMessage = new OpenRPCMessage(rpcMsg);
- String rpcParamList = openRPCMessage.msgDump();
- String msg = SdlTrace.B64EncodeForXML(rpcParamList);
- rpcAsXml.append("<d>");
- rpcAsXml.append(msg);
- rpcAsXml.append("</d>");
- } // end-if
- return rpcAsXml.toString();
- } // end-method
-
- public static boolean logMarshallingEvent(InterfaceActivityDirection msgDirection, byte[] marshalledMessage, String token) {
- DetailLevel dl = DiagLevel.getLevel(Mod.mar);
- if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
- return false;
- }
-
- long timestamp = SdlTrace.getBaseTicsDelta();
- StringBuilder msg = new StringBuilder();
- msg.append("<sz>");
- msg.append(marshalledMessage.length);
- msg.append("</sz>");
- if (dl == DetailLevel.VERBOSE) {
- msg.append("<d>");
- msg.append(Mime.base64Encode(marshalledMessage));
- // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: msg.append(Base64.encodeToString(marshalledMessage, Base64.DEFAULT));
- msg.append("</d>");
- }
- String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.mar, msgDirection, msg.toString());
- return writeXmlTraceMessage(xml);
- }
-
- public static boolean logProtocolEvent(InterfaceActivityDirection frameDirection, SdlPacket packet, int frameDataOffset, int frameDataLength, String token) {
- DetailLevel dl = DiagLevel.getLevel(Mod.proto);
- if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
- return false;
- }
-
- StringBuffer protoMsg = new StringBuffer();
- protoMsg.append("<frame>");
- protoMsg.append(SdlTraceBase.getProtocolFrameHeaderInfo(packet));
- if (dl == DetailLevel.VERBOSE) {
- if (packet.getPayload() != null && frameDataLength > 0) {
- protoMsg.append("<d>");
- String bytesInfo = "";
- bytesInfo = Mime.base64Encode(packet.getPayload(), frameDataOffset, frameDataLength);
- // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: bytesInfo = Base64.encodeToString(frameData, frameDataOffset, frameDataLength, Base64.DEFAULT);
- protoMsg.append(bytesInfo);
- protoMsg.append("</d>");
- }
- }
- protoMsg.append("</frame>");
- String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proto, frameDirection, protoMsg.toString());
- return writeXmlTraceMessage(xml);
- }
-
- private static String getProtocolFrameType(FrameType f) {
- if (f == FrameType.Control)
- return "Control";
- else if (f == FrameType.Consecutive)
- return "Consecutive";
- else if (f == FrameType.First)
- return "First";
- else if (f == FrameType.Single)
- return "Single";
-
- return "Unknown";
- } // end-method
-
- private static String getProtocolSessionType(SessionType serviceType) {
- String s;
- if (serviceType == SessionType.RPC )
- s = "rpc";
- else if (serviceType == SessionType.BULK_DATA)
- s = "bulk";
- else
- s = "Unknown";
- return s;
- } // end-method
-
- private static String getProtocolFrameHeaderInfo(SdlPacket hdr) {
- StringBuilder sb = new StringBuilder();
- sb.append("<hdr>");
- sb.append("<ver>");
- sb.append(hdr.getVersion());
- sb.append("</ver><cmp>");
- sb.append(hdr.isEncrypted());
- sb.append("</cmp><ft>");
- sb.append(getProtocolFrameType(hdr.getFrameType()));
- sb.append("</ft><st>");
- sb.append(getProtocolSessionType(SessionType.valueOf((byte)hdr.getServiceType())));
- sb.append("</st><sid>");
- sb.append(hdr.getSessionId());
- sb.append("</sid><sz>");
- sb.append(hdr.getDataSize());
- sb.append("</sz>");
-
- int frameData = hdr.getFrameInfo();
- if (hdr.getFrameType() == FrameType.Control) {
- sb.append("<ca>");
- if (frameData == FrameDataControlFrameType.StartSession.getValue())
- sb.append("StartSession");
- else if (frameData == FrameDataControlFrameType.StartSessionACK.getValue())
- sb.append("StartSessionACK");
- else if (frameData == FrameDataControlFrameType.StartSessionNACK.getValue())
- sb.append("StartSessionNACK");
- else if (frameData == FrameDataControlFrameType.EndSession.getValue())
- sb.append("EndSession");
- sb.append("</ca>");
- } else if (hdr.getFrameType() == FrameType.Consecutive ) {
- sb.append("<fsn>");
- if (frameData == 0 )
- sb.append("lastFrame");
- else
- sb.append(String.format("%02X",frameData));
- sb.append("</fsn>");
- } else if (hdr.getFrameType() == FrameType.First ) {
- int totalSize = BitConverter.intFromByteArray(hdr.getPayload(), 0);
- int numFrames = BitConverter.intFromByteArray(hdr.getPayload(), 4);
- sb.append("<total>").append(totalSize).append("</total><numframes>").append(numFrames).append("</numframes>");
- } else if (hdr.getFrameType() == FrameType.Single ) {
- sb.append("<single/>");
- }
-
- sb.append("</hdr>");
-
- return sb.toString();
- } // end-method
-
- public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte[] buf, int byteLength, String token) {
- return logTransportEvent(preamble, transportSpecificInfoXml, msgDirection, buf, 0, byteLength, token);
- }
-
- private static void checkB64(String x, byte[] buf, int offset, int byteLength) {
- if ((x.length() % 4) != 0) {
- NativeLogTool.logWarning(SdlTrace.SYSTEM_LOG_TAG, "b64 string length (" + x.length() + ") isn't multiple of 4: buf.length=" + buf.length + ", offset=" + offset + ", len=" + byteLength);
- } // end-if
- } // end-method
-
- public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte[] buf, int offset, int byteLength, String token) {
- if (DiagLevel.getLevel(Mod.tran) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
- return false;
- }
-
- StringBuilder msg = new StringBuilder();
- if (transportSpecificInfoXml != null && transportSpecificInfoXml.length() > 0) {
- msg.append(transportSpecificInfoXml);
- }
- if (preamble != null && preamble.length() > 0) {
- msg.append("<desc>");
- msg.append(preamble);
- msg.append("</desc>");
- }
- if (buf != null) {
- msg.append("<sz>");
- msg.append(byteLength);
- msg.append("</sz>");
- DetailLevel dl = DiagLevel.getLevel(Mod.tran);
- if (dl == DetailLevel.VERBOSE) {
- if (buf != null && byteLength > 0) {
- msg.append("<d>");
- String bytesInfo = Mime.base64Encode(buf, offset, byteLength);
- checkB64(bytesInfo, buf, offset, byteLength);
- msg.append(bytesInfo);
- msg.append("</d>");
- }
- }
- }
- String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.tran, msgDirection, msg.toString());
- return writeXmlTraceMessage(xml);
- }
-
- // Package-scoped
- static long getBaseTicsDelta() {
- return java.lang.System.currentTimeMillis() - getBaseTics();
- }
-
- // Package-scoped
- static long getBaseTics() {
- return baseTics;
- } // end-method
-
- public static Boolean writeMessageToSiphonServer(String info) {
- return SiphonServer.sendFormattedTraceMessage(info);
- }
-
- private static boolean writeXmlTraceMessage(String msg) {
- try {
- // Attempt to write formatted message to the Siphon
- if (!writeMessageToSiphonServer(msg)) {
- // If writing to the Siphon fails, write to the native log
- NativeLogTool.logInfo(SdlTrace.SYSTEM_LOG_TAG, msg);
- return false;
- }
-
- ISTListener localTraceListener = m_appTraceListener;
-
- if (localTraceListener != null) {
- try {
- localTraceListener.logXmlMsg(msg, SDL_LIB_TRACE_KEY);
- } catch (Exception ex) {
- DebugTool.logError(SYSTEM_LOG_TAG, "Failure calling ISTListener: " + ex.toString(), ex);
- return false;
- }
- }
- } catch (Exception ex) {
- NativeLogTool.logError(SdlTrace.SYSTEM_LOG_TAG, "Failure writing XML trace message: " + ex.toString());
- return false;
- }
- return true;
- }
-
- static String getSmartDeviceLinkTraceRoot(String dumpReason, int seqNo) {
- StringBuilder write = new StringBuilder("<SmartDeviceLinktraceroot>" + "<sequencenum>" + seqNo
- + "</sequencenum>" + "<dumpreason>" + dumpReason
- + "</dumpreason><tracelevel>");
-
- write.append("<tran>").append(DiagLevel.getLevel(Mod.tran)).append("</tran>");
- write.append("<proto>").append(DiagLevel.getLevel(Mod.proto)).append("</proto>");
- write.append("<mar>").append(DiagLevel.getLevel(Mod.mar)).append("</mar>");
- write.append("<rpc>").append(DiagLevel.getLevel(Mod.rpc)).append("</rpc>");
- write.append("<proxy>").append(DiagLevel.getLevel(Mod.proxy)).append("</proxy>");
- write.append("<app>").append(DiagLevel.getLevel(Mod.app)).append("</app>");
-
- write.append("</tracelevel>");
- write.append("</SmartDeviceLinktraceroot>");
- return write.toString();
- } // end-method
+ private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
+
+ public static final String SYSTEM_LOG_TAG = "SdlTrace";
+
+ private static final long baseTics = java.lang.System.currentTimeMillis();
+ private static boolean acceptAPITraceAdjustments = true;
+
+ protected static ISTListener m_appTraceListener = null;
+
+ ///
+ /// The PUBLIC interface to SdlTrace starts here
+ ///
+
+ public static void setAcceptAPITraceAdjustments(Boolean APITraceAdjustmentsAccepted) {
+ if (APITraceAdjustmentsAccepted != null) {
+ acceptAPITraceAdjustments = APITraceAdjustmentsAccepted;
+ }
+ }
+
+ public static boolean getAcceptAPITraceAdjustments() {
+ return acceptAPITraceAdjustments;
+ }
+
+ public static void setAppTraceListener(ISTListener listener) {
+ m_appTraceListener = listener;
+ } // end-method
+
+ public static void setAppTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.app, dt);
+ } // end-method
+
+ public static void setProxyTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.proxy, dt);
+ } // end-method
+
+ public static void setRpcTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.rpc, dt);
+ } // end-method
+
+ public static void setMarshallingTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.mar, dt);
+ } // end-method
+
+ public static void setProtocolTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.proto, dt);
+ } // end-method
+
+ public static void setTransportTraceLevel(DetailLevel dt) {
+ if (dt != null && acceptAPITraceAdjustments)
+ DiagLevel.setLevel(Mod.tran, dt);
+ } // end-method
+
+ private static String getPid() {
+ return "UNKNOWN";
+ }
+
+ private static String encodeTraceMessage(long timestamp, Mod module, InterfaceActivityDirection msgDirection, String msgBodyXml) {
+ StringBuilder sb = new StringBuilder("<msg><dms>");
+ sb.append(timestamp);
+ sb.append("</dms><pid>");
+ sb.append(getPid());
+ sb.append("</pid><tid>");
+ sb.append(Thread.currentThread().getId());
+ sb.append("</tid><mod>");
+ sb.append(module.toString());
+ sb.append("</mod>");
+ if (msgDirection != InterfaceActivityDirection.None) {
+ sb.append("<dir>");
+ sb.append(interfaceActivityDirectionToString(msgDirection));
+ sb.append("</dir>");
+ } // end-if
+ sb.append(msgBodyXml);
+ sb.append("</msg>");
+
+ return sb.toString();
+ } // end-method
+
+ private static String interfaceActivityDirectionToString(InterfaceActivityDirection iaDirection) {
+ String str = "";
+ switch (iaDirection) {
+ case Receive:
+ str = "rx";
+ break;
+ case Transmit:
+ str = "tx";
+ break;
+ default:
+ break;
+ } // end-switch
+ return str;
+ } // end-method
+
+ static String B64EncodeForXML(String data) {
+ return Mime.base64Encode(data);
+ // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: return Base64.encodeToString(data.getBytes(), Base64.DEFAULT);
+ } // end-method
+
+ public static boolean logProxyEvent(String eventText, String token) {
+ if (DiagLevel.getLevel(Mod.proxy) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
+
+ String msg = SdlTrace.B64EncodeForXML(eventText);
+ String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proxy, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
+ return writeXmlTraceMessage(xml);
+ }
+
+ public static boolean logAppEvent(String eventText) {
+ if (DiagLevel.getLevel(Mod.app) == DetailLevel.OFF) {
+ return false;
+ }
+
+ long timestamp = SdlTrace.getBaseTicsDelta();
+ String msg = SdlTrace.B64EncodeForXML(eventText);
+ String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.app, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
+ return writeXmlTraceMessage(xml);
+ }
+
+ public static boolean logRPCEvent(InterfaceActivityDirection msgDirection, RPCMessage rpcMsg, String token) {
+ DetailLevel dl = DiagLevel.getLevel(Mod.rpc);
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
+
+ long timestamp = SdlTrace.getBaseTicsDelta();
+ String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.rpc, msgDirection, rpc2Xml(dl, rpcMsg));
+ return writeXmlTraceMessage(xml);
+ }
+
+ private static String rpc2Xml(DetailLevel dl, RPCMessage rpcMsg) {
+ StringBuilder rpcAsXml = new StringBuilder();
+ rpcAsXml.append("<op>");
+ rpcAsXml.append(rpcMsg.getFunctionName());
+ rpcAsXml.append("</op>");
+ boolean hasCorrelationID = false;
+ Integer correlationID = -1;
+ if (rpcMsg instanceof RPCRequest) {
+ hasCorrelationID = true;
+ correlationID = ((RPCRequest) rpcMsg).getCorrelationID();
+ } else if (rpcMsg instanceof RPCResponse) {
+ hasCorrelationID = true;
+ correlationID = ((RPCResponse) rpcMsg).getCorrelationID();
+ } // end-if
+ if (hasCorrelationID) {
+ rpcAsXml.append("<cid>");
+ rpcAsXml.append(correlationID);
+ rpcAsXml.append("</cid>");
+ } // end-if
+ rpcAsXml.append("<type>");
+ rpcAsXml.append(rpcMsg.getMessageType());
+ rpcAsXml.append("</type>");
+ //rpcAsXml.append(newline);
+
+ if (dl == DetailLevel.VERBOSE) {
+ OpenRPCMessage openRPCMessage = new OpenRPCMessage(rpcMsg);
+ String rpcParamList = openRPCMessage.msgDump();
+ String msg = SdlTrace.B64EncodeForXML(rpcParamList);
+ rpcAsXml.append("<d>");
+ rpcAsXml.append(msg);
+ rpcAsXml.append("</d>");
+ } // end-if
+ return rpcAsXml.toString();
+ } // end-method
+
+ public static boolean logMarshallingEvent(InterfaceActivityDirection msgDirection, byte[] marshalledMessage, String token) {
+ DetailLevel dl = DiagLevel.getLevel(Mod.mar);
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
+
+ long timestamp = SdlTrace.getBaseTicsDelta();
+ StringBuilder msg = new StringBuilder();
+ msg.append("<sz>");
+ msg.append(marshalledMessage.length);
+ msg.append("</sz>");
+ if (dl == DetailLevel.VERBOSE) {
+ msg.append("<d>");
+ msg.append(Mime.base64Encode(marshalledMessage));
+ // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: msg.append(Base64.encodeToString(marshalledMessage, Base64.DEFAULT));
+ msg.append("</d>");
+ }
+ String xml = SdlTraceBase.encodeTraceMessage(timestamp, Mod.mar, msgDirection, msg.toString());
+ return writeXmlTraceMessage(xml);
+ }
+
+ public static boolean logProtocolEvent(InterfaceActivityDirection frameDirection, SdlPacket packet, int frameDataOffset, int frameDataLength, String token) {
+ DetailLevel dl = DiagLevel.getLevel(Mod.proto);
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
+
+ StringBuffer protoMsg = new StringBuffer();
+ protoMsg.append("<frame>");
+ protoMsg.append(SdlTraceBase.getProtocolFrameHeaderInfo(packet));
+ if (dl == DetailLevel.VERBOSE) {
+ if (packet.getPayload() != null && frameDataLength > 0) {
+ protoMsg.append("<d>");
+ String bytesInfo = "";
+ bytesInfo = Mime.base64Encode(packet.getPayload(), frameDataOffset, frameDataLength);
+ // Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: bytesInfo = Base64.encodeToString(frameData, frameDataOffset, frameDataLength, Base64.DEFAULT);
+ protoMsg.append(bytesInfo);
+ protoMsg.append("</d>");
+ }
+ }
+ protoMsg.append("</frame>");
+ String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proto, frameDirection, protoMsg.toString());
+ return writeXmlTraceMessage(xml);
+ }
+
+ private static String getProtocolFrameType(FrameType f) {
+ if (f == FrameType.Control)
+ return "Control";
+ else if (f == FrameType.Consecutive)
+ return "Consecutive";
+ else if (f == FrameType.First)
+ return "First";
+ else if (f == FrameType.Single)
+ return "Single";
+
+ return "Unknown";
+ } // end-method
+
+ private static String getProtocolSessionType(SessionType serviceType) {
+ String s;
+ if (serviceType == SessionType.RPC)
+ s = "rpc";
+ else if (serviceType == SessionType.BULK_DATA)
+ s = "bulk";
+ else
+ s = "Unknown";
+ return s;
+ } // end-method
+
+ private static String getProtocolFrameHeaderInfo(SdlPacket hdr) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<hdr>");
+ sb.append("<ver>");
+ sb.append(hdr.getVersion());
+ sb.append("</ver><cmp>");
+ sb.append(hdr.isEncrypted());
+ sb.append("</cmp><ft>");
+ sb.append(getProtocolFrameType(hdr.getFrameType()));
+ sb.append("</ft><st>");
+ sb.append(getProtocolSessionType(SessionType.valueOf((byte) hdr.getServiceType())));
+ sb.append("</st><sid>");
+ sb.append(hdr.getSessionId());
+ sb.append("</sid><sz>");
+ sb.append(hdr.getDataSize());
+ sb.append("</sz>");
+
+ int frameData = hdr.getFrameInfo();
+ if (hdr.getFrameType() == FrameType.Control) {
+ sb.append("<ca>");
+ if (frameData == FrameDataControlFrameType.StartSession.getValue())
+ sb.append("StartSession");
+ else if (frameData == FrameDataControlFrameType.StartSessionACK.getValue())
+ sb.append("StartSessionACK");
+ else if (frameData == FrameDataControlFrameType.StartSessionNACK.getValue())
+ sb.append("StartSessionNACK");
+ else if (frameData == FrameDataControlFrameType.EndSession.getValue())
+ sb.append("EndSession");
+ sb.append("</ca>");
+ } else if (hdr.getFrameType() == FrameType.Consecutive) {
+ sb.append("<fsn>");
+ if (frameData == 0)
+ sb.append("lastFrame");
+ else
+ sb.append(String.format("%02X", frameData));
+ sb.append("</fsn>");
+ } else if (hdr.getFrameType() == FrameType.First) {
+ int totalSize = BitConverter.intFromByteArray(hdr.getPayload(), 0);
+ int numFrames = BitConverter.intFromByteArray(hdr.getPayload(), 4);
+ sb.append("<total>").append(totalSize).append("</total><numframes>").append(numFrames).append("</numframes>");
+ } else if (hdr.getFrameType() == FrameType.Single) {
+ sb.append("<single/>");
+ }
+
+ sb.append("</hdr>");
+
+ return sb.toString();
+ } // end-method
+
+ public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte[] buf, int byteLength, String token) {
+ return logTransportEvent(preamble, transportSpecificInfoXml, msgDirection, buf, 0, byteLength, token);
+ }
+
+ private static void checkB64(String x, byte[] buf, int offset, int byteLength) {
+ if ((x.length() % 4) != 0) {
+ NativeLogTool.logWarning(SdlTrace.SYSTEM_LOG_TAG, "b64 string length (" + x.length() + ") isn't multiple of 4: buf.length=" + buf.length + ", offset=" + offset + ", len=" + byteLength);
+ } // end-if
+ } // end-method
+
+ public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte[] buf, int offset, int byteLength, String token) {
+ if (DiagLevel.getLevel(Mod.tran) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
+
+ StringBuilder msg = new StringBuilder();
+ if (transportSpecificInfoXml != null && transportSpecificInfoXml.length() > 0) {
+ msg.append(transportSpecificInfoXml);
+ }
+ if (preamble != null && preamble.length() > 0) {
+ msg.append("<desc>");
+ msg.append(preamble);
+ msg.append("</desc>");
+ }
+ if (buf != null) {
+ msg.append("<sz>");
+ msg.append(byteLength);
+ msg.append("</sz>");
+ DetailLevel dl = DiagLevel.getLevel(Mod.tran);
+ if (dl == DetailLevel.VERBOSE) {
+ if (buf != null && byteLength > 0) {
+ msg.append("<d>");
+ String bytesInfo = Mime.base64Encode(buf, offset, byteLength);
+ checkB64(bytesInfo, buf, offset, byteLength);
+ msg.append(bytesInfo);
+ msg.append("</d>");
+ }
+ }
+ }
+ String xml = SdlTraceBase.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.tran, msgDirection, msg.toString());
+ return writeXmlTraceMessage(xml);
+ }
+
+ // Package-scoped
+ static long getBaseTicsDelta() {
+ return java.lang.System.currentTimeMillis() - getBaseTics();
+ }
+
+ // Package-scoped
+ static long getBaseTics() {
+ return baseTics;
+ } // end-method
+
+ public static Boolean writeMessageToSiphonServer(String info) {
+ return SiphonServer.sendFormattedTraceMessage(info);
+ }
+
+ private static boolean writeXmlTraceMessage(String msg) {
+ try {
+ // Attempt to write formatted message to the Siphon
+ if (!writeMessageToSiphonServer(msg)) {
+ // If writing to the Siphon fails, write to the native log
+ NativeLogTool.logInfo(SdlTrace.SYSTEM_LOG_TAG, msg);
+ return false;
+ }
+
+ ISTListener localTraceListener = m_appTraceListener;
+
+ if (localTraceListener != null) {
+ try {
+ localTraceListener.logXmlMsg(msg, SDL_LIB_TRACE_KEY);
+ } catch (Exception ex) {
+ DebugTool.logError(SYSTEM_LOG_TAG, "Failure calling ISTListener: " + ex.toString(), ex);
+ return false;
+ }
+ }
+ } catch (Exception ex) {
+ NativeLogTool.logError(SdlTrace.SYSTEM_LOG_TAG, "Failure writing XML trace message: " + ex.toString());
+ return false;
+ }
+ return true;
+ }
+
+ static String getSmartDeviceLinkTraceRoot(String dumpReason, int seqNo) {
+ StringBuilder write = new StringBuilder("<SmartDeviceLinktraceroot>" + "<sequencenum>" + seqNo
+ + "</sequencenum>" + "<dumpreason>" + dumpReason
+ + "</dumpreason><tracelevel>");
+
+ write.append("<tran>").append(DiagLevel.getLevel(Mod.tran)).append("</tran>");
+ write.append("<proto>").append(DiagLevel.getLevel(Mod.proto)).append("</proto>");
+ write.append("<mar>").append(DiagLevel.getLevel(Mod.mar)).append("</mar>");
+ write.append("<rpc>").append(DiagLevel.getLevel(Mod.rpc)).append("</rpc>");
+ write.append("<proxy>").append(DiagLevel.getLevel(Mod.proxy)).append("</proxy>");
+ write.append("<app>").append(DiagLevel.getLevel(Mod.app)).append("</app>");
+
+ write.append("</tracelevel>");
+ write.append("</SmartDeviceLinktraceroot>");
+ return write.toString();
+ } // end-method
} // end-class \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/trace/enums/DetailLevel.java b/base/src/main/java/com/smartdevicelink/trace/enums/DetailLevel.java
index 24b746d22..6aac6930b 100644
--- a/base/src/main/java/com/smartdevicelink/trace/enums/DetailLevel.java
+++ b/base/src/main/java/com/smartdevicelink/trace/enums/DetailLevel.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,19 +29,19 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.trace.enums;
-
-
-public enum DetailLevel {
- OFF,
- TERSE,
- VERBOSE;
-
- public static DetailLevel valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
+package com.smartdevicelink.trace.enums;
+
+
+public enum DetailLevel {
+ OFF,
+ TERSE,
+ VERBOSE;
+
+ public static DetailLevel valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/trace/enums/InterfaceActivityDirection.java b/base/src/main/java/com/smartdevicelink/trace/enums/InterfaceActivityDirection.java
index 5a75025e4..4af5300f8 100644
--- a/base/src/main/java/com/smartdevicelink/trace/enums/InterfaceActivityDirection.java
+++ b/base/src/main/java/com/smartdevicelink/trace/enums/InterfaceActivityDirection.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,18 +29,18 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.trace.enums;
-
-public enum InterfaceActivityDirection {
- Transmit,
- Receive,
- None;
-
- public static InterfaceActivityDirection valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+package com.smartdevicelink.trace.enums;
+
+public enum InterfaceActivityDirection {
+ Transmit,
+ Receive,
+ None;
+
+ public static InterfaceActivityDirection valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/trace/enums/Mod.java b/base/src/main/java/com/smartdevicelink/trace/enums/Mod.java
index ecc89dd15..10d7ca8f7 100644
--- a/base/src/main/java/com/smartdevicelink/trace/enums/Mod.java
+++ b/base/src/main/java/com/smartdevicelink/trace/enums/Mod.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,21 +29,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.trace.enums;
-
-public enum Mod {
- tran,
- proto,
- mar,
- rpc,
- app,
- proxy;
-
- public static Mod valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
+package com.smartdevicelink.trace.enums;
+
+public enum Mod {
+ tran,
+ proto,
+ mar,
+ rpc,
+ app,
+ proxy;
+
+ public static Mod valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}; \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/transport/BaseTransportConfig.java b/base/src/main/java/com/smartdevicelink/transport/BaseTransportConfig.java
index b037e2b1b..4fdd75c87 100644
--- a/base/src/main/java/com/smartdevicelink/transport/BaseTransportConfig.java
+++ b/base/src/main/java/com/smartdevicelink/transport/BaseTransportConfig.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -37,19 +37,20 @@ import com.smartdevicelink.transport.enums.TransportType;
* Defines base abstract class for transport configurations.
*/
public abstract class BaseTransportConfig {
- protected int iHeartBeatTimeout = Integer.MAX_VALUE;
- /**
- * Gets transport type for this transport configuration.
- *
- * @return One of {@link TransportType} enumeration values that represents type of this transport configuration.
- */
- public abstract TransportType getTransportType();
-
- public int getHeartBeatTimeout() {
- return iHeartBeatTimeout;
- }
-
- public void setHeartBeatTimeout(int iTimeout) {
- iHeartBeatTimeout = iTimeout;
- }
+ protected int iHeartBeatTimeout = Integer.MAX_VALUE;
+
+ /**
+ * Gets transport type for this transport configuration.
+ *
+ * @return One of {@link TransportType} enumeration values that represents type of this transport configuration.
+ */
+ public abstract TransportType getTransportType();
+
+ public int getHeartBeatTimeout() {
+ return iHeartBeatTimeout;
+ }
+
+ public void setHeartBeatTimeout(int iTimeout) {
+ iHeartBeatTimeout = iTimeout;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/SdlPsm.java b/base/src/main/java/com/smartdevicelink/transport/SdlPsm.java
index b6eac12e0..a142cebad 100644
--- a/base/src/main/java/com/smartdevicelink/transport/SdlPsm.java
+++ b/base/src/main/java/com/smartdevicelink/transport/SdlPsm.java
@@ -37,253 +37,251 @@ import static com.smartdevicelink.protocol.SdlProtocol.V1_HEADER_SIZE;
import static com.smartdevicelink.protocol.SdlProtocol.V1_V2_MTU_SIZE;
-public class SdlPsm{
- //private static final String TAG = "Sdl PSM";
- //Each state represents the byte that should be incoming
-
- public static final int START_STATE = 0x0;
- public static final int SERVICE_TYPE_STATE = 0x02;
- public static final int CONTROL_FRAME_INFO_STATE = 0x03;
- public static final int SESSION_ID_STATE = 0x04;
- public static final int DATA_SIZE_1_STATE = 0x05;
- public static final int DATA_SIZE_2_STATE = 0x06;
- public static final int DATA_SIZE_3_STATE = 0x07;
- public static final int DATA_SIZE_4_STATE = 0x08;
- public static final int MESSAGE_1_STATE = 0x09;
- public static final int MESSAGE_2_STATE = 0x0A;
- public static final int MESSAGE_3_STATE = 0x0B;
- public static final int MESSAGE_4_STATE = 0x0C;
- public static final int DATA_PUMP_STATE = 0x0D;
- public static final int FINISHED_STATE = 0xFF;
- public static final int ERROR_STATE = -1;
-
-
- private static final byte FIRST_FRAME_DATA_SIZE = 0x08;
-
- private static final int VERSION_MASK = 0xF0; //4 highest bits
- private static final int COMPRESSION_MASK = 0x08; //4th lowest bit
- private static final int FRAME_TYPE_MASK = 0x07; //3 lowest bits
-
-
-
- int state ;
-
- int version;
- boolean compression;
- int frameType;
- int serviceType;
- int controlFrameInfo;
- int sessionId;
- int dumpSize, dataLength;
- int messageId = 0;
-
- byte[] payload;
-
- public SdlPsm(){
- reset();
- }
-
- public boolean handleByte(byte data) {
- //Log.trace(TAG, data + " = incoming");
- state = transitionOnInput(data,state);
-
- return state != ERROR_STATE;
- }
-
- private int transitionOnInput(byte rawByte, int state){
- switch(state){
- case START_STATE:
- version = (rawByte&(byte)VERSION_MASK)>>4;
- //Log.trace(TAG, "Version: " + version);
- if(version==0){ //It should never be 0
- return ERROR_STATE;
- }
- compression = (1 == ((rawByte&(byte)COMPRESSION_MASK)>>3));
-
-
- frameType = rawByte&(byte)FRAME_TYPE_MASK;
- //Log.trace(TAG, rawByte + " = Frame Type: " + frameType);
-
- if((version < 1 || version > 5) //These are known versions supported by this library.
- && frameType!=SdlPacket.FRAME_TYPE_CONTROL){
- return ERROR_STATE;
- }
-
- if(frameType<SdlPacket.FRAME_TYPE_CONTROL || frameType > SdlPacket.FRAME_TYPE_CONSECUTIVE){
- return ERROR_STATE;
- }
-
- return SERVICE_TYPE_STATE;
-
- case SERVICE_TYPE_STATE:
- serviceType = (int)(rawByte&0xFF);
- return CONTROL_FRAME_INFO_STATE;
-
- case CONTROL_FRAME_INFO_STATE:
- controlFrameInfo = (int)(rawByte&0xFF);
- //Log.trace(TAG,"Frame Info: " + controlFrameInfo);
- switch(frameType){
- case SdlPacket.FRAME_TYPE_CONTROL:
+public class SdlPsm {
+ //private static final String TAG = "Sdl PSM";
+ //Each state represents the byte that should be incoming
+
+ public static final int START_STATE = 0x0;
+ public static final int SERVICE_TYPE_STATE = 0x02;
+ public static final int CONTROL_FRAME_INFO_STATE = 0x03;
+ public static final int SESSION_ID_STATE = 0x04;
+ public static final int DATA_SIZE_1_STATE = 0x05;
+ public static final int DATA_SIZE_2_STATE = 0x06;
+ public static final int DATA_SIZE_3_STATE = 0x07;
+ public static final int DATA_SIZE_4_STATE = 0x08;
+ public static final int MESSAGE_1_STATE = 0x09;
+ public static final int MESSAGE_2_STATE = 0x0A;
+ public static final int MESSAGE_3_STATE = 0x0B;
+ public static final int MESSAGE_4_STATE = 0x0C;
+ public static final int DATA_PUMP_STATE = 0x0D;
+ public static final int FINISHED_STATE = 0xFF;
+ public static final int ERROR_STATE = -1;
+
+
+ private static final byte FIRST_FRAME_DATA_SIZE = 0x08;
+
+ private static final int VERSION_MASK = 0xF0; //4 highest bits
+ private static final int COMPRESSION_MASK = 0x08; //4th lowest bit
+ private static final int FRAME_TYPE_MASK = 0x07; //3 lowest bits
+
+
+ int state;
+
+ int version;
+ boolean compression;
+ int frameType;
+ int serviceType;
+ int controlFrameInfo;
+ int sessionId;
+ int dumpSize, dataLength;
+ int messageId = 0;
+
+ byte[] payload;
+
+ public SdlPsm() {
+ reset();
+ }
+
+ public boolean handleByte(byte data) {
+ //Log.trace(TAG, data + " = incoming");
+ state = transitionOnInput(data, state);
+
+ return state != ERROR_STATE;
+ }
+
+ private int transitionOnInput(byte rawByte, int state) {
+ switch (state) {
+ case START_STATE:
+ version = (rawByte & (byte) VERSION_MASK) >> 4;
+ //Log.trace(TAG, "Version: " + version);
+ if (version == 0) { //It should never be 0
+ return ERROR_STATE;
+ }
+ compression = (1 == ((rawByte & (byte) COMPRESSION_MASK) >> 3));
+
+
+ frameType = rawByte & (byte) FRAME_TYPE_MASK;
+ //Log.trace(TAG, rawByte + " = Frame Type: " + frameType);
+
+ if ((version < 1 || version > 5) //These are known versions supported by this library.
+ && frameType != SdlPacket.FRAME_TYPE_CONTROL) {
+ return ERROR_STATE;
+ }
+
+ if (frameType < SdlPacket.FRAME_TYPE_CONTROL || frameType > SdlPacket.FRAME_TYPE_CONSECUTIVE) {
+ return ERROR_STATE;
+ }
+
+ return SERVICE_TYPE_STATE;
+
+ case SERVICE_TYPE_STATE:
+ serviceType = (int) (rawByte & 0xFF);
+ return CONTROL_FRAME_INFO_STATE;
+
+ case CONTROL_FRAME_INFO_STATE:
+ controlFrameInfo = (int) (rawByte & 0xFF);
+ //Log.trace(TAG,"Frame Info: " + controlFrameInfo);
+ switch (frameType) {
+ case SdlPacket.FRAME_TYPE_CONTROL:
/*if(frameInfo<FRAME_INFO_HEART_BEAT
|| (frameInfo>FRAME_INFO_END_SERVICE_ACK
&& (frameInfo!=FRAME_INFO_SERVICE_DATA_ACK || frameInfo!=FRAME_INFO_HEART_BEAT_ACK))){
return ERROR_STATE;
}*/ //Although some bits are reserved...whatever
- break;
- case SdlPacket.FRAME_TYPE_SINGLE: //Fall through since they are both the same
- case SdlPacket.FRAME_TYPE_FIRST:
- if(controlFrameInfo!=0x00){
- return ERROR_STATE;
- }
- break;
- case SdlPacket.FRAME_TYPE_CONSECUTIVE:
- //It might be a good idea to check packet sequence numbers here
- break;
-
- default:
- return ERROR_STATE;
- }
- return SESSION_ID_STATE;
-
- case SESSION_ID_STATE:
- sessionId = (int)(rawByte&0xFF);
- return DATA_SIZE_1_STATE;
-
- case DATA_SIZE_1_STATE:
- //First data size byte
- //Log.d(TAG, "Data byte 1: " + rawByte);
- dataLength += ((int)(rawByte& 0xFF))<<24; //3 bytes x 8 bits
- //Log.d(TAG, "Data Size 1 : " + dataLength);
- return DATA_SIZE_2_STATE;
-
- case DATA_SIZE_2_STATE:
- //Log.d(TAG, "Data byte 2: " + rawByte);
- dataLength += ((int)(rawByte& 0xFF))<<16; //2 bytes x 8 bits
- //Log.d(TAG, "Data Size 2 : " + dataLength);
- return DATA_SIZE_3_STATE;
-
- case DATA_SIZE_3_STATE:
- //Log.d(TAG, "Data byte 3: " + rawByte);
- dataLength += ((int)(rawByte& 0xFF))<<8; //1 byte x 8 bits
- //Log.d(TAG, "Data Size 3 : " + dataLength);
- return DATA_SIZE_4_STATE;
-
- case DATA_SIZE_4_STATE:
- //Log.d(TAG, "Data byte 4: " + rawByte);
- dataLength+=((int)rawByte) & 0xFF;
- //Log.trace(TAG, "Data Size: " + dataLength);
- //We should have data length now for the pump state
- switch(frameType){ //If all is correct we should break out of this switch statement
- case SdlPacket.FRAME_TYPE_SINGLE:
- case SdlPacket.FRAME_TYPE_CONSECUTIVE:
- break;
- case SdlPacket.FRAME_TYPE_CONTROL:
- //Ok, well here's some interesting bit of knowledge. Because the start session request is from the phone with no knowledge of version it sends out
- //a v1 packet. THEREFORE there is no message id field. **** Now you know and knowing is half the battle ****
- if(version==1 && controlFrameInfo == SdlPacket.FRAME_INFO_START_SERVICE){
- if(dataLength==0){
- return FINISHED_STATE; //We are done if we don't have any payload
- }
- if(dataLength <= V1_V2_MTU_SIZE - V1_HEADER_SIZE){ // sizes from protocol/WiProProtocol.java
- payload = new byte[dataLength];
- }else{
- return ERROR_STATE;
- }
- dumpSize = dataLength;
- return DATA_PUMP_STATE;
- }
- break;
-
- case SdlPacket.FRAME_TYPE_FIRST:
- if(dataLength==FIRST_FRAME_DATA_SIZE){
- break;
- }
- default:
- return ERROR_STATE;
- }
- if(version==1){ //Version 1 packets will not have message id's
- if(dataLength == 0){
- return FINISHED_STATE; //We are done if we don't have any payload
- }
- if(dataLength <= V1_V2_MTU_SIZE - V1_HEADER_SIZE){ // sizes from protocol/WiProProtocol.java
- payload = new byte[dataLength];
- }else{
- return ERROR_STATE;
- }
- dumpSize = dataLength;
- return DATA_PUMP_STATE;
- }else{
- return MESSAGE_1_STATE;
- }
-
- case MESSAGE_1_STATE:
- messageId += ((int)(rawByte& 0xFF))<<24; //3 bytes x 8 bits
- return MESSAGE_2_STATE;
-
- case MESSAGE_2_STATE:
- messageId += ((int)(rawByte& 0xFF))<<16; //2 bytes x 8 bits
- return MESSAGE_3_STATE;
-
- case MESSAGE_3_STATE:
- messageId += ((int)(rawByte& 0xFF))<<8; //1 byte x 8 bits
- return MESSAGE_4_STATE;
-
- case MESSAGE_4_STATE:
- messageId+=((int)rawByte) & 0xFF;
-
- if(dataLength==0){
- return FINISHED_STATE; //We are done if we don't have any payload
- }
- try{
- payload = new byte[dataLength];
- }catch(OutOfMemoryError oom){
- return ERROR_STATE;
- }
- dumpSize = dataLength;
- return DATA_PUMP_STATE;
-
- case DATA_PUMP_STATE:
- payload[dataLength-dumpSize] = rawByte;
- dumpSize--;
- //Do we have any more bytes to read in?
- if(dumpSize>0){
- return DATA_PUMP_STATE;
- }
- else if(dumpSize==0){
- return FINISHED_STATE;
- }else{
- return ERROR_STATE;
- }
- case FINISHED_STATE: //We shouldn't be here...Should have been reset
- default:
- return ERROR_STATE;
-
- }
-
- }
-
- public SdlPacket getFormedPacket(){
- if(state==FINISHED_STATE){
- //Log.trace(TAG, "Finished packet.");
- return new SdlPacket(version, compression, frameType,
- serviceType, controlFrameInfo, sessionId,
- dataLength, messageId, payload);
- }else{
- return null;
- }
- }
-
- public int getState() {
- return state;
- }
-
- public void reset() {
- version = 0;
- state = START_STATE;
- messageId = 0;
- dataLength = 0;
- frameType = 0x00; //Set it to null
- payload = null;
- }
+ break;
+ case SdlPacket.FRAME_TYPE_SINGLE: //Fall through since they are both the same
+ case SdlPacket.FRAME_TYPE_FIRST:
+ if (controlFrameInfo != 0x00) {
+ return ERROR_STATE;
+ }
+ break;
+ case SdlPacket.FRAME_TYPE_CONSECUTIVE:
+ //It might be a good idea to check packet sequence numbers here
+ break;
+
+ default:
+ return ERROR_STATE;
+ }
+ return SESSION_ID_STATE;
+
+ case SESSION_ID_STATE:
+ sessionId = (int) (rawByte & 0xFF);
+ return DATA_SIZE_1_STATE;
+
+ case DATA_SIZE_1_STATE:
+ //First data size byte
+ //Log.d(TAG, "Data byte 1: " + rawByte);
+ dataLength += ((int) (rawByte & 0xFF)) << 24; //3 bytes x 8 bits
+ //Log.d(TAG, "Data Size 1 : " + dataLength);
+ return DATA_SIZE_2_STATE;
+
+ case DATA_SIZE_2_STATE:
+ //Log.d(TAG, "Data byte 2: " + rawByte);
+ dataLength += ((int) (rawByte & 0xFF)) << 16; //2 bytes x 8 bits
+ //Log.d(TAG, "Data Size 2 : " + dataLength);
+ return DATA_SIZE_3_STATE;
+
+ case DATA_SIZE_3_STATE:
+ //Log.d(TAG, "Data byte 3: " + rawByte);
+ dataLength += ((int) (rawByte & 0xFF)) << 8; //1 byte x 8 bits
+ //Log.d(TAG, "Data Size 3 : " + dataLength);
+ return DATA_SIZE_4_STATE;
+
+ case DATA_SIZE_4_STATE:
+ //Log.d(TAG, "Data byte 4: " + rawByte);
+ dataLength += ((int) rawByte) & 0xFF;
+ //Log.trace(TAG, "Data Size: " + dataLength);
+ //We should have data length now for the pump state
+ switch (frameType) { //If all is correct we should break out of this switch statement
+ case SdlPacket.FRAME_TYPE_SINGLE:
+ case SdlPacket.FRAME_TYPE_CONSECUTIVE:
+ break;
+ case SdlPacket.FRAME_TYPE_CONTROL:
+ //Ok, well here's some interesting bit of knowledge. Because the start session request is from the phone with no knowledge of version it sends out
+ //a v1 packet. THEREFORE there is no message id field. **** Now you know and knowing is half the battle ****
+ if (version == 1 && controlFrameInfo == SdlPacket.FRAME_INFO_START_SERVICE) {
+ if (dataLength == 0) {
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ if (dataLength <= V1_V2_MTU_SIZE - V1_HEADER_SIZE) { // sizes from protocol/WiProProtocol.java
+ payload = new byte[dataLength];
+ } else {
+ return ERROR_STATE;
+ }
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+ }
+ break;
+
+ case SdlPacket.FRAME_TYPE_FIRST:
+ if (dataLength == FIRST_FRAME_DATA_SIZE) {
+ break;
+ }
+ default:
+ return ERROR_STATE;
+ }
+ if (version == 1) { //Version 1 packets will not have message id's
+ if (dataLength == 0) {
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ if (dataLength <= V1_V2_MTU_SIZE - V1_HEADER_SIZE) { // sizes from protocol/WiProProtocol.java
+ payload = new byte[dataLength];
+ } else {
+ return ERROR_STATE;
+ }
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+ } else {
+ return MESSAGE_1_STATE;
+ }
+
+ case MESSAGE_1_STATE:
+ messageId += ((int) (rawByte & 0xFF)) << 24; //3 bytes x 8 bits
+ return MESSAGE_2_STATE;
+
+ case MESSAGE_2_STATE:
+ messageId += ((int) (rawByte & 0xFF)) << 16; //2 bytes x 8 bits
+ return MESSAGE_3_STATE;
+
+ case MESSAGE_3_STATE:
+ messageId += ((int) (rawByte & 0xFF)) << 8; //1 byte x 8 bits
+ return MESSAGE_4_STATE;
+
+ case MESSAGE_4_STATE:
+ messageId += ((int) rawByte) & 0xFF;
+
+ if (dataLength == 0) {
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ try {
+ payload = new byte[dataLength];
+ } catch (OutOfMemoryError oom) {
+ return ERROR_STATE;
+ }
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+
+ case DATA_PUMP_STATE:
+ payload[dataLength - dumpSize] = rawByte;
+ dumpSize--;
+ //Do we have any more bytes to read in?
+ if (dumpSize > 0) {
+ return DATA_PUMP_STATE;
+ } else if (dumpSize == 0) {
+ return FINISHED_STATE;
+ } else {
+ return ERROR_STATE;
+ }
+ case FINISHED_STATE: //We shouldn't be here...Should have been reset
+ default:
+ return ERROR_STATE;
+
+ }
+
+ }
+
+ public SdlPacket getFormedPacket() {
+ if (state == FINISHED_STATE) {
+ //Log.trace(TAG, "Finished packet.");
+ return new SdlPacket(version, compression, frameType,
+ serviceType, controlFrameInfo, sessionId,
+ dataLength, messageId, payload);
+ } else {
+ return null;
+ }
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void reset() {
+ version = 0;
+ state = START_STATE;
+ messageId = 0;
+ dataLength = 0;
+ frameType = 0x00; //Set it to null
+ payload = null;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java b/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
index 3648bd8fc..cd22abc04 100644
--- a/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
+++ b/base/src/main/java/com/smartdevicelink/transport/SiphonServer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -42,376 +42,378 @@ import java.net.ServerSocket;
import java.net.Socket;
public class SiphonServer {
- private static final String TAG = "SiphonServer";
- // Prohibit use of no-arg ctor
- private SiphonServer() {}
-
- enum SiphonDataType {
- fromSdl,
- fromApp,
- appLog,
- formattedTrace,
- baselineTimeStamp,
- traceSettings
- }
-
- // Boolean to enable/disable the siphon
- private static Boolean m_siphonEnabled = false;
-
- // Boolean to determine if the siphon has been initialized
- private static Boolean m_siphonInitialized = false;
- private static Boolean m_foundOpenSocket = false;
- private static Socket m_siphonSocket = null;
- private static final Object m_siphonLock = new Object();
- private static ServerSocket m_listeningSocket = null;
- private static short m_listenPort = -1;
- private static OutputStream m_siphonSocketOutputStream = null;
- private static SiphonServerThread m_siphonClientThread = null;
-
- // Initial timestamp in MS
- private static long m_startTimeStamp = 0;
-
- // SDL Trace Message Version
- private static final byte m_sdlTraceMsgVersionNumber = 1;
-
- // Max number of ports to attempt a connection on
- private final static Integer MAX_NUMBER_OF_PORT_ATTEMPTS = 20;
-
- // Starting port for future port attempts
- private final static short FIRST_PORT_TO_ATTEMPT_CONNECTION = 7474;
-
- // Boolean to determine if formatted trace is being sent
- private static Boolean m_sendingFormattedTrace = false;
-
- public static short enableSiphonServer() {
- m_siphonEnabled = true;
- SiphonServer.init();
- return m_listenPort;
- }
-
- public static Boolean getSiphonEnabledStatus() {
- return m_siphonEnabled;
- }
-
- public static short disableSiphonServer() {
- if (!m_siphonEnabled) {
- m_listenPort = -1;
- } else {
- m_siphonEnabled = false;
- }
-
- m_siphonInitialized = false;
-
- try {
- SiphonServer.closeServer();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return m_listenPort;
- }
-
- public static boolean init() {
- // Only initialize if the siphon has not been initialized previously
-
- // Check here to be lean. If true, no need to sdlhronize
- if (m_siphonInitialized) {
- return true;
- }
-
- synchronized (m_siphonLock) {
- // To prevent a race condition, re-check m_siphonInitialized inside of sdlhronize block
- if (!m_siphonInitialized) {
- if (m_siphonClientThread == null) {
- // Set current time stamp
- m_startTimeStamp = System.currentTimeMillis();
-
- // Start Siphon Thread
- m_siphonClientThread = new SiphonServerThread();
- m_siphonClientThread.setName("Siphon");
- m_siphonClientThread.setDaemon(true);
- m_foundOpenSocket = m_siphonClientThread.findOpenSocket(FIRST_PORT_TO_ATTEMPT_CONNECTION);
- m_siphonClientThread.start();
-
- m_siphonInitialized = true;
- } // end-if
- } // end-lock
- }
-
- return m_siphonInitialized;
- } // end-method
-
- public static void closeServer() throws IOException {
-
- if (m_siphonClientThread != null) {
- m_siphonClientThread.halt();
- m_siphonClientThread = null;
- }
-
- if (m_listeningSocket != null) {
- m_listeningSocket.close();
- m_listeningSocket = null;
- }
-
- if (m_siphonSocket != null) {
- m_siphonSocket.close();
- m_siphonSocket = null;
- }
-
- if (m_siphonSocketOutputStream != null) {
- m_siphonSocketOutputStream.close();
- m_siphonSocketOutputStream = null;
- }
- }
-
- public static Boolean sendBytesFromAPP(byte[] msgBytes, int offset, int length) {
-
- if (m_sendingFormattedTrace) {
- return false;
- }
-
- return sendSiphonData(SiphonDataType.fromApp, msgBytes, offset, length);
- } // end-method
-
- public static Boolean sendBytesFromSDL(byte[] msgBytes, int offset, int length) {
-
- if (m_sendingFormattedTrace) {
- return false;
- }
-
- return sendSiphonData(SiphonDataType.fromSdl, msgBytes, offset, length);
- } // end-method
-
- public static Boolean sendSiphonLogData(String message) {
-
- if (m_sendingFormattedTrace) {
- return false;
- }
-
- if (message == null || message.length() == 0) {
- return false;
- }
-
- byte[] messageBytes;
- int messageLength = 0;
-
- try {
- messageBytes = message.getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- return false;
- }
-
- messageLength = messageBytes.length;
- return sendSiphonData(SiphonDataType.appLog, messageBytes, 0, messageLength);
-
- }
-
- public static Boolean sendFormattedTraceMessage(String message) {
-
- if (message == null || message.length() == 0) {
- return false;
- }
-
- byte[] messageBytes;
- int messageLength = 0;
-
- try {
- messageBytes = message.getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- return false;
- }
-
- messageLength = messageBytes.length;
- if (sendSiphonData(SiphonDataType.formattedTrace, messageBytes, 0, messageLength)) {
- m_sendingFormattedTrace = true;
- return true;
- } else {
- return false;
- }
- }
-
- private static Boolean sendSiphonData(SiphonDataType direction, byte[] msgBytes, int offset, int length) {
- byte siphonDataTypeIndicator = 0x00;
-
- long currentDateTime = System.currentTimeMillis();
- Integer deltaTimeMills;
-
- deltaTimeMills = (int)(currentDateTime - m_startTimeStamp);
-
- switch(direction) {
- case fromSdl:
- siphonDataTypeIndicator = 0x00;
- break;
- case fromApp:
- siphonDataTypeIndicator = 0x01;
- break;
- case appLog:
- siphonDataTypeIndicator = 0x02;
- break;
- case formattedTrace:
- siphonDataTypeIndicator = 0x03;
- break;
- case baselineTimeStamp:
- siphonDataTypeIndicator = 0x04;
- break;
- case traceSettings:
- siphonDataTypeIndicator = 0x05;
- break;
- default:
- siphonDataTypeIndicator = 0x00;
- break;
- }
-
- // Set high bit to indicate new format
- siphonDataTypeIndicator = (byte)((byte)0x80 | siphonDataTypeIndicator);
-
- return sendDataToSiphonSocket(siphonDataTypeIndicator, deltaTimeMills, msgBytes, offset, length);
- }
-
- private synchronized static Boolean sendDataToSiphonSocket(byte directionIndicator, Integer timeStamp,
- byte[] msgBytes, int offset, int length) {
- if (!m_siphonEnabled) {
- return false;
- }
-
- if (msgBytes == null || length == 0) {
- return false;
- }
-
- OutputStream siphonOutputStream;
-
- synchronized (m_siphonLock) {
- siphonOutputStream = m_siphonSocketOutputStream;
- } // end-lock
-
- if (siphonOutputStream == null) {
- return false;
- }
-
- try {
- // blobSize = length(of message) + 1(size of direction indicator)
- // + 1 (size of msgVersionNumber) + 4 (size of timeStamp)
- int blobSize = length + 1 + 1 + 4;
-
- siphonOutputStream.write(BitConverter.intToByteArray(blobSize));
- siphonOutputStream.write(new byte[] {directionIndicator});
- siphonOutputStream.write(new byte[] {m_sdlTraceMsgVersionNumber});
- siphonOutputStream.write(intToByteArray(timeStamp));
- siphonOutputStream.write(msgBytes, offset, length);
- } catch (Exception ex) {
- return false;
- } // end-catch
-
- return true;
- } // end-method
-
+ private static final String TAG = "SiphonServer";
+
+ // Prohibit use of no-arg ctor
+ private SiphonServer() {
+ }
+
+ enum SiphonDataType {
+ fromSdl,
+ fromApp,
+ appLog,
+ formattedTrace,
+ baselineTimeStamp,
+ traceSettings
+ }
+
+ // Boolean to enable/disable the siphon
+ private static Boolean m_siphonEnabled = false;
+
+ // Boolean to determine if the siphon has been initialized
+ private static Boolean m_siphonInitialized = false;
+ private static Boolean m_foundOpenSocket = false;
+ private static Socket m_siphonSocket = null;
+ private static final Object m_siphonLock = new Object();
+ private static ServerSocket m_listeningSocket = null;
+ private static short m_listenPort = -1;
+ private static OutputStream m_siphonSocketOutputStream = null;
+ private static SiphonServerThread m_siphonClientThread = null;
+
+ // Initial timestamp in MS
+ private static long m_startTimeStamp = 0;
+
+ // SDL Trace Message Version
+ private static final byte m_sdlTraceMsgVersionNumber = 1;
+
+ // Max number of ports to attempt a connection on
+ private final static Integer MAX_NUMBER_OF_PORT_ATTEMPTS = 20;
+
+ // Starting port for future port attempts
+ private final static short FIRST_PORT_TO_ATTEMPT_CONNECTION = 7474;
+
+ // Boolean to determine if formatted trace is being sent
+ private static Boolean m_sendingFormattedTrace = false;
+
+ public static short enableSiphonServer() {
+ m_siphonEnabled = true;
+ SiphonServer.init();
+ return m_listenPort;
+ }
+
+ public static Boolean getSiphonEnabledStatus() {
+ return m_siphonEnabled;
+ }
+
+ public static short disableSiphonServer() {
+ if (!m_siphonEnabled) {
+ m_listenPort = -1;
+ } else {
+ m_siphonEnabled = false;
+ }
+
+ m_siphonInitialized = false;
+
+ try {
+ SiphonServer.closeServer();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return m_listenPort;
+ }
+
+ public static boolean init() {
+ // Only initialize if the siphon has not been initialized previously
+
+ // Check here to be lean. If true, no need to sdlhronize
+ if (m_siphonInitialized) {
+ return true;
+ }
+
+ synchronized (m_siphonLock) {
+ // To prevent a race condition, re-check m_siphonInitialized inside of sdlhronize block
+ if (!m_siphonInitialized) {
+ if (m_siphonClientThread == null) {
+ // Set current time stamp
+ m_startTimeStamp = System.currentTimeMillis();
+
+ // Start Siphon Thread
+ m_siphonClientThread = new SiphonServerThread();
+ m_siphonClientThread.setName("Siphon");
+ m_siphonClientThread.setDaemon(true);
+ m_foundOpenSocket = m_siphonClientThread.findOpenSocket(FIRST_PORT_TO_ATTEMPT_CONNECTION);
+ m_siphonClientThread.start();
+
+ m_siphonInitialized = true;
+ } // end-if
+ } // end-lock
+ }
+
+ return m_siphonInitialized;
+ } // end-method
+
+ public static void closeServer() throws IOException {
+
+ if (m_siphonClientThread != null) {
+ m_siphonClientThread.halt();
+ m_siphonClientThread = null;
+ }
+
+ if (m_listeningSocket != null) {
+ m_listeningSocket.close();
+ m_listeningSocket = null;
+ }
+
+ if (m_siphonSocket != null) {
+ m_siphonSocket.close();
+ m_siphonSocket = null;
+ }
+
+ if (m_siphonSocketOutputStream != null) {
+ m_siphonSocketOutputStream.close();
+ m_siphonSocketOutputStream = null;
+ }
+ }
+
+ public static Boolean sendBytesFromAPP(byte[] msgBytes, int offset, int length) {
+
+ if (m_sendingFormattedTrace) {
+ return false;
+ }
+
+ return sendSiphonData(SiphonDataType.fromApp, msgBytes, offset, length);
+ } // end-method
+
+ public static Boolean sendBytesFromSDL(byte[] msgBytes, int offset, int length) {
+
+ if (m_sendingFormattedTrace) {
+ return false;
+ }
+
+ return sendSiphonData(SiphonDataType.fromSdl, msgBytes, offset, length);
+ } // end-method
+
+ public static Boolean sendSiphonLogData(String message) {
+
+ if (m_sendingFormattedTrace) {
+ return false;
+ }
+
+ if (message == null || message.length() == 0) {
+ return false;
+ }
+
+ byte[] messageBytes;
+ int messageLength = 0;
+
+ try {
+ messageBytes = message.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return false;
+ }
+
+ messageLength = messageBytes.length;
+ return sendSiphonData(SiphonDataType.appLog, messageBytes, 0, messageLength);
+
+ }
+
+ public static Boolean sendFormattedTraceMessage(String message) {
+
+ if (message == null || message.length() == 0) {
+ return false;
+ }
+
+ byte[] messageBytes;
+ int messageLength = 0;
+
+ try {
+ messageBytes = message.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return false;
+ }
+
+ messageLength = messageBytes.length;
+ if (sendSiphonData(SiphonDataType.formattedTrace, messageBytes, 0, messageLength)) {
+ m_sendingFormattedTrace = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static Boolean sendSiphonData(SiphonDataType direction, byte[] msgBytes, int offset, int length) {
+ byte siphonDataTypeIndicator = 0x00;
+
+ long currentDateTime = System.currentTimeMillis();
+ Integer deltaTimeMills;
+
+ deltaTimeMills = (int) (currentDateTime - m_startTimeStamp);
+
+ switch (direction) {
+ case fromSdl:
+ siphonDataTypeIndicator = 0x00;
+ break;
+ case fromApp:
+ siphonDataTypeIndicator = 0x01;
+ break;
+ case appLog:
+ siphonDataTypeIndicator = 0x02;
+ break;
+ case formattedTrace:
+ siphonDataTypeIndicator = 0x03;
+ break;
+ case baselineTimeStamp:
+ siphonDataTypeIndicator = 0x04;
+ break;
+ case traceSettings:
+ siphonDataTypeIndicator = 0x05;
+ break;
+ default:
+ siphonDataTypeIndicator = 0x00;
+ break;
+ }
+
+ // Set high bit to indicate new format
+ siphonDataTypeIndicator = (byte) ((byte) 0x80 | siphonDataTypeIndicator);
+
+ return sendDataToSiphonSocket(siphonDataTypeIndicator, deltaTimeMills, msgBytes, offset, length);
+ }
+
+ private synchronized static Boolean sendDataToSiphonSocket(byte directionIndicator, Integer timeStamp,
+ byte[] msgBytes, int offset, int length) {
+ if (!m_siphonEnabled) {
+ return false;
+ }
+
+ if (msgBytes == null || length == 0) {
+ return false;
+ }
+
+ OutputStream siphonOutputStream;
+
+ synchronized (m_siphonLock) {
+ siphonOutputStream = m_siphonSocketOutputStream;
+ } // end-lock
+
+ if (siphonOutputStream == null) {
+ return false;
+ }
+
+ try {
+ // blobSize = length(of message) + 1(size of direction indicator)
+ // + 1 (size of msgVersionNumber) + 4 (size of timeStamp)
+ int blobSize = length + 1 + 1 + 4;
+
+ siphonOutputStream.write(BitConverter.intToByteArray(blobSize));
+ siphonOutputStream.write(new byte[]{directionIndicator});
+ siphonOutputStream.write(new byte[]{m_sdlTraceMsgVersionNumber});
+ siphonOutputStream.write(intToByteArray(timeStamp));
+ siphonOutputStream.write(msgBytes, offset, length);
+ } catch (Exception ex) {
+ return false;
+ } // end-catch
+
+ return true;
+ } // end-method
+
private static class SiphonServerThread extends Thread {
-
- private Boolean isHalted = false;
- short listenPort;
-
- public void halt() {
- isHalted = true;
- }
-
- private boolean findOpenSocket(short port) {
- // Accept incoming siphon connection from trace utility.
- Boolean foundOpenPort = false;
- listenPort = port;
-
- // Listen to accept incoming connection from SDL
- while (!foundOpenPort) {
- try {
- m_listeningSocket = new ServerSocket(listenPort);
- foundOpenPort = true;
- m_listenPort = listenPort;
- } catch (BindException ex) {
- listenPort++;
- if(listenPort > port + MAX_NUMBER_OF_PORT_ATTEMPTS) {
- return false;
- }
- } catch (IOException e) {
- return false;
- }
- }
-
- return foundOpenPort;
- }
-
- private void startServerOnPort() throws IOException {
- Socket newSocket;
-
- // Wait for a connection
- newSocket = m_listeningSocket.accept();
-
+
+ private Boolean isHalted = false;
+ short listenPort;
+
+ public void halt() {
+ isHalted = true;
+ }
+
+ private boolean findOpenSocket(short port) {
+ // Accept incoming siphon connection from trace utility.
+ Boolean foundOpenPort = false;
+ listenPort = port;
+
+ // Listen to accept incoming connection from SDL
+ while (!foundOpenPort) {
+ try {
+ m_listeningSocket = new ServerSocket(listenPort);
+ foundOpenPort = true;
+ m_listenPort = listenPort;
+ } catch (BindException ex) {
+ listenPort++;
+ if (listenPort > port + MAX_NUMBER_OF_PORT_ATTEMPTS) {
+ return false;
+ }
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ return foundOpenPort;
+ }
+
+ private void startServerOnPort() throws IOException {
+ Socket newSocket;
+
+ // Wait for a connection
+ newSocket = m_listeningSocket.accept();
+
// If isHalted after accept() delay, return
- if (isHalted) {
- return;
- }
-
- synchronized (m_siphonLock) {
- // Reset siphonSocketOutputStream
- if (m_siphonSocketOutputStream != null) {
- try {
- m_siphonSocketOutputStream.close();
- } catch (IOException e) {
- // Do nothing
- }
- m_siphonSocketOutputStream = null;
- }
-
- // Reset siphonSocket
- if (m_siphonSocket != null) {
- try {
- m_siphonSocket.close();
- } catch (IOException e) {
- // Do nothing
- }
- m_siphonSocket = null;
- }
-
- // Store the new socket
- m_siphonSocket = newSocket;
-
- // Set Socket Options
- m_siphonSocket.setKeepAlive(true);
-
- // Get the output stream of the connection
- m_siphonSocketOutputStream = m_siphonSocket.getOutputStream();
-
- // Output version number to the Siphon upon connection (version number prepending to logInfo)
- DebugTool.logInfo(TAG, "Siphon connected.");
- } // end-lock
+ if (isHalted) {
+ return;
+ }
+
+ synchronized (m_siphonLock) {
+ // Reset siphonSocketOutputStream
+ if (m_siphonSocketOutputStream != null) {
+ try {
+ m_siphonSocketOutputStream.close();
+ } catch (IOException e) {
+ // Do nothing
+ }
+ m_siphonSocketOutputStream = null;
+ }
+
+ // Reset siphonSocket
+ if (m_siphonSocket != null) {
+ try {
+ m_siphonSocket.close();
+ } catch (IOException e) {
+ // Do nothing
+ }
+ m_siphonSocket = null;
+ }
+
+ // Store the new socket
+ m_siphonSocket = newSocket;
+
+ // Set Socket Options
+ m_siphonSocket.setKeepAlive(true);
+
+ // Get the output stream of the connection
+ m_siphonSocketOutputStream = m_siphonSocket.getOutputStream();
+
+ // Output version number to the Siphon upon connection (version number prepending to logInfo)
+ DebugTool.logInfo(TAG, "Siphon connected.");
+ } // end-lock
} // end-method
-
- @Override
- public void run() {
- try {
- if (m_foundOpenSocket){
- while (!isHalted) {
- startServerOnPort();
- }
- }
- } catch (Exception ex) {
- // Do nothing
- } finally {
- if (m_listeningSocket != null) {
- try {
- m_listeningSocket.close();
- } catch (IOException e) {
- // Do nothing
- }
- m_listeningSocket = null;
- }
- }
- }
+
+ @Override
+ public void run() {
+ try {
+ if (m_foundOpenSocket) {
+ while (!isHalted) {
+ startServerOnPort();
+ }
+ }
+ } catch (Exception ex) {
+ // Do nothing
+ } finally {
+ if (m_listeningSocket != null) {
+ try {
+ m_listeningSocket.close();
+ } catch (IOException e) {
+ // Do nothing
+ }
+ m_listeningSocket = null;
+ }
+ }
+ }
}
-
+
private static byte[] intToByteArray(int value) {
- return new byte[] {
- (byte)(value >>> 24),
- (byte)(value >>> 16),
- (byte)(value >>> 8),
- (byte)value};
+ return new byte[]{
+ (byte) (value >>> 24),
+ (byte) (value >>> 16),
+ (byte) (value >>> 8),
+ (byte) value};
}
} // end-class \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
index 7fbcde80d..d2a45fcb9 100644
--- a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
+++ b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,271 +35,268 @@ package com.smartdevicelink.transport;
/**
* These constants are shared between the router service and the SDL base service.
* They are defined as strings/actions/values that both of them can understand.
- * Attempting to use standard HTTP error codes as definitions.
- * @author Joey Grover
+ * Attempting to use standard HTTP error codes as definitions.
*
+ * @author Joey Grover
*/
public class TransportConstants {
- public static final String START_ROUTER_SERVICE_ACTION ="sdl.router.startservice";
- public static final String ROUTER_SERVICE_ACTION = "com.smartdevicelink.router.service";
- public static final String FOREGROUND_EXTRA = "foreground";
- public static final String CONFIRMED_SDL_DEVICE = "confirmed_sdl_device";
-
- public static final String BIND_LOCATION_PACKAGE_NAME_EXTRA = "BIND_LOCATION_PACKAGE_NAME_EXTRA";
- public static final String BIND_LOCATION_CLASS_NAME_EXTRA = "BIND_LOCATION_CLASS_NAME_EXTRA";
-
- public static final String ALT_TRANSPORT_RECEIVER = "com.sdl.android.alttransport";
- public static final String ALT_TRANSPORT_CONNECTION_STATUS_EXTRA = "connection_status";
- public static final int ALT_TRANSPORT_DISCONNECTED = 0;
- public static final int ALT_TRANSPORT_CONNECTED = 1;
- public static final String ALT_TRANSPORT_READ = "read";//Read from the alt transport, goes to the app
- public static final String ALT_TRANSPORT_WRITE = "write";//Write to the alt transport, comes from the app
- public static final String ALT_TRANSPORT_ADDRESS_EXTRA = "altTransportAddress";
-
- public static final String START_ROUTER_SERVICE_SDL_ENABLED_EXTRA = "sdl_enabled";
- public static final String START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE = "package_name";
- public static final String START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME = "component_name";
- public static final String START_ROUTER_SERVICE_TRANSPORT_CONNECTED = "transport_connected"; //Extra for the transport that just connected
- public static final String START_ROUTER_SERVICE_SDL_ENABLED_PING = "ping";
- @Deprecated
- public static final String FORCE_TRANSPORT_CONNECTED = "force_connect"; //This is legacy, do not refactor this.
- public static final String ROUTER_SERVICE_VALIDATED = "router_service_validated";
-
- public static final String CONNECT_AS_CLIENT_BOOLEAN_EXTRA = "connectAsClient";
- public static final String PACKAGE_NAME_STRING = "package.name";
- public static final String APP_ID_EXTRA = "app.id";//Sent as a Long. This is no longer used
- public static final String APP_ID_EXTRA_STRING = "app.id.string";
- public static final String ROUTER_MESSAGING_VERSION = "router.messaging.version";
-
- public static final String SESSION_ID_EXTRA = "session.id";
-
- public static final String ENABLE_LEGACY_MODE_EXTRA = "ENABLE_LEGACY_MODE_EXTRA";
-
- @Deprecated
- public static final String HARDWARE_DISCONNECTED = "hardware.disconect"; //This is legacy, do not refactor this.
- public static final String TRANSPORT_DISCONNECTED = "transport.disconect";
- public static final String HARDWARE_CONNECTED = "hardware.connected";
- public static final String CURRENT_HARDWARE_CONNECTED = "current.hardware.connected";
-
- public static final String SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME = "senderintent";
- public static final String SEND_PACKET_TO_ROUTER_LOCATION_EXTRA_NAME = "routerintent";
-
-
- public static final String BIND_REQUEST_TYPE_CLIENT = "BIND_REQUEST_TYPE_CLIENT";
- public static final String BIND_REQUEST_TYPE_ALT_TRANSPORT = "BIND_REQUEST_TYPE_ALT_TRANSPORT";
- public static final String BIND_REQUEST_TYPE_STATUS = "BIND_REQUEST_TYPE_STATUS";
- public static final String BIND_REQUEST_TYPE_USB_PROVIDER = "BIND_REQUEST_TYPE_USB_PROVIDER";
-
-
- public static final String PING_ROUTER_SERVICE_EXTRA = "ping.router.service";
-
- public static final String SDL_NOTIFICATION_CHANNEL_ID = "sdl_notification_channel";
- public static final String SDL_NOTIFICATION_CHANNEL_NAME = "SmartDeviceLink";
- public static final String SDL_ERROR_NOTIFICATION_CHANNEL_ID = "sdl_error_notification_channel";
- public static final int SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT = 99;
-
-
-
-
- /**
- * This class houses all important router service versions
- */
- public class RouterServiceVersions{
- /**
- * This version of the router service is when app IDs went from Longs to Strings
- */
- public static final int APPID_STRING = 4;
- }
-
-
- /*
- * Alt transport
- *
- */
-
- /**
- * This will be the response when a hardware connect event comes through from an alt transport.
- * This is because it only makes sense to register an alt transport when a connection is established with that
- * transport, not waiting for one.
- */
- public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE = 0x02;
- public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS = 0x00;
- /**
- * There is already another alt transport connected, so we are unable to register this one
- */
- public static final int ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED = 0x01;
-
- /**
- * This means the router service is shutting down for some reason. Most likely
- */
- public static final int ROUTER_SHUTTING_DOWN_NOTIFICATION = 0x0F;
-
- /**
- * There is a newer service to start up, so this one is shutting down
- */
- public static final int ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE = 0x00;
-
- /*
- * Router to Client binding service
- *
- */
-
- //WHATS
- /**
+ public static final String START_ROUTER_SERVICE_ACTION = "sdl.router.startservice";
+ public static final String ROUTER_SERVICE_ACTION = "com.smartdevicelink.router.service";
+ public static final String FOREGROUND_EXTRA = "foreground";
+ public static final String CONFIRMED_SDL_DEVICE = "confirmed_sdl_device";
+
+ public static final String BIND_LOCATION_PACKAGE_NAME_EXTRA = "BIND_LOCATION_PACKAGE_NAME_EXTRA";
+ public static final String BIND_LOCATION_CLASS_NAME_EXTRA = "BIND_LOCATION_CLASS_NAME_EXTRA";
+
+ public static final String ALT_TRANSPORT_RECEIVER = "com.sdl.android.alttransport";
+ public static final String ALT_TRANSPORT_CONNECTION_STATUS_EXTRA = "connection_status";
+ public static final int ALT_TRANSPORT_DISCONNECTED = 0;
+ public static final int ALT_TRANSPORT_CONNECTED = 1;
+ public static final String ALT_TRANSPORT_READ = "read";//Read from the alt transport, goes to the app
+ public static final String ALT_TRANSPORT_WRITE = "write";//Write to the alt transport, comes from the app
+ public static final String ALT_TRANSPORT_ADDRESS_EXTRA = "altTransportAddress";
+
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_EXTRA = "sdl_enabled";
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE = "package_name";
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME = "component_name";
+ public static final String START_ROUTER_SERVICE_TRANSPORT_CONNECTED = "transport_connected"; //Extra for the transport that just connected
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_PING = "ping";
+ @Deprecated
+ public static final String FORCE_TRANSPORT_CONNECTED = "force_connect"; //This is legacy, do not refactor this.
+ public static final String ROUTER_SERVICE_VALIDATED = "router_service_validated";
+
+ public static final String CONNECT_AS_CLIENT_BOOLEAN_EXTRA = "connectAsClient";
+ public static final String PACKAGE_NAME_STRING = "package.name";
+ public static final String APP_ID_EXTRA = "app.id";//Sent as a Long. This is no longer used
+ public static final String APP_ID_EXTRA_STRING = "app.id.string";
+ public static final String ROUTER_MESSAGING_VERSION = "router.messaging.version";
+
+ public static final String SESSION_ID_EXTRA = "session.id";
+
+ public static final String ENABLE_LEGACY_MODE_EXTRA = "ENABLE_LEGACY_MODE_EXTRA";
+
+ @Deprecated
+ public static final String HARDWARE_DISCONNECTED = "hardware.disconect"; //This is legacy, do not refactor this.
+ public static final String TRANSPORT_DISCONNECTED = "transport.disconect";
+ public static final String HARDWARE_CONNECTED = "hardware.connected";
+ public static final String CURRENT_HARDWARE_CONNECTED = "current.hardware.connected";
+
+ public static final String SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME = "senderintent";
+ public static final String SEND_PACKET_TO_ROUTER_LOCATION_EXTRA_NAME = "routerintent";
+
+
+ public static final String BIND_REQUEST_TYPE_CLIENT = "BIND_REQUEST_TYPE_CLIENT";
+ public static final String BIND_REQUEST_TYPE_ALT_TRANSPORT = "BIND_REQUEST_TYPE_ALT_TRANSPORT";
+ public static final String BIND_REQUEST_TYPE_STATUS = "BIND_REQUEST_TYPE_STATUS";
+ public static final String BIND_REQUEST_TYPE_USB_PROVIDER = "BIND_REQUEST_TYPE_USB_PROVIDER";
+
+
+ public static final String PING_ROUTER_SERVICE_EXTRA = "ping.router.service";
+
+ public static final String SDL_NOTIFICATION_CHANNEL_ID = "sdl_notification_channel";
+ public static final String SDL_NOTIFICATION_CHANNEL_NAME = "SmartDeviceLink";
+ public static final String SDL_ERROR_NOTIFICATION_CHANNEL_ID = "sdl_error_notification_channel";
+ public static final int SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT = 99;
+
+
+ /**
+ * This class houses all important router service versions
+ */
+ public class RouterServiceVersions {
+ /**
+ * This version of the router service is when app IDs went from Longs to Strings
+ */
+ public static final int APPID_STRING = 4;
+ }
+
+
+ /*
+ * Alt transport
+ *
+ */
+
+ /**
+ * This will be the response when a hardware connect event comes through from an alt transport.
+ * This is because it only makes sense to register an alt transport when a connection is established with that
+ * transport, not waiting for one.
+ */
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE = 0x02;
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS = 0x00;
+ /**
+ * There is already another alt transport connected, so we are unable to register this one
+ */
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED = 0x01;
+
+ /**
+ * This means the router service is shutting down for some reason. Most likely
+ */
+ public static final int ROUTER_SHUTTING_DOWN_NOTIFICATION = 0x0F;
+
+ /**
+ * There is a newer service to start up, so this one is shutting down
+ */
+ public static final int ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE = 0x00;
+
+ /*
+ * Router to Client binding service
+ *
+ */
+
+ //WHATS
+ /**
* Command to the service to register a client, receiving callbacks
* from the service. The Message's replyTo field must be a Messenger of
* the client where callbacks should be sent.
*/
- public static final int ROUTER_REGISTER_CLIENT = 0x01;
- /**
- * This response message will contain if the registration request was successful or not. If not, the reason will be
- * great or equal to 1 and be descriptive of why it was denied.
- */
- public static final int ROUTER_REGISTER_CLIENT_RESPONSE = 0x02;
- //Response arguments
- public static final int REGISTRATION_RESPONSE_SUCESS = 0x00;
- public static final int REGISTRATION_RESPONSE_DENIED_AUTHENTICATION_FAILED = 0x01;
- public static final int REGISTRATION_RESPONSE_DENIED_NO_CONNECTION = 0x02;
- public static final int REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED = 0x03;
- public static final int REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED = 0x04;
- public static final int REGISTRATION_RESPONSE_DENIED_UNKNOWN = 0xFF;
-
- /**
+ public static final int ROUTER_REGISTER_CLIENT = 0x01;
+ /**
+ * This response message will contain if the registration request was successful or not. If not, the reason will be
+ * great or equal to 1 and be descriptive of why it was denied.
+ */
+ public static final int ROUTER_REGISTER_CLIENT_RESPONSE = 0x02;
+ //Response arguments
+ public static final int REGISTRATION_RESPONSE_SUCESS = 0x00;
+ public static final int REGISTRATION_RESPONSE_DENIED_AUTHENTICATION_FAILED = 0x01;
+ public static final int REGISTRATION_RESPONSE_DENIED_NO_CONNECTION = 0x02;
+ public static final int REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED = 0x03;
+ public static final int REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED = 0x04;
+ public static final int REGISTRATION_RESPONSE_DENIED_UNKNOWN = 0xFF;
+
+ /**
* Command to the service to unregister a client, to stop receiving callbacks
* from the service. The Message's replyTo field must be a Messenger of
* the client as previously given with MSG_REGISTER_CLIENT. Also include the app id as arg1.
*/
- public static final int ROUTER_UNREGISTER_CLIENT = 0x03;
- public static final int ROUTER_UNREGISTER_CLIENT_RESPONSE = 0x04;
- //Response arguments
- public static final int UNREGISTRATION_RESPONSE_SUCESS = 0x00;
- public static final int UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND = 0x01;
-
-
- /**
- * what message type to notify apps of a hardware connection event. The connection event will be placed in the bundle
- * attached to the message
- */
- public static final int HARDWARE_CONNECTION_EVENT = 0x05;
- public static final int HARDWARE_CONNECTION_EVENT_CONNECTED = 0x10;
- public static final int HARDWARE_CONNECTION_EVENT_DISCONNECTED = 0x30;
-
-
- public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT = 0x10;
- public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT_RESPONSE = 0x11;
-
- /**
- * This provides the app with an ability to request another session within the router service.
- * A replyTo must be provided or else there won't be a response
- */
- public static final int ROUTER_REQUEST_NEW_SESSION = 0x12;
- //Request arguments
- //See TRANSPORT_TYPE & TRANSPORT_ADDRESS
-
-
- public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE = 0x13;
- //Response arguments
- public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS = 0x00;
- public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
- public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
-
- /**
- * This provides the app with an ability to request another session within the router service.
- * A replyTo must be provided or else there won't be a response
- */
- public static final int ROUTER_REMOVE_SESSION = 0x14;
- public static final int ROUTER_REMOVE_SESSION_RESPONSE = 0x15;
- //Response arguments
- public static final int ROUTER_REMOVE_SESSION_RESPONSE_SUCESS = 0x00;
- public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
- public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
- public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND = 0x03;
- public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL = 0x04;
+ public static final int ROUTER_UNREGISTER_CLIENT = 0x03;
+ public static final int ROUTER_UNREGISTER_CLIENT_RESPONSE = 0x04;
+ //Response arguments
+ public static final int UNREGISTRATION_RESPONSE_SUCESS = 0x00;
+ public static final int UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND = 0x01;
+
+
+ /**
+ * what message type to notify apps of a hardware connection event. The connection event will be placed in the bundle
+ * attached to the message
+ */
+ public static final int HARDWARE_CONNECTION_EVENT = 0x05;
+ public static final int HARDWARE_CONNECTION_EVENT_CONNECTED = 0x10;
+ public static final int HARDWARE_CONNECTION_EVENT_DISCONNECTED = 0x30;
+
+
+ public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT = 0x10;
+ public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT_RESPONSE = 0x11;
+
+ /**
+ * This provides the app with an ability to request another session within the router service.
+ * A replyTo must be provided or else there won't be a response
+ */
+ public static final int ROUTER_REQUEST_NEW_SESSION = 0x12;
+ //Request arguments
+ //See TRANSPORT_TYPE & TRANSPORT_ADDRESS
+
+
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE = 0x13;
+ //Response arguments
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS = 0x00;
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
+
+ /**
+ * This provides the app with an ability to request another session within the router service.
+ * A replyTo must be provided or else there won't be a response
+ */
+ public static final int ROUTER_REMOVE_SESSION = 0x14;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE = 0x15;
+ //Response arguments
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_SUCESS = 0x00;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND = 0x03;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL = 0x04;
/**
* Command to have router service to send a packet
*/
- public static final int ROUTER_SEND_PACKET = 0x20;
-
- //response
- /**
- * Router has received a packet and sent it to the client
- */
- public static final int ROUTER_RECEIVED_PACKET = 0x26;
- //response
-
- /**
- * Command to tell router service details of secondary transport
- */
- public static final int ROUTER_REQUEST_SECONDARY_TRANSPORT_CONNECTION = 0x30;
-
- //BUNDLE EXTRAS
-
- public static final String FORMED_PACKET_EXTRA_NAME = "packet";
-
- public static final String BYTES_TO_SEND_EXTRA_NAME = "bytes";
- public static final String BYTES_TO_SEND_EXTRA_OFFSET = "offset";
- public static final String BYTES_TO_SEND_EXTRA_COUNT = "count";
- public static final String BYTES_TO_SEND_FLAGS = "flags";
-
- public static final String PACKET_PRIORITY_COEFFICIENT = "priority_coefficient";
-
- public static final String TRANSPORT_TYPE = "transport_type";
- public static final String TRANSPORT_ADDRESS = "transport_address";
-
- public static final int BYTES_TO_SEND_FLAG_NONE = 0x00;
- public static final int BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED = 0x01;
- public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_START = 0x02;
- public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT = 0x04;
- public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_END = 0x08;
-
- public static final String CONNECTED_DEVICE_STRING_EXTRA_NAME = "devicestring";
-
- public static final int PACKET_SENDING_ERROR_NOT_REGISTERED_APP = 0x00;
- public static final int PACKET_SENDING_ERROR_NOT_CONNECTED = 0x01;
- public static final int PACKET_SENDING_ERROR_UKNOWN = 0xFF;
-
- public static final String ROUTER_SERVICE_VERSION = "router_service_version";
-
- /**
- * Status binder
- */
-
- public static final int ROUTER_STATUS_CONNECTED_STATE_REQUEST = 0x01;
- public static final int ROUTER_STATUS_CONNECTED_STATE_RESPONSE = 0x02;
- /**
- * This flag when used to check router status will trigger the router service in sending out a ping that if it is connected to a device
- */
- public static final int ROUTER_STATUS_FLAG_TRIGGER_PING = 0x02;
-
-
- /**
- * Usb Transfer binder
- */
-
- public static final int USB_CONNECTED_WITH_DEVICE = 0x55;
- public static final int ROUTER_USB_ACC_RECEIVED = 0x56;
-
-
- /**
- * Multiple-transports related constants
- *
- */
- public static final String IAP_BLUETOOTH = "IAP_BLUETOOTH";
- public static final String IAP_USB = "IAP_USB";
- public static final String IAP_USB_HOST_MODE = "TCP_WIFI";
- public static final String IAP_CARPLAY = "IAP_CARPLAY";
- public static final String SPP_BLUETOOTH = "SPP_BLUETOOTH";
- public static final String AOA_USB = "AOA_USB";
- public static final String TCP_WIFI = "TCP_WIFI";
-
-
- /**
- * Broadcast action: sent when a USB accessory is attached.
- *
- * UsbManager.EXTRA_ACCESSORY extra contains UsbAccessory object that has
- * been attached.
- */
- public static final String ACTION_USB_ACCESSORY_ATTACHED = "com.smartdevicelink.USB_ACCESSORY_ATTACHED";
+ public static final int ROUTER_SEND_PACKET = 0x20;
+
+ //response
+ /**
+ * Router has received a packet and sent it to the client
+ */
+ public static final int ROUTER_RECEIVED_PACKET = 0x26;
+ //response
+
+ /**
+ * Command to tell router service details of secondary transport
+ */
+ public static final int ROUTER_REQUEST_SECONDARY_TRANSPORT_CONNECTION = 0x30;
+
+ //BUNDLE EXTRAS
+
+ public static final String FORMED_PACKET_EXTRA_NAME = "packet";
+
+ public static final String BYTES_TO_SEND_EXTRA_NAME = "bytes";
+ public static final String BYTES_TO_SEND_EXTRA_OFFSET = "offset";
+ public static final String BYTES_TO_SEND_EXTRA_COUNT = "count";
+ public static final String BYTES_TO_SEND_FLAGS = "flags";
+
+ public static final String PACKET_PRIORITY_COEFFICIENT = "priority_coefficient";
+
+ public static final String TRANSPORT_TYPE = "transport_type";
+ public static final String TRANSPORT_ADDRESS = "transport_address";
+
+ public static final int BYTES_TO_SEND_FLAG_NONE = 0x00;
+ public static final int BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED = 0x01;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_START = 0x02;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT = 0x04;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_END = 0x08;
+
+ public static final String CONNECTED_DEVICE_STRING_EXTRA_NAME = "devicestring";
+
+ public static final int PACKET_SENDING_ERROR_NOT_REGISTERED_APP = 0x00;
+ public static final int PACKET_SENDING_ERROR_NOT_CONNECTED = 0x01;
+ public static final int PACKET_SENDING_ERROR_UKNOWN = 0xFF;
+
+ public static final String ROUTER_SERVICE_VERSION = "router_service_version";
+
+ /**
+ * Status binder
+ */
+
+ public static final int ROUTER_STATUS_CONNECTED_STATE_REQUEST = 0x01;
+ public static final int ROUTER_STATUS_CONNECTED_STATE_RESPONSE = 0x02;
+ /**
+ * This flag when used to check router status will trigger the router service in sending out a ping that if it is connected to a device
+ */
+ public static final int ROUTER_STATUS_FLAG_TRIGGER_PING = 0x02;
+
+
+ /**
+ * Usb Transfer binder
+ */
+
+ public static final int USB_CONNECTED_WITH_DEVICE = 0x55;
+ public static final int ROUTER_USB_ACC_RECEIVED = 0x56;
+
+
+ /**
+ * Multiple-transports related constants
+ */
+ public static final String IAP_BLUETOOTH = "IAP_BLUETOOTH";
+ public static final String IAP_USB = "IAP_USB";
+ public static final String IAP_USB_HOST_MODE = "TCP_WIFI";
+ public static final String IAP_CARPLAY = "IAP_CARPLAY";
+ public static final String SPP_BLUETOOTH = "SPP_BLUETOOTH";
+ public static final String AOA_USB = "AOA_USB";
+ public static final String TCP_WIFI = "TCP_WIFI";
+
+
+ /**
+ * Broadcast action: sent when a USB accessory is attached.
+ * <p>
+ * UsbManager.EXTRA_ACCESSORY extra contains UsbAccessory object that has
+ * been attached.
+ */
+ public static final String ACTION_USB_ACCESSORY_ATTACHED = "com.smartdevicelink.USB_ACCESSORY_ATTACHED";
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/TransportManagerBase.java b/base/src/main/java/com/smartdevicelink/transport/TransportManagerBase.java
index bc6de3d61..6382619f5 100644
--- a/base/src/main/java/com/smartdevicelink/transport/TransportManagerBase.java
+++ b/base/src/main/java/com/smartdevicelink/transport/TransportManagerBase.java
@@ -47,10 +47,10 @@ public abstract class TransportManagerBase {
final List<TransportRecord> transportStatus;
final TransportEventListener transportListener;
- public TransportManagerBase(BaseTransportConfig config,TransportEventListener listener){
+ public TransportManagerBase(BaseTransportConfig config, TransportEventListener listener) {
transportListener = listener;
this.TRANSPORT_STATUS_LOCK = new Object();
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
this.transportStatus = new ArrayList<>();
}
}
@@ -61,19 +61,22 @@ public abstract class TransportManagerBase {
/**
* Check to see if a transport is connected.
+ *
* @param transportType the transport to have its connection status returned. If `null` is
* passed in, all transports will be checked and if any are connected a
* true value will be returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be used to return if connected.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be used to return if connected.
* @return if a transport is connected based on included variables
*/
public abstract boolean isConnected(TransportType transportType, String address);
+
/**
* Retrieve a transport record with the supplied params
+ *
* @param transportType the transport to have its connection status returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be returned.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be returned.
* @return the transport record for the transport type and address if supplied
*/
public abstract TransportRecord getTransportRecord(TransportType transportType, String address);
@@ -81,14 +84,15 @@ public abstract class TransportManagerBase {
/**
* Retrieves the currently connected transports
+ *
* @return the currently connected transports
*/
- public List<TransportRecord> getConnectedTransports(){
+ public List<TransportRecord> getConnectedTransports() {
return this.transportStatus;
}
- public boolean isHighBandwidthAvailable(){
+ public boolean isHighBandwidthAvailable() {
synchronized (TRANSPORT_STATUS_LOCK) {
for (TransportRecord record : transportStatus) {
if (record.getType().equals(TransportType.USB)
@@ -101,7 +105,7 @@ public abstract class TransportManagerBase {
}
}
- public BaseTransportConfig updateTransportConfig(BaseTransportConfig config){
+ public BaseTransportConfig updateTransportConfig(BaseTransportConfig config) {
return config;
}
@@ -111,39 +115,48 @@ public abstract class TransportManagerBase {
* Base implementation does nothing and assumes it is not necessary. This method should be
* overridden in children classes that need to add a prerequest to their transports to make
* space ready for a new session.
+ *
* @param transportRecord the transport that the new session should be assigned to
*/
- public void requestNewSession(TransportRecord transportRecord){
+ public void requestNewSession(TransportRecord transportRecord) {
//Base implementation does nothing
}
- public void requestSecondaryTransportConnection(byte sessionId, TransportRecord transportRecord){
+ public void requestSecondaryTransportConnection(byte sessionId, TransportRecord transportRecord) {
//Base implementation does nothing
}
- synchronized void enterLegacyMode(final String info){
+ synchronized void enterLegacyMode(final String info) {
//Base implementation does nothing
}
- synchronized void exitLegacyMode(String info ){
+ synchronized void exitLegacyMode(String info) {
//Base implementation does nothing
}
- public interface TransportEventListener{
- /** Called to indicate and deliver a packet received from transport */
+ public interface TransportEventListener {
+ /**
+ * Called to indicate and deliver a packet received from transport
+ */
void onPacketReceived(SdlPacket packet);
- /** Called to indicate that transport connection was established */
+ /**
+ * Called to indicate that transport connection was established
+ */
void onTransportConnected(List<TransportRecord> transports);
- /** Called to indicate that transport was disconnected (by either side) */
+ /**
+ * Called to indicate that transport was disconnected (by either side)
+ */
void onTransportDisconnected(String info, TransportRecord type, List<TransportRecord> connectedTransports);
// Called when the transport manager experiences an unrecoverable failure
void onError(String info);
+
/**
* Called when the transport manager has determined it needs to move towards a legacy style
* transport connection. It will always be bluetooth.
+ *
* @param info simple info string about the situation
* @return if the listener is ok with entering legacy mode
*/
diff --git a/base/src/main/java/com/smartdevicelink/transport/enums/TransportType.java b/base/src/main/java/com/smartdevicelink/transport/enums/TransportType.java
index 04ae0c033..a998bc86c 100644
--- a/base/src/main/java/com/smartdevicelink/transport/enums/TransportType.java
+++ b/base/src/main/java/com/smartdevicelink/transport/enums/TransportType.java
@@ -1,72 +1,72 @@
-/*
- * 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.transport.enums;
/**
* Defines available types of the transports.
*/
public enum TransportType {
- /**
- * Transport type will be anything the multiplexing service connects to.
- */
- MULTIPLEX,
- /**
- * Transport type is Bluetooth.
- */
- BLUETOOTH,
-
- /**
- * Transport type is TCP.
- */
- TCP,
- USB,
- /**
- * Used for cloud and embedded
- */
- WEB_SOCKET_SERVER,
+ /**
+ * Transport type will be anything the multiplexing service connects to.
+ */
+ MULTIPLEX,
+ /**
+ * Transport type is Bluetooth.
+ */
+ BLUETOOTH,
+
+ /**
+ * Transport type is TCP.
+ */
+ TCP,
+ USB,
+ /**
+ * Used for cloud and embedded
+ */
+ WEB_SOCKET_SERVER,
+
+ /**
+ * This transport is setup to be essentially a proxy to a different transport. It allows a developer to create a
+ * custom transport without much effort.
+ */
+ CUSTOM,
- /**
- * This transport is setup to be essentially a proxy to a different transport. It allows a developer to create a
- * custom transport without much effort.
- */
- CUSTOM,
+ ;
- ;
-
- public static TransportType valueForString(String value) {
- try{
+ public static TransportType valueForString(String value) {
+ try {
return valueOf(value);
- }catch(Exception e){
+ } catch (Exception e) {
return null;
}
- }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java b/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
index b0099581e..8a352ac46 100644
--- a/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
+++ b/base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java
@@ -34,14 +34,15 @@ package com.smartdevicelink.transport.utl;
import com.smartdevicelink.transport.enums.TransportType;
-class BaseTransportRecord{
+class BaseTransportRecord {
protected TransportType type;
protected String address;
- BaseTransportRecord(){}
+ BaseTransportRecord() {
+ }
- BaseTransportRecord(TransportType transportType, String address){
+ BaseTransportRecord(TransportType transportType, String address) {
this.type = transportType;
this.address = address;
}
@@ -56,7 +57,7 @@ class BaseTransportRecord{
@Override
public boolean equals(Object obj) {
- if(obj == null) {
+ if (obj == null) {
return false;
}
@@ -71,7 +72,7 @@ class BaseTransportRecord{
}
@Override
- public String toString(){
+ public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Transport Type: ");
builder.append(type.name());
diff --git a/base/src/main/java/com/smartdevicelink/util/BitConverter.java b/base/src/main/java/com/smartdevicelink/util/BitConverter.java
index e300d53ad..c3b55ebf3 100644
--- a/base/src/main/java/com/smartdevicelink/util/BitConverter.java
+++ b/base/src/main/java/com/smartdevicelink/util/BitConverter.java
@@ -1,147 +1,160 @@
-/*
- * 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.util;
public class BitConverter {
- /**
- * @param bytes byte array that will be converted to hex
- * @return the String containing converted hex values or null if byte array is null
- */
- public static String bytesToHex(byte [] bytes) {
- if (bytes == null) { return null; }
- return bytesToHex(bytes, 0, bytes.length);
- } // end-method
+ /**
+ * @param bytes byte array that will be converted to hex
+ * @return the String containing converted hex values or null if byte array is null
+ */
+ public static String bytesToHex(byte[] bytes) {
+ if (bytes == null) {
+ return null;
+ }
+ return bytesToHex(bytes, 0, bytes.length);
+ } // end-method
- /**
- * @param bytes byte array that will be converted to hex
- * @param offset int representing the offset to begin conversion at
- * @param length int representing number of bytes in array to convert
- * @return the String containing converted hex values or null if byte array is null
- */
- public static String bytesToHex(byte[] bytes, int offset, int length) {
- if (bytes == null) { return null; }
- final char[] HexDigits = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- byte b;
- char[] hexChars = new char[2 * length];
- //StringBuffer sb = new StringBuffer();
- int upperBound = Math.min(bytes.length, (offset + length));
- int baidx = 0;
- int sidx = 0;
- for (baidx = offset; baidx < upperBound; baidx++) {
- // Get the byte from the array
- b = bytes[baidx];
- // Use nibbles as index into hex digit array (left nibble, then right)
- hexChars[sidx++] = HexDigits[(b & 0xf0) >> 4];
- hexChars[sidx++] = HexDigits[(b & 0x0f)];
- } // end-for
- return new String(hexChars);
- } // end-method
+ /**
+ * @param bytes byte array that will be converted to hex
+ * @param offset int representing the offset to begin conversion at
+ * @param length int representing number of bytes in array to convert
+ * @return the String containing converted hex values or null if byte array is null
+ */
+ public static String bytesToHex(byte[] bytes, int offset, int length) {
+ if (bytes == null) {
+ return null;
+ }
+ final char[] HexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ byte b;
+ char[] hexChars = new char[2 * length];
+ //StringBuffer sb = new StringBuffer();
+ int upperBound = Math.min(bytes.length, (offset + length));
+ int baidx = 0;
+ int sidx = 0;
+ for (baidx = offset; baidx < upperBound; baidx++) {
+ // Get the byte from the array
+ b = bytes[baidx];
+ // Use nibbles as index into hex digit array (left nibble, then right)
+ hexChars[sidx++] = HexDigits[(b & 0xf0) >> 4];
+ hexChars[sidx++] = HexDigits[(b & 0x0f)];
+ } // end-for
+ return new String(hexChars);
+ } // end-method
- /**
- * @param hexString the String containing converted hex values
- * @return byte array converted from input String or null if String is null
- */
- public static byte [] hexToBytes(String hexString) {
- if (hexString == null) { return null; }
- if (hexString.length() % 2 != 0) {
- hexString = "0" + hexString;
- }
- byte [] theBytes = new byte[hexString.length() / 2];
- for (int i = 0; i < hexString.length(); i += 2) {
- String byteString = hexString.substring(i, i + 2);
- byte theByte = (byte)Integer.parseInt(byteString, 16);
- theBytes[i/2] = theByte;
- }
- return theBytes;
- } // end-method
+ /**
+ * @param hexString the String containing converted hex values
+ * @return byte array converted from input String or null if String is null
+ */
+ public static byte[] hexToBytes(String hexString) {
+ if (hexString == null) {
+ return null;
+ }
+ if (hexString.length() % 2 != 0) {
+ hexString = "0" + hexString;
+ }
+ byte[] theBytes = new byte[hexString.length() / 2];
+ for (int i = 0; i < hexString.length(); i += 2) {
+ String byteString = hexString.substring(i, i + 2);
+ byte theByte = (byte) Integer.parseInt(byteString, 16);
+ theBytes[i / 2] = theByte;
+ }
+ return theBytes;
+ } // end-method
- public static final byte[] intToByteArray(int value) {
- return new byte[] {
- (byte)(value >>> 24),
- (byte)(value >>> 16),
- (byte)(value >>> 8),
- (byte)value};
- }
+ public static final byte[] intToByteArray(int value) {
+ return new byte[]{
+ (byte) (value >>> 24),
+ (byte) (value >>> 16),
+ (byte) (value >>> 8),
+ (byte) value};
+ }
+
+ /**
+ * @param sizeBuf byte array that will be converted to int
+ * @return int converted from byte array or -1 if byte array is null
+ */
+ public static int intFromByteArray(byte[] sizeBuf, int offset) {
+ if (sizeBuf == null) {
+ return -1;
+ }
+ int ret = 0;
+ for (int i = offset; i < offset + 4; i++) {
+ ret <<= 8;
+ ret |= 0xFF & sizeBuf[i];
+ }
+ return ret;
+ }
- /**
- * @param sizeBuf byte array that will be converted to int
- * @return int converted from byte array or -1 if byte array is null
- */
- public static int intFromByteArray(byte[] sizeBuf, int offset) {
- if (sizeBuf == null) { return -1; }
- int ret = 0;
- for (int i = offset; i < offset + 4; i++) {
- ret <<= 8;
- ret |= 0xFF & sizeBuf[i];
- }
- return ret;
+ public static final byte[] shortToByteArray(short value) {
+ return new byte[]{
+ (byte) (value >>> 8),
+ (byte) value};
}
- public static final byte[] shortToByteArray(short value) {
- return new byte[] {
- (byte)(value >>> 8),
- (byte)value};
- }
+ /**
+ * @param sizeBuf byte array that will be converted to short
+ * @return short converted from byte array or -1 if byte array is null
+ */
+ public static short shortFromByteArray(byte[] sizeBuf, int offset) {
+ if (sizeBuf == null) {
+ return -1;
+ }
+ short ret = 0;
+ for (int i = offset; i < offset + 2; i++) {
+ ret <<= 8;
+ ret |= 0xFF & sizeBuf[i];
+ }
+ return ret;
+ }
- /**
- * @param sizeBuf byte array that will be converted to short
- * @return short converted from byte array or -1 if byte array is null
- */
- public static short shortFromByteArray(byte[] sizeBuf, int offset) {
- if (sizeBuf == null) { return -1; }
- short ret = 0;
- for (int i = offset; i < offset + 2; i++) {
- ret <<= 8;
- ret |= 0xFF & sizeBuf[i];
- }
- return ret;
+ /**
+ * Converts the byte array into a string of hex values.
+ *
+ * @param bytes byte array that will be converted to hex
+ * @param end EXCLUSIVE so if it it receives 10 it will print 0-9
+ * @return the String containing converted hex values or null if byte array is null
+ */
+ public static String bytesToHex(byte[] bytes, int end) {
+ if (bytes == null) {
+ return null;
+ }
+ if (bytes.length < end) {
+ end = bytes.length;
+ }
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < end; i++) {
+ sb.append(" ");
+ sb.append(String.format("%02X ", bytes[i]));
+ }
+ return sb.toString();
}
-
- /**
- * Converts the byte array into a string of hex values.
- * @param bytes byte array that will be converted to hex
- * @param end EXCLUSIVE so if it it receives 10 it will print 0-9
- * @return the String containing converted hex values or null if byte array is null
- */
- public static String bytesToHex(byte[] bytes,int end){
- if (bytes == null) { return null; }
- if(bytes.length<end){
- end = bytes.length;
- }
- StringBuilder sb = new StringBuilder();
- for(int i=0;i<end;i++){
- sb.append(" ");
- sb.append(String.format("%02X ", bytes[i]));
- }
- return sb.toString();
- }
}
diff --git a/base/src/main/java/com/smartdevicelink/util/ByteEnumer.java b/base/src/main/java/com/smartdevicelink/util/ByteEnumer.java
index ae949a25a..918265e4a 100644
--- a/base/src/main/java/com/smartdevicelink/util/ByteEnumer.java
+++ b/base/src/main/java/com/smartdevicelink/util/ByteEnumer.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,58 +35,63 @@ import java.util.Enumeration;
import java.util.Objects;
import java.util.Vector;
-public abstract class ByteEnumer {
-
- protected ByteEnumer(byte value, String name) {
- this.value = value;
- this.name = name;
- }
-
- private final byte value;
- private final String name;
-
- public byte getValue() { return value; }
- public String getName() { return name; }
-
- public boolean equals(ByteEnumer other) {
- return Objects.equals(name, other.getName());
- }
-
- public boolean eq(ByteEnumer other) {
- return equals(other);
- }
-
- public byte value() {
- return value;
- }
-
- public static ByteEnumer get(Vector<?> theList, byte value) {
- Enumeration<?> enumer = theList.elements();
- while (enumer.hasMoreElements()) {
- try {
- ByteEnumer current = (ByteEnumer)enumer.nextElement();
- if (current.getValue() == value) {
- return current;
- }
- } catch (ClassCastException e) {
- return null;
- }
- }
- return null;
- }
-
- public static ByteEnumer get(Vector<?> theList, String name) {
- Enumeration<?> enumer = theList.elements();
- while (enumer.hasMoreElements()) {
- try {
- ByteEnumer current = (ByteEnumer)enumer.nextElement();
- if (current.getName().equals(name)) {
- return current;
- }
- } catch (ClassCastException e) {
- return null;
- }
- }
- return null;
- }
+public abstract class ByteEnumer {
+
+ protected ByteEnumer(byte value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ private final byte value;
+ private final String name;
+
+ public byte getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean equals(ByteEnumer other) {
+ return Objects.equals(name, other.getName());
+ }
+
+ public boolean eq(ByteEnumer other) {
+ return equals(other);
+ }
+
+ public byte value() {
+ return value;
+ }
+
+ public static ByteEnumer get(Vector<?> theList, byte value) {
+ Enumeration<?> enumer = theList.elements();
+ while (enumer.hasMoreElements()) {
+ try {
+ ByteEnumer current = (ByteEnumer) enumer.nextElement();
+ if (current.getValue() == value) {
+ return current;
+ }
+ } catch (ClassCastException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public static ByteEnumer get(Vector<?> theList, String name) {
+ Enumeration<?> enumer = theList.elements();
+ while (enumer.hasMoreElements()) {
+ try {
+ ByteEnumer current = (ByteEnumer) enumer.nextElement();
+ if (current.getName().equals(name)) {
+ return current;
+ }
+ } catch (ClassCastException e) {
+ return null;
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/util/CompareUtils.java b/base/src/main/java/com/smartdevicelink/util/CompareUtils.java
index 141b6ed35..71197e7c8 100644
--- a/base/src/main/java/com/smartdevicelink/util/CompareUtils.java
+++ b/base/src/main/java/com/smartdevicelink/util/CompareUtils.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.util;
public class CompareUtils {
- public static boolean areStringsEqual(String string1, String string2, boolean ignoreCase, boolean nullIsEqual){
+ public static boolean areStringsEqual(String string1, String string2, boolean ignoreCase, boolean nullIsEqual) {
if (string1 == null) {
if (string2 == null) {
diff --git a/base/src/main/java/com/smartdevicelink/util/CorrelationIdGenerator.java b/base/src/main/java/com/smartdevicelink/util/CorrelationIdGenerator.java
index 6c26b046c..acd9ac800 100644
--- a/base/src/main/java/com/smartdevicelink/util/CorrelationIdGenerator.java
+++ b/base/src/main/java/com/smartdevicelink/util/CorrelationIdGenerator.java
@@ -34,23 +34,23 @@ package com.smartdevicelink.util;
import java.util.concurrent.atomic.AtomicInteger;
public class CorrelationIdGenerator {
-
- private static final int CORRELATION_ID_START = 0;
-
- private static final AtomicInteger sNextCorrelationId = new AtomicInteger(CORRELATION_ID_START);
-
- public static int generateId() {
- for (;;) {
- final int result = sNextCorrelationId.get();
- // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
- int newValue = result + 1;
-
- if (newValue > 0x00FFFFFF){
- newValue = CORRELATION_ID_START; // Roll over to 0.
- }
- if (sNextCorrelationId.compareAndSet(result, newValue)) {
- return result;
- }
- }
- }
+
+ private static final int CORRELATION_ID_START = 0;
+
+ private static final AtomicInteger sNextCorrelationId = new AtomicInteger(CORRELATION_ID_START);
+
+ public static int generateId() {
+ for (; ; ) {
+ final int result = sNextCorrelationId.get();
+ // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
+ int newValue = result + 1;
+
+ if (newValue > 0x00FFFFFF) {
+ newValue = CORRELATION_ID_START; // Roll over to 0.
+ }
+ if (sNextCorrelationId.compareAndSet(result, newValue)) {
+ return result;
+ }
+ }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/util/DebugTool.java b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
index 58af5a09a..f8ffb5299 100644
--- a/base/src/main/java/com/smartdevicelink/util/DebugTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -48,339 +48,342 @@ import java.util.Hashtable;
import java.util.Vector;
public class DebugTool {
-
-
- public static final String TAG = "SDL";
-
- private static boolean isErrorEnabled = false;
- private static boolean isWarningEnabled = false;
- private static boolean isInfoEnabled = false;
-
- public static void enableDebugTool() {
- isErrorEnabled = true;
- isWarningEnabled = true;
- isInfoEnabled = true;
- }
-
- public static void disableDebugTool() {
- isErrorEnabled = true;
- isWarningEnabled = false;
- isInfoEnabled = false;
- }
-
- public static boolean isDebugEnabled()
- {
- return isWarningEnabled && isInfoEnabled;
- }
-
- @SuppressWarnings("ConstantConditions")
- private static String prependProxyVersionNumberToString(String string) {
- if (BuildConfig.VERSION_NAME != null && string != null) {
- string = BuildConfig.VERSION_NAME + ": " + string;
- }
-
- return string;
- }
-
- public static void logError(String tag, String msg) {
- Boolean wasWritten = false;
-
- msg = prependProxyVersionNumberToString(msg);
-
- wasWritten = logToSiphon(msg);
-
- if (isErrorEnabled && !wasWritten) {
- tag = tag != null ? tag : TAG;
- NativeLogTool.logError(tag, msg);
- }
- }
-
- public static void logError(String tag, String msg, Throwable ex) {
- Boolean wasWritten = false;
-
- msg = prependProxyVersionNumberToString(msg);
-
- if (ex != null) {
- wasWritten = logToSiphon(msg + " Exception String: " + ex.toString());
- } else {
- wasWritten = logToSiphon(msg);
- }
-
- if (isErrorEnabled && !wasWritten) {
- tag = tag != null ? tag : TAG;
- NativeLogTool.logError(tag, msg, ex);
- }
- }
-
- public static void logWarning(String tag, String msg) {
- Boolean wasWritten = false;
-
- msg = prependProxyVersionNumberToString(msg);
-
- wasWritten = logToSiphon(msg);
-
- if (isWarningEnabled && !wasWritten) {
- tag = tag != null ? tag : TAG;
- NativeLogTool.logWarning(tag, msg);
- }
- }
-
- public static void logInfo(String tag, String msg) {
- Boolean wasWritten = false;
-
- msg = prependProxyVersionNumberToString(msg);
-
- wasWritten = logToSiphon(msg);
-
- if (isInfoEnabled && !wasWritten) {
- tag = tag != null ? tag : TAG;
- NativeLogTool.logInfo(tag, msg);
- }
- }
-
- public static void logInfo(String tag, String msg, Boolean bPrependVersion) {
- Boolean wasWritten = false;
-
- if (bPrependVersion) msg = prependProxyVersionNumberToString(msg);
-
- wasWritten = logToSiphon(msg);
-
- if (isInfoEnabled && !wasWritten) {
- tag = tag != null ? tag : TAG;
- NativeLogTool.logInfo(tag, msg);
- }
- }
-
- protected static Boolean logToSiphon(String msg) {
- if (SiphonServer.getSiphonEnabledStatus()) {
- // Initialize the SiphonServer, will be ignored if already initialized
- SiphonServer.init();
-
- // Write to the SiphonServer
- return SiphonServer.sendSiphonLogData(msg);
- }
- return false;
- }
-
- protected static String getLine(Throwable ex) {
- if (ex == null) { return null; }
- StringBuilder toPrint = new StringBuilder(ex.toString() + " :" + ex.getMessage());
- for (int i=0; i<ex.getStackTrace().length; i++) {
- StackTraceElement elem = ex.getStackTrace()[i];
- toPrint.append("\n ").append(elem.toString());
- }
-
- if (ex instanceof SdlException) {
- SdlException sdlEx = (SdlException) ex;
- if (sdlEx.getInnerException() != null && sdlEx != sdlEx.getInnerException()) {
- toPrint.append("\n nested:\n");
- toPrint.append(getLine(sdlEx.getInnerException()));
- }
- }
-
- return toPrint.toString();
- }
-
-
- protected static final Vector<IConsole> consoleListenerList = new Vector<>();
-
- protected final static boolean isTransportEnabled = false;
- protected final static boolean isRPCEnabled = false;
-
- public static void addConsole(IConsole console) {
- synchronized(consoleListenerList) {
- consoleListenerList.addElement(console);
- }
- }
-
- public static void removeConsole(IConsole console) {
- synchronized(consoleListenerList) {
- consoleListenerList.removeElement(console);
- }
- }
-
- public static void clearConsoles() {
- synchronized(consoleListenerList) {
- consoleListenerList.removeAllElements();
- }
- }
-
- public static void logTransport(String msg) {
- if (isTransportEnabled) {
- Log.i(TAG, msg);
- logInfoToConsole(msg);
- }
- }
-
- public static void logRPCSend(String rpcMsg) {
- if (isRPCEnabled) {
- Log.i(TAG, "Sending RPC message: " + rpcMsg);
- logRPCSendToConsole(rpcMsg);
- }
- }
-
- public static void logRPCReceive(String rpcMsg) {
- if (isRPCEnabled) {
- Log.i(TAG, "Received RPC message: " + rpcMsg);
- logRPCSendToConsole(rpcMsg);
- }
- }
-
- @SuppressWarnings("unchecked")
+
+
+ public static final String TAG = "SDL";
+
+ private static boolean isErrorEnabled = false;
+ private static boolean isWarningEnabled = false;
+ private static boolean isInfoEnabled = false;
+
+ public static void enableDebugTool() {
+ isErrorEnabled = true;
+ isWarningEnabled = true;
+ isInfoEnabled = true;
+ }
+
+ public static void disableDebugTool() {
+ isErrorEnabled = true;
+ isWarningEnabled = false;
+ isInfoEnabled = false;
+ }
+
+ public static boolean isDebugEnabled() {
+ return isWarningEnabled && isInfoEnabled;
+ }
+
+ @SuppressWarnings("ConstantConditions")
+ private static String prependProxyVersionNumberToString(String string) {
+ if (BuildConfig.VERSION_NAME != null && string != null) {
+ string = BuildConfig.VERSION_NAME + ": " + string;
+ }
+
+ return string;
+ }
+
+ public static void logError(String tag, String msg) {
+ Boolean wasWritten = false;
+
+ msg = prependProxyVersionNumberToString(msg);
+
+ wasWritten = logToSiphon(msg);
+
+ if (isErrorEnabled && !wasWritten) {
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logError(tag, msg);
+ }
+ }
+
+ public static void logError(String tag, String msg, Throwable ex) {
+ Boolean wasWritten = false;
+
+ msg = prependProxyVersionNumberToString(msg);
+
+ if (ex != null) {
+ wasWritten = logToSiphon(msg + " Exception String: " + ex.toString());
+ } else {
+ wasWritten = logToSiphon(msg);
+ }
+
+ if (isErrorEnabled && !wasWritten) {
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logError(tag, msg, ex);
+ }
+ }
+
+ public static void logWarning(String tag, String msg) {
+ Boolean wasWritten = false;
+
+ msg = prependProxyVersionNumberToString(msg);
+
+ wasWritten = logToSiphon(msg);
+
+ if (isWarningEnabled && !wasWritten) {
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logWarning(tag, msg);
+ }
+ }
+
+ public static void logInfo(String tag, String msg) {
+ Boolean wasWritten = false;
+
+ msg = prependProxyVersionNumberToString(msg);
+
+ wasWritten = logToSiphon(msg);
+
+ if (isInfoEnabled && !wasWritten) {
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logInfo(tag, msg);
+ }
+ }
+
+ public static void logInfo(String tag, String msg, Boolean bPrependVersion) {
+ Boolean wasWritten = false;
+
+ if (bPrependVersion) msg = prependProxyVersionNumberToString(msg);
+
+ wasWritten = logToSiphon(msg);
+
+ if (isInfoEnabled && !wasWritten) {
+ tag = tag != null ? tag : TAG;
+ NativeLogTool.logInfo(tag, msg);
+ }
+ }
+
+ protected static Boolean logToSiphon(String msg) {
+ if (SiphonServer.getSiphonEnabledStatus()) {
+ // Initialize the SiphonServer, will be ignored if already initialized
+ SiphonServer.init();
+
+ // Write to the SiphonServer
+ return SiphonServer.sendSiphonLogData(msg);
+ }
+ return false;
+ }
+
+ protected static String getLine(Throwable ex) {
+ if (ex == null) {
+ return null;
+ }
+ StringBuilder toPrint = new StringBuilder(ex.toString() + " :" + ex.getMessage());
+ for (int i = 0; i < ex.getStackTrace().length; i++) {
+ StackTraceElement elem = ex.getStackTrace()[i];
+ toPrint.append("\n ").append(elem.toString());
+ }
+
+ if (ex instanceof SdlException) {
+ SdlException sdlEx = (SdlException) ex;
+ if (sdlEx.getInnerException() != null && sdlEx != sdlEx.getInnerException()) {
+ toPrint.append("\n nested:\n");
+ toPrint.append(getLine(sdlEx.getInnerException()));
+ }
+ }
+
+ return toPrint.toString();
+ }
+
+
+ protected static final Vector<IConsole> consoleListenerList = new Vector<>();
+
+ protected final static boolean isTransportEnabled = false;
+ protected final static boolean isRPCEnabled = false;
+
+ public static void addConsole(IConsole console) {
+ synchronized (consoleListenerList) {
+ consoleListenerList.addElement(console);
+ }
+ }
+
+ public static void removeConsole(IConsole console) {
+ synchronized (consoleListenerList) {
+ consoleListenerList.removeElement(console);
+ }
+ }
+
+ public static void clearConsoles() {
+ synchronized (consoleListenerList) {
+ consoleListenerList.removeAllElements();
+ }
+ }
+
+ public static void logTransport(String msg) {
+ if (isTransportEnabled) {
+ Log.i(TAG, msg);
+ logInfoToConsole(msg);
+ }
+ }
+
+ public static void logRPCSend(String rpcMsg) {
+ if (isRPCEnabled) {
+ Log.i(TAG, "Sending RPC message: " + rpcMsg);
+ logRPCSendToConsole(rpcMsg);
+ }
+ }
+
+ public static void logRPCReceive(String rpcMsg) {
+ if (isRPCEnabled) {
+ Log.i(TAG, "Received RPC message: " + rpcMsg);
+ logRPCSendToConsole(rpcMsg);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
protected static void logInfoToConsole(String msg) {
- Vector<IConsole> localList;
- synchronized(consoleListenerList) {
- localList = (Vector<IConsole>) consoleListenerList.clone();
- }
-
- for (int i = 0; i < localList.size(); i++) {
- IConsole consoleListener = (IConsole) localList.elementAt(i);
- try {
- consoleListener.logInfo(msg);
- } catch (Exception ex) {
- Log.e(TAG, "Failure propagating logInfo: " + ex.toString(), ex);
- } // end-catch
- }
- }
-
- @SuppressWarnings("unchecked")
+ Vector<IConsole> localList;
+ synchronized (consoleListenerList) {
+ localList = (Vector<IConsole>) consoleListenerList.clone();
+ }
+
+ for (int i = 0; i < localList.size(); i++) {
+ IConsole consoleListener = (IConsole) localList.elementAt(i);
+ try {
+ consoleListener.logInfo(msg);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure propagating logInfo: " + ex.toString(), ex);
+ } // end-catch
+ }
+ }
+
+ @SuppressWarnings("unchecked")
protected static void logErrorToConsole(String msg) {
- Vector<IConsole> localList;
- synchronized(consoleListenerList) {
- localList = (Vector<IConsole>) consoleListenerList.clone();
- }
- for (int i = 0; i < localList.size(); i++) {
- IConsole consoleListener = (IConsole) localList.elementAt(i);
- try {
- consoleListener.logError(msg);
- } catch (Exception ex) {
- Log.e(TAG, "Failure propagating logError: " + ex.toString(), ex);
- } // end-catch
- }
- }
-
- @SuppressWarnings("unchecked")
+ Vector<IConsole> localList;
+ synchronized (consoleListenerList) {
+ localList = (Vector<IConsole>) consoleListenerList.clone();
+ }
+ for (int i = 0; i < localList.size(); i++) {
+ IConsole consoleListener = (IConsole) localList.elementAt(i);
+ try {
+ consoleListener.logError(msg);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure propagating logError: " + ex.toString(), ex);
+ } // end-catch
+ }
+ }
+
+ @SuppressWarnings("unchecked")
protected static void logErrorToConsole(String msg, Throwable e) {
- Vector<IConsole> localList;
- synchronized(consoleListenerList) {
- localList = (Vector<IConsole>) consoleListenerList.clone();
- }
-
- for (int i = 0; i < localList.size(); i++) {
- IConsole consoleListener = (IConsole) localList.elementAt(i);
- try {
- consoleListener.logError(msg, e);
- } catch (Exception ex) {
- Log.e(TAG, "Failure propagating logError: " + ex.toString(), ex);
- } // end-catch
- }
- }
-
- @SuppressWarnings("unchecked")
+ Vector<IConsole> localList;
+ synchronized (consoleListenerList) {
+ localList = (Vector<IConsole>) consoleListenerList.clone();
+ }
+
+ for (int i = 0; i < localList.size(); i++) {
+ IConsole consoleListener = (IConsole) localList.elementAt(i);
+ try {
+ consoleListener.logError(msg, e);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure propagating logError: " + ex.toString(), ex);
+ } // end-catch
+ }
+ }
+
+ @SuppressWarnings("unchecked")
protected static void logRPCSendToConsole(String msg) {
- Vector<IConsole> localList;
- synchronized(consoleListenerList) {
- localList = (Vector<IConsole>) consoleListenerList.clone();
- }
-
- for (int i = 0; i < localList.size(); i++) {
- IConsole consoleListener = (IConsole) localList.elementAt(i);
- try {
- consoleListener.logRPCSend(msg);
- } catch (Exception ex) {
- Log.e(TAG, "Failure propagating logRPCSend: " + ex.toString(), ex);
- } // end-catch
- }
- }
-
- @SuppressWarnings("unchecked")
+ Vector<IConsole> localList;
+ synchronized (consoleListenerList) {
+ localList = (Vector<IConsole>) consoleListenerList.clone();
+ }
+
+ for (int i = 0; i < localList.size(); i++) {
+ IConsole consoleListener = (IConsole) localList.elementAt(i);
+ try {
+ consoleListener.logRPCSend(msg);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure propagating logRPCSend: " + ex.toString(), ex);
+ } // end-catch
+ }
+ }
+
+ @SuppressWarnings("unchecked")
protected static void logRPCReceiveToConsole(String msg) {
- Vector<IConsole> localList;
- synchronized(consoleListenerList) {
- localList = (Vector<IConsole>) consoleListenerList.clone();
- }
-
- for (int i = 0; i < localList.size(); i++) {
- IConsole consoleListener = (IConsole) localList.elementAt(i);
- try {
- consoleListener.logRPCReceive(msg);
- } catch (Exception ex) {
- Log.e(TAG, "Failure propagating logRPCReceive: " + ex.toString(), ex);
- } // end-catch
- }
- }
-
- /**
- * Debug method to try to extract the RPC hash from the packet payload. Should only be used while debugging, not in production.
- * Currently it will only handle single frame RPCs
- * @param packet to inspect
- * @return The Hashtable to be used to construct an RPC
- */
- public static Hashtable<String, Object> getRPCHash(SdlPacket packet){
- if(packet == null ||
- packet.getFrameType().getValue() != SdlPacket.FRAME_TYPE_SINGLE ||
- packet.getServiceType()!=SdlPacket.SERVICE_TYPE_RPC){
- Log.w("Debug", "Unable to get hash");
- return null;
- }
- int version = packet.getVersion();
-
- ProtocolMessage message = new ProtocolMessage();
- SessionType serviceType = SessionType.valueOf((byte)packet.getServiceType());
- if (serviceType == SessionType.RPC) {
- message.setMessageType(MessageType.RPC);
- } else if (serviceType == SessionType.BULK_DATA) {
- message.setMessageType(MessageType.BULK);
- } // end-if
- message.setSessionType(serviceType);
- message.setSessionID((byte)packet.getSessionId());
- //If it is WiPro 2.0 it must have binary header
- if (version > 1) {
- BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
- parseBinaryHeader(packet.getPayload());
- if(binFrameHeader == null) {
- return null;
- }
- message.setVersion((byte) version);
- message.setRPCType(binFrameHeader.getRPCType());
- message.setFunctionID(binFrameHeader.getFunctionID());
- message.setCorrID(binFrameHeader.getCorrID());
- if (binFrameHeader.getJsonSize() > 0){
- message.setData(binFrameHeader.getJsonData());
- }
- if (binFrameHeader.getBulkData() != null){
- message.setBulkData(binFrameHeader.getBulkData());
- }
- } else {
- message.setData(packet.getPayload());
- }
- Hashtable<String, Object> hash = new Hashtable<>();
- if (packet.getVersion() > 1) {
- Hashtable<String, Object> hashTemp = new Hashtable<>();
-
- hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
- if (message.getJsonSize() > 0) {
- final Hashtable<String, Object> mHash = JsonRPCMarshaller.unmarshall(message.getData());
- hashTemp.put(RPCMessage.KEY_PARAMETERS, mHash);
- }
-
- String functionName = FunctionID.getFunctionName(message.getFunctionID());
- if (functionName != null) {
- hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
- } else {
- return null;
- }
- if (message.getRPCType() == 0x00) {
- hash.put(RPCMessage.KEY_REQUEST, hashTemp);
- } else if (message.getRPCType() == 0x01) {
- hash.put(RPCMessage.KEY_RESPONSE, hashTemp);
- } else if (message.getRPCType() == 0x02) {
- hash.put(RPCMessage.KEY_NOTIFICATION, hashTemp);
- }
- if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
- } else {
- hash = JsonRPCMarshaller.unmarshall(message.getData());
- }
- return hash;
- }
+ Vector<IConsole> localList;
+ synchronized (consoleListenerList) {
+ localList = (Vector<IConsole>) consoleListenerList.clone();
+ }
+
+ for (int i = 0; i < localList.size(); i++) {
+ IConsole consoleListener = (IConsole) localList.elementAt(i);
+ try {
+ consoleListener.logRPCReceive(msg);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure propagating logRPCReceive: " + ex.toString(), ex);
+ } // end-catch
+ }
+ }
+
+ /**
+ * Debug method to try to extract the RPC hash from the packet payload. Should only be used while debugging, not in production.
+ * Currently it will only handle single frame RPCs
+ *
+ * @param packet to inspect
+ * @return The Hashtable to be used to construct an RPC
+ */
+ public static Hashtable<String, Object> getRPCHash(SdlPacket packet) {
+ if (packet == null ||
+ packet.getFrameType().getValue() != SdlPacket.FRAME_TYPE_SINGLE ||
+ packet.getServiceType() != SdlPacket.SERVICE_TYPE_RPC) {
+ Log.w("Debug", "Unable to get hash");
+ return null;
+ }
+ int version = packet.getVersion();
+
+ ProtocolMessage message = new ProtocolMessage();
+ SessionType serviceType = SessionType.valueOf((byte) packet.getServiceType());
+ if (serviceType == SessionType.RPC) {
+ message.setMessageType(MessageType.RPC);
+ } else if (serviceType == SessionType.BULK_DATA) {
+ message.setMessageType(MessageType.BULK);
+ } // end-if
+ message.setSessionType(serviceType);
+ message.setSessionID((byte) packet.getSessionId());
+ //If it is WiPro 2.0 it must have binary header
+ if (version > 1) {
+ BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
+ parseBinaryHeader(packet.getPayload());
+ if (binFrameHeader == null) {
+ return null;
+ }
+ message.setVersion((byte) version);
+ message.setRPCType(binFrameHeader.getRPCType());
+ message.setFunctionID(binFrameHeader.getFunctionID());
+ message.setCorrID(binFrameHeader.getCorrID());
+ if (binFrameHeader.getJsonSize() > 0) {
+ message.setData(binFrameHeader.getJsonData());
+ }
+ if (binFrameHeader.getBulkData() != null) {
+ message.setBulkData(binFrameHeader.getBulkData());
+ }
+ } else {
+ message.setData(packet.getPayload());
+ }
+ Hashtable<String, Object> hash = new Hashtable<>();
+ if (packet.getVersion() > 1) {
+ Hashtable<String, Object> hashTemp = new Hashtable<>();
+
+ hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
+ if (message.getJsonSize() > 0) {
+ final Hashtable<String, Object> mHash = JsonRPCMarshaller.unmarshall(message.getData());
+ hashTemp.put(RPCMessage.KEY_PARAMETERS, mHash);
+ }
+
+ String functionName = FunctionID.getFunctionName(message.getFunctionID());
+ if (functionName != null) {
+ hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
+ } else {
+ return null;
+ }
+ if (message.getRPCType() == 0x00) {
+ hash.put(RPCMessage.KEY_REQUEST, hashTemp);
+ } else if (message.getRPCType() == 0x01) {
+ hash.put(RPCMessage.KEY_RESPONSE, hashTemp);
+ } else if (message.getRPCType() == 0x02) {
+ hash.put(RPCMessage.KEY_NOTIFICATION, hashTemp);
+ }
+ if (message.getBulkData() != null)
+ hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
+ } else {
+ hash = JsonRPCMarshaller.unmarshall(message.getData());
+ }
+ return hash;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/util/FileUtls.java b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
index b9be1c761..ca96f1d35 100644
--- a/base/src/main/java/com/smartdevicelink/util/FileUtls.java
+++ b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
@@ -46,30 +46,32 @@ public class FileUtls {
/**
* When using on Android, this method should only be used for Android Oreo and newer
+ *
* @param file the path to the file
* @return a byte array representation of the file if one exists
*/
- public static byte[] getFileData(String file){
- return getFileData(file,null);
+ public static byte[] getFileData(String file) {
+ return getFileData(file, null);
}
/**
* When using on Android, this method should only be used for Android Oreo and newer
+ *
* @param filePath the path to the file
* @param fileName the name of the file
* @return a byte array representation of the file if one exists
*/
- public static byte[] getFileData(String filePath, String fileName){
- if(filePath != null && filePath.length() > 0) {
+ public static byte[] getFileData(String filePath, String fileName) {
+ if (filePath != null && filePath.length() > 0) {
File file;
- if(fileName != null && fileName.length() > 0 ){
+ if (fileName != null && fileName.length() > 0) {
file = new File(filePath, fileName);
- }else{
+ } else {
file = new File(filePath);
}
if (file.exists() && file.isFile() && file.canRead()) {
try {
- return Files.readAllBytes(file.toPath());
+ return Files.readAllBytes(file.toPath());
} catch (IOException e) {
e.printStackTrace();
}
@@ -79,7 +81,7 @@ public class FileUtls {
return null;
}
- public static byte[] downloadFile(@NonNull String urlStr){
+ public static byte[] downloadFile(@NonNull String urlStr) {
try {
URL url = new URL(urlStr);
URLConnection connection = url.openConnection();
@@ -93,7 +95,7 @@ public class FileUtls {
buffer.write(data, 0, nRead);
}
return buffer.toByteArray();
- }catch (Exception e){
+ } catch (Exception e) {
DebugTool.logError(TAG, "Unable to download file - " + urlStr, e);
return null;
}
diff --git a/base/src/main/java/com/smartdevicelink/util/IConsole.java b/base/src/main/java/com/smartdevicelink/util/IConsole.java
index de03c57b5..178ae4e28 100644
--- a/base/src/main/java/com/smartdevicelink/util/IConsole.java
+++ b/base/src/main/java/com/smartdevicelink/util/IConsole.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -29,13 +29,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.util;
-
-
-public interface IConsole {
- void logInfo(String msg);
- void logError(String msg);
- void logError(String msg, Throwable ex);
- void logRPCSend(String rpcMsg);
- void logRPCReceive(String rpcMsg);
-}
+package com.smartdevicelink.util;
+
+
+public interface IConsole {
+ void logInfo(String msg);
+
+ void logError(String msg);
+
+ void logError(String msg, Throwable ex);
+
+ void logRPCSend(String rpcMsg);
+
+ void logRPCReceive(String rpcMsg);
+}
diff --git a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
index 7fe37ff3b..6a9528e9e 100644
--- a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,105 +32,103 @@
package com.smartdevicelink.util;
public class NativeLogTool {
- private static final String TAG = "NativeLogTool";
- static private boolean logToSystemEnabled = true;
- private static final int ChunkSize = 4000;
-
- public enum LogTarget {
- Info
- ,Warning
- ,Error;
-
- public static LogTarget valueForString (String value) {
- try{
- return valueOf(value);
- } catch(Exception e) {
- return null;
- }
- }
- }
+ private static final String TAG = "NativeLogTool";
+ static private boolean logToSystemEnabled = true;
+ private static final int ChunkSize = 4000;
- public static void setEnableState(boolean en) {
- logToSystemEnabled = en;
- } // end-method
+ public enum LogTarget {
+ Info, Warning, Error;
- public static boolean isEnabled() {
- return logToSystemEnabled;
- } // end-method
-
- public static boolean logInfo(String message) {
- return logInfo(TAG, message);
- }
-
- public static boolean logInfo(String tag, String message) {
- if (logToSystemEnabled) {
- return log(LogTarget.Info, tag, message);
- }
- return false;
- }
-
- public static boolean logWarning(String message) {
- return logWarning(TAG, message);
- }
-
- public static boolean logWarning(String tag, String message) {
- if (logToSystemEnabled) {
- return log(LogTarget.Warning, tag, message);
- }
- return false;
- }
-
- public static boolean logError(String message) {
- return logError(TAG, message);
- }
-
- public static boolean logError(String tag, String message) {
- if (logToSystemEnabled) {
- return log(LogTarget.Error, tag, message);
- }
- return false;
- }
-
- public static boolean logError(String message, Throwable t) {
- return logError(TAG, message, t);
- }
-
- public static boolean logError(String tag, String message, Throwable t) {
- // If the call to logError is passed a throwable, write directly to the system log
- if (logToSystemEnabled) {
- Log.e(tag, message, t);
- }
- return logToSystemEnabled;
- }
-
- private static boolean log(LogTarget logTarget, String source, String logMsg) {
- // Don't log empty messages
- if (logMsg == null || logMsg.length() == 0) {
- return false;
- }
+ public static LogTarget valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
- int subStrSize = 0;
- String chunk;
- try {
- for (int idx=0;idx < logMsg.length();idx += subStrSize) {
- subStrSize = Math.min(ChunkSize, logMsg.length() - idx);
- chunk = logMsg.substring(idx, idx + subStrSize);
- switch (logTarget) {
- case Info:
- Log.i(source, chunk);
- break;
- case Warning:
- Log.w(source, chunk);
- break;
- case Error:
- Log.e(source, chunk, null);
- break;
- }
- }
- } catch (Exception ex) {
- Log.e(TAG, "Failure writing " + logTarget.name() + " fragments to android log:" + ex.toString(), null);
- return false;
- }
- return true;
- }
+ public static void setEnableState(boolean en) {
+ logToSystemEnabled = en;
+ } // end-method
+
+ public static boolean isEnabled() {
+ return logToSystemEnabled;
+ } // end-method
+
+ public static boolean logInfo(String message) {
+ return logInfo(TAG, message);
+ }
+
+ public static boolean logInfo(String tag, String message) {
+ if (logToSystemEnabled) {
+ return log(LogTarget.Info, tag, message);
+ }
+ return false;
+ }
+
+ public static boolean logWarning(String message) {
+ return logWarning(TAG, message);
+ }
+
+ public static boolean logWarning(String tag, String message) {
+ if (logToSystemEnabled) {
+ return log(LogTarget.Warning, tag, message);
+ }
+ return false;
+ }
+
+ public static boolean logError(String message) {
+ return logError(TAG, message);
+ }
+
+ public static boolean logError(String tag, String message) {
+ if (logToSystemEnabled) {
+ return log(LogTarget.Error, tag, message);
+ }
+ return false;
+ }
+
+ public static boolean logError(String message, Throwable t) {
+ return logError(TAG, message, t);
+ }
+
+ public static boolean logError(String tag, String message, Throwable t) {
+ // If the call to logError is passed a throwable, write directly to the system log
+ if (logToSystemEnabled) {
+ Log.e(tag, message, t);
+ }
+ return logToSystemEnabled;
+ }
+
+ private static boolean log(LogTarget logTarget, String source, String logMsg) {
+ // Don't log empty messages
+ if (logMsg == null || logMsg.length() == 0) {
+ return false;
+ }
+
+ int subStrSize = 0;
+ String chunk;
+ try {
+ for (int idx = 0; idx < logMsg.length(); idx += subStrSize) {
+ subStrSize = Math.min(ChunkSize, logMsg.length() - idx);
+ chunk = logMsg.substring(idx, idx + subStrSize);
+ switch (logTarget) {
+ case Info:
+ Log.i(source, chunk);
+ break;
+ case Warning:
+ Log.w(source, chunk);
+ break;
+ case Error:
+ Log.e(source, chunk, null);
+ break;
+ }
+ }
+ } catch (Exception ex) {
+ Log.e(TAG, "Failure writing " + logTarget.name() + " fragments to android log:" + ex.toString(), null);
+ return false;
+ }
+ return true;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/util/SdlDataTypeConverter.java b/base/src/main/java/com/smartdevicelink/util/SdlDataTypeConverter.java
index b2fe1d2c1..b82033a26 100644
--- a/base/src/main/java/com/smartdevicelink/util/SdlDataTypeConverter.java
+++ b/base/src/main/java/com/smartdevicelink/util/SdlDataTypeConverter.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -35,60 +35,60 @@ package com.smartdevicelink.util;
* This is a utility class to aid in handling values stored in the RPC classes.
*/
public class SdlDataTypeConverter {
-
- /**
- * Converts values that are retrieved from an RPC parameters Hashtable as an
- * Object into the standard number value of the mobile API, Double.
- *
- * @param originalValue The value retrieved from an RPC parameters Hashtable.
- * @return The Double representation of an integer or double value stored in
- * the Object, or null if the value could not be converted.
- */
- public static Double objectToDouble(Object originalValue) {
- if (originalValue == null) {
- return null;
- }
+ /**
+ * Converts values that are retrieved from an RPC parameters Hashtable as an
+ * Object into the standard number value of the mobile API, Double.
+ *
+ * @param originalValue The value retrieved from an RPC parameters Hashtable.
+ * @return The Double representation of an integer or double value stored in
+ * the Object, or null if the value could not be converted.
+ */
+ public static Double objectToDouble(Object originalValue) {
- Double result = null;
+ if (originalValue == null) {
+ return null;
+ }
- // Uses reflection to determine if the object is a valid type.
- if (originalValue instanceof Integer) {
- result = ((Integer) originalValue).doubleValue();
- } else if (originalValue instanceof Float){
- result = ((Float) originalValue).doubleValue();
- } else if (originalValue instanceof Double){
- result = (Double) originalValue;
- }
+ Double result = null;
- return result;
- }
+ // Uses reflection to determine if the object is a valid type.
+ if (originalValue instanceof Integer) {
+ result = ((Integer) originalValue).doubleValue();
+ } else if (originalValue instanceof Float) {
+ result = ((Float) originalValue).doubleValue();
+ } else if (originalValue instanceof Double) {
+ result = (Double) originalValue;
+ }
- /**
- * Converts values that are retrieved from an RPC parameters Hashtable as an
- * Object into the standard number value of the mobile API, Float.
- *
- * @param originalValue The value retrieved from an RPC parameters Hashtable.
- * @return The Float representation of an integer or float value stored in
- * the Object, or null if the value could not be converted.
- */
- public static Float objectToFloat(Object originalValue) {
+ return result;
+ }
- if (originalValue == null) {
- return null;
- }
+ /**
+ * Converts values that are retrieved from an RPC parameters Hashtable as an
+ * Object into the standard number value of the mobile API, Float.
+ *
+ * @param originalValue The value retrieved from an RPC parameters Hashtable.
+ * @return The Float representation of an integer or float value stored in
+ * the Object, or null if the value could not be converted.
+ */
+ public static Float objectToFloat(Object originalValue) {
- Float result = null;
+ if (originalValue == null) {
+ return null;
+ }
- // Uses reflection to determine if the object is a valid type.
- if (originalValue instanceof Integer) {
- result = ((Integer) originalValue).floatValue();
- } else if (originalValue instanceof Double){
- result = ((Double) originalValue).floatValue();
- } else if (originalValue instanceof Float){
- result = (Float) originalValue;
- }
+ Float result = null;
- return result;
- }
+ // Uses reflection to determine if the object is a valid type.
+ if (originalValue instanceof Integer) {
+ result = ((Integer) originalValue).floatValue();
+ } else if (originalValue instanceof Double) {
+ result = ((Double) originalValue).floatValue();
+ } else if (originalValue instanceof Float) {
+ result = (Float) originalValue;
+ }
+
+ return result;
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/util/Version.java b/base/src/main/java/com/smartdevicelink/util/Version.java
index 6b409af9b..a86aea963 100644
--- a/base/src/main/java/com/smartdevicelink/util/Version.java
+++ b/base/src/main/java/com/smartdevicelink/util/Version.java
@@ -38,29 +38,29 @@ import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
public class Version {
- final int major,minor,patch;
+ final int major, minor, patch;
- public Version(){
+ public Version() {
major = 0;
minor = 0;
patch = 0;
}
- public Version(int major, int minor, int patch){
+ public Version(int major, int minor, int patch) {
this.major = major;
this.minor = minor;
this.patch = patch;
}
- public Version(SdlMsgVersion sdlMsgVersion){
+ public Version(SdlMsgVersion sdlMsgVersion) {
this.major = sdlMsgVersion.getMajorVersion();
this.minor = sdlMsgVersion.getMinorVersion();
this.patch = sdlMsgVersion.getPatchVersion();
}
- public Version(String versionString){
+ public Version(String versionString) {
String[] versions = versionString.split("\\.");
- if(versions.length!=3){
+ if (versions.length != 3) {
throw new IllegalArgumentException("Incorrect version string format");
}
major = Integer.parseInt(versions[0]);
@@ -83,19 +83,20 @@ public class Version {
/**
* Method to test if this instance of Version is newer than the supplied one.
+ *
* @param version the version to check against
* @return 1 if this instance is newer, -1 if supplied version is newer, and 0 if they are equal
*/
- public int isNewerThan(Version version){
- if(this.major > version.major){
+ public int isNewerThan(Version version) {
+ if (this.major > version.major) {
return 1;
- }else if(this.major == version.major){
- if(this.minor > version.minor){
+ } else if (this.major == version.major) {
+ if (this.minor > version.minor) {
return 1;
- } else if(this.minor == version.minor){
- if(this.patch > version.patch){
+ } else if (this.minor == version.minor) {
+ if (this.patch > version.patch) {
return 1;
- }else if(this.patch == version.patch){
+ } else if (this.patch == version.patch) {
return 0;
}
}
@@ -104,26 +105,25 @@ public class Version {
}
/**
- *
* @param minVersion the lowest version to be used in the comparison
* @param maxVersion the highest version to be used in the comparison
* @return -1 if this number is not between minVersion and maxVersion or if minVersion is greater than maxVersion, <br> 0 if the number is
* equal to either minVersion or maxVersion <br> 1 if the number is between the minVersion and maxVersion
*/
- public int isBetween(@NonNull Version minVersion, @NonNull Version maxVersion){
- if(minVersion.isNewerThan(maxVersion) == 1){
+ public int isBetween(@NonNull Version minVersion, @NonNull Version maxVersion) {
+ if (minVersion.isNewerThan(maxVersion) == 1) {
return -1;
}
int resultsForMin = this.isNewerThan(minVersion);
int resultsForMax = this.isNewerThan(maxVersion);
- if(resultsForMin == 0 || resultsForMax == 0){
+ if (resultsForMin == 0 || resultsForMax == 0) {
return 0;
//return resultsForMin >= 0 && resultsForMax <=0;
- }else if (resultsForMin == 1 && resultsForMax == -1 ){
+ } else if (resultsForMin == 1 && resultsForMax == -1) {
return 1;
- }else{
+ } else {
return -1;
}
diff --git a/javaSE/javaSE/bintray.gradle b/javaSE/javaSE/bintray.gradle
index d40cb0e28..9b890b842 100644
--- a/javaSE/javaSE/bintray.gradle
+++ b/javaSE/javaSE/bintray.gradle
@@ -45,7 +45,7 @@ bintray {
version {
name = libVersion // Change to release version
desc = libDescription
- released = new Date() // Will be the current date & time
+ released = new Date() // Will be the current date & time
vcsTag = libVersion // Should match git tag
}
}
@@ -54,7 +54,7 @@ bintray {
def pomConfig = {
Properties props = new Properties()
props.load(new FileInputStream("$projectDir/bintray.properties"))
-
+
licenses {
license {
name 'BSD 3-Clause'
diff --git a/javaSE/javaSE/build.gradle b/javaSE/javaSE/build.gradle
index 1390cd913..09da6d5a6 100644
--- a/javaSE/javaSE/build.gradle
+++ b/javaSE/javaSE/build.gradle
@@ -65,11 +65,11 @@ task generateSources {
srcFile.append("\n")
}
srcFile.append("*/\n")
- }else{
+ } else {
srcFile.write("\n")
}
srcFile.append(
-"""package com.smartdevicelink;
+ """package com.smartdevicelink;
// THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
public final class BuildConfig {
diff --git a/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java b/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java
index 30037bad6..e00101ef2 100644
--- a/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java
+++ b/javaSE/javaSE/src/main/java/com/livio/BSON/BsonEncoder.java
@@ -47,7 +47,7 @@ public class BsonEncoder {
private static final String TAG = "BsonEncoder";
public static byte[] encodeToBytes(HashMap<String, Object> map) throws ClassCastException {
- if(map != null) {
+ if (map != null) {
BasicBSONObject bson = new BasicBSONObject();
bson.putAll(sanitizeMap(map));
BasicBSONEncoder encoder = new BasicBSONEncoder();
@@ -60,7 +60,7 @@ public class BsonEncoder {
}
public static HashMap<String, Object> decodeFromBytes(byte[] bytes) {
- if(bytes != null) {
+ if (bytes != null) {
BasicBSONDecoder decoder = new BasicBSONDecoder();
BSONObject object = decoder.readObject(bytes);
if (object != null) {
@@ -77,28 +77,29 @@ public class BsonEncoder {
/**
* Goes through the map and ensures that all the values included are supported by SDL. If they are not of a supported
* value it is removed from the map
+ *
* @param map the map to be sanitized
* @return a sanitized HashMap with non-supported object type removes
*/
- private static HashMap<String, Object> sanitizeMap(HashMap<String, Object> map){
+ private static HashMap<String, Object> sanitizeMap(HashMap<String, Object> map) {
Set<String> keys = map.keySet();
Object value;
- for(String key : keys){
+ for (String key : keys) {
value = map.get(key);
//First check to see if it value is a valid type used in SDL
- if(isSupportedType(value)){
+ if (isSupportedType(value)) {
continue;
- }else if(value instanceof List){ //Next, check to see if it is a list of values
- List list = (List)value;
+ } else if (value instanceof List) { //Next, check to see if it is a list of values
+ List list = (List) value;
//If the list is empty, there shouldn't be a problem leaving it in the map
- if(list.isEmpty()){
+ if (list.isEmpty()) {
continue;
}
//Since the list isn't empty, check the first item
- if(isSupportedType(list.get(0))){
+ if (isSupportedType(list.get(0))) {
continue;
}
}
@@ -111,10 +112,11 @@ public class BsonEncoder {
/**
* Checks the value to ensure it is of a supported type
- * @param value the generic object value
+ *
+ * @param value the generic object value
* @return if the object is an instanceOf one of the supported SDL BSON objects
*/
- private static boolean isSupportedType(Object value){
+ private static boolean isSupportedType(Object value) {
return value instanceof Integer
|| value instanceof Long
|| value instanceof Double
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
index ecd7b1f9b..926db35b3 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
@@ -1,33 +1,33 @@
/*
-* Copyright (c) 2017 - 2020, 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 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 - 2020, 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 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;
// THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index 43aad3161..cf3e7d04c 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -36,34 +36,35 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
public interface SdlManagerListener extends BaseSdlManagerListener {
- /**
- * Called when a manager is ready for use
- */
- void onStart(SdlManager manager);
+ /**
+ * Called when a manager is ready for use
+ */
+ void onStart(SdlManager manager);
- /**
- * Called when the manager is destroyed
- */
- void onDestroy(SdlManager manager);
+ /**
+ * Called when the manager is destroyed
+ */
+ void onDestroy(SdlManager manager);
- /**
- * Called when the manager encounters an error
- * @param info info regarding the error
- * @param e the exception
- */
- void onError(SdlManager manager, String info, Exception e);
+ /**
+ * Called when the manager encounters an error
+ *
+ * @param info info regarding the error
+ * @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 VR+TTS language of the connected head unit the manager is trying to update the configuration.
- * @param hmiLanguage The HMI display 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, Language hmiLanguage);
+ /**
+ * 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 VR+TTS language of the connected head unit the manager is trying to update the configuration.
+ * @param hmiLanguage The HMI display 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, Language hmiLanguage);
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
index a84f0a7c7..a2a464c11 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
@@ -35,8 +35,8 @@ package com.smartdevicelink.managers.file;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.rpc.PutFile;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.FileUtls;
@@ -47,100 +47,103 @@ import java.net.URI;
/**
* <strong>FileManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The SDLFileManager uploads files and keeps track of all the uploaded files names during a session. <br>
- *
+ * <p>
* We need to add the following struct: SDLFile<br>
- *
+ * <p>
* It is broken down to these areas: <br>
- *
+ * <p>
* 1. Getters <br>
* 2. Deletion methods <br>
* 3. Uploading Files / Artwork
*/
public class FileManager extends BaseFileManager {
- /**
- * Constructor for FileManager
- * @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
- * @param fileManagerConfig an instance of the FileManagerConfig gives access to artworkRetryCount and fileRetryCount to let us if those file types can be re-upload if they fail
- */
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public FileManager(ISdl internalInterface, FileManagerConfig fileManagerConfig) {
- // setup
- super(internalInterface, fileManagerConfig);
- }
+ /**
+ * Constructor for FileManager
+ *
+ * @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
+ * @param fileManagerConfig an instance of the FileManagerConfig gives access to artworkRetryCount and fileRetryCount to let us if those file types can be re-upload if they fail
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public FileManager(ISdl internalInterface, FileManagerConfig fileManagerConfig) {
+ // setup
+ super(internalInterface, fileManagerConfig);
+ }
- /**
- * Creates and returns a PutFile request that would upload a given SdlFile
- * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
- * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
- */
- @Override
- PutFile createPutFile(@NonNull final SdlFile file){
- PutFile putFile = new PutFile();
- if(file.getName() == null){
- throw new IllegalArgumentException("You must specify an file name in the SdlFile");
- }else{
- putFile.setSdlFileName(file.getName());
- }
+ /**
+ * Creates and returns a PutFile request that would upload a given SdlFile
+ *
+ * @param file SdlFile with fileName and one of A) fileData, B) Uri, or C) resourceID set
+ * @return a valid PutFile request if SdlFile contained a fileName and sufficient data
+ */
+ @Override
+ PutFile createPutFile(@NonNull final SdlFile file) {
+ PutFile putFile = new PutFile();
+ if (file.getName() == null) {
+ throw new IllegalArgumentException("You must specify an file name in the SdlFile");
+ } else {
+ putFile.setSdlFileName(file.getName());
+ }
- if(file.getFilePath() != null){
- //Attempt to access the file via a path
- byte[] data = FileUtls.getFileData(file.getFilePath());
- if(data != null ){
- putFile.setFileData(data);
- }else{
- throw new IllegalArgumentException("File at path was empty");
- }
- }else if(file.getURI() != null){
- // Use URI to upload file
- byte[] data = contentsOfUri(file.getURI());
- if(data != null){
- putFile.setFileData(data);
- }else{
- throw new IllegalArgumentException("Uri was empty");
- }
- }else if(file.getFileData() != null){
- // Use file data (raw bytes) to upload file
- putFile.setFileData(file.getFileData());
- }else{
- throw new IllegalArgumentException("The SdlFile to upload does " +
- "not specify its resourceId, Uri, or file data");
- }
+ if (file.getFilePath() != null) {
+ //Attempt to access the file via a path
+ byte[] data = FileUtls.getFileData(file.getFilePath());
+ if (data != null) {
+ putFile.setFileData(data);
+ } else {
+ throw new IllegalArgumentException("File at path was empty");
+ }
+ } else if (file.getURI() != null) {
+ // Use URI to upload file
+ byte[] data = contentsOfUri(file.getURI());
+ if (data != null) {
+ putFile.setFileData(data);
+ } else {
+ throw new IllegalArgumentException("Uri was empty");
+ }
+ } else if (file.getFileData() != null) {
+ // Use file data (raw bytes) to upload file
+ putFile.setFileData(file.getFileData());
+ } else {
+ throw new IllegalArgumentException("The SdlFile to upload does " +
+ "not specify its resourceId, Uri, or file data");
+ }
- if(file.getType() != null){
- putFile.setFileType(file.getType());
- }
- putFile.setPersistentFile(file.isPersistent());
+ if (file.getType() != null) {
+ putFile.setFileType(file.getType());
+ }
+ putFile.setPersistentFile(file.isPersistent());
- return putFile;
- }
+ return putFile;
+ }
- /**
- * Helper method to take Uri and turn it into byte array
- * @param uri Uri for desired file
- * @return Resulting byte array
- */
- private byte[] contentsOfUri(URI uri){
- InputStream is = null;
- try{
- is = uri.toURL().openStream();
- return contentsOfInputStream(is);
- } catch (IOException e){
- DebugTool.logError(TAG, "Can't read from URI", e);
- return null;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
+ /**
+ * Helper method to take Uri and turn it into byte array
+ *
+ * @param uri Uri for desired file
+ * @return Resulting byte array
+ */
+ private byte[] contentsOfUri(URI uri) {
+ InputStream is = null;
+ try {
+ is = uri.toURL().openStream();
+ return contentsOfInputStream(is);
+ } catch (IOException e) {
+ DebugTool.logError(TAG, "Can't read from URI", e);
+ return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index eee60bd69..affa4ec36 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
@@ -44,20 +44,22 @@ import java.net.URI;
/**
* A class that extends SdlFile, representing artwork (JPEG, PNG, or BMP) to be uploaded to core
*/
-public class SdlArtwork extends SdlFile implements Cloneable{
+public class SdlArtwork extends SdlFile implements Cloneable {
private boolean isTemplate;
private Image imageRPC;
/**
* Creates a new instance of SdlArtwork
*/
- public SdlArtwork(){}
+ public SdlArtwork() {
+ }
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param filePath a String value representing the the location of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param filePath a String value representing the the location of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, String filePath, boolean persistentFile) {
@@ -66,9 +68,10 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param uri a URI value representing a file's location. Currently, it only supports local files
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, URI uri, boolean persistentFile) {
@@ -77,9 +80,10 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param data a byte array representing the data of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
public SdlArtwork(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile) {
@@ -88,6 +92,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
+ *
* @param staticIconName a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public SdlArtwork(@NonNull StaticIconName staticIconName) {
@@ -96,33 +101,36 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Sets whether this SdlArtwork is a template image whose coloring should be decided by the HMI
+ *
* @param isTemplate boolean that tells whether this SdlArtwork is a template image
*/
- public void setTemplateImage(boolean isTemplate){
+ public void setTemplateImage(boolean isTemplate) {
this.isTemplate = isTemplate;
}
/**
* Gets whether this SdlArtwork is a template image whose coloring should be decided by the HMI
+ *
* @return boolean that tells whether this SdlArtwork is a template image
*/
- public boolean isTemplateImage(){
+ public boolean isTemplateImage() {
return isTemplate;
}
@Override
public void setType(@NonNull FileType fileType) {
- if(fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
- || fileType.equals(FileType.GRAPHIC_BMP)){
+ if (fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
+ || fileType.equals(FileType.GRAPHIC_BMP)) {
super.setType(fileType);
- }else{
+ } else {
throw new IllegalArgumentException("Only JPEG, PNG, and BMP image types are supported.");
}
}
/**
* Gets the Image RPC representing this artwork. Generally for use internally, you should instead pass an artwork to a Screen Manager method
+ *
* @return The Image RPC representing this artwork.
*/
public Image getImageRPC() {
@@ -132,7 +140,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{
return imageRPC;
}
- private Image createImageRPC(){
+ private Image createImageRPC() {
Image image;
if (isStaticIcon()) {
image = new Image(getName(), ImageType.STATIC);
@@ -146,18 +154,19 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a deep copy of the object
+ *
* @return deep copy of the object
*/
@Override
public SdlArtwork clone() {
- try{
+ try {
SdlArtwork artwork = (SdlArtwork) super.clone();
- if(artwork != null){
+ if (artwork != null) {
artwork.imageRPC = artwork.createImageRPC();
}
return artwork;
} catch (CloneNotSupportedException e) {
- if(DebugTool.isDebugEnabled()){
+ if (DebugTool.isDebugEnabled()) {
throw new RuntimeException("Clone not supported by super class");
}
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
index 10e400f40..6fd91b8a0 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
@@ -44,7 +44,7 @@ import java.util.Arrays;
/**
* A class representing data to be uploaded to core
*/
-public class SdlFile{
+public class SdlFile {
private String fileName;
private String filePath;
private URI uri;
@@ -59,16 +59,18 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
*/
- public SdlFile(){}
+ public SdlFile() {
+ }
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param filePath a String value representing the the location of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param filePath a String value representing the the location of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, String filePath, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, String filePath, boolean persistentFile) {
setName(fileName);
setType(fileType);
setFilePath(filePath);
@@ -77,12 +79,13 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param uri a URI value representing a file's location. Currently, it only supports local files
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, URI uri, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, URI uri, boolean persistentFile) {
setName(fileName);
setType(fileType);
setURI(uri);
@@ -91,12 +94,13 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
- * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
- * @param fileType a FileType enum value representing the type of the file
- * @param data a byte array representing the data of the file
+ *
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
+ * @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public SdlFile(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile){
+ public SdlFile(String fileName, @NonNull FileType fileType, byte[] data, boolean persistentFile) {
setName(fileName);
setType(fileType);
setFileData(data);
@@ -105,9 +109,10 @@ public class SdlFile{
/**
* Creates a new instance of SdlFile
+ *
* @param staticIconName a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
- public SdlFile(@NonNull StaticIconName staticIconName){
+ public SdlFile(@NonNull StaticIconName staticIconName) {
setName(staticIconName.toString());
setFileData(staticIconName.toString().getBytes());
setPersistent(false);
@@ -116,6 +121,7 @@ public class SdlFile{
/**
* Sets the name of the file
+ *
* @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
*/
public void setName(String fileName) {
@@ -136,17 +142,19 @@ public class SdlFile{
/**
* Gets the name of the file
+ *
* @return a String value representing the name that will be used to store the file in the head unit
*/
- public String getName(){
+ public String getName() {
return fileName;
}
/**
* Sets the location of the file
+ *
* @param filePath a String value representing the the location of the file
*/
- public void setFilePath(String filePath){
+ public void setFilePath(String filePath) {
this.filePath = filePath;
if (shouldAutoGenerateName && filePath != null) {
this.fileName = generateFileNameFromFilePath(filePath);
@@ -155,17 +163,19 @@ public class SdlFile{
/**
* Gets the location of the file
+ *
* @return represents the path of the file
*/
- public String getFilePath(){
+ public String getFilePath() {
return this.filePath;
}
/**
* Sets the uri of the file
+ *
* @param uri a URI value representing a file's location. Currently, it only supports local files
*/
- public void setURI(URI uri){
+ public void setURI(URI uri) {
this.uri = uri;
if (shouldAutoGenerateName && uri != null) {
this.fileName = generateFileNameFromUri(uri);
@@ -174,17 +184,19 @@ public class SdlFile{
/**
* Gets the uri of the file
+ *
* @return a URI value representing a file's location. Currently, it only supports local files
*/
- public URI getURI(){
+ public URI getURI() {
return uri;
}
/**
* Sets the byte array that represents the content of the file
+ *
* @param data a byte array representing the data of the file
*/
- public void setFileData(byte[] data){
+ public void setFileData(byte[] data) {
this.fileData = data;
if (shouldAutoGenerateName && data != null) {
this.fileName = generateFileNameFromData(data);
@@ -193,46 +205,52 @@ public class SdlFile{
/**
* Gets the byte array that represents the content of the file
+ *
* @return a byte array representing the data of the file
*/
- public byte[] getFileData(){
+ public byte[] getFileData() {
return fileData;
}
/**
* Sets the type of the file
+ *
* @param fileType a FileType enum value representing the type of the file
*/
- public void setType(@NonNull FileType fileType){
+ public void setType(@NonNull FileType fileType) {
this.fileType = fileType;
}
/**
* Gets the type of the file
+ *
* @return a FileType enum value representing the type of the file
*/
- public FileType getType(){
+ public FileType getType() {
return fileType;
}
/**
* Sets whether the file should persist between sessions / ignition cycles
+ *
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public void setPersistent(boolean persistentFile){
+ public void setPersistent(boolean persistentFile) {
this.persistentFile = persistentFile;
}
/**
* Gets whether the file should persist between sessions / ignition cycles
+ *
* @return a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
- public boolean isPersistent(){
+ public boolean isPersistent() {
return this.persistentFile;
}
/**
* Sets the the name of the static file. Static files comes pre-shipped with the head unit
+ *
* @param staticIcon a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public void setStaticIcon(boolean staticIcon) {
@@ -241,6 +259,7 @@ public class SdlFile{
/**
* Gets the the name of the static file. Static files comes pre-shipped with the head unit
+ *
* @return a StaticIconName enum value representing the name of a static file that comes pre-shipped with the head unit
*/
public boolean isStaticIcon() {
@@ -249,6 +268,7 @@ public class SdlFile{
/**
* Gets the overwrite property for an SdlFile by default its set to true
+ *
* @return a boolean value that indicates if a file can be overwritten.
*/
public boolean getOverwrite() {
@@ -257,6 +277,7 @@ public class SdlFile{
/**
* Sets the overwrite property for an SdlFile by default its set to true
+ *
* @param overwrite a boolean value that indicates if a file can be overwritten
*/
public void setOverwrite(boolean overwrite) {
@@ -265,6 +286,7 @@ public class SdlFile{
/**
* Generates a file name from data by hashing the data and returning the last 16 chars
+ *
* @param data a byte array representing the data of the file
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -292,6 +314,7 @@ public class SdlFile{
/**
* Generates a file name from filePath by hashing the filePath and returning the last 16 chars
+ *
* @param filePath a String value representing the the location of the file
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -301,6 +324,7 @@ public class SdlFile{
/**
* Generates a file name from uri by hashing the uri string and returning the last 16 chars
+ *
* @param uri a URI value representing a file's location
* @return a String value representing the name that will be used to store the file in the head unit
*/
@@ -310,6 +334,7 @@ public class SdlFile{
/**
* Used to compile hashcode for SdlFile for use to compare in equals method
+ *
* @return Custom hashcode of SdlFile variables
*/
@Override
@@ -327,6 +352,7 @@ public class SdlFile{
/**
* Uses our custom hashCode for SdlFile objects
+ *
* @param o - The object to compare
* @return boolean of whether the objects are the same or not
*/
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
index d749811a1..a23a057c5 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
@@ -34,8 +34,8 @@ package com.smartdevicelink.managers.lifecycle;
import androidx.annotation.NonNull;
-import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.ServiceEncryptionListener;
class EncryptionLifecycleManager extends BaseEncryptionLifecycleManager {
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index 89c9f3190..e29d34640 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -34,9 +34,9 @@ package com.smartdevicelink.managers.lifecycle;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
+import com.smartdevicelink.session.SdlSession;
import com.smartdevicelink.transport.BaseTransportConfig;
/**
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
index e10693770..4ca79c893 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManager.java
@@ -35,7 +35,7 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>SystemCapabilityManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
*/
public class SystemCapabilityManager extends BaseSystemCapabilityManager {
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
index 141e16151..ffecb9fdd 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/permission/PermissionManager.java
@@ -37,13 +37,13 @@ import androidx.annotation.RestrictTo;
import com.smartdevicelink.managers.ISdl;
/**
- PermissionManager gives the developer information about what permissions are permitted in specific HMI level
- and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * PermissionManager gives the developer information about what permissions are permitted in specific HMI level
+ * and helps developers setup listeners to be called when specific permissions become allowed.<br>
+ * <p>
+ * This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
+ **/
- This should be used through the {@link com.smartdevicelink.managers.SdlManager} and not be instantiated by itself
-**/
-
- public class PermissionManager extends BasePermissionManager{
+public class PermissionManager extends BasePermissionManager {
/**
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
index d1f6811ac..2e0b0e244 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/ScreenManager.java
@@ -34,18 +34,18 @@ package com.smartdevicelink.managers.screen;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>ScreenManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
-*/
+ */
public class ScreenManager extends BaseScreenManager {
- @RestrictTo(RestrictTo.Scope.LIBRARY)
- public ScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
- super(internalInterface, fileManager);
- }
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ public ScreenManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
+ super(internalInterface, fileManager);
+ }
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SoftButtonManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SoftButtonManager.java
index 7f67faa47..e01ab736a 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SoftButtonManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SoftButtonManager.java
@@ -34,8 +34,8 @@ package com.smartdevicelink.managers.screen;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>SoftButtonManager</strong> <br>
@@ -49,7 +49,7 @@ class SoftButtonManager extends BaseSoftButtonManager {
* Creates a new instance of the SoftButtonManager
*
* @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
- * @param fileManager an instance of the FileManager so that button graphics can be sent
+ * @param fileManager an instance of the FileManager so that button graphics can be sent
*/
SoftButtonManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
super(internalInterface, fileManager);
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
index b14ad987c..a77eb43cf 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/SubscribeButtonManager.java
@@ -7,9 +7,8 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>SubscribeButtonManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SubscribeButtonManager extends BaseSubscribeButtonManager {
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
index d5ff0f52f..b479e3ba5 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
@@ -34,32 +34,31 @@ package com.smartdevicelink.managers.screen;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
+import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
-import com.smartdevicelink.managers.ISdl;
import com.smartdevicelink.proxy.rpc.enums.FileType;
/**
* <strong>TextAndGraphicManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
class TextAndGraphicManager extends BaseTextAndGraphicManager {
- TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
- super(internalInterface, fileManager, softButtonManager);
- }
-
- @Override
- SdlArtwork getBlankArtwork(){
- if (blankArtwork == null){
- blankArtwork = new SdlArtwork();
- blankArtwork.setType(FileType.GRAPHIC_PNG);
- blankArtwork.setName("blankArtwork");
- blankArtwork.setFileData(new byte[50]);
- }
- return blankArtwork;
- }
+ TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
+ super(internalInterface, fileManager, softButtonManager);
+ }
+
+ @Override
+ SdlArtwork getBlankArtwork() {
+ if (blankArtwork == null) {
+ blankArtwork = new SdlArtwork();
+ blankArtwork.setType(FileType.GRAPHIC_PNG);
+ blankArtwork.setName("blankArtwork");
+ blankArtwork.setFileData(new byte[50]);
+ }
+ return blankArtwork;
+ }
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
index ebcfa9c10..887d40e94 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
@@ -35,8 +35,8 @@ package com.smartdevicelink.managers.screen.choiceset;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>ChoiceSetManager</strong> <br>
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
index 6a51ddd65..ef4583968 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/MenuManager.java
@@ -34,22 +34,22 @@ package com.smartdevicelink.managers.screen.menu;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.ISdl;
+import com.smartdevicelink.managers.file.FileManager;
/**
* <strong>MenuManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the ScreenManager via the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The MenuManager takes MenuCell objects and creates and sends all necessary RPCs to build out a menu
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class MenuManager extends BaseMenuManager {
- public MenuManager(ISdl internalInterface, FileManager fileManager) {
- // setup
- super(internalInterface, fileManager);
- }
+ public MenuManager(ISdl internalInterface, FileManager fileManager) {
+ // setup
+ super(internalInterface, fileManager);
+ }
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
index 641ab189e..40e2d27d7 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommandManager.java
@@ -38,17 +38,17 @@ import com.smartdevicelink.managers.ISdl;
/**
* <strong>VoiceCommandManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the ScreenManager via the SdlManager. Do not instantiate it by itself. <br>
- *
+ * <p>
* The VoiceCommandManager takes a List of VoiceCommand objects and sets them on the Head unit for you.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class VoiceCommandManager extends BaseVoiceCommandManager {
- public VoiceCommandManager(ISdl internalInterface) {
- // setup
- super(internalInterface);
- }
+ public VoiceCommandManager(ISdl internalInterface) {
+ // setup
+ super(internalInterface);
+ }
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
index 0c9481c2d..df4144286 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -48,7 +48,7 @@ public class SdlPacket extends BaseSdlPacket {
super(version, encryption, frameType, serviceType, frameInfo, sessionId, dataSize, messageId, payload, offset, bytesToWrite);
}
- protected SdlPacket() {
+ protected SdlPacket() {
super();
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
index 64cd728ca..a83cdf0e0 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
@@ -43,11 +43,10 @@ import com.smartdevicelink.transport.TransportManager;
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class SdlProtocol extends SdlProtocolBase {
- public SdlProtocol( ISdlProtocol iSdlProtocol, BaseTransportConfig config) {
+ public SdlProtocol(ISdlProtocol iSdlProtocol, BaseTransportConfig config) {
super(iSdlProtocol, config);
this.setTransportManager(new TransportManager(config, transportEventListener));
}
-
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
index e8ed85b70..0d1f2d72a 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/security/SdlSecurityBase.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -32,5 +32,5 @@
package com.smartdevicelink.security;
public abstract class SdlSecurityBase extends AbstractSdlSecurityBase {
-
+
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java
index 4aaef8985..ba92df647 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java
@@ -35,11 +35,11 @@ package com.smartdevicelink.session;
import androidx.annotation.RestrictTo;
+import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.SdlProtocol;
import com.smartdevicelink.protocol.SdlProtocolBase;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.protocol.ISdlServiceListener;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/trace/SdlTrace.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/trace/SdlTrace.java
index 482b4a846..987dbc223 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/trace/SdlTrace.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/trace/SdlTrace.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -40,9 +40,9 @@ package com.smartdevicelink.trace;
It is manifested in the <SmartDeviceLink>...</SmartDeviceLink> tags
*/
-public class SdlTrace extends SdlTraceBase{
- private static String getPid(){
- //Default implementation is not able to get this information
- return "UNKNOWN";
- }
+public class SdlTrace extends SdlTraceBase {
+ private static String getPid() {
+ //Default implementation is not able to get this information
+ return "UNKNOWN";
+ }
} // end-class \ No newline at end of file
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransport.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransport.java
index ad02f96d2..5bb61e7d3 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransport.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransport.java
@@ -39,7 +39,7 @@ import com.smartdevicelink.util.DebugTool;
import java.nio.ByteBuffer;
-public abstract class CustomTransport implements TransportInterface{
+public abstract class CustomTransport implements TransportInterface {
private static final String TAG = "CustomTransport";
final TransportRecord transportRecord;
@@ -47,27 +47,27 @@ public abstract class CustomTransport implements TransportInterface{
TransportCallback transportCallback;
-
public CustomTransport(String address) {
//Creates a callback for when packets
psm = new SdlPsm();
- transportRecord = new TransportRecord(TransportType.CUSTOM,address);
+ transportRecord = new TransportRecord(TransportType.CUSTOM, address);
}
- public TransportRecord getTransportRecord(){
+ public TransportRecord getTransportRecord() {
return this.transportRecord;
}
/**
* Call this method when reading a byte array off the transport
+ *
* @param bytes the bytes read off the transport
*/
- public synchronized void onByteArrayReceived (byte[] bytes, int offset, int length) {
+ public synchronized void onByteArrayReceived(byte[] bytes, int offset, int length) {
- if(bytes != null && bytes.length > 0){
+ if (bytes != null && bytes.length > 0) {
boolean stateProgress;
- for(int i = 0; i < length; i++){
+ for (int i = 0; i < length; i++) {
stateProgress = psm.handleByte(bytes[i]);
if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
//Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
@@ -90,10 +90,11 @@ public abstract class CustomTransport implements TransportInterface{
/**
* Call this method when reading a ByteBuffer off the transport
+ *
* @param message the byte buffer that was read off the transport
*/
- public synchronized void onByteBufferReceived (ByteBuffer message) {
- if(message != null){
+ public synchronized void onByteBufferReceived(ByteBuffer message) {
+ if (message != null) {
boolean stateProgress;
while (message.hasRemaining()) {
stateProgress = psm.handleByte(message.get());
@@ -134,7 +135,7 @@ public abstract class CustomTransport implements TransportInterface{
@Override
public void write(SdlPacket packet) {
byte[] bytes = packet.constructPacket();
- if(bytes != null && bytes.length > 0) {
+ if (bytes != null && bytes.length > 0) {
try {
onWrite(bytes, 0, bytes.length);
} catch (Exception exc) {
@@ -148,7 +149,7 @@ public abstract class CustomTransport implements TransportInterface{
this.transportCallback = transportCallback;
}
- public void onError(){
+ public void onError() {
if (transportCallback != null) {
transportCallback.onError();
}
@@ -158,14 +159,12 @@ public abstract class CustomTransport implements TransportInterface{
/**
* Integrator should write out these bytes to whatever actual transport there is. This will be called from the
* internals of the library.
- * @param bytes a deconstructed packet into a byte array that needs to be written out
+ *
+ * @param bytes a deconstructed packet into a byte array that needs to be written out
* @param offset in bytes
* @param length in bytes
*/
public abstract void onWrite(byte[] bytes, int offset, int length);
-
-
-
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransportConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransportConfig.java
index af0613aa1..ee82c68d7 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransportConfig.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/CustomTransportConfig.java
@@ -38,7 +38,7 @@ public class CustomTransportConfig extends BaseTransportConfig {
final CustomTransport customTransport;
- public CustomTransportConfig(CustomTransport customTransport){
+ public CustomTransportConfig(CustomTransport customTransport) {
this.customTransport = customTransport;
}
@@ -47,7 +47,7 @@ public class CustomTransportConfig extends BaseTransportConfig {
return TransportType.CUSTOM;
}
- public TransportInterface getTransportInterface(){
+ public TransportInterface getTransportInterface() {
return this.customTransport;
}
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportCallback.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportCallback.java
index 551ed9d29..327b4dd5c 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportCallback.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportCallback.java
@@ -14,7 +14,7 @@
* 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
+ * 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"
@@ -38,7 +38,10 @@ import com.smartdevicelink.protocol.SdlPacket;
*/
public interface TransportCallback {
void onConnectionEstablished();
+
void onError();
+
void onConnectionTerminated(String reason);
+
void onPacketReceived(SdlPacket packet);
} \ No newline at end of file
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportInterface.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportInterface.java
index 989b2df33..e9fdaf4c6 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportInterface.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportInterface.java
@@ -40,8 +40,12 @@ import com.smartdevicelink.transport.utl.TransportRecord;
*/
public interface TransportInterface {
void start();
+
void stop();
+
void write(SdlPacket packet);
+
void setCallback(TransportCallback callback);
+
TransportRecord getTransportRecord();
} \ No newline at end of file
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java
index ee08f19de..69a8de75a 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -41,7 +41,7 @@ import com.smartdevicelink.util.DebugTool;
import java.util.Collections;
import java.util.List;
-public class TransportManager extends TransportManagerBase{
+public class TransportManager extends TransportManagerBase {
private static final String TAG = "TransportManager";
TransportInterface transport;
@@ -52,13 +52,13 @@ public class TransportManager extends TransportManagerBase{
* If transport is not connected. Request Router service connect to it. Get connected message
*/
- public TransportManager(BaseTransportConfig config, TransportEventListener listener){
+ public TransportManager(BaseTransportConfig config, TransportEventListener listener) {
super(config, listener);
//Start the new transport
- switch (config.getTransportType()){
+ switch (config.getTransportType()) {
case WEB_SOCKET_SERVER:
- transport = new WebSocketServer((WebSocketServerConfig)config, new SingleTransportCallbackImpl(new TransportRecord(TransportType.WEB_SOCKET_SERVER,"127.0.0.1:"+((WebSocketServerConfig)config).port)));
+ transport = new WebSocketServer((WebSocketServerConfig) config, new SingleTransportCallbackImpl(new TransportRecord(TransportType.WEB_SOCKET_SERVER, "127.0.0.1:" + ((WebSocketServerConfig) config).port)));
break;
case CUSTOM:
transport = ((CustomTransportConfig) config).getTransportInterface();
@@ -69,32 +69,33 @@ public class TransportManager extends TransportManagerBase{
}
@Override
- public void start(){
- if(transport != null){
+ public void start() {
+ if (transport != null) {
transport.start();
- }else{
+ } else {
System.out.print("Unable to start transport.");
}
}
@Override
- public void close(long sessionId){
- if(transport != null) {
+ public void close(long sessionId) {
+ if (transport != null) {
transport.stop();
}
}
/**
* Check to see if a transport is connected.
+ *
* @param transportType the transport to have its connection status returned. If `null` is
* passed in, all transports will be checked and if any are connected a
* true value will be returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be used to return if connected.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be used to return if connected.
* @return if a transport is connected based on included variables
*/
@Override
- public boolean isConnected(TransportType transportType, String address){
+ public boolean isConnected(TransportType transportType, String address) {
synchronized (TRANSPORT_STATUS_LOCK) {
if (transportType == null) {
return !transportStatus.isEmpty();
@@ -114,15 +115,17 @@ public class TransportManager extends TransportManagerBase{
return false;
}
}
+
/**
* Retrieve a transport record with the supplied params
+ *
* @param transportType the transport to have its connection status returned.
- * @param address the address associated with the transport type. If null, the first transport
- * of supplied type will be returned.
+ * @param address the address associated with the transport type. If null, the first transport
+ * of supplied type will be returned.
* @return the transport record for the transport type and address if supplied
*/
@Override
- public TransportRecord getTransportRecord(TransportType transportType, String address){
+ public TransportRecord getTransportRecord(TransportType transportType, String address) {
synchronized (TRANSPORT_STATUS_LOCK) {
if (transportType == null) {
return null;
@@ -145,26 +148,27 @@ public class TransportManager extends TransportManagerBase{
@Override
- public void sendPacket(SdlPacket packet){
- if(transport !=null){
+ public void sendPacket(SdlPacket packet) {
+ if (transport != null) {
transport.write(packet);
- }else {
+ } else {
}
}
- class SingleTransportCallbackImpl implements TransportCallback {
+ class SingleTransportCallbackImpl implements TransportCallback {
final List<TransportRecord> finalList;
final TransportRecord record;
- protected SingleTransportCallbackImpl(TransportRecord transportRecord){
- record = transportRecord;
- finalList = Collections.singletonList(record);
+
+ protected SingleTransportCallbackImpl(TransportRecord transportRecord) {
+ record = transportRecord;
+ finalList = Collections.singletonList(record);
}
@Override
public void onConnectionEstablished() {
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
transportStatus.clear();
transportStatus.addAll(finalList);
}
@@ -174,21 +178,21 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onError() {
DebugTool.logError(TAG, "Error in the transport manager from the web socket server");
- if(transportListener != null){
+ if (transportListener != null) {
transportListener.onError("");
}
}
@Override
public void onConnectionTerminated(String reason) {
- if(record != null){
+ if (record != null) {
DebugTool.logInfo(TAG, "Transport disconnected - " + record);
- }else{
+ } else {
DebugTool.logInfo(TAG, "Transport disconnected");
}
- synchronized (TRANSPORT_STATUS_LOCK){
+ synchronized (TRANSPORT_STATUS_LOCK) {
TransportManager.this.transportStatus.remove(record);
//Might check connectedTransports vs transportStatus to ensure they are equal
}
@@ -198,7 +202,7 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onPacketReceived(SdlPacket packet) {
- if(packet!=null){
+ if (packet != null) {
transportListener.onPacketReceived(packet);
}
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
index 65037f6b8..d98acff2c 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServer.java
@@ -45,7 +45,7 @@ import org.java_websocket.handshake.ClientHandshake;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
-public class WebSocketServer extends org.java_websocket.server.WebSocketServer implements TransportInterface{
+public class WebSocketServer extends org.java_websocket.server.WebSocketServer implements TransportInterface {
private static final String TAG = "WebSocketServer";
final TransportCallback callback;
final WebSocketServerConfig config;
@@ -54,31 +54,31 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
final TransportRecord transportRecord;
- public WebSocketServer(WebSocketServerConfig config, TransportCallback callback){
+ public WebSocketServer(WebSocketServerConfig config, TransportCallback callback) {
super((new InetSocketAddress(config.port)));
this.config = config;
this.callback = callback;
- transportRecord = new TransportRecord(TransportType.WEB_SOCKET_SERVER,"127.0.0.1:" + config.port); //If changed, change in transport manager as well
+ transportRecord = new TransportRecord(TransportType.WEB_SOCKET_SERVER, "127.0.0.1:" + config.port); //If changed, change in transport manager as well
//This will set the connection lost timeout to not occur. So we might ping, but not pong
this.setConnectionLostTimeout(config.connectionLostTimeout);
- if(config.getSslConfig() != null){
+ if (config.getSslConfig() != null) {
WebSocketServerFactory factory = SSLWebSocketFactoryGenerator.generateWebSocketServer(config.getSslConfig());
- if(factory!=null){
+ if (factory != null) {
this.setWebSocketFactory(factory);
- }else{
+ } else {
DebugTool.logError(TAG, "WebSocketServer: Unable to generate SSL Web Socket Server Factory");
}
}
}
- public TransportRecord getTransportRecord(){
+ public TransportRecord getTransportRecord() {
return this.transportRecord;
}
@Override
- public void stop(){
+ public void stop() {
try {
this.stop(500);
} catch (InterruptedException e) {
@@ -87,9 +87,9 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
}
@Override
- public void write(SdlPacket packet){
+ public void write(SdlPacket packet) {
//DebugTool.logInfo(TAG, "Attempt to write packet " + packet);
- if(packet != null
+ if (packet != null
&& this.webSocket != null
&& this.webSocket.isOpen()) {
this.webSocket.send(packet.constructPacket());
@@ -107,7 +107,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
DebugTool.logInfo(TAG, "onOpen");
this.webSocket = webSocket;
- if(callback!=null){
+ if (callback != null) {
callback.onConnectionEstablished();
}
}
@@ -115,15 +115,15 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onClose(WebSocket webSocket, int i, String s, boolean b) {
DebugTool.logInfo(TAG, "onClose");
- try{
+ try {
DebugTool.logInfo(TAG, "Closing id - " + i);
DebugTool.logInfo(TAG, "Closing string - " + s);
DebugTool.logInfo(TAG, "Closing from remote? " + b);
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
- if(callback!=null) {
+ if (callback != null) {
callback.onConnectionTerminated(s);
}
}
@@ -132,9 +132,10 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
@Override
public void onWebsocketCloseInitiated(WebSocket conn, int code, String reason) {
super.onWebsocketCloseInitiated(conn, code, reason);
- try{
+ try {
DebugTool.logInfo(TAG, "Code - " + code + " Reason - " + reason);
- }catch (Exception e){}
+ } catch (Exception e) {
+ }
}
@Override
@@ -148,7 +149,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
//DebugTool.logInfo(TAG, "on Message - ByteBuffer");
byte input;
- if(message != null){
+ if (message != null) {
synchronized (WebSocketServer.this) {
boolean stateProgress;
while (message.hasRemaining()) {
@@ -164,7 +165,7 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
synchronized (WebSocketServer.this) {
SdlPacket packet = psm.getFormedPacket();
if (callback != null && packet != null) {
- /// DebugTool.logInfo(TAG, "Read a packet: " + packet);
+ /// DebugTool.logInfo(TAG, "Read a packet: " + packet);
packet.setTransportRecord(transportRecord);
callback.onPacketReceived(packet);
}
@@ -180,11 +181,10 @@ public class WebSocketServer extends org.java_websocket.server.WebSocketServer i
}
-
@Override
public void onError(WebSocket webSocket, Exception e) {
DebugTool.logError(TAG, "bad", e);
- if(callback!=null) {
+ if (callback != null) {
callback.onError();
}
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java
index 316375bf3..9dc4dab9c 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/WebSocketServerConfig.java
@@ -34,17 +34,19 @@ package com.smartdevicelink.transport;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.SSLConfig;
-public class WebSocketServerConfig extends BaseTransportConfig{
+public class WebSocketServerConfig extends BaseTransportConfig {
final int port, connectionLostTimeout;
SSLConfig sslConfig;
+
/**
* Default constructor for WebSocketConfig
- * @param port the port this web socket should listen on
+ *
+ * @param port the port this web socket should listen on
* @param connectionLostTimeout the timeout for a connection lost, default would be 60 seconds. If a value less than
* 0 is used, then the web socket will wait indefinitely.
*/
- public WebSocketServerConfig(int port, int connectionLostTimeout){
+ public WebSocketServerConfig(int port, int connectionLostTimeout) {
this.port = port;
this.connectionLostTimeout = connectionLostTimeout;
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLConfig.java
index e2eb1c2b0..92e703996 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLConfig.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLConfig.java
@@ -42,12 +42,15 @@ public class SSLConfig {
@IntDef({JKS, PEM})
@Retention(RetentionPolicy.SOURCE)
- public @interface SSLCertificateType {}
+ public @interface SSLCertificateType {
+ }
+
public static final int JKS = 0;
public static final int PEM = 1;
- final @SSLCertificateType int sslCertificateType;
+ final @SSLCertificateType
+ int sslCertificateType;
String pemCertificate, privateKey, password;
String storePassword, keyPassword;
File jksFile;
@@ -55,11 +58,12 @@ public class SSLConfig {
/**
* This creates an SSLConfig using a PEM type certificate.
+ *
* @param pemCertificate string representation of a PEM file that should be used for the SSL session
- * @param privateKey the private key used with the PEM file
- * @param password the password used with the PEN file
+ * @param privateKey the private key used with the PEM file
+ * @param password the password used with the PEN file
*/
- public SSLConfig(@NonNull String pemCertificate, @NonNull String privateKey, @NonNull String password){
+ public SSLConfig(@NonNull String pemCertificate, @NonNull String privateKey, @NonNull String password) {
this.sslCertificateType = PEM;
this.pemCertificate = pemCertificate;
this.privateKey = privateKey;
@@ -69,18 +73,20 @@ public class SSLConfig {
/**
* This creates an SSLConfig using a JKS file.
- * @param jksFile File that contains the JKS that should be used for the SSL session
+ *
+ * @param jksFile File that contains the JKS that should be used for the SSL session
* @param storePassword the password associated with the JKS
- * @param keyPassword the key password used with the JKS
+ * @param keyPassword the key password used with the JKS
*/
- public SSLConfig(@NonNull File jksFile, @NonNull String storePassword, @NonNull String keyPassword){
+ public SSLConfig(@NonNull File jksFile, @NonNull String storePassword, @NonNull String keyPassword) {
this.sslCertificateType = JKS;
this.jksFile = jksFile;
this.storePassword = storePassword;
this.keyPassword = keyPassword;
}
- public @SSLCertificateType int getSslCertificateType() {
+ public @SSLCertificateType
+ int getSslCertificateType() {
return sslCertificateType;
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
index 4bcb9ca8d..7ba8957e0 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/transport/utl/SSLWebSocketFactoryGenerator.java
@@ -62,9 +62,9 @@ public class SSLWebSocketFactoryGenerator {
private static final String TLS = "TLS";
private static final String SUNX509 = "SunX509";
- public static WebSocketServerFactory generateWebSocketServer(SSLConfig config){
+ public static WebSocketServerFactory generateWebSocketServer(SSLConfig config) {
SSLContext context;
- switch (config.getSslCertificateType()){
+ switch (config.getSslCertificateType()) {
case SSLConfig.JKS:
context = getSSLContextFromJKS(config);
break;
@@ -75,17 +75,17 @@ public class SSLWebSocketFactoryGenerator {
DebugTool.logError(TAG, "Unable to generateWebSocketServer. Unsupported cert type.");
return null;
}
- if(context != null) {
+ if (context != null) {
return new DefaultSSLWebSocketServerFactory(context);
- }else{
+ } else {
DebugTool.logError(TAG, "SSLWebSocketFactoryGenerator: Unable to create SSL Context");
return null;
}
}
-/* ******************************************* JKS ********************************************/
+ /* ******************************************* JKS ********************************************/
- private static SSLContext getSSLContextFromJKS(SSLConfig config){
+ private static SSLContext getSSLContextFromJKS(SSLConfig config) {
try {
KeyStore ks = KeyStore.getInstance(JAVA_KEY_STORE);
@@ -101,9 +101,8 @@ public class SSLWebSocketFactoryGenerator {
sslContext = SSLContext.getInstance(TLS);
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
return sslContext;
- }
- catch(Exception e){
- DebugTool.logError(TAG, "Issue creating SSLContext with JKS : " , e);
+ } catch (Exception e) {
+ DebugTool.logError(TAG, "Issue creating SSLContext with JKS : ", e);
}
return null;
}
@@ -114,51 +113,51 @@ public class SSLWebSocketFactoryGenerator {
SSLContext context;
try {
- context = SSLContext.getInstance( TLS );
+ context = SSLContext.getInstance(TLS);
- byte[] certBytes = parseDERFromPEM( config.getPemCertificate().getBytes(), "-----BEGIN CERTIFICATE-----", "-----END CERTIFICATE-----" );
- byte[] keyBytes = parseDERFromPEM( config.getPrivateKey().getBytes(), "-----BEGIN PRIVATE KEY-----", "-----END PRIVATE KEY-----" );
+ byte[] certBytes = parseDERFromPEM(config.getPemCertificate().getBytes(), "-----BEGIN CERTIFICATE-----", "-----END CERTIFICATE-----");
+ byte[] keyBytes = parseDERFromPEM(config.getPrivateKey().getBytes(), "-----BEGIN PRIVATE KEY-----", "-----END PRIVATE KEY-----");
- X509Certificate cert = generateCertificateFromDER( certBytes );
- RSAPrivateKey key = generatePrivateKeyFromDER( keyBytes );
+ X509Certificate cert = generateCertificateFromDER(certBytes);
+ RSAPrivateKey key = generatePrivateKeyFromDER(keyBytes);
- KeyStore keystore = KeyStore.getInstance( JAVA_KEY_STORE );
- keystore.load( null );
- keystore.setCertificateEntry( "cert-alias", cert );
- keystore.setKeyEntry( "key-alias", key, config.getPassword().toCharArray(), new Certificate[]{ cert } );
+ KeyStore keystore = KeyStore.getInstance(JAVA_KEY_STORE);
+ keystore.load(null);
+ keystore.setCertificateEntry("cert-alias", cert);
+ keystore.setKeyEntry("key-alias", key, config.getPassword().toCharArray(), new Certificate[]{cert});
- KeyManagerFactory kmf = KeyManagerFactory.getInstance( SUNX509 );
- kmf.init( keystore, config.getPassword().toCharArray() );
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(SUNX509);
+ kmf.init(keystore, config.getPassword().toCharArray());
KeyManager[] km = kmf.getKeyManagers();
- context.init( km, null, null );
- } catch ( Exception e ) {
+ context.init(km, null, null);
+ } catch (Exception e) {
context = null;
- DebugTool.logError(TAG, "Issue creating SSLContext with PEM Cert : " , e);
+ DebugTool.logError(TAG, "Issue creating SSLContext with PEM Cert : ", e);
}
return context;
}
- private static byte[] parseDERFromPEM( byte[] pem, String beginDelimiter, String endDelimiter ) {
- String data = new String( pem );
- String[] tokens = data.split( beginDelimiter );
- tokens = tokens[1].split( endDelimiter );
- return DatatypeConverter.parseBase64Binary( tokens[0] );
+ private static byte[] parseDERFromPEM(byte[] pem, String beginDelimiter, String endDelimiter) {
+ String data = new String(pem);
+ String[] tokens = data.split(beginDelimiter);
+ tokens = tokens[1].split(endDelimiter);
+ return DatatypeConverter.parseBase64Binary(tokens[0]);
}
- private static RSAPrivateKey generatePrivateKeyFromDER( byte[] keyBytes ) throws InvalidKeySpecException, NoSuchAlgorithmException {
- PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec( keyBytes );
+ private static RSAPrivateKey generatePrivateKeyFromDER(byte[] keyBytes) throws InvalidKeySpecException, NoSuchAlgorithmException {
+ PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes);
- KeyFactory factory = KeyFactory.getInstance( "RSA" );
+ KeyFactory factory = KeyFactory.getInstance("RSA");
- return ( RSAPrivateKey ) factory.generatePrivate( spec );
+ return (RSAPrivateKey) factory.generatePrivate(spec);
}
- private static X509Certificate generateCertificateFromDER( byte[] certBytes ) throws CertificateException {
- CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
+ private static X509Certificate generateCertificateFromDER(byte[] certBytes) throws CertificateException {
+ CertificateFactory factory = CertificateFactory.getInstance("X.509");
- return ( X509Certificate ) factory.generateCertificate( new ByteArrayInputStream( certBytes ) );
+ return (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(certBytes));
}
diff --git a/javaSE/javaSE/src/main/java/org/json/JSON.java b/javaSE/javaSE/src/main/java/org/json/JSON.java
index 1b32e698d..ac304a80e 100644
--- a/javaSE/javaSE/src/main/java/org/json/JSON.java
+++ b/javaSE/javaSE/src/main/java/org/json/JSON.java
@@ -93,7 +93,7 @@ class JSON {
}
public static JSONException typeMismatch(Object indexOrName, Object actual,
- String requiredType) throws JSONException {
+ String requiredType) throws JSONException {
if (actual == null) {
throw new JSONException("Value at " + indexOrName + " is null.");
} else {
diff --git a/javaSE/javaSE/src/main/java/org/json/JSONArray.java b/javaSE/javaSE/src/main/java/org/json/JSONArray.java
index 996f44909..30a5fb072 100644
--- a/javaSE/javaSE/src/main/java/org/json/JSONArray.java
+++ b/javaSE/javaSE/src/main/java/org/json/JSONArray.java
@@ -62,14 +62,14 @@ public class JSONArray {
* collection.
*
* @param copyFrom a collection whose values are of supported types.
- * Unsupported values are not permitted and will yield an array in an
- * inconsistent state.
+ * Unsupported values are not permitted and will yield an array in an
+ * inconsistent state.
*/
/* Accept a raw type for API compatibility */
public JSONArray(Collection copyFrom) {
this();
if (copyFrom != null) {
- for (Iterator it = copyFrom.iterator(); it.hasNext();) {
+ for (Iterator it = copyFrom.iterator(); it.hasNext(); ) {
put(JSONObject.wrap(it.next()));
}
}
@@ -80,9 +80,9 @@ public class JSONArray {
* tokener.
*
* @param readFrom a tokener whose nextValue() method will yield a
- * {@code JSONArray}.
+ * {@code JSONArray}.
* @throws JSONException if the parse fails or doesn't yield a
- * {@code JSONArray}.
+ * {@code JSONArray}.
*/
public JSONArray(JSONTokener readFrom) throws JSONException {
/*
@@ -102,7 +102,7 @@ public class JSONArray {
*
* @param json a JSON-encoded string containing an array.
* @throws JSONException if the parse fails or doesn't yield a {@code
- * JSONArray}.
+ * JSONArray}.
*/
public JSONArray(String json) throws JSONException {
this(new JSONTokener(json));
@@ -143,7 +143,7 @@ public class JSONArray {
* Appends {@code value} to the end of this array.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
- * {@link Double#isInfinite() infinities}.
+ * {@link Double#isInfinite() infinities}.
* @return this array.
*/
public JSONArray put(double value) throws JSONException {
@@ -175,10 +175,10 @@ public class JSONArray {
* Appends {@code value} to the end of this array.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May
- * not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
- * infinities}. Unsupported values are not permitted and will cause the
- * array to be in an inconsistent state.
+ * Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May
+ * not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
+ * infinities}. Unsupported values are not permitted and will cause the
+ * array to be in an inconsistent state.
* @return this array.
*/
public JSONArray put(Object value) {
@@ -214,7 +214,7 @@ public class JSONArray {
* index}, it will be replaced.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
- * {@link Double#isInfinite() infinities}.
+ * {@link Double#isInfinite() infinities}.
* @return this array.
*/
public JSONArray put(int index, double value) throws JSONException {
@@ -249,9 +249,9 @@ public class JSONArray {
* index}, it will be replaced.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May
- * not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
- * infinities}.
+ * Integer, Long, Double, {@link JSONObject#NULL}, or {@code null}. May
+ * not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
+ * infinities}.
* @return this array.
*/
public JSONArray put(int index, Object value) throws JSONException {
@@ -279,8 +279,8 @@ public class JSONArray {
* Returns the value at {@code index}.
*
* @throws JSONException if this array has no value at {@code index}, or if
- * that value is the {@code null} reference. This method returns
- * normally if the value is {@code JSONObject#NULL}.
+ * that value is the {@code null} reference. This method returns
+ * normally if the value is {@code JSONObject#NULL}.
*/
public Object get(int index) throws JSONException {
try {
@@ -321,7 +321,7 @@ public class JSONArray {
* be coerced to a boolean.
*
* @throws JSONException if the value at {@code index} doesn't exist or
- * cannot be coerced to a boolean.
+ * cannot be coerced to a boolean.
*/
public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
@@ -355,7 +355,7 @@ public class JSONArray {
* be coerced to a double.
*
* @throws JSONException if the value at {@code index} doesn't exist or
- * cannot be coerced to a double.
+ * cannot be coerced to a double.
*/
public double getDouble(int index) throws JSONException {
Object object = get(index);
@@ -389,7 +389,7 @@ public class JSONArray {
* can be coerced to an int.
*
* @throws JSONException if the value at {@code index} doesn't exist or
- * cannot be coerced to a int.
+ * cannot be coerced to a int.
*/
public int getInt(int index) throws JSONException {
Object object = get(index);
@@ -423,7 +423,7 @@ public class JSONArray {
* can be coerced to a long.
*
* @throws JSONException if the value at {@code index} doesn't exist or
- * cannot be coerced to a long.
+ * cannot be coerced to a long.
*/
public long getLong(int index) throws JSONException {
Object object = get(index);
@@ -490,7 +490,7 @@ public class JSONArray {
* JSONArray}.
*
* @throws JSONException if the value doesn't exist or is not a {@code
- * JSONArray}.
+ * JSONArray}.
*/
public JSONArray getJSONArray(int index) throws JSONException {
Object object = get(index);
@@ -515,7 +515,7 @@ public class JSONArray {
* JSONObject}.
*
* @throws JSONException if the value doesn't exist or is not a {@code
- * JSONObject}.
+ * JSONObject}.
*/
public JSONObject getJSONObject(int index) throws JSONException {
Object object = get(index);
@@ -579,7 +579,8 @@ public class JSONArray {
* Encodes this array as a compact JSON string, such as:
* <pre>[94043,90210]</pre>
*/
- @Override public String toString() {
+ @Override
+ public String toString() {
try {
JSONStringer stringer = new JSONStringer();
writeTo(stringer);
@@ -599,7 +600,7 @@ public class JSONArray {
* ]</pre>
*
* @param indentSpaces the number of spaces to indent for each level of
- * nesting.
+ * nesting.
*/
public String toString(int indentSpaces) throws JSONException {
JSONStringer stringer = new JSONStringer(indentSpaces);
@@ -615,11 +616,13 @@ public class JSONArray {
stringer.endArray();
}
- @Override public boolean equals(Object o) {
+ @Override
+ public boolean equals(Object o) {
return o instanceof JSONArray && ((JSONArray) o).values.equals(values);
}
- @Override public int hashCode() {
+ @Override
+ public int hashCode() {
// diverge from the original, which doesn't implement hashCode
return values.hashCode();
}
diff --git a/javaSE/javaSE/src/main/java/org/json/JSONObject.java b/javaSE/javaSE/src/main/java/org/json/JSONObject.java
index 74ea973c2..f7fbd12b5 100644
--- a/javaSE/javaSE/src/main/java/org/json/JSONObject.java
+++ b/javaSE/javaSE/src/main/java/org/json/JSONObject.java
@@ -101,12 +101,19 @@ public class JSONObject {
*/
@NonNull
public static final Object NULL = new Object() {
- @Override public boolean equals(Object o) {
+ @Override
+ public boolean equals(Object o) {
return o == this || o == null; // API specifies this broken equals implementation
}
+
// at least make the broken equals(null) consistent with Objects.hashCode(null).
- @Override public int hashCode() { return Objects.hashCode(null); }
- @Override public String toString() {
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(null);
+ }
+
+ @Override
+ public String toString() {
return "null";
}
};
@@ -126,7 +133,7 @@ public class JSONObject {
* the given map.
*
* @param copyFrom a map whose keys are of type {@link String} and whose
- * values are of supported types.
+ * values are of supported types.
* @throws NullPointerException if any of the map's keys are null.
*/
/* (accept a raw type for API compatibility) */
@@ -151,9 +158,9 @@ public class JSONObject {
* object in the tokener.
*
* @param readFrom a tokener whose nextValue() method will yield a
- * {@code JSONObject}.
+ * {@code JSONObject}.
* @throws JSONException if the parse fails or doesn't yield a
- * {@code JSONObject}.
+ * {@code JSONObject}.
*/
public JSONObject(@NonNull JSONTokener readFrom) throws JSONException {
/*
@@ -174,7 +181,7 @@ public class JSONObject {
*
* @param json a JSON-encoded string containing an object.
* @throws JSONException if the parse fails or doesn't yield a {@code
- * JSONObject}.
+ * JSONObject}.
*/
public JSONObject(@NonNull String json) throws JSONException {
this(new JSONTokener(json));
@@ -185,7 +192,7 @@ public class JSONObject {
* from the given object. Names that aren't present in {@code copyFrom} will
* be skipped.
*/
- public JSONObject(@NonNull JSONObject copyFrom, @NonNull String [] names) throws JSONException {
+ public JSONObject(@NonNull JSONObject copyFrom, @NonNull String[] names) throws JSONException {
this();
for (String name : names) {
Object value = copyFrom.opt(name);
@@ -208,7 +215,8 @@ public class JSONObject {
*
* @return this object.
*/
- @NonNull public JSONObject put(@NonNull String name, boolean value) throws JSONException {
+ @NonNull
+ public JSONObject put(@NonNull String name, boolean value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
@@ -218,10 +226,11 @@ public class JSONObject {
* mapping with the same name.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
- * {@link Double#isInfinite() infinities}.
+ * {@link Double#isInfinite() infinities}.
* @return this object.
*/
- @NonNull public JSONObject put(@NonNull String name, double value) throws JSONException {
+ @NonNull
+ public JSONObject put(@NonNull String name, double value) throws JSONException {
nameValuePairs.put(checkName(name), JSON.checkDouble(value));
return this;
}
@@ -232,7 +241,8 @@ public class JSONObject {
*
* @return this object.
*/
- @NonNull public JSONObject put(@NonNull String name, int value) throws JSONException {
+ @NonNull
+ public JSONObject put(@NonNull String name, int value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
@@ -243,7 +253,8 @@ public class JSONObject {
*
* @return this object.
*/
- @NonNull public JSONObject put(@NonNull String name, long value) throws JSONException {
+ @NonNull
+ public JSONObject put(@NonNull String name, long value) throws JSONException {
nameValuePairs.put(checkName(name), value);
return this;
}
@@ -254,12 +265,13 @@ public class JSONObject {
* mapping for {@code name} is removed.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double, {@link #NULL}, or {@code null}. May not be
- * {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
- * infinities}.
+ * Integer, Long, Double, {@link #NULL}, or {@code null}. May not be
+ * {@link Double#isNaN() NaNs} or {@link Double#isInfinite()
+ * infinities}.
* @return this object.
*/
- @NonNull public JSONObject put(@NonNull String name, @Nullable Object value) throws JSONException {
+ @NonNull
+ public JSONObject put(@NonNull String name, @Nullable Object value) throws JSONException {
if (value == null) {
nameValuePairs.remove(name);
return this;
@@ -276,7 +288,8 @@ public class JSONObject {
* Equivalent to {@code put(name, value)} when both parameters are non-null;
* does nothing otherwise.
*/
- @NonNull public JSONObject putOpt(@Nullable String name, @Nullable Object value) throws JSONException {
+ @NonNull
+ public JSONObject putOpt(@Nullable String name, @Nullable Object value) throws JSONException {
if (name == null || value == null) {
return this;
}
@@ -298,12 +311,13 @@ public class JSONObject {
* depending on the number of calls to it.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double, {@link #NULL} or null. May not be {@link
- * Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}.
+ * Integer, Long, Double, {@link #NULL} or null. May not be {@link
+ * Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}.
*/
// TODO: Change {@code append) to {@link #append} when append is
// unhidden.
- @NonNull public JSONObject accumulate(@NonNull String name, @Nullable Object value) throws JSONException {
+ @NonNull
+ public JSONObject accumulate(@NonNull String name, @Nullable Object value) throws JSONException {
Object current = nameValuePairs.get(checkName(name));
if (current == null) {
return put(name, value);
@@ -328,8 +342,7 @@ public class JSONObject {
* will be thrown.
*
* @throws JSONException if {@code name} is {@code null} or if the mapping for
- * {@code name} is non-null and is not a {@link JSONArray}.
- *
+ * {@code name} is non-null and is not a {@link JSONArray}.
*/
public JSONObject append(String name, Object value) throws JSONException {
Object current = nameValuePairs.get(checkName(name));
@@ -361,9 +374,10 @@ public class JSONObject {
* Removes the named mapping if it exists; does nothing otherwise.
*
* @return the value previously mapped by {@code name}, or null if there was
- * no such mapping.
+ * no such mapping.
*/
- @Nullable public Object remove(@Nullable String name) {
+ @Nullable
+ public Object remove(@Nullable String name) {
return nameValuePairs.remove(name);
}
@@ -389,7 +403,8 @@ public class JSONObject {
*
* @throws JSONException if no such mapping exists.
*/
- @NonNull public Object get(@NonNull String name) throws JSONException {
+ @NonNull
+ public Object get(@NonNull String name) throws JSONException {
Object result = nameValuePairs.get(name);
if (result == null) {
throw new JSONException("No value for " + name);
@@ -401,7 +416,8 @@ public class JSONObject {
* Returns the value mapped by {@code name}, or null if no such mapping
* exists.
*/
- @Nullable public Object opt(@Nullable String name) {
+ @Nullable
+ public Object opt(@Nullable String name) {
return nameValuePairs.get(name);
}
@@ -410,7 +426,7 @@ public class JSONObject {
* can be coerced to a boolean, or throws otherwise.
*
* @throws JSONException if the mapping doesn't exist or cannot be coerced
- * to a boolean.
+ * to a boolean.
*/
public boolean getBoolean(@NonNull String name) throws JSONException {
Object object = get(name);
@@ -444,7 +460,7 @@ public class JSONObject {
* can be coerced to a double, or throws otherwise.
*
* @throws JSONException if the mapping doesn't exist or cannot be coerced
- * to a double.
+ * to a double.
*/
public double getDouble(@NonNull String name) throws JSONException {
Object object = get(name);
@@ -478,7 +494,7 @@ public class JSONObject {
* can be coerced to an int, or throws otherwise.
*
* @throws JSONException if the mapping doesn't exist or cannot be coerced
- * to an int.
+ * to an int.
*/
public int getInt(@NonNull String name) throws JSONException {
Object object = get(name);
@@ -514,7 +530,7 @@ public class JSONObject {
* so this is <a href="#lossy">lossy</a>; use strings to transfer numbers via JSON.
*
* @throws JSONException if the mapping doesn't exist or cannot be coerced
- * to a long.
+ * to a long.
*/
public long getLong(@NonNull String name) throws JSONException {
Object object = get(name);
@@ -552,7 +568,8 @@ public class JSONObject {
*
* @throws JSONException if no such mapping exists.
*/
- @NonNull public String getString(@NonNull String name) throws JSONException {
+ @NonNull
+ public String getString(@NonNull String name) throws JSONException {
Object object = get(name);
String result = JSON.toString(object);
if (result == null) {
@@ -565,7 +582,8 @@ public class JSONObject {
* Returns the value mapped by {@code name} if it exists, coercing it if
* necessary, or the empty string if no such mapping exists.
*/
- @NonNull public String optString(@Nullable String name) {
+ @NonNull
+ public String optString(@Nullable String name) {
return optString(name, "");
}
@@ -573,7 +591,8 @@ public class JSONObject {
* Returns the value mapped by {@code name} if it exists, coercing it if
* necessary, or {@code fallback} if no such mapping exists.
*/
- @NonNull public String optString(@Nullable String name, @NonNull String fallback) {
+ @NonNull
+ public String optString(@Nullable String name, @NonNull String fallback) {
Object object = opt(name);
String result = JSON.toString(object);
return result != null ? result : fallback;
@@ -584,9 +603,10 @@ public class JSONObject {
* JSONArray}, or throws otherwise.
*
* @throws JSONException if the mapping doesn't exist or is not a {@code
- * JSONArray}.
+ * JSONArray}.
*/
- @NonNull public JSONArray getJSONArray(@NonNull String name) throws JSONException {
+ @NonNull
+ public JSONArray getJSONArray(@NonNull String name) throws JSONException {
Object object = get(name);
if (object instanceof JSONArray) {
return (JSONArray) object;
@@ -599,7 +619,8 @@ public class JSONObject {
* Returns the value mapped by {@code name} if it exists and is a {@code
* JSONArray}, or null otherwise.
*/
- @Nullable public JSONArray optJSONArray(@Nullable String name) {
+ @Nullable
+ public JSONArray optJSONArray(@Nullable String name) {
Object object = opt(name);
return object instanceof JSONArray ? (JSONArray) object : null;
}
@@ -609,9 +630,10 @@ public class JSONObject {
* JSONObject}, or throws otherwise.
*
* @throws JSONException if the mapping doesn't exist or is not a {@code
- * JSONObject}.
+ * JSONObject}.
*/
- @NonNull public JSONObject getJSONObject(@NonNull String name) throws JSONException {
+ @NonNull
+ public JSONObject getJSONObject(@NonNull String name) throws JSONException {
Object object = get(name);
if (object instanceof JSONObject) {
return (JSONObject) object;
@@ -624,7 +646,8 @@ public class JSONObject {
* Returns the value mapped by {@code name} if it exists and is a {@code
* JSONObject}, or null otherwise.
*/
- @Nullable public JSONObject optJSONObject(@Nullable String name) {
+ @Nullable
+ public JSONObject optJSONObject(@Nullable String name) {
Object object = opt(name);
return object instanceof JSONObject ? (JSONObject) object : null;
}
@@ -634,7 +657,8 @@ public class JSONObject {
* array contains null for names that aren't mapped. This method returns
* null if {@code names} is either null or empty.
*/
- @Nullable public JSONArray toJSONArray(@Nullable JSONArray names) throws JSONException {
+ @Nullable
+ public JSONArray toJSONArray(@Nullable JSONArray names) throws JSONException {
JSONArray result = new JSONArray();
if (names == null) {
return null;
@@ -657,7 +681,8 @@ public class JSONObject {
* modified after the iterator is returned, the iterator's behavior is
* undefined. The order of the keys is undefined.
*/
- @NonNull public Iterator<String> keys() {
+ @NonNull
+ public Iterator<String> keys() {
return nameValuePairs.keySet().iterator();
}
@@ -666,9 +691,8 @@ public class JSONObject {
* is a view of the keys in this object. {@link Set#remove(Object)} will remove
* the corresponding mapping from this object and set iterator behaviour
* is undefined if this object is modified after it is returned.
- *
+ * <p>
* See {@link #keys()}.
- *
*/
public Set<String> keySet() {
return nameValuePairs.keySet();
@@ -678,7 +702,8 @@ public class JSONObject {
* Returns an array containing the string names in this object. This method
* returns null if this object contains no mappings.
*/
- @Nullable public JSONArray names() {
+ @Nullable
+ public JSONArray names() {
return nameValuePairs.isEmpty()
? null
: new JSONArray(new ArrayList<String>(nameValuePairs.keySet()));
@@ -688,7 +713,9 @@ public class JSONObject {
* Encodes this object as a compact JSON string, such as:
* <pre>{"query":"Pizza","locations":[94043,90210]}</pre>
*/
- @Override @NonNull public String toString() {
+ @Override
+ @NonNull
+ public String toString() {
try {
JSONStringer stringer = new JSONStringer();
writeTo(stringer);
@@ -711,9 +738,10 @@ public class JSONObject {
* }</pre>
*
* @param indentSpaces the number of spaces to indent for each level of
- * nesting.
+ * nesting.
*/
- @NonNull public String toString(int indentSpaces) throws JSONException {
+ @NonNull
+ public String toString(int indentSpaces) throws JSONException {
JSONStringer stringer = new JSONStringer(indentSpaces);
writeTo(stringer);
return stringer.toString();
@@ -732,9 +760,10 @@ public class JSONObject {
* Encodes the number as a JSON string.
*
* @param number a finite value. May not be {@link Double#isNaN() NaNs} or
- * {@link Double#isInfinite() infinities}.
+ * {@link Double#isInfinite() infinities}.
*/
- @NonNull public static String numberToString(@NonNull Number number) throws JSONException {
+ @NonNull
+ public static String numberToString(@NonNull Number number) throws JSONException {
if (number == null) {
throw new JSONException("Number must be non-null");
}
@@ -760,9 +789,10 @@ public class JSONObject {
* necessary character escaping.
*
* @param data the string to encode. Null will be interpreted as an empty
- * string.
+ * string.
*/
- @NonNull public static String quote(@Nullable String data) {
+ @NonNull
+ public static String quote(@Nullable String data) {
if (data == null) {
return "\"\"";
}
@@ -789,7 +819,8 @@ public class JSONObject {
* Otherwise if the object is from a {@code java} package, returns the result of {@code toString}.
* If wrapping fails, returns null.
*/
- @Nullable public static Object wrap(@Nullable Object o) {
+ @Nullable
+ public static Object wrap(@Nullable Object o) {
if (o == null) {
return NULL;
}
@@ -809,14 +840,14 @@ public class JSONObject {
return new JSONObject((Map) o);
}
if (o instanceof Boolean ||
- o instanceof Byte ||
- o instanceof Character ||
- o instanceof Double ||
- o instanceof Float ||
- o instanceof Integer ||
- o instanceof Long ||
- o instanceof Short ||
- o instanceof String) {
+ o instanceof Byte ||
+ o instanceof Character ||
+ o instanceof Double ||
+ o instanceof Float ||
+ o instanceof Integer ||
+ o instanceof Long ||
+ o instanceof Short ||
+ o instanceof String) {
return o;
}
if (o.getClass().getPackage().getName().startsWith("java.")) {
diff --git a/javaSE/javaSE/src/main/java/org/json/JSONStringer.java b/javaSE/javaSE/src/main/java/org/json/JSONStringer.java
index dd3b2a7d8..302129c4f 100644
--- a/javaSE/javaSE/src/main/java/org/json/JSONStringer.java
+++ b/javaSE/javaSE/src/main/java/org/json/JSONStringer.java
@@ -60,7 +60,9 @@ import java.util.List;
*/
public class JSONStringer {
- /** The output data, containing at most one top-level array or object. */
+ /**
+ * The output data, containing at most one top-level array or object.
+ */
final StringBuilder out = new StringBuilder();
/**
@@ -220,8 +222,8 @@ public class JSONStringer {
* Encodes {@code value}.
*
* @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double or null. May not be {@link Double#isNaN() NaNs}
- * or {@link Double#isInfinite() infinities}.
+ * Integer, Long, Double or null. May not be {@link Double#isNaN() NaNs}
+ * or {@link Double#isInfinite() infinities}.
* @return this stringer.
*/
public JSONStringer value(Object value) throws JSONException {
@@ -273,7 +275,7 @@ public class JSONStringer {
* Encodes {@code value} to this stringer.
*
* @param value a finite value. May not be {@link Double#isNaN() NaNs} or
- * {@link Double#isInfinite() infinities}.
+ * {@link Double#isInfinite() infinities}.
* @return this stringer.
*/
public JSONStringer value(double value) throws JSONException {
@@ -426,7 +428,8 @@ public class JSONStringer {
* of {@link Object#toString}, this method returns null if the stringer
* contains no data.
*/
- @Override public String toString() {
+ @Override
+ public String toString() {
return out.length() == 0 ? null : out.toString();
}
}
diff --git a/javaSE/javaSE/src/main/java/org/json/JSONTokener.java b/javaSE/javaSE/src/main/java/org/json/JSONTokener.java
index 4bdd9ad37..ce47196be 100644
--- a/javaSE/javaSE/src/main/java/org/json/JSONTokener.java
+++ b/javaSE/javaSE/src/main/java/org/json/JSONTokener.java
@@ -62,7 +62,9 @@ package org.json;
*/
public class JSONTokener {
- /** The input JSON. */
+ /**
+ * The input JSON.
+ */
private final String in;
/**
@@ -73,8 +75,8 @@ public class JSONTokener {
/**
* @param in JSON encoded string. Null is not permitted and will yield a
- * tokener that throws {@code NullPointerExceptions} when methods are
- * called.
+ * tokener that throws {@code NullPointerExceptions} when methods are
+ * called.
*/
public JSONTokener(String in) {
// consume an optional byte order mark (BOM) if it exists
@@ -88,7 +90,7 @@ public class JSONTokener {
* Returns the next value from the input.
*
* @return a {@link JSONObject}, {@link JSONArray}, String, Boolean,
- * Integer, Long, Double or {@link JSONObject#NULL}.
+ * Integer, Long, Double or {@link JSONObject#NULL}.
* @throws JSONException if the input is malformed.
*/
public Object nextValue() throws JSONException {
@@ -453,7 +455,8 @@ public class JSONTokener {
/**
* Returns the current position and the entire input string.
*/
- @Override public String toString() {
+ @Override
+ public String toString() {
// consistent with the original implementation
return " at character " + pos + " of " + in;
}
@@ -514,7 +517,7 @@ public class JSONTokener {
* to avoid memory leaks.
*
* @throws JSONException if the remaining input is not long enough to
- * satisfy this request.
+ * satisfy this request.
*/
public String next(int length) throws JSONException {
if (pos + length > in.length()) {
@@ -595,7 +598,7 @@ public class JSONTokener {
* for non-hex input.
*
* @param hex a character in the ranges [0-9], [A-F] or [a-f]. Any other
- * character will yield a -1 result.
+ * character will yield a -1 result.
*/
public static int dehexchar(char hex) {
if (hex >= '0' && hex <= '9') {
diff --git a/javaSE/javaSE/src/test/java/com/smartdevicelink/test/TestValues.java b/javaSE/javaSE/src/test/java/com/smartdevicelink/test/TestValues.java
index d3efa2326..6ff8f26bb 100644
--- a/javaSE/javaSE/src/test/java/com/smartdevicelink/test/TestValues.java
+++ b/javaSE/javaSE/src/test/java/com/smartdevicelink/test/TestValues.java
@@ -5,9 +5,9 @@ import com.smartdevicelink.proxy.rpc.enums.FileType;
import java.net.URI;
public class TestValues {
- public static final boolean GENERAL_BOOLEAN = true;
- public static final byte[] GENERAL_BYTE_ARRAY = new byte[0];
- public static final String GENERAL_STRING = "test";
- public static final FileType GENERAL_FILETYPE = FileType.BINARY;
- public static final URI GENERAL_URI = URI.create("http://www.google.com");
+ public static final boolean GENERAL_BOOLEAN = true;
+ public static final byte[] GENERAL_BYTE_ARRAY = new byte[0];
+ public static final String GENERAL_STRING = "test";
+ public static final FileType GENERAL_FILETYPE = FileType.BINARY;
+ public static final URI GENERAL_URI = URI.create("http://www.google.com");
}